OpenBIC
OpenSource Bridge-IC
hal_i2c_target.h File Reference
#include <drivers/i2c.h>
#include "hal_i2c.h"
Include dependency graph for hal_i2c_target.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  i2c_target_data
 
struct  _i2c_target_config
 
struct  i2c_target_device
 

Macros

#define MAX_I2C_TARGET_BUFF   256
 
#define MAX_TARGET_NUM   16
 
#define I2C_DEVICE_PREFIX   "I2C_"
 
#define I2C_CONTROLLER_NAME_GET(inst)   I2C_DEVICE_PREFIX #inst
 

Enumerations

enum  i2c_target_error_status {
  I2C_TARGET_HAS_NO_ERR , I2C_TARGET_BUS_INVALID , I2C_TARGET_NOT_INIT , I2C_TARGET_NOT_REGISTER = 0x04 ,
  I2C_TARGET_CONTROLLER_ERR
}
 
enum  i2c_target_api_error_status {
  I2C_TARGET_API_NO_ERR , I2C_TARGET_API_INPUT_ERR , I2C_TARGET_API_LOCK_ERR , I2C_TARGET_API_MEMORY_ERR ,
  I2C_TARGET_API_MSGQ_ERR , I2C_TARGET_API_BUS_GET_FAIL , I2C_TARGET_API_UNKNOWN_ERR = 0xFF
}
 
enum  i2c_target_api_control_mode { I2C_CONTROL_UNREGISTER , I2C_CONTROL_REGISTER , I2C_CONTROL_MAX = 0xFF }
 

Functions

struct __attribute__ ((__packed__)) i2c_msg_package
 
uint8_t i2c_target_status_get (uint8_t bus_num)
 
uint8_t i2c_target_status_print (uint8_t bus_num)
 
uint8_t i2c_target_cfg_get (uint8_t bus_num, struct _i2c_target_config *cfg)
 
uint8_t i2c_target_read (uint8_t bus_num, uint8_t *buff, uint16_t buff_len, uint16_t *msg_len)
 
uint8_t i2c_target_write (uint8_t bus_num, uint8_t *buff, uint16_t buff_len)
 
int i2c_target_control (uint8_t bus_num, struct _i2c_target_config *cfg, enum i2c_target_api_control_mode mode)
 
void util_init_I2C_target (void)
 

Variables

const bool I2C_TARGET_ENABLE_TABLE [MAX_TARGET_NUM]
 
const struct _i2c_target_config I2C_TARGET_CONFIG_TABLE [MAX_TARGET_NUM]
 

Macro Definition Documentation

◆ I2C_CONTROLLER_NAME_GET

#define I2C_CONTROLLER_NAME_GET (   inst)    I2C_DEVICE_PREFIX #inst

◆ I2C_DEVICE_PREFIX

#define I2C_DEVICE_PREFIX   "I2C_"

◆ MAX_I2C_TARGET_BUFF

#define MAX_I2C_TARGET_BUFF   256

◆ MAX_TARGET_NUM

#define MAX_TARGET_NUM   16

Enumeration Type Documentation

◆ i2c_target_api_control_mode

Enumerator
I2C_CONTROL_UNREGISTER 
I2C_CONTROL_REGISTER 
I2C_CONTROL_MAX 

◆ i2c_target_api_error_status

Enumerator
I2C_TARGET_API_NO_ERR 
I2C_TARGET_API_INPUT_ERR 
I2C_TARGET_API_LOCK_ERR 
I2C_TARGET_API_MEMORY_ERR 
I2C_TARGET_API_MSGQ_ERR 
I2C_TARGET_API_BUS_GET_FAIL 
I2C_TARGET_API_UNKNOWN_ERR 

◆ i2c_target_error_status

Enumerator
I2C_TARGET_HAS_NO_ERR 
I2C_TARGET_BUS_INVALID 
I2C_TARGET_NOT_INIT 
I2C_TARGET_NOT_REGISTER 
I2C_TARGET_CONTROLLER_ERR 

Function Documentation

◆ __attribute__()

struct __attribute__ ( (__packed__)  )

◆ i2c_target_cfg_get()

uint8_t i2c_target_cfg_get ( uint8_t  bus_num,
struct _i2c_target_config cfg 
)
Here is the call graph for this function:

◆ i2c_target_control()

int i2c_target_control ( uint8_t  bus_num,
struct _i2c_target_config cfg,
enum i2c_target_api_control_mode  mode 
)
Here is the call graph for this function:

◆ i2c_target_read()

uint8_t i2c_target_read ( uint8_t  bus_num,
uint8_t *  buff,
uint16_t  buff_len,
uint16_t *  msg_len 
)
Here is the call graph for this function:

◆ i2c_target_status_get()

uint8_t i2c_target_status_get ( uint8_t  bus_num)

◆ i2c_target_status_print()

uint8_t i2c_target_status_print ( uint8_t  bus_num)
Here is the call graph for this function:

◆ i2c_target_write()

uint8_t i2c_target_write ( uint8_t  bus_num,
uint8_t *  buff,
uint16_t  buff_len 
)
Here is the call graph for this function:

◆ util_init_I2C_target()

void util_init_I2C_target ( void  )

Variable Documentation

◆ I2C_TARGET_CONFIG_TABLE

const struct _i2c_target_config I2C_TARGET_CONFIG_TABLE[MAX_TARGET_NUM]
extern

◆ I2C_TARGET_ENABLE_TABLE

const bool I2C_TARGET_ENABLE_TABLE[MAX_TARGET_NUM]
extern