OpenBIC
OpenSource Bridge-IC
plat_cpld.c File Reference
#include "plat_cpld.h"
#include "libutil.h"
#include "plat_i2c.h"
#include "plat_util.h"
#include "plat_gpio.h"
#include "plat_log.h"
#include "plat_hook.h"
#include <logging/log.h>
Include dependency graph for plat_cpld.c:

Classes

struct  _vr_error_callback_info_
 

Macros

#define CPLD_ADDR   (0x4C >> 1)
 
#define I2C_BUS_CPLD   I2C_BUS11
 
#define POLLING_CPLD_STACK_SIZE   2048
 
#define CPLD_POLLING_INTERVAL_MS   1000
 
#define CHECK_ALL_BITS   0xFF
 

Typedefs

typedef struct _vr_error_callback_info_ vr_error_callback_info
 

Functions

 LOG_MODULE_REGISTER (plat_cpld)
 
bool plat_read_cpld (uint8_t offset, uint8_t *data, uint8_t len)
 
bool plat_write_cpld (uint8_t offset, uint8_t *data)
 
void check_cpld_handler ()
 
 K_WORK_DELAYABLE_DEFINE (check_cpld_work, check_cpld_handler)
 
void check_ubc_delayed_timer_handler (struct k_timer *timer)
 
 K_TIMER_DEFINE (init_ubc_delayed_timer, check_ubc_delayed_timer_handler, NULL)
 
void check_ubc_delayed (struct k_work *work)
 
 K_WORK_DEFINE (check_ubc_delayed_work, check_ubc_delayed)
 
 K_THREAD_STACK_DEFINE (cpld_polling_stack, POLLING_CPLD_STACK_SIZE)
 
bool vr_error_callback (cpld_info *cpld_info, uint8_t *current_cpld_value)
 
void check_cpld_polling_alert_status (void)
 
void set_cpld_polling_enable_flag (bool status)
 
bool get_cpld_polling_enable_flag (void)
 
void reset_error_log_states (uint8_t err_type)
 
void poll_cpld_registers ()
 
void init_cpld_polling (void)
 

Variables

struct k_thread cpld_polling_thread
 
k_tid_t cpld_polling_tid
 
cpld_info cpld_info_table []
 
bool cpld_polling_alert_status = false
 
bool cpld_polling_enable_flag = true
 
bool ubc_enabled_delayed_status = false
 

Macro Definition Documentation

◆ CHECK_ALL_BITS

#define CHECK_ALL_BITS   0xFF

◆ CPLD_ADDR

#define CPLD_ADDR   (0x4C >> 1)

◆ CPLD_POLLING_INTERVAL_MS

#define CPLD_POLLING_INTERVAL_MS   1000

◆ I2C_BUS_CPLD

#define I2C_BUS_CPLD   I2C_BUS11

◆ POLLING_CPLD_STACK_SIZE

#define POLLING_CPLD_STACK_SIZE   2048

Typedef Documentation

◆ vr_error_callback_info

Function Documentation

◆ check_cpld_handler()

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

◆ check_cpld_polling_alert_status()

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

◆ check_ubc_delayed()

void check_ubc_delayed ( struct k_work *  work)
Here is the call graph for this function:

◆ check_ubc_delayed_timer_handler()

void check_ubc_delayed_timer_handler ( struct k_timer *  timer)

◆ get_cpld_polling_enable_flag()

bool get_cpld_polling_enable_flag ( void  )

◆ init_cpld_polling()

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

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( cpld_polling_stack  ,
POLLING_CPLD_STACK_SIZE   
)

◆ K_TIMER_DEFINE()

K_TIMER_DEFINE ( init_ubc_delayed_timer  ,
check_ubc_delayed_timer_handler  ,
NULL   
)

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( check_ubc_delayed_work  ,
check_ubc_delayed   
)

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( check_cpld_work  ,
check_cpld_handler   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_cpld  )

◆ plat_read_cpld()

bool plat_read_cpld ( uint8_t  offset,
uint8_t *  data,
uint8_t  len 
)
Here is the call graph for this function:

◆ plat_write_cpld()

bool plat_write_cpld ( uint8_t  offset,
uint8_t *  data 
)
Here is the call graph for this function:

◆ poll_cpld_registers()

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

◆ reset_error_log_states()

void reset_error_log_states ( uint8_t  err_type)
Here is the call graph for this function:

◆ set_cpld_polling_enable_flag()

void set_cpld_polling_enable_flag ( bool  status)

◆ vr_error_callback()

bool vr_error_callback ( cpld_info cpld_info,
uint8_t *  current_cpld_value 
)
Here is the call graph for this function:

Variable Documentation

◆ cpld_info_table

cpld_info cpld_info_table[]
Initial value:
= {
{ VR_POWER_FAULT_1_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_2_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_3_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_4_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_5_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
}
#define VR_POWER_FAULT_5_REG
Definition: plat_event.h:122
#define VR_POWER_FAULT_4_REG
Definition: plat_event.h:121
#define VR_POWER_FAULT_1_REG
Definition: plat_event.h:118
#define VR_POWER_FAULT_2_REG
Definition: plat_event.h:119
#define VR_POWER_FAULT_3_REG
Definition: plat_event.h:120
bool vr_error_callback(cpld_info *cpld_info, uint8_t *current_cpld_value)
Definition: plat_cpld.c:131
#define CHECK_ALL_BITS
Definition: plat_cpld.c:16

◆ cpld_polling_alert_status

bool cpld_polling_alert_status = false

◆ cpld_polling_enable_flag

bool cpld_polling_enable_flag = true

◆ cpld_polling_thread

struct k_thread cpld_polling_thread

◆ cpld_polling_tid

k_tid_t cpld_polling_tid

◆ ubc_enabled_delayed_status

bool ubc_enabled_delayed_status = false