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

Classes

struct  tda38640_config_sect
 
struct  tda38640_config
 

Macros

#define TDA38640_CNFG_BYTE_NUM   4
 
#define TDA38640_MAX_SECT_NUM   48
 
#define TDA38640_SECT_COLUMN_NUM   64
 
#define CHECKSUM_FIELD   "[Image 00] : "
 
#define IMAGE_COUNT   "Image Count : "
 
#define CNFG_TAG   "[CNFG]"
 
#define DATA_END_TAG   "[End]"
 
#define DATA_COMMENT   "//"
 
#define DATA_LEN_IN_LINE   17
 
#define CNFG_REMAINING_WRITES_MAX   5
 
#define USER_REMAINING_WRITES_MAX   48
 
#define VR_PROGRAM_DELAY   200
 
#define VR_PROGRAM_RECHECK   3
 

Enumerations

enum  {
  CRC_HIGH_REG = 0xAE , CRC_LOW_REG = 0xB0 , CNFG_REG = 0xB2 , USER_1_REG = 0xB4 ,
  USER_2_REG = 0xB6 , USER_3_REG = 0xB8 , UNLOCK_REGS_REG = 0xD4 , PROG_CMD_REG = 0xD6 ,
  PAGE_REG = 0xff
}
 
enum  { CNFG_WR = 0x12 , USER_RD = 0x41 , USER_WR = 0x42 }
 
enum  { VR_PAGE_0 }
 

Functions

 LOG_MODULE_REGISTER (tda38741)
 
int pal_bitcount (unsigned int val)
 
bool tda38741_get_remaining_wr (uint8_t bus, uint8_t addr, uint8_t *user_remain, uint8_t *cnfg_remain)
 
bool tda38741_get_checksum (uint8_t bus, uint8_t addr, uint32_t *crc)
 
bool tda38741_fwupdate (uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size)
 

Macro Definition Documentation

◆ CHECKSUM_FIELD

#define CHECKSUM_FIELD   "[Image 00] : "

◆ CNFG_REMAINING_WRITES_MAX

#define CNFG_REMAINING_WRITES_MAX   5

◆ CNFG_TAG

#define CNFG_TAG   "[CNFG]"

◆ DATA_COMMENT

#define DATA_COMMENT   "//"

◆ DATA_END_TAG

#define DATA_END_TAG   "[End]"

◆ DATA_LEN_IN_LINE

#define DATA_LEN_IN_LINE   17

◆ IMAGE_COUNT

#define IMAGE_COUNT   "Image Count : "

◆ TDA38640_CNFG_BYTE_NUM

#define TDA38640_CNFG_BYTE_NUM   4

◆ TDA38640_MAX_SECT_NUM

#define TDA38640_MAX_SECT_NUM   48

◆ TDA38640_SECT_COLUMN_NUM

#define TDA38640_SECT_COLUMN_NUM   64

◆ USER_REMAINING_WRITES_MAX

#define USER_REMAINING_WRITES_MAX   48

◆ VR_PROGRAM_DELAY

#define VR_PROGRAM_DELAY   200

◆ VR_PROGRAM_RECHECK

#define VR_PROGRAM_RECHECK   3

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CRC_HIGH_REG 
CRC_LOW_REG 
CNFG_REG 
USER_1_REG 
USER_2_REG 
USER_3_REG 
UNLOCK_REGS_REG 
PROG_CMD_REG 
PAGE_REG 

◆ anonymous enum

anonymous enum
Enumerator
CNFG_WR 
USER_RD 
USER_WR 

◆ anonymous enum

anonymous enum
Enumerator
VR_PAGE_0 

Function Documentation

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( tda38741  )

◆ pal_bitcount()

int pal_bitcount ( unsigned int  val)

◆ tda38741_fwupdate()

bool tda38741_fwupdate ( uint8_t  bus,
uint8_t  addr,
uint8_t *  img_buff,
uint32_t  img_size 
)

◆ tda38741_get_checksum()

bool tda38741_get_checksum ( uint8_t  bus,
uint8_t  addr,
uint32_t *  crc 
)

◆ tda38741_get_remaining_wr()

bool tda38741_get_remaining_wr ( uint8_t  bus,
uint8_t  addr,
uint8_t *  user_remain,
uint8_t *  cnfg_remain 
)