Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

c code to write a register

hi,i had created a custom component "32-bit register" using sopc builder.I want to write a data into the register using NIOS-II SBT Eclipse.Can anyone tell me the entire c-code to perform writing of register using nios-ii sbt eclipse

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Something like that maybe?

    #include <system.h>
    # include <sys/alt_cache.h>
    unsigned int *my_register = alt_remap_uncached((void*)MY_REGISTER_BASE);
    *my_register = my_value
    
    OF course replace MY_REGISTER_BASE with the actual base address value defined in system.h