8f6c61bcef
Includes some common routines which may be used by other drivers. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8405 a95241bf-73f2-0310-859d-f6bbb57e9c96
31 lines
1.0 KiB
C
31 lines
1.0 KiB
C
/*
|
|
Copyright (c) 2002, Thomas Kurschel
|
|
|
|
|
|
Part of Radeon driver
|
|
|
|
Macros for easier memory mapped I/O access
|
|
*/
|
|
|
|
#ifndef _MMIO_H
|
|
#define _MMIO_H
|
|
|
|
// read 8-bit register
|
|
#define INREG8( regs, addr ) (*(regs + (addr)))
|
|
// write 8-bit register
|
|
#define OUTREG8( regs, addr, val ) do { *(regs + (addr)) = (val); } while( 0 )
|
|
// read 32-bit register
|
|
#define INREG( regs, addr ) (*((vuint32 *)(regs + (addr))))
|
|
// write 32-bit register
|
|
#define OUTREG( regs, addr, val ) do { *(vuint32 *)(regs + (addr)) = (val); } while( 0 )
|
|
// write partial 32-bit register, keeping bits "mask"
|
|
#define OUTREGP( regs, addr, val, mask ) \
|
|
do { \
|
|
uint32 tmp = INREG( (regs), (addr) ); \
|
|
tmp &= (mask); \
|
|
tmp |= (val) & ~(mask); \
|
|
OUTREG( (regs), (addr), tmp ); \
|
|
} while (0)
|
|
|
|
#endif
|