OpenBIC
OpenSource Bridge-IC
xdpe15284.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <logging/log.h>
#include "sensor.h"
#include "libutil.h"
#include "hal_i2c.h"
#include "util_pmbus.h"
#include "pmbus.h"
#include "xdpe15284.h"
Include dependency graph for xdpe15284.c:

Classes

struct  config_sect
 
struct  xdpe15284_config
 

Macros

#define XDPE15284_MFR_BLOCK_DATA_LEN   4
 
#define XDPE15284_MFR_FW_CMD_DATA_LEN   4
 
#define XDPE15284_REMAINING_WRITE_DATA_LEN   2
 
#define XDPE15284_WAIT_DATA_DELAY_MS   10
 
#define XDPE15284C_CONF_SIZE   1344
 
#define XDPE15284_WRITE_PROTECT_DEFAULT_VAL   0xFF
 
#define ADDRESS_FIELD   "PMBus Address :"
 
#define CHECKSUM_FIELD   "Checksum : 0x"
 
#define DATA_START_TAG   "[Configuration Data]"
 
#define DATA_END_TAG   "[End Configuration Data]"
 
#define DATA_COMMENT   "//"
 
#define MAX_SECT_DATA_NUM   200
 
#define MAX_SECT_NUM   16
 
#define SECT_TRIM   0x02
 
#define SECT_CRC_OFFSET   2
 
#define DATA_LEN_IN_LINE   5
 
#define SCRATCHPAD_ADDRESS   0x2005e000
 
#define CML_OTHER_MEMORY_FAULT_BIT   BIT(0)
 
#define CR_ASCII   0x0D
 
#define NEW_LINE_ASCII   0x0A
 
#define SPACE_ASCII   0x20
 
#define CRC32_POLY   0xEDB88320
 

Enumerations

enum  XDPE15284_REG {
  XDPE15284_WRITE_PROTECT_CMD_REG = 0x10 , XDPE15284_MFR_DISABLE_SECURITY_ONCE_REG = 0xCB , XDPE15284_IFX_MFR_AHB_ADDR_REG = 0xCE , XDPE15284_IFX_MFR_REG_WRITE_REG = 0xDE ,
  XDPE15284_IFX_MFR_REG_READ_REG = 0xDF , XDPE15284_MFR_FW_CMD_DATA_REG = 0xFD , XDPE15284_MFR_FW_CMD_REG = 0xFE
}
 
enum  XDPE15284_MFR_CMD {
  XDPE15284_NOP_CMD = 0x00 , XDPE15284_GET_REMAINING_WR_CMD = 0x10 , XDPE15284_OTP_CONF_STO = 0x11 , XDPE15284_OTP_FILE_INVD = 0x12 ,
  XDPE15284_CALCULATE_CRC_CMD = 0x2D
}
 

Functions

 LOG_MODULE_REGISTER (xdpe15284)
 
bool xdpe15284_set_write_protect (uint8_t bus, uint8_t addr, uint8_t option)
 
void xdpe15284_set_write_protect_default_val (uint8_t val)
 
bool xdpe15284_mfr_fw_operation (uint8_t bus, uint8_t addr, uint8_t cmd, uint8_t tx_len, uint8_t *tx_buf, uint8_t rx_len, uint8_t *rx_buf)
 
bool xdpe15284_get_checksum (uint8_t bus, uint8_t addr, uint8_t *checksum)
 
bool xdpe15284_get_remaining_wr (uint8_t bus, uint8_t addr, uint8_t *data)
 
bool xdpe15284_get_status_byte (uint8_t bus, uint8_t addr, uint8_t *data)
 
uint8_t xdpe15284_read (sensor_cfg *cfg, int *reading)
 
bool xdpe15284_lock_reg (uint8_t bus, uint8_t addr)
 
bool xdpe15284_unlock_reg (uint8_t bus, uint8_t addr)
 
uint8_t xdpe15284_init (sensor_cfg *cfg)
 
int xdpe15284_line_split (char **str, uint8_t *image_buf, uint32_t start_index, uint32_t end_index, int max_size)
 
int xdpe15284_parse_file (struct xdpe15284_config *config, uint8_t *image_buf, uint32_t img_size)
 
bool xdpe15284_fwupdate (uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size)
 

Variables

const uint32_t REG_LOCK_PASSWORD = 0x7F48680C
 

Macro Definition Documentation

◆ ADDRESS_FIELD

#define ADDRESS_FIELD   "PMBus Address :"

◆ CHECKSUM_FIELD

#define CHECKSUM_FIELD   "Checksum : 0x"

◆ CML_OTHER_MEMORY_FAULT_BIT

#define CML_OTHER_MEMORY_FAULT_BIT   BIT(0)

◆ CR_ASCII

#define CR_ASCII   0x0D

◆ CRC32_POLY

#define CRC32_POLY   0xEDB88320

◆ DATA_COMMENT

#define DATA_COMMENT   "//"

◆ DATA_END_TAG

#define DATA_END_TAG   "[End Configuration Data]"

◆ DATA_LEN_IN_LINE

#define DATA_LEN_IN_LINE   5

◆ DATA_START_TAG

#define DATA_START_TAG   "[Configuration Data]"

◆ MAX_SECT_DATA_NUM

#define MAX_SECT_DATA_NUM   200

◆ MAX_SECT_NUM

#define MAX_SECT_NUM   16

◆ NEW_LINE_ASCII

#define NEW_LINE_ASCII   0x0A

◆ SCRATCHPAD_ADDRESS

#define SCRATCHPAD_ADDRESS   0x2005e000

◆ SECT_CRC_OFFSET

#define SECT_CRC_OFFSET   2

◆ SECT_TRIM

#define SECT_TRIM   0x02

◆ SPACE_ASCII

#define SPACE_ASCII   0x20

◆ XDPE15284_MFR_BLOCK_DATA_LEN

#define XDPE15284_MFR_BLOCK_DATA_LEN   4

◆ XDPE15284_MFR_FW_CMD_DATA_LEN

#define XDPE15284_MFR_FW_CMD_DATA_LEN   4

◆ XDPE15284_REMAINING_WRITE_DATA_LEN

#define XDPE15284_REMAINING_WRITE_DATA_LEN   2

◆ XDPE15284_WAIT_DATA_DELAY_MS

#define XDPE15284_WAIT_DATA_DELAY_MS   10

◆ XDPE15284_WRITE_PROTECT_DEFAULT_VAL

#define XDPE15284_WRITE_PROTECT_DEFAULT_VAL   0xFF

◆ XDPE15284C_CONF_SIZE

#define XDPE15284C_CONF_SIZE   1344

Enumeration Type Documentation

◆ XDPE15284_MFR_CMD

Enumerator
XDPE15284_NOP_CMD 
XDPE15284_GET_REMAINING_WR_CMD 
XDPE15284_OTP_CONF_STO 
XDPE15284_OTP_FILE_INVD 
XDPE15284_CALCULATE_CRC_CMD 

◆ XDPE15284_REG

Enumerator
XDPE15284_WRITE_PROTECT_CMD_REG 
XDPE15284_MFR_DISABLE_SECURITY_ONCE_REG 
XDPE15284_IFX_MFR_AHB_ADDR_REG 
XDPE15284_IFX_MFR_REG_WRITE_REG 
XDPE15284_IFX_MFR_REG_READ_REG 
XDPE15284_MFR_FW_CMD_DATA_REG 
XDPE15284_MFR_FW_CMD_REG 

Function Documentation

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( xdpe15284  )

◆ xdpe15284_fwupdate()

bool xdpe15284_fwupdate ( uint8_t  bus,
uint8_t  addr,
uint8_t *  img_buff,
uint32_t  img_size 
)
Here is the call graph for this function:

◆ xdpe15284_get_checksum()

bool xdpe15284_get_checksum ( uint8_t  bus,
uint8_t  addr,
uint8_t *  checksum 
)
Here is the call graph for this function:

◆ xdpe15284_get_remaining_wr()

bool xdpe15284_get_remaining_wr ( uint8_t  bus,
uint8_t  addr,
uint8_t *  data 
)
Here is the call graph for this function:

◆ xdpe15284_get_status_byte()

bool xdpe15284_get_status_byte ( uint8_t  bus,
uint8_t  addr,
uint8_t *  data 
)
Here is the call graph for this function:

◆ xdpe15284_init()

uint8_t xdpe15284_init ( sensor_cfg cfg)
Here is the call graph for this function:

◆ xdpe15284_line_split()

int xdpe15284_line_split ( char **  str,
uint8_t *  image_buf,
uint32_t  start_index,
uint32_t  end_index,
int  max_size 
)
Here is the call graph for this function:

◆ xdpe15284_lock_reg()

bool xdpe15284_lock_reg ( uint8_t  bus,
uint8_t  addr 
)
Here is the call graph for this function:

◆ xdpe15284_mfr_fw_operation()

bool xdpe15284_mfr_fw_operation ( uint8_t  bus,
uint8_t  addr,
uint8_t  cmd,
uint8_t  tx_len,
uint8_t *  tx_buf,
uint8_t  rx_len,
uint8_t *  rx_buf 
)
Here is the call graph for this function:

◆ xdpe15284_parse_file()

int xdpe15284_parse_file ( struct xdpe15284_config config,
uint8_t *  image_buf,
uint32_t  img_size 
)
Here is the call graph for this function:

◆ xdpe15284_read()

uint8_t xdpe15284_read ( sensor_cfg cfg,
int *  reading 
)
Here is the call graph for this function:

◆ xdpe15284_set_write_protect()

bool xdpe15284_set_write_protect ( uint8_t  bus,
uint8_t  addr,
uint8_t  option 
)

◆ xdpe15284_set_write_protect_default_val()

void xdpe15284_set_write_protect_default_val ( uint8_t  val)

◆ xdpe15284_unlock_reg()

bool xdpe15284_unlock_reg ( uint8_t  bus,
uint8_t  addr 
)
Here is the call graph for this function:

Variable Documentation

◆ REG_LOCK_PASSWORD

const uint32_t REG_LOCK_PASSWORD = 0x7F48680C