diff options
Diffstat (limited to 'c/src/lib/libbsp/arm/beagle/include/i2c.h')
-rw-r--r-- | c/src/lib/libbsp/arm/beagle/include/i2c.h | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/c/src/lib/libbsp/arm/beagle/include/i2c.h b/c/src/lib/libbsp/arm/beagle/include/i2c.h index e7d17163f4..010fcee09c 100644 --- a/c/src/lib/libbsp/arm/beagle/include/i2c.h +++ b/c/src/lib/libbsp/arm/beagle/include/i2c.h @@ -180,187 +180,6 @@ struct i2c { unsigned short res15; }; -static unsigned short wait_for_pin( void ); - -static void wait_for_bb( void ); - -static void flush_fifo( void ); - -void i2c_init( int speed, int slaveadd ); - -static int i2c_read_byte( - unsigned char devaddr, - unsigned char regoffset, - unsigned char *value -); - -int i2c_write( - unsigned char chip, - unsigned int addr, - int alen, - unsigned char *buffer, - int len -); - -int i2c_read( - unsigned char chip, - uint addr, - int alen, - unsigned char *buffer, - int len -); - -static int imw ( unsigned char chip, unsigned long addr, unsigned char byte ); - -static int imd( unsigned char chip, unsigned int addr, unsigned int length ); - -/** - * @brief Initializes the I2C module @a i2c. - * - * Valid @a clock_in_hz values are 100000 and 400000. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_ID Invalid @a i2c value. - * @retval RTEMS_INVALID_CLOCK Invalid @a clock_in_hz value. - */ -rtems_status_code beagle_i2c_init( - volatile beagle_i2c *i2c, - unsigned clock_in_hz -); - -/** - * @brief Resets the I2C module @a i2c. - */ -void beagle_i2c_reset(volatile beagle_i2c *i2c); - -/** - * @brief Sets the I2C module @a i2c clock. - * - * Valid @a clock_in_hz values are 100000 and 400000. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_INVALID_CLOCK Invalid @a clock_in_hz value. - */ -rtems_status_code beagle_i2c_clock( - volatile beagle_i2c *i2c, - unsigned clock_in_hz -); - -/** - * @brief Starts a write transaction on the I2C module @a i2c. - * - * The address parameter @a addr must not contain the read/write bit. - * - * The error status may be delayed to the next - * beagle_i2c_write_with_optional_stop() due to controller flaws. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -rtems_status_code beagle_i2c_write_start( - volatile beagle_i2c *i2c, - unsigned addr -); - -/** - * @brief Writes data via the I2C module @a i2c with optional stop. - * - * The error status may be delayed to the next - * beagle_i2c_write_with_optional_stop() due to controller flaws. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -rtems_status_code beagle_i2c_write_with_optional_stop( - volatile beagle_i2c *i2c, - const uint8_t *out, - size_t n, - bool stop -); - -/** - * @brief Starts a read transaction on the I2C module @a i2c. - * - * The address parameter @a addr must not contain the read/write bit. - * - * The error status may be delayed to the next - * beagle_i2c_read_with_optional_stop() due to controller flaws. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -rtems_status_code beagle_i2c_read_start( - volatile beagle_i2c *i2c, - unsigned addr -); - -/** - * @brief Reads data via the I2C module @a i2c with optional stop. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - * @retval RTEMS_NOT_IMPLEMENTED Stop is @a false. - */ -rtems_status_code beagle_i2c_read_with_optional_stop( - volatile beagle_i2c *i2c, - uint8_t *in, - size_t n, - bool stop -); - -/** - * @brief Writes and reads data via the I2C module @a i2c. - * - * This will be one bus transaction. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -rtems_status_code beagle_i2c_write_and_read( - volatile beagle_i2c *i2c, - unsigned addr, - const uint8_t *out, - size_t out_size, - uint8_t *in, - size_t in_size -); - -/** - * @brief Writes data via the I2C module @a i2c. - * - * This will be one bus transaction. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -static inline rtems_status_code beagle_i2c_write( - volatile beagle_i2c *i2c, - unsigned addr, - const uint8_t *out, - size_t out_size -) -{ - return beagle_i2c_write_and_read(i2c, addr, out, out_size, NULL, 0); -} - -/** - * @brief Reads data via the I2C module @a i2c. - * - * This will be one bus transaction. - * - * @retval RTEMS_SUCCESSFUL Successful operation. - * @retval RTEMS_IO_ERROR Received a NACK from the slave. - */ -static inline rtems_status_code beagle_i2c_read( - volatile beagle_i2c *i2c, - unsigned addr, - uint8_t *in, - size_t in_size -) -{ - return beagle_i2c_write_and_read(i2c, addr, NULL, 0, in, in_size); -} - #ifdef __cplusplus } #endif /* __cplusplus */ |