1 /* 2 Copyright (c) 2002, Thomas Kurschel 3 4 5 Part of Radeon driver 6 7 Macros for easier memory mapped I/O access 8 */ 9 10 #ifndef _MMIO_H 11 #define _MMIO_H 12 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 ) \ 23 do { \ 24 uint32 tmp = INREG( (regs), (addr) ); \ 25 tmp &= (mask); \ 26 tmp |= (val); \ 27 OUTREG( (regs), (addr), tmp ); \ 28 } while (0) 29 30 #endif 31