Altera_Forum
Honored Contributor
20 years agoVolatile... or is it??
Hi there,
I just wanted to save you guys some gray hairs when working with pointers to your hardware in a kernel module. I had a module with a volatile struct pointing to the registers of my custom peripheral on the avalon-bus. All worked fine untill I got strange errors when changing values "fast" (each millisecond). Values would not be updated correctly... Even though I declared everything volatile, it wouldn't work when I wrote and read data every milisecond. When I changed my delay 'till 50ms or higher everything worked like expected. Changing the volatile struct with the corresponding inl and outl functions solved my problems. I Hope I can save someone some time....