2 Copyright (c) 2002, Thomas Kurschel
7 Macros for easier memory mapped I/O access
13 // read 8-bit register
14 #define INREG8( regs, addr ) (*(regs + (addr)))
15 // write 8-bit register
16 #define OUTREG8( regs, addr, val ) do { *(regs + (addr)) = (val); } while( 0 )
17 // read 32-bit register
18 #define INREG( regs, addr ) (*((vuint32 *)(regs + (addr))))
19 // write 32-bit register
20 #define OUTREG( regs, addr, val ) do { *(vuint32 *)(regs + (addr)) = (val); } while( 0 )
21 // write partial 32-bit register, keeping bits "mask"
22 #define OUTREGP( regs, addr, val, mask ) \
24 uint32 tmp = INREG( (regs), (addr) ); \
26 tmp |= (val) & ~(mask); \
27 OUTREG( (regs), (addr), tmp ); \