Bouffalo SDK  1.0
Bouffalolab Software Development Kit
bflb_i2c.h File Reference
#include "bflb_core.h"
Include dependency graph for bflb_i2c.h:

Go to the source code of this file.

Data Structures

struct  bflb_i2c_msg_s
 I2C message structure. More...
 

Macros

#define I2C_M_READ   0x0001 /* Read data, from slave to master */
 
#define I2C_M_TEN   0x0002 /* Ten bit address */
 
#define I2C_M_DMA   0x0004 /* Enable dma mode */
 
#define I2C_M_NOSTOP   0x0040 /* Message should not end with a STOP */
 
#define I2C_M_NOSTART   0x0080 /* Message should not begin with a START */
 
#define I2C_INTSTS_END   (1 << 0) /* Transfer end interrupt */
 
#define I2C_INTSTS_TX_FIFO   (1 << 1) /* TX FIFO ready interrupt */
 
#define I2C_INTSTS_RX_FIFO   (1 << 2) /* RX FIFO ready interrupt */
 
#define I2C_INTSTS_NACK   (1 << 3) /* NACK interrupt */
 
#define I2C_INTSTS_ARB   (1 << 4) /* Arbitration lost interrupt */
 
#define I2C_INTSTS_FER   (1 << 5) /* TX/RX FIFO error interrupt */
 
#define I2C_INTCLR_END   (1 << 0) /* Transfer end interrupt */
 
#define I2C_INTCLR_NACK   (1 << 3) /* NACK interrupt */
 
#define I2C_INTCLR_ARB   (1 << 4) /* Arbitration lost interrupt */
 
#define I2C_INTEN_END   (1 << 0) /* Transfer end interrupt */
 
#define I2C_INTEN_TX_FIFO   (1 << 1) /* TX FIFO ready interrupt */
 
#define I2C_INTEN_RX_FIFO   (1 << 2) /* RX FIFO ready interrupt */
 
#define I2C_INTEN_NACK   (1 << 3) /* NACK interrupt */
 
#define I2C_INTEN_ARB   (1 << 4) /* Arbitration lost interrupt */
 
#define I2C_INTEN_FER   (1 << 5) /* TX/RX FIFO error interrupt */
 
#define I2C_CMD_SET_SCL_SYNC   (0x01) /* Enable or disable multi-master and clock-stretching */
 
#define I2C_CMD_SET_DEGLITCH   (0x02) /* 0 for disable deglitch, others for deglitch count */
 

Functions

void bflb_i2c_init (struct bflb_device_s *dev, uint32_t frequency)
 Initialize i2c. More...
 
void bflb_i2c_deinit (struct bflb_device_s *dev)
 Deinitialize i2c. More...
 
void bflb_i2c_link_txdma (struct bflb_device_s *dev, bool enable)
 Enable i2c tx dma. More...
 
void bflb_i2c_link_rxdma (struct bflb_device_s *dev, bool enable)
 Enable i2c rx dma. More...
 
int bflb_i2c_transfer (struct bflb_device_s *dev, struct bflb_i2c_msg_s *msgs, int count)
 Start transferring i2c message. More...
 
void bflb_i2c_int_mask (struct bflb_device_s *dev, uint32_t int_type, bool mask)
 Enable or disable i2c interrupt. More...
 
void bflb_i2c_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear i2c interrupt status. More...
 
uint32_t bflb_i2c_get_intstatus (struct bflb_device_s *dev)
 Get i2c interrupt status. More...
 
int bflb_i2c_feature_control (struct bflb_device_s *dev, int cmd, size_t arg)
 Control i2c feature. More...