haiku/headers/private/graphics/radeon/mmio.h
shadow303 8f6c61bcef Upgrade to version 4.1 of radeon driver.
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
2004-07-16 00:46:01 +00:00

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