#ifndef __OC_I2C_REGS_H__
#define __OC_I2C_REGS_H__

#include <io.h>
//PRERlo
#define IOADDR_OC_I2C_PRERLO(base)                 __IO_CALC_ADDRESS_NATIVE(base, 0)
#define IORD_OC_I2C_PRERLO(base)                   IORD(base, 0) 
#define IOWR_OC_I2C_PRERLO(base, data)             IOWR(base, 0, data)

//PRERhi
#define IOADDR_OC_I2C_PRERHI(base)                 __IO_CALC_ADDRESS_NATIVE(base, 1)
#define IORD_OC_I2C_PRERHI(base)                   IORD(base, 1) 
#define IOWR_OC_I2C_PRERHI(base, data)             IOWR(base, 1, data)

//CTR
#define IOADDR_OC_I2C_CTR(base)                    __IO_CALC_ADDRESS_NATIVE(base, 2)
#define IORD_OC_I2C_CTR(base)                      IORD(base, 2) 
#define IOWR_OC_I2C_CTR(base, data)                IOWR(base, 2, data)

//RXR
#define IORD_OC_I2C_RXR(base)                      IORD(base, 3)
//TXR 
#define IOWR_OC_I2C_TXR(base, data)                IOWR(base, 3, data)

#define I2C_SR_TIP  0x2
//SR
#define IORD_OC_I2C_SR(base)                       IORD(base, 4)
//CR
#define I2C_CR_STA  0x80
#define I2C_CR_STO  0x40
#define I2C_CR_RD   0x20
#define I2C_CR_WR   0x10
#define I2C_CR_ACK  0x08
#define I2C_CR_IACK 0x01 
#define IOWR_OC_I2C_CR(base, data)                 IOWR(base, 4, data)

#endif /* __OC_I2C_REGS_H__ */
