23 #ifndef LIBBSP_ARM_BEAGLE_I2C_H 24 #define LIBBSP_ARM_BEAGLE_I2C_H 37 #define BBB_I2C_CON_EN (1 << 15) 38 #define BBB_I2C_CON_BE (1 << 14) 39 #define BBB_I2C_CON_STB (1 << 11) 40 #define BBB_I2C_CON_MST (1 << 10) 41 #define BBB_I2C_CON_TRX (1 << 9) 43 #define BBB_I2C_CON_XA (1 << 8) 44 #define BBB_I2C_CON_STP (1 << 1) 45 #define BBB_I2C_CON_STT (1 << 0) 46 #define BBB_I2C_CON_CLR 0x0 49 #define BBB_I2C_STAT_SBD (1 << 15) 50 #define BBB_I2C_STAT_BB (1 << 12) 51 #define BBB_I2C_STAT_ROVR (1 << 11) 52 #define BBB_I2C_STAT_XUDF (1 << 10) 53 #define BBB_I2C_STAT_AAS (1 << 9) 54 #define BBB_I2C_STAT_GC (1 << 5) 55 #define BBB_I2C_STAT_XRDY (1 << 4) 56 #define BBB_I2C_STAT_RRDY (1 << 3) 57 #define BBB_I2C_STAT_ARDY (1 << 2) 58 #define BBB_I2C_STAT_NACK (1 << 1) 59 #define BBB_I2C_STAT_AL (1 << 0) 62 #define BBB_I2C_IE_GC_IE (1 << 5) 63 #define BBB_I2C_IE_XRDY_IE (1 << 4) 64 #define BBB_I2C_IE_RRDY_IE (1 << 3) 65 #define BBB_I2C_IE_ARDY_IE (1 << 2) 66 #define BBB_I2C_IE_NACK_IE (1 << 1) 67 #define BBB_I2C_IE_AL_IE (1 << 0) 70 #define BBB_I2C_SYSC_SRST (1 << 1) 72 #define BBB_I2C_TIMEOUT 1000 74 #define BBB_I2C_SYSS_RDONE (1 << 0) 76 #define BBB_CONFIG_SYS_I2C_SPEED 100000 77 #define BBB_CONFIG_SYS_I2C_SLAVE 1 78 #define BBB_I2C_ALL_FLAGS 0x7FFF 79 #define BBB_I2C_ALL_IRQ_FLAGS 0xFFFF 81 #define BBB_I2C_SYSCLK 48000000 82 #define BBB_I2C_INTERNAL_CLK 12000000 83 #define BBB_I2C_SPEED_CLK 100000 85 #define BBB_I2C_IRQ_ERROR \ 86 ( AM335X_I2C_IRQSTATUS_NACK \ 87 | AM335X_I2C_IRQSTATUS_ROVR \ 88 | AM335X_I2C_IRQSTATUS_AL \ 89 | AM335X_I2C_IRQSTATUS_ARDY \ 90 | AM335X_I2C_IRQSTATUS_RRDY \ 91 | AM335X_I2C_IRQSTATUS_XRDY \ 92 | AM335X_I2C_IRQSTATUS_XUDF ) 94 #define BBB_I2C_IRQ_USED \ 95 ( AM335X_I2C_IRQSTATUS_ARDY \ 96 | AM335X_I2C_IRQSTATUS_XRDY ) 98 #define BBB_I2C_0_BUS_PATH "/dev/i2c-0" 99 #define BBB_I2C_1_BUS_PATH "/dev/i2c-1" 100 #define BBB_I2C_2_BUS_PATH "/dev/i2c-2" 102 #define BBB_I2C0_IRQ 70 103 #define BBB_I2C1_IRQ 71 104 #define BBB_I2C2_IRQ 30 117 uint32_t BBB_I2C_REVNB_LO;
118 uint32_t BBB_I2C_REVNB_HI;
119 uint32_t dummy1[ 2 ];
120 uint32_t BBB_I2C_SYSC;
121 uint32_t dummy2[ 4 ];
122 uint32_t BBB_I2C_IRQSTATUS_RAW;
123 uint32_t BBB_I2C_IRQSTATUS;
124 uint32_t BBB_I2C_IRQENABLE_SET;
125 uint32_t BBB_I2C_IRQENABLE_CLR;
127 uint32_t BBB_I2C_DMARXENABLE_SET;
128 uint32_t BBB_I2C_DMATXENABLE_SET;
129 uint32_t BBB_I2C_DMARXENABLE_CLR;
130 uint32_t BBB_I2C_DMATXENABLE_CLR;
131 uint32_t BBB_I2C_DMARXWAKE_EN;
132 uint32_t BBB_I2C_DMATXWAKE_EN;
133 uint32_t dummy3[ 16 ];
134 uint32_t BBB_I2C_SYSS;
135 uint32_t BBB_I2C_BUF;
136 uint32_t BBB_I2C_CNT;
137 uint32_t BBB_I2C_DATA;
139 uint32_t BBB_I2C_CON;
142 uint32_t BBB_I2C_PSC;
143 uint32_t BBB_I2C_SCLL;
144 uint32_t BBB_I2C_SCLH;
145 uint32_t BBB_I2C_SYSTEST;
146 uint32_t BBB_I2C_BUFSTAT;
147 uint32_t BBB_I2C_OA1;
148 uint32_t BBB_I2C_OA2;
149 uint32_t BBB_I2C_OA3;
150 uint32_t BBB_I2C_ACTOA;
151 uint32_t BBB_I2C_SBLOCK;
159 uint32_t current_msg_todo;
160 uint8_t *current_msg_byte;
161 uint32_t current_todo;
166 uint32_t input_clock;
167 uint32_t already_transferred;
170 int am335x_i2c_bus_register(
171 const char *bus_path,
172 uintptr_t register_base,
173 uint32_t input_clock,
177 static inline int bbb_register_i2c_0(
void )
179 return am335x_i2c_bus_register(
187 static inline int bbb_register_i2c_1(
void )
189 return am335x_i2c_bus_register(
197 static inline int bbb_register_i2c_2(
void )
199 return am335x_i2c_bus_register(
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:27
I2C transfer message.
Definition: i2c.h:138
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
I2C bus control.
Definition: i2c.h:108
Inter-Integrated Circuit (I2C) Driver API.
#define I2C_BUS_CLOCK_DEFAULT
Default I2C bus clock in Hz.
Definition: i2c.h:103
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:83