sysI2CDrv.h
资源名称:idt438.rar [点击查看]
上传用户:yingyi0918
上传日期:2022-06-26
资源大小:214k
文件大小:4k
源码类别:
VxWorks
开发平台:
C/C++
- /* sysI2CDrv.h - rc32355 I2C Header File */
- /* Copyright 1984-2002 Wind River Systems, Inc. */
- #include "copyright_wrs.h"
- /*
- * This file has been developed or significantly modified by the
- * MIPS Center of Excellence Dedicated Engineering Staff.
- * This notice is as per the MIPS Center of Excellence Master Partner
- * Agreement, do not remove this notice without checking first with
- * WR/Platforms MIPS Center of Excellence engineering management.
- */
- /*
- modification history
- --------------------
- 01c,05aug02,slk remove I2C_24LC64_CNTL_BYTE
- 01b,25jun02,d_c Further cleanup
- 01a,19Jun02,d_c Code from IDT modified to approach C of E standards.
- */
- /*
- DESCRIPTION
- This is the header file for the I2C interface.
- */
- #ifndef __sysI2CDrvh
- #define __sysI2CDrvh
- #ifdef __cplusplus
- extern "C" {
- #endif /*__cplusplus*/
- /*defines*/
- /*
- * Size of a page for I2C serial EEPROM.
- *
- * NOTE: If you change this value you must also change function
- * documentation headers in sysI2CDrv.c that refer to the page size as
- * being '32'.
- *
- * NOTE 2: Must be a power of 2.
- */
- #define I2C_EEPROM_PAGE_SIZE 32
- /* I2C clock rate and pre-scaler */
- #define I2C_BPS 100000 /* Clock rate (Bits per second) */
- #define I2C_CPP ((UINT16) (((CPU_CLOCK_RATE / I2C_BPS) / 8.0) + .5))
- #define I2C_MASTER_INT_MASK 0xF /* Master interrupt mask */
- #define I2C_SLAVE_INT_MASK 0x7F /* Slave interrupt mask */
- #define I2C_24LC64_RD_EN 0x01 /* Serial EEPROM read enable */
- #define I2C_MEM_SIZE 8192 /* 8K Bytes total of I2C Space */
- /* I2CC register */
- #define I2CC_MEN (1<<0) /* MEN bit */
- #define I2CC_SEN (1<<1) /* SEN bit */
- #define I2CC_IOM (1<<2) /* IOM bit */
- /* I2CM Commands */
- #define NOP 0
- #define START 1
- #define STOP 2
- #define RD 4
- #define RDACK 5
- #define WD 6
- #define WDACK 7
- #define I2CMCMD_CMD(v) ((v&0xffff)<<0) /* CMD field */
- /* I2CMS register */
- #define I2CMS_D (1<<0) /* Done bit */
- #define I2CMS_NACK (1<<1) /* No-ACK bit */
- #define I2CMS_LA (1<<2) /* Lost Arbitration bit */
- #define I2CMS_ERR (1<<3) /* Error bit */
- #define I2CMS_MASK 0xF /* Mask for CMS sig. bits */
- /* I2CSS register */
- #define I2CSS_RR (1<<0) /* RR bit */
- #define I2CSS_WR (1<<1) /* WR bit */
- #define I2CSS_SA (1<<2) /* SA bit */
- #define I2CSS_TF (1<<3) /* TF bit */
- #define I2CSS_GC (1<<4) /* GC bit */
- #define I2CSS_ACK (1<<5) /* ACK bit */
- #define I2CSS_ERR (1<<6) /* ERR bit */
- /* I2CSADDR register */
- #define I2CSADDR_ADDR(v) ((v&0x3ff)<<0) /* ADDR field */
- #define I2CSADDR_GC (1<<10) /* GC bit */
- #define I2CSADDR_A10 (1<<11) /* A10 bit */
- /* I2CSACK register */
- #define I2CSACK_ACK (1<<0) /* ACK bit */
- /* I2CCP register */
- #define I2CCP_DIV(v) ((v&0xffff)<<0) /* DIV field */
- /* I2CDI register */
- #define I2CDI_DATA(v) ((v&0xffff)<<0) /* DATA field */
- /* I2CDO register */
- #define I2CDO_DATA_WIDTH 8 /* Width of I2CDO data field */
- #define I2CDO_DATA_MASK 0xFF /* Mask for I2CDO Data field */
- STATUS sysI2CAckPollOnWrite (void);
- STATUS sysI2CByteRead (UINT16 address, int * byte);
- STATUS sysI2CByteWrite (UINT16 address, UINT8 byte);
- STATUS sysI2CByteWrites (UINT16 address, UINT8 * string, UINT32 numOfBytes);
- STATUS sysI2CChkDone (void);
- STATUS sysI2CInPageWrite (UINT8 byteData);
- void sysI2CInit ();
- STATUS sysI2CPageWrite (UINT16 address, UINT8 * string);
- STATUS sysI2CPageWriteOpen (UINT16 address);
- STATUS sysI2CSeqRead (int * byte);
- STATUS sysI2CSeqReadLast (int * byte);
- STATUS sysI2CSeqReadStart (UINT16 address);
- STATUS sysI2CStart (void);
- STATUS sysI2CStop (void);
- STATUS sysI2CStringRead (UINT16 address, UINT8 * string, UINT32 numOfBytes);
- STATUS sysI2CStringWrite (UINT16 address, UINT8 * string, UINT32 numOfBytes);
- #ifdef __cplusplus
- }
- #endif /* __cplusplus */
- #endif /* __sysI2CDrvh */