Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- Personally I wouldn't ever have written anything like IOWR_32DIRECT() or any of its friends. It is much, much, much safer to define C structures to map device registers and then either use a pointer initialiased to the correct value or get the linker to assign a constant to a normal C structure variable. --- Quote End --- This was taken from section 9-4 of the nios ii software developers handbook: "The HAL provides the C-language macros IORD and IOWR that expand to the appropriate assembly instructions to bypass the data cache. The IORD macro expands to the ldwio instruction, and the IOWR macro expands to the stwio instruction. These macros are provided to enable HAL device drivers to access device registers." Can you explain how using the macro expansion IOWR_32DIRECT() is different? thanks, Drew