RTEMS
5.1
|
I2C Support. More...
Files | |
file | i2c.c |
I2C support implementation. | |
file | i2c.h |
I2C support API. | |
Functions | |
rtems_status_code | lpc32xx_i2c_init (volatile lpc32xx_i2c *i2c, unsigned clock_in_hz) |
Initializes the I2C module i2c. More... | |
void | lpc32xx_i2c_reset (volatile lpc32xx_i2c *i2c) |
Resets the I2C module i2c. | |
rtems_status_code | lpc32xx_i2c_clock (volatile lpc32xx_i2c *i2c, unsigned clock_in_hz) |
Sets the I2C module i2c clock. More... | |
rtems_status_code | lpc32xx_i2c_write_start (volatile lpc32xx_i2c *i2c, unsigned addr) |
Starts a write transaction on the I2C module i2c. More... | |
rtems_status_code | lpc32xx_i2c_write_with_optional_stop (volatile lpc32xx_i2c *i2c, const uint8_t *out, size_t n, bool stop) |
Writes data via the I2C module i2c with optional stop. More... | |
rtems_status_code | lpc32xx_i2c_read_start (volatile lpc32xx_i2c *i2c, unsigned addr) |
Starts a read transaction on the I2C module i2c. More... | |
rtems_status_code | lpc32xx_i2c_read_with_optional_stop (volatile lpc32xx_i2c *i2c, uint8_t *in, size_t n, bool stop) |
Reads data via the I2C module i2c with optional stop. More... | |
rtems_status_code | lpc32xx_i2c_write_and_read (volatile lpc32xx_i2c *i2c, unsigned addr, const uint8_t *out, size_t out_size, uint8_t *in, size_t in_size) |
Writes and reads data via the I2C module i2c. More... | |
I2C TX Data FIFO Register (I2Cn_TX) | |
#define | I2C_TX_READ BSP_BIT32(0) |
#define | I2C_TX_ADDR(val) BSP_FLD32(val, 1, 7) |
#define | I2C_TX_START BSP_BIT32(8) |
#define | I2C_TX_STOP BSP_BIT32(9) |
I2C Support.
All writes and reads will be performed in master mode. Exclusive bus access will be assumed.
rtems_status_code lpc32xx_i2c_clock | ( | volatile lpc32xx_i2c * | i2c, |
unsigned | clock_in_hz | ||
) |
Sets the I2C module i2c clock.
Valid clock_in_hz values are 100000 and 400000.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_INVALID_CLOCK | Invalid clock_in_hz value. |
rtems_status_code lpc32xx_i2c_init | ( | volatile lpc32xx_i2c * | i2c, |
unsigned | clock_in_hz | ||
) |
rtems_status_code lpc32xx_i2c_read_start | ( | volatile lpc32xx_i2c * | i2c, |
unsigned | addr | ||
) |
Starts a read transaction on the I2C module i2c.
The address parameter addr must not contain the read/write bit.
The error status may be delayed to the next lpc32xx_i2c_read_with_optional_stop() due to controller flaws.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_IO_ERROR | Received a NACK from the slave. |
rtems_status_code lpc32xx_i2c_read_with_optional_stop | ( | volatile lpc32xx_i2c * | i2c, |
uint8_t * | in, | ||
size_t | n, | ||
bool | stop | ||
) |
Reads data via the I2C module i2c with optional stop.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_IO_ERROR | Received a NACK from the slave. |
RTEMS_NOT_IMPLEMENTED | Stop is false. |
rtems_status_code lpc32xx_i2c_write_and_read | ( | volatile lpc32xx_i2c * | i2c, |
unsigned | addr, | ||
const uint8_t * | out, | ||
size_t | out_size, | ||
uint8_t * | in, | ||
size_t | in_size | ||
) |
Writes and reads data via the I2C module i2c.
This will be one bus transaction.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_IO_ERROR | Received a NACK from the slave. |
rtems_status_code lpc32xx_i2c_write_start | ( | volatile lpc32xx_i2c * | i2c, |
unsigned | addr | ||
) |
Starts a write transaction on the I2C module i2c.
The address parameter addr must not contain the read/write bit.
The error status may be delayed to the next lpc32xx_i2c_write_with_optional_stop() due to controller flaws.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_IO_ERROR | Received a NACK from the slave. |
rtems_status_code lpc32xx_i2c_write_with_optional_stop | ( | volatile lpc32xx_i2c * | i2c, |
const uint8_t * | out, | ||
size_t | n, | ||
bool | stop | ||
) |
Writes data via the I2C module i2c with optional stop.
The error status may be delayed to the next lpc32xx_i2c_write_with_optional_stop() due to controller flaws.
RTEMS_SUCCESSFUL | Successful operation. |
RTEMS_IO_ERROR | Received a NACK from the slave. |