How to uncache a memory area in C?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
how to uncache

Hello all,

When I write a driver, I want to uncache the registers of the peripheral, that means, I want to access the registers directly and bypass the cache. How to do it in C? Thanks!

DAVY
 

how to uncache memory

That is far, far out of the scope of the C programming language. It's a hardware and operating system issue, so what OS are you using? And what hardware?

Generally speaking though, adress ranges used for IO registers should never be cached in the first place.
 

In many compilers you can declare the variable accessing registers as 'volatile'. This tells the compiler that the variable (register) always has to be read & written. So it isn't "cached" in the compilers optimization process as usual variables do.


Mik
 

Use volatile as M!k suggests

Have a look here

**broken link removed**

/Bingo
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…