?? tvp9k_i2c_def.h
字號:
/*******************************************************************************
* @ModuleName :: TVP9K_I2C_Def.h
*
* @Copyright :: Copyright 2005- Texas Instruments, Inc.
*
* @Description :: Constants & Definitions for TVP9K I2C Module
*
* @History ::
*---------------------------------------
* 03-13-2005 W.Shi Created
*******************************************************************************/
#ifndef _TVP9K_I2C_DEF_H_
#define _TVP9K_I2C_DEF_H_
#define TVP9K_I2C_0_REG_BASE_ADDR 0x00034000
#define TVP9K_I2C_1_REG_BASE_ADDR 0x00034080
typedef union _TVP9K_I2C_CTRL_ {
UINT32 Data;
struct {
UINT32 SoftReset: 1; // Soft reset
UINT32 Reserved: 12; // Reserved
UINT32 Acknowledge: 1; // Acknowledge value: 0 = ACK, 1 = NACK
// UINT32 DisableSlave: 1; // 1 = Disable Slave mode: not consistant to RTSCL ???
UINT32 TimeOutIrqEnable: 1; // Enable Timeout Interrupt
UINT32 ErrorIrqMask: 1; // 1 = Mask Error Interrupt
UINT32 SlaveWrIrqMask: 1; // 1 = Mask Slave Write Interrupt
UINT32 SlaveRdIrqMask: 1; // 1 = Mask Slave Read Interrupt
UINT32 MasterWrIrqMask: 1; // 1 = Mask Master Write Interrupt
UINT32 MasterRdIrqMask: 1; // 1 = Mask Master Read Interrupt
UINT32 StopCondition: 1; // Stop condition after next byte
UINT32 Restart: 1; // restart before next byte
UINT32 StartCondition: 1; // start condition before next byte
UINT32 StartTransaction: 1; // Start transmission
UINT32 Data: 8; // data transmitted or received
} Bits;
} TVP9K_I2C_CTRL;
typedef union _TVP9K_I2C_ADDR_ {
UINT32 Data;
struct {
UINT32 :12; // Reserved
UINT32 FastMode: 1; // 1 = Fast (400KHz) mode, 0 = 100KHz mode
UINT32 SlaveAddrMode: 2; // 10 = 10-bit, 01 = 7-bit, 00 = disable slave addr
UINT32 SlaveAddr10bit: 10; // 10-bit slave address
UINT32 SlaveAddr7bit: 7; // 7-bit slave address
} Bits;
} TVP9K_I2C_ADDR;
typedef union _TVP9K_I2C_STATUS_ {
UINT32 Data;
struct {
UINT32 :4; // Reserved
UINT32 SlaveRestart: 1;
UINT32 SlaveStart: 1;
UINT32 BitCount: 4;
UINT32 Arbitration: 1;
UINT32 SlaveError: 1;
UINT32 TimeoutError: 1;
UINT32 BusError: 1;
UINT32 ReadFlag: 1;
UINT32 MasterFlag: 1;
UINT32 SlaveFlag: 1;
UINT32 StopFlag: 1;
UINT32 RestartFlag: 1;
UINT32 StartFlag: 1;
UINT32 AckValue: 1; // Last ACK(0)/NAK (1) received
UINT32 ActiveFlag: 1;
UINT32 MaskedMasterRdIrq: 1; // Mask Master Read interrupt
UINT32 MaskedMasterWrIrq: 1; // Mask Master Write interrupt
UINT32 MaskedSlaveRdIrq: 1; // Mask Slave Read interrupt
UINT32 MaskedSlaveWrIrq: 1; // Mask Slave Write interrupt
UINT32 MaskedErrorIrq: 1; // Mask Error Interrupt
UINT32 MasterRdIrq: 1; // Raw Master Read interrupt
UINT32 MasterWrIrq: 1; // Raw Master Write interrupt
UINT32 SlaveRdIrq: 1; // Raw Slave Read interrupt
UINT32 SlaveWrIrq: 1; // Raw Slave Write interrupt
UINT32 ErrorIrq: 1; // Raw Error interrupt
} Bits;
} TVP9K_I2C_STATUS;
typedef struct _TVP9K_I2C_REG_ {
volatile TVP9K_I2C_CTRL Ctrl; // I2C Channel-0: Control register
volatile TVP9K_I2C_ADDR Addr; // I2C Channel-0: Address register
volatile TVP9K_I2C_STATUS Status; // I2C Channel-0: Status register
} TVP9K_I2C_REG;
typedef struct _TI_DTV_I2C_CTRL_ {
OS_EVENT *pMutexSem; // Mutual Exclusive Semaphore
volatile TVP9K_I2C_REG *pI2cReg; // pointer to I2C H/W Registers
UINT16 EventFlag; // I2C Event Flag (Data Ready)
int Status; // Tx/Rx status
int TxDataSize; // Tx Data byte size
UCHAR *pTxDataBuf; // pointer to Tx Data buffer
int RxDataSize; // Rx Data byte size
UCHAR *pRxDataBuf; // pointer to Rx Data buffer
} TI_DTV_I2C_CTRL;
//----------------------------------------------------------
// Defined in "TiDTV_I2C.c"
//
void TiDTV_InitI2C(void);
int TiDTV_I2cWriteByte(UCHAR I2cChNo, UCHAR I2cSpeed, UCHAR DeviceAddr, UCHAR SubAddrEnable,
UCHAR SubAddr, UCHAR DataByte, UINT16 TimeOut);
int TiDTV_I2cWrite(UCHAR I2cChNo, UCHAR I2cSpeed, UCHAR DeviceAddr,
int TxDataSize, UCHAR *pTxDataBuf, UINT16 TimeOut);
int TiDTV_I2cRead(UCHAR I2cChNo, UCHAR I2cSpeed, UCHAR DeviceAddr, UCHAR SubAddrEnable,
UCHAR SubAddr, int RxDataSize, UCHAR *pRxDataBuf, UINT16 TimeOut);
int TiDTV_I2cReadAfterWrite(UCHAR I2cChNo, UCHAR I2cSpeed, int TxDataSize, UCHAR *pTxDataBuf,
int RxDataSize, UCHAR *pRxDataBuf, UINT16 TimeOut);
#endif /* _TVP9K_I2C_DEF_H_ */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -