Building register array (C) -


for embedded application in c, want array of registers can accessed host system. each register has following field:

address (32 bits), value (32 bits), callback (32 bits)

now, suppose have hundreds of these registers. efficient way point right register when host wants access 1 particular register base on address? note address values not continued.

doing if/else or switch/case structure out of question , parsing register register not efficient.

the best way have found define each register this:

regstruct * registername = ( (regstruct*) address_of_register);

but way, implies address_of_register must valid address in memory map , not portable between platform.

what want let linker place register in memory , access address gave. there way it?


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -