openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
i2c_driver.h
Go to the documentation of this file.
1#ifdef USE_GENERIC_I2C_DRIVER
2#ifndef I2C_DRIVER_H_
3#define I2C_DRIVER_H_
4
16#define I2C_STAT_BUS_ERROR 0x00
24#define I2C_STAT_START 0x08
26#define I2C_STAT_REPEATED_START 0x10
28#define I2C_STAT_ARB_LOST 0x38
31
36#define I2C_STAT_SLA_W_SENT_ACK 0x18
38#define I2C_STAT_SLA_W_SENT_NACK 0x20
40#define I2C_STAT_DATA_SENT_ACK 0x28
42#define I2C_STAT_DATA_SENT_NACK 0x30
45
49#define I2C_STAT_SLA_R_SENT_ACK 0x40
51#define I2C_STAT_SLA_R_SENT_NACK 0x48
53#define I2C_STAT_DATA_RECV_ACK 0x50
55#define I2C_STAT_DATA_RECV_NACK 0x58
58
63#define I2C_STAT_SLA_W_RECV_ACK 0x60
65#define I2C_STAT_ARB_LOST_SLA_W_RECV_ACK 0x68
69#define I2C_STAT_GEN_CALL_ACK 0x70
71#define I2C_STAT_ARB_LOST_GEN_CALL_ACK 0x78
75#define I2C_STAT_SLA_DATA_RECV_ACK 0x80
77#define I2C_STAT_SLA_DATA_RECV_NACK 0x88
79#define I2C_STAT_GEN_CALL_DATA_RECV_ACK 0x90
81#define I2C_STAT_GEN_CALL_DATA_RECV_NACK 0x98
83#define I2C_STAT_SLA_STOP_REP_START 0xA0
86#define I2C_STAT_BUSERR 0x00
89
94#define I2C_STAT_SLA_R_RECV_ACK 0xA8
95#define I2C_STAT_ARB_LOST_SLA_R_RECV_ACK 0xB0
96#define I2C_STAT_SLA_DATA_SENT_ACK 0xB8
97#define I2C_STAT_SLA_DATA_SENT_NACK 0xC0
98#define I2C_STAT_SLA_LAST_DATA_SENT_ACK 0xC8
102#define LPC_I2Cx(x) ((i2c_cfg[x].reg))
103
108typedef struct xI2C_pins {
109 uint8_t sda_port;
110 uint8_t sda_pin;
111 uint8_t scl_port;
112 uint8_t scl_pin;
113 uint8_t pin_func;
114} xI2C_pins_t;
115
117typedef struct xI2C_Config {
118 void *reg;
119 xI2C_pins_t pins;
120 IRQn_Type irq;
121 I2C_Mode mode;
122 xI2C_msg msg;
123} xI2C_Config;
124
126extern struct xI2C_Config i2c_cfg[];
127
128#endif
129#endif
IRQn_Type
Definition LPC176x5x.h:56