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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -