Hacker News new | ask | show | jobs
by Taniwha 2823 days ago
I think you're missing 'volatile's in your casts
2 comments

The examples should only view the bit/address mapping, not be a complete example on how to access memory mapped peripherals.
why would you need that in this case?
Probably so the compiler doesn't just optimize out the statements, seeing as they don't seem to have a visible effect on the program execution because they're never read again.
because writing to one location causes the data to change in another (a system register) you don't want the compiler to assume that data in an IO register can be cached in a CPU register