OpenBIC
OpenSource Bridge-IC
plat_modbus.c File Reference
#include <stdlib.h>
#include <sys/util.h>
#include <sys/byteorder.h>
#include <drivers/gpio.h>
#include <modbus/modbus.h>
#include <time.h>
#include <logging/log.h>
#include "sensor.h"
#include "modbus_server.h"
#include "fru.h"
#include "eeprom.h"
#include "libutil.h"
#include "plat_modbus.h"
#include "plat_sensor_table.h"
#include "plat_fru.h"
#include "hal_gpio.h"
#include "plat_gpio.h"
#include <modbus_internal.h>
#include "plat_util.h"
#include "plat_pwm.h"
#include "util_sys.h"
#include "util_spi.h"
#include "plat_version.h"
#include "plat_hwmon.h"
#include "plat_log.h"
#include "plat_i2c.h"
#include "plat_threshold.h"
#include "plat_fsc.h"
#include "plat_led.h"
#include "plat_status.h"
#include "plat_fru_date.h"
#include "plat_isr.h"
Include dependency graph for plat_modbus.c:

Classes

struct  modbus_server
 

Macros

#define FW_UPDATE_SWITCH_FC   0x64
 
#define FW_UPDATE_SWITCH_ADDR   0x0119
 
#define FW_UPDATE_ENABLE_DATA   0x0101
 
#define FW_UPDATE_DISABLE_DATA   0x0100
 
#define UPADTE_FW_DATA_LENGTH_MIN   3
 
#define LOG_BEGIN_MODBUS_ADDR   MODBUS_EVENT_1_ERROR_LOG_ADDR
 
#define TIMER_SINCE_LAST_ON_LENGTH   4
 
#define BOARD_MFG_DATA_READ_START_OFFSET   3
 
#define IPMI_FRU_DATA_LENGTH_MASK   BIT_MASK(6)
 

Functions

 LOG_MODULE_REGISTER (plat_modbus)
 
uint8_t modbus_get_senser_reading (modbus_command_mapping *cmd)
 
uint8_t modbus_read_fruid_data (modbus_command_mapping *cmd)
 
uint8_t modbus_write_fruid_data (modbus_command_mapping *cmd)
 
uint8_t modbus_get_fw_reversion (modbus_command_mapping *cmd)
 
uint8_t modbus_fw_download (modbus_command_mapping *cmd)
 
uint8_t modbus_command_i2c_master_write_read_response (modbus_command_mapping *cmd)
 
uint8_t modbus_command_i2c_master_write_read (modbus_command_mapping *cmd)
 
uint8_t modbus_command_i2c_scan_bus_set (modbus_command_mapping *cmd)
 
uint8_t modbus_command_i2c_scan (modbus_command_mapping *cmd)
 
uint8_t modbus_write_hmi_version (modbus_command_mapping *cmd)
 
uint8_t modbus_read_hmi_version (modbus_command_mapping *cmd)
 
uint8_t modbus_leakage_status_read (modbus_command_mapping *cmd)
 
uint8_t modbus_pump_setting_get (modbus_command_mapping *cmd)
 
uint8_t modbus_pump_setting (modbus_command_mapping *cmd)
 
uint8_t modbus_error_log_count (modbus_command_mapping *cmd)
 
uint8_t modbus_error_log_event (modbus_command_mapping *cmd)
 
uint8_t modbus_get_manual_pwm (modbus_command_mapping *cmd)
 
uint8_t modbus_set_manual_pwm (modbus_command_mapping *cmd)
 
uint8_t modbus_get_pwm (modbus_command_mapping *cmd)
 
uint8_t modbus_set_sticky_sensor_status (modbus_command_mapping *cmd)
 
uint8_t modbus_get_sticky_sensor_status (modbus_command_mapping *cmd)
 
uint8_t modbus_get_manual_flag (modbus_command_mapping *cmd)
 
uint8_t modbus_set_manual_flag (modbus_command_mapping *cmd)
 
uint8_t modbus_get_aalc_sensor_status (modbus_command_mapping *cmd)
 
uint8_t modbus_get_led_status (modbus_command_mapping *cmd)
 
uint8_t modbus_sensor_poll_get (modbus_command_mapping *cmd)
 
uint8_t modbus_sensor_poll_set (modbus_command_mapping *cmd)
 
uint8_t modbus_set_status_flag_config (modbus_command_mapping *cmd)
 
uint8_t modbus_status_flag_get (modbus_command_mapping *cmd)
 
uint8_t modbus_status_flag_set (modbus_command_mapping *cmd)
 
uint8_t modbus_get_rpu_addr (modbus_command_mapping *cmd)
 
uint8_t modbus_set_rpu_addr (modbus_command_mapping *cmd)
 
uint8_t modbus_read_uptime (modbus_command_mapping *cmd)
 
uint8_t modbus_read_time_since_last_on (modbus_command_mapping *cmd)
 
uint8_t modbus_read_pump_running_time (modbus_command_mapping *cmd)
 
uint8_t modbus_set_log_level (modbus_command_mapping *cmd)
 
uint8_t modbus_get_setpoint (modbus_command_mapping *cmd)
 
uint8_t modbus_set_setpoint (modbus_command_mapping *cmd)
 
uint8_t modbus_get_setpoint_enable (modbus_command_mapping *cmd)
 
uint8_t modbus_set_setpoint_enable (modbus_command_mapping *cmd)
 
modbus_command_mappingptr_to_modbus_table (uint16_t addr)
 
void init_modbus_command_table (void)
 
 MODBUS_CUSTOM_FC_DEFINE (custom_fc64, custom_handler_fc64, FW_UPDATE_SWITCH_FC, NULL)
 
int init_custom_modbus_server (void)
 
int change_modbus_slave_addr (uint8_t idx, uint8_t addr)
 

Variables

modbus_server modbus_server_config []
 
pump_reset_struct modbus_pump_setting_table []
 
modbus_command_mapping modbus_command_table []
 

Macro Definition Documentation

◆ BOARD_MFG_DATA_READ_START_OFFSET

#define BOARD_MFG_DATA_READ_START_OFFSET   3

◆ FW_UPDATE_DISABLE_DATA

#define FW_UPDATE_DISABLE_DATA   0x0100

◆ FW_UPDATE_ENABLE_DATA

#define FW_UPDATE_ENABLE_DATA   0x0101

◆ FW_UPDATE_SWITCH_ADDR

#define FW_UPDATE_SWITCH_ADDR   0x0119

◆ FW_UPDATE_SWITCH_FC

#define FW_UPDATE_SWITCH_FC   0x64

◆ IPMI_FRU_DATA_LENGTH_MASK

#define IPMI_FRU_DATA_LENGTH_MASK   BIT_MASK(6)

◆ LOG_BEGIN_MODBUS_ADDR

#define LOG_BEGIN_MODBUS_ADDR   MODBUS_EVENT_1_ERROR_LOG_ADDR

◆ TIMER_SINCE_LAST_ON_LENGTH

#define TIMER_SINCE_LAST_ON_LENGTH   4

◆ UPADTE_FW_DATA_LENGTH_MIN

#define UPADTE_FW_DATA_LENGTH_MIN   3

Function Documentation

◆ change_modbus_slave_addr()

int change_modbus_slave_addr ( uint8_t  idx,
uint8_t  addr 
)

◆ init_custom_modbus_server()

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

◆ init_modbus_command_table()

void init_modbus_command_table ( void  )

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_modbus  )

◆ modbus_command_i2c_master_write_read()

uint8_t modbus_command_i2c_master_write_read ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_command_i2c_master_write_read_response()

uint8_t modbus_command_i2c_master_write_read_response ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_command_i2c_scan()

uint8_t modbus_command_i2c_scan ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_command_i2c_scan_bus_set()

uint8_t modbus_command_i2c_scan_bus_set ( modbus_command_mapping cmd)

◆ MODBUS_CUSTOM_FC_DEFINE()

MODBUS_CUSTOM_FC_DEFINE ( custom_fc64  ,
custom_handler_fc64  ,
FW_UPDATE_SWITCH_FC  ,
NULL   
)

◆ modbus_error_log_count()

uint8_t modbus_error_log_count ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_error_log_event()

uint8_t modbus_error_log_event ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_fw_download()

uint8_t modbus_fw_download ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_aalc_sensor_status()

uint8_t modbus_get_aalc_sensor_status ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_fw_reversion()

uint8_t modbus_get_fw_reversion ( modbus_command_mapping cmd)

◆ modbus_get_led_status()

uint8_t modbus_get_led_status ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_manual_flag()

uint8_t modbus_get_manual_flag ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_manual_pwm()

uint8_t modbus_get_manual_pwm ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_pwm()

uint8_t modbus_get_pwm ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_rpu_addr()

uint8_t modbus_get_rpu_addr ( modbus_command_mapping cmd)

◆ modbus_get_senser_reading()

uint8_t modbus_get_senser_reading ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_setpoint()

uint8_t modbus_get_setpoint ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_setpoint_enable()

uint8_t modbus_get_setpoint_enable ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_get_sticky_sensor_status()

uint8_t modbus_get_sticky_sensor_status ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_leakage_status_read()

uint8_t modbus_leakage_status_read ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_pump_setting()

uint8_t modbus_pump_setting ( modbus_command_mapping cmd)

◆ modbus_pump_setting_get()

uint8_t modbus_pump_setting_get ( modbus_command_mapping cmd)

◆ modbus_read_fruid_data()

uint8_t modbus_read_fruid_data ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_read_hmi_version()

uint8_t modbus_read_hmi_version ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_read_pump_running_time()

uint8_t modbus_read_pump_running_time ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_read_time_since_last_on()

uint8_t modbus_read_time_since_last_on ( modbus_command_mapping cmd)

◆ modbus_read_uptime()

uint8_t modbus_read_uptime ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_sensor_poll_get()

uint8_t modbus_sensor_poll_get ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_sensor_poll_set()

uint8_t modbus_sensor_poll_set ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_log_level()

uint8_t modbus_set_log_level ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_manual_flag()

uint8_t modbus_set_manual_flag ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_manual_pwm()

uint8_t modbus_set_manual_pwm ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_rpu_addr()

uint8_t modbus_set_rpu_addr ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_setpoint()

uint8_t modbus_set_setpoint ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_setpoint_enable()

uint8_t modbus_set_setpoint_enable ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_status_flag_config()

uint8_t modbus_set_status_flag_config ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_set_sticky_sensor_status()

uint8_t modbus_set_sticky_sensor_status ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_status_flag_get()

uint8_t modbus_status_flag_get ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_status_flag_set()

uint8_t modbus_status_flag_set ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_write_fruid_data()

uint8_t modbus_write_fruid_data ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ modbus_write_hmi_version()

uint8_t modbus_write_hmi_version ( modbus_command_mapping cmd)
Here is the call graph for this function:

◆ ptr_to_modbus_table()

modbus_command_mapping * ptr_to_modbus_table ( uint16_t  addr)

Variable Documentation

◆ modbus_command_table

modbus_command_mapping modbus_command_table[]

◆ modbus_pump_setting_table

pump_reset_struct modbus_pump_setting_table[]
Initial value:
= {
}
bool rpu_remote_power_cycle_function(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:294
bool modbus_pump_setting_unsupport_function(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:47
bool clear_log_for_modbus_pump_setting(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:54
bool close_pump(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:114
bool modbus_clear_pump_running_time_function(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:607
bool pump_setting_set_manual_flag(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:135
bool pump_setting_set_auto_tune_flag(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:153
bool pump_setting_set_pump_redundant(pump_reset_struct *data, uint8_t bit_val)
Definition: plat_hwmon.c:177
bool pump_setting_pump2_reset(pump_reset_struct *data, uint8_t bit_val)
bool pump_setting_pump3_reset(pump_reset_struct *data, uint8_t bit_val)
bool pump_setting_pump1_reset(pump_reset_struct *data, uint8_t bit_val)
@ CLEAR_LOG
Definition: plat_hwmon.h:27
@ MANUAL_CONTROL_PUMP
Definition: plat_hwmon.h:19
@ CLEAR_PUMP_RUNNING_TIME
Definition: plat_hwmon.h:26
@ MANUAL_CONTROL_FAN
Definition: plat_hwmon.h:20
@ PUMP_REDUNDENT_SWITCHED
Definition: plat_hwmon.h:18
@ AUTOTUNE_PRESSURE_BALANCE_CONTROL
Definition: plat_hwmon.h:22
@ SYSTEM_STOP
Definition: plat_hwmon.h:23
@ PUMP_2_RESET
Definition: plat_hwmon.h:29
@ PUMP_1_RESET
Definition: plat_hwmon.h:28
@ PUMP_3_RESET
Definition: plat_hwmon.h:30
@ MANUAL_CONTROL
Definition: plat_hwmon.h:25
@ AUTOTUNE_FLOW_CONTROL
Definition: plat_hwmon.h:21
@ RPU_REMOTE_POWER_CYCLE
Definition: plat_hwmon.h:24

◆ modbus_server_config

modbus_server modbus_server_config[]
Initial value:
= {
{ "MODBUS0", true },
{ "MODBUS1", false },
{ "MODBUS2", false },
}