
typedef struct
{
        volatile unsigned int offset[4096];     /* 4K * 4 = SZ_16K */

} __regbase32;

typedef struct
{
        volatile unsigned short offset[4096];   /* 4K * 2 = SZ_8K */

} __regbase16;

typedef struct
{
        volatile unsigned char offset[4096];    /* 4K * 1 = SZ_4K */

} __regbase8;


#define REG32(a)        ((__regbase32 *)((a)&~4095))->offset[((a)&4095)>>2]
#define REG16(a)        ((__regbase16 *)((a)&~4095))->offset[((a)&4095)>>1]
#define REG8(a)         ((__regbase8  *)((a)&~4095))->offset[((a)&4095)>>0]

#define inb(a)           REG8(a)
#define inhw(a)          REG16(a)
#define inw(a)           REG32(a)

#define outb(a,v)        (REG8(a) = (unsigned char)(v))
#define outhw(a,v)       (REG16(a) = (unsigned short)(v))
#define outw(a,v)        (REG32(a) = (unsigned int)(v))

