OpenBIC
OpenSource Bridge-IC
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
plat_i2c_target.c File Reference
#include <zephyr.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libutil.h"
#include "plat_i2c_target.h"
#include "plat_i2c.h"
#include <logging/log.h>
#include "plat_gpio.h"
#include "plat_pldm_sensor.h"
#include "pldm_sensor.h"
#include "plat_version.h"
#include "plat_isr.h"
#include "plat_hook.h"
#include "plat_fru.h"
Include dependency graph for plat_i2c_target.c:

Macros

#define DEVICE_TYPE   0x01
 
#define REGISTER_LAYOUT_VERSION   0x01
 
#define AEGIS_CARRIER_BOARD_ID   0x0000
 
#define AEGIS_CPLD_ADDR   (0x4C >> 1)
 
#define DATA_TABLE_LENGTH_1   1
 
#define DATA_TABLE_LENGTH_2   2
 
#define DATA_TABLE_LENGTH_4   4
 
#define DATA_TABLE_LENGTH_7   7
 
#define DATA_TABLE_LENGTH_13   13
 
#define SENSOR_INIT_PDR_INDEX_MAX   248
 
#define SENSOR_READING_PDR_INDEX_MAX   50
 
#define PLAT_MASTER_WRITE_STACK_SIZE   1024
 
#define STRAP_SET_TYPE   0x44
 
#define TELEMETRY_MSG_MAX_LENGTH   32
 

Functions

void set_bootstrap_element_handler ()
 
 K_WORK_DEFINE (set_bootstrap_element_work, set_bootstrap_element_handler)
 
 K_THREAD_STACK_DEFINE (plat_master_write_stack, PLAT_MASTER_WRITE_STACK_SIZE)
 
struct __attribute__ ((__packed__))
 
 LOG_MODULE_REGISTER (plat_i2c_target)
 
void * allocate_sensor_data_table (void **buffer, size_t buffer_size)
 
bool get_fru_info_element (telemetry_info *telemetry_info, char **fru_element, uint8_t *fru_element_size)
 
bool set_bootstrap_element (uint8_t bootstrap_pin, uint8_t user_setting_level)
 
void i2c_bridge_command_handler (struct k_work *work_item)
 
void set_sensor_polling_handler (struct k_work *work_item)
 
bool initialize_sensor_data_0_1 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
bool initialize_sensor_data_2_5 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
bool initialize_sensor_data_6 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
bool initialize_sensor_data_8 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
bool initialize_sensor_data_60_66 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
bool initialize_sensor_data_70_76 (telemetry_info *telemetry_info, uint8_t *buffer_size)
 
void update_sensor_data_2_5_table ()
 
void update_sensor_data_8_table ()
 
void plat_master_write_thread_handler ()
 
void plat_master_write_thread_init ()
 
void sensor_data_table_init (void)
 

Variables

struct k_thread plat_master_write_thread
 
k_tid_t plat_master_write_tid
 
 plat_sensor_init_data_0_1
 
 sensor_entry
 
 plat_sensor_init_data_2_5
 
 plat_sensor_init_data_6
 
 strap_entry
 
 plat_sensor_init_data_8
 
 plat_sensor_init_data_60_76
 
 plat_sensor_init_data_40
 
 plat_sensor_init_data_41
 
 plat_sensor_init_data_42
 
 plat_sensor_init_data_f0
 
const bool I2C_TARGET_ENABLE_TABLE [MAX_TARGET_NUM]
 
const struct _i2c_target_config I2C_TARGET_CONFIG_TABLE [MAX_TARGET_NUM]
 
plat_sensor_init_data_0_1sensor_init_data_0_1_table [DATA_TABLE_LENGTH_2] = { NULL }
 
plat_sensor_init_data_2_5sensor_init_data_2_5_table [DATA_TABLE_LENGTH_4] = { NULL }
 
plat_sensor_init_data_6sensor_init_data_6_table [DATA_TABLE_LENGTH_1] = { NULL }
 
plat_sensor_init_data_8sensor_init_data_8_table [DATA_TABLE_LENGTH_1] = { NULL }
 
plat_sensor_init_data_60_76sensor_init_data_60_66_table [DATA_TABLE_LENGTH_13] = { NULL }
 
plat_sensor_init_data_60_76sensor_init_data_70_76_table [DATA_TABLE_LENGTH_7] = { NULL }
 
plat_sensor_init_data_41sensor_init_data_41_table [DATA_TABLE_LENGTH_1] = { NULL }
 
plat_sensor_init_data_42sensor_init_data_42_table [DATA_TABLE_LENGTH_1] = { NULL }
 
telemetry_info telemetry_info_table []
 

Macro Definition Documentation

◆ AEGIS_CARRIER_BOARD_ID

#define AEGIS_CARRIER_BOARD_ID   0x0000

◆ AEGIS_CPLD_ADDR

#define AEGIS_CPLD_ADDR   (0x4C >> 1)

◆ DATA_TABLE_LENGTH_1

#define DATA_TABLE_LENGTH_1   1

◆ DATA_TABLE_LENGTH_13

#define DATA_TABLE_LENGTH_13   13

◆ DATA_TABLE_LENGTH_2

#define DATA_TABLE_LENGTH_2   2

◆ DATA_TABLE_LENGTH_4

#define DATA_TABLE_LENGTH_4   4

◆ DATA_TABLE_LENGTH_7

#define DATA_TABLE_LENGTH_7   7

◆ DEVICE_TYPE

#define DEVICE_TYPE   0x01

◆ PLAT_MASTER_WRITE_STACK_SIZE

#define PLAT_MASTER_WRITE_STACK_SIZE   1024

◆ REGISTER_LAYOUT_VERSION

#define REGISTER_LAYOUT_VERSION   0x01

◆ SENSOR_INIT_PDR_INDEX_MAX

#define SENSOR_INIT_PDR_INDEX_MAX   248

◆ SENSOR_READING_PDR_INDEX_MAX

#define SENSOR_READING_PDR_INDEX_MAX   50

◆ STRAP_SET_TYPE

#define STRAP_SET_TYPE   0x44

◆ TELEMETRY_MSG_MAX_LENGTH

#define TELEMETRY_MSG_MAX_LENGTH   32

Function Documentation

◆ __attribute__()

struct __attribute__ ( (__packed__)  )

◆ allocate_sensor_data_table()

void * allocate_sensor_data_table ( void **  buffer,
size_t  buffer_size 
)

◆ get_fru_info_element()

bool get_fru_info_element ( telemetry_info telemetry_info,
char **  fru_element,
uint8_t *  fru_element_size 
)
Here is the call graph for this function:

◆ i2c_bridge_command_handler()

void i2c_bridge_command_handler ( struct k_work *  work_item)
Here is the call graph for this function:

◆ initialize_sensor_data_0_1()

bool initialize_sensor_data_0_1 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ initialize_sensor_data_2_5()

bool initialize_sensor_data_2_5 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ initialize_sensor_data_6()

bool initialize_sensor_data_6 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ initialize_sensor_data_60_66()

bool initialize_sensor_data_60_66 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ initialize_sensor_data_70_76()

bool initialize_sensor_data_70_76 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ initialize_sensor_data_8()

bool initialize_sensor_data_8 ( telemetry_info telemetry_info,
uint8_t *  buffer_size 
)
Here is the call graph for this function:

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( plat_master_write_stack  ,
PLAT_MASTER_WRITE_STACK_SIZE   
)

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( set_bootstrap_element_work  ,
set_bootstrap_element_handler   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_i2c_target  )

◆ plat_master_write_thread_handler()

void plat_master_write_thread_handler ( )
Here is the call graph for this function:

◆ plat_master_write_thread_init()

void plat_master_write_thread_init ( )
Here is the call graph for this function:

◆ sensor_data_table_init()

void sensor_data_table_init ( void  )
Here is the call graph for this function:

◆ set_bootstrap_element()

bool set_bootstrap_element ( uint8_t  bootstrap_pin,
uint8_t  user_setting_level 
)

◆ set_bootstrap_element_handler()

void set_bootstrap_element_handler ( )

◆ set_sensor_polling_handler()

void set_sensor_polling_handler ( struct k_work *  work_item)
Here is the call graph for this function:

◆ update_sensor_data_2_5_table()

void update_sensor_data_2_5_table ( void  )
Here is the call graph for this function:

◆ update_sensor_data_8_table()

void update_sensor_data_8_table ( void  )
Here is the call graph for this function:

Variable Documentation

◆ I2C_TARGET_CONFIG_TABLE

const struct _i2c_target_config I2C_TARGET_CONFIG_TABLE[MAX_TARGET_NUM]
Initial value:
= {
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0x40, 0xA },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0x40, 0xA, command_reply_data_handle },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
{ 0xFF, 0xA },
}

◆ I2C_TARGET_ENABLE_TABLE

const bool I2C_TARGET_ENABLE_TABLE[MAX_TARGET_NUM]
Initial value:
= {
}
#define TARGET_DISABLE
Definition: plat_i2c_target.h:24
#define TARGET_ENABLE
Definition: plat_i2c_target.h:23

◆ plat_master_write_thread

struct k_thread plat_master_write_thread

◆ plat_master_write_tid

k_tid_t plat_master_write_tid

◆ plat_sensor_init_data_0_1

plat_sensor_init_data_0_1

◆ plat_sensor_init_data_2_5

plat_sensor_init_data_2_5

◆ plat_sensor_init_data_40

plat_sensor_init_data_40

◆ plat_sensor_init_data_41

plat_sensor_init_data_41

◆ plat_sensor_init_data_42

plat_sensor_init_data_42

◆ plat_sensor_init_data_6

plat_sensor_init_data_6

◆ plat_sensor_init_data_60_76

plat_sensor_init_data_60_76

◆ plat_sensor_init_data_8

plat_sensor_init_data_8

◆ plat_sensor_init_data_f0

plat_sensor_init_data_f0

◆ sensor_entry

sensor_entry

◆ sensor_init_data_0_1_table

plat_sensor_init_data_0_1* sensor_init_data_0_1_table[DATA_TABLE_LENGTH_2] = { NULL }

◆ sensor_init_data_2_5_table

plat_sensor_init_data_2_5* sensor_init_data_2_5_table[DATA_TABLE_LENGTH_4] = { NULL }

◆ sensor_init_data_41_table

plat_sensor_init_data_41* sensor_init_data_41_table[DATA_TABLE_LENGTH_1] = { NULL }

◆ sensor_init_data_42_table

plat_sensor_init_data_42* sensor_init_data_42_table[DATA_TABLE_LENGTH_1] = { NULL }

◆ sensor_init_data_60_66_table

plat_sensor_init_data_60_76* sensor_init_data_60_66_table[DATA_TABLE_LENGTH_13] = { NULL }

◆ sensor_init_data_6_table

plat_sensor_init_data_6* sensor_init_data_6_table[DATA_TABLE_LENGTH_1] = { NULL }

◆ sensor_init_data_70_76_table

plat_sensor_init_data_60_76* sensor_init_data_70_76_table[DATA_TABLE_LENGTH_7] = { NULL }

◆ sensor_init_data_8_table

plat_sensor_init_data_8* sensor_init_data_8_table[DATA_TABLE_LENGTH_1] = { NULL }

◆ strap_entry

strap_entry

◆ telemetry_info_table

telemetry_info telemetry_info_table[]