C/Direct memory access

From Attie's Wiki
(Redirected from Direct memory access)
Jump to: navigation, search

This example shows how to access memory locations directly (in this case a 16-bit register)

unsigned short *p;
unsigned short mask = 0x400;
 
p = 0xFFFE3A02;
if (*p & mask) {
  *p &= ~mask;
} else {
  *p |= mask;
}

From within the kernel, use ptr = ioremap(addr,len) and iounmap(ptr)

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox