📄 ixdp2400i2c.h
字号:
/*ixdp2400I2c.h *//*modification history--------------------rev, 5apr02, vgd - creation*/#ifndef I2C_H#define I2C_H#ifdef __cplusplusextern "C" {#endif#define LOW 0#define HIGH 1/*write this to POSR to drive the clock pin (GPIO pin 7)High and POCR for LOW*/#define CLOCK 0x80/*write this to POSR to drive the data pin (gpio pin 6)High and POCR for LOW*/ #define DATA 0x40 /*This GPIO bit 2 has to be configured as output and *drive a high to cause a pull up on the SDA line. */#define I2C_INIT_BIT 0x04 /*delayUSec() is defined in ixdp2400.c*/extern void delayUSec(unsigned int n);#define I2C_DELAY(n) delayUSec(n);#define CLOCK_LOW_TIME 3 /*us*/ #define CLOCK_HIGH_TIME 3 /*us*/#define START_CONDITION_HOLD_TIME 3 /*us*/#define STOP_CONDITION_HOLD_TIME 3 /*us*/#define I2C_ERROR 1#define I2C_NOERR 0#define I2C_READ 0x01#define I2C_WRITE 0x00#define SLAVE_ADDR_0 0xa0 /*SDRAM SPD*/#define SLAVE_ADDR_1 0xa2 /*KI config EEPROM*/#define SLAVE_ADDR_2 0xa4 /*media i/f cfg PROM*/#define SLAVE_ADDR_3 0xa6 /*sw i/f cfg prom*/#define SLAVE_ADDR_4 0xa8 /*tcam cfg prom*/#define SLAVE_ADDR_5 0xaa /*ADUC812*//*slave address = DEV_TYPE | DEV_ADDR | MODE. *Device type is fixed to 1010 i.e., 0xa. *___________________________________ *1 | 0 | 1 | 0 | A2 | A1 | A0| R/W| *----------------------------------- * *The LSB is r/W bit. if it is 1 the slave is in read mode and *if it is 0 the slave is in write mode. */#define I2C_BUFSIZE 256/*config data structure*/struct EEPROM_CONTENT { unsigned char prom_fmt; unsigned char dev_id; unsigned char man_id[12]; unsigned char part_rev [2]; unsigned char part_num[10]; unsigned char serial_num[10]; unsigned char model_id[12]; unsigned char rsvd1[8]; unsigned char passwd[8]; unsigned char test_status; unsigned char date[8]; unsigned char chksum[4]; unsigned char rsvd2[3]; unsigned int M_uart_baud; unsigned char M_ether_mac_addr[6]; unsigned int S_uart_baud; unsigned char S_ether_mac_addr[6]; unsigned char rsvd3[12];};struct board_config{ struct EEPROM_CONTENT config_data; int sdram_size; int qdr_channel_size[MAX_QDR_CHANNEL]; int flash_size; int config_valid;};#define CONFIG_DATA_SIZE 112void i2c_read(unsigned char slave, unsigned char word_address, unsigned char *x);void i2c_write(unsigned char slave, unsigned char addr, unsigned char data);void i2c_page_write(unsigned char slave, unsigned char addr, unsigned char * data, unsigned char count);void i2c_seq_read(unsigned char slave, unsigned char addr, unsigned char * ptr, unsigned char count);void i2c_clk_cycles(int i);void i2c_init(void);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -