OpenBIC
OpenSource Bridge-IC
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <logging/log.h>
#include "sensor.h"
#include "hal_i2c.h"
#include "pmbus.h"
#include "mp2985.h"
#include "util_pmbus.h"
Classes | |
struct | mp2985_data |
struct | mp2985_config |
Macros | |
#define | ENABLE_LOW_POWER_MODE_BIT BIT(0) |
#define | ENABLE_PROGRAM_MODE_BIT BIT(2) |
#define | PASSWORD_MATCH_BIT BIT(3) |
#define | MFR_TEST_MODE_EN_BIT BIT(7) |
#define | MP2985_VENDOR_ID 0x4D5053 |
#define | MP2985_MODULE_ID 0x0185 |
#define | CR_ASCII 0x0D |
#define | TAB_ASCII 0x09 |
#define | NEW_LINE_ASCII 0x0A |
#define | MP2985_DATA_END_TAG "END" |
#define | MP2985_PRODUCT_ID_TAG "Product ID: " |
#define | MP2985_4_DIGITAL_TAG "4-digital Code: " |
#define | MP2985_CRC_CHECK_START_TAG "CRC_CHECK_START" |
#define | MP2985_PRODUCT_ID "MP2985H" |
Enumerations | |
enum | MP2985_REG { MP2985_MFR_DEBUG = 0x04 , MP2985_PAGE_PLUS_WRITE = 0x05 , MP2985_STORE_USER_CODE = 0x15 , MP2985_MFR_VR_CONFIG2 = 0x35 , MP2985_PAGE3_DISABLE_STORE_FAULT = 0x51 , MP2985_MFR_ID = 0x99 , MP2985_MFR_MODULE = 0x9A , MP2985_MFR_REVISION = 0x9B , MP2985_GET_USER_DATA = 0xB8 , MP2985_USER_PWD_CHECK_CMD = 0xC7 , MP2985_MFR_USER_PWD = 0xC9 } |
enum | MP2985_CONFIG_FILE_COLUMN { ATE_CONF_ID , ATE_PAGE_NUM , ATE_REG_ADDR_HEX , ATE_REG_ADDR_DEC , ATE_REG_NAME , ATE_REG_DATA_HEX , ATE_REG_DATA_DEC , ATE_WRITE_TYPE , ATE_COLUMN_MAX } |
enum | ENTER_PAGE3_CONTROL_OPTION { DISABLE_ENTER_PAGE3 = false , ENABLE_ENTER_PAGE = true } |
Functions | |
LOG_MODULE_REGISTER (mp2985) | |
int | mp2985_line_split (char **str, uint8_t *image_buf, uint32_t start_index, uint32_t end_index, int max_size) |
int | mp2985_parse_file (struct mp2985_config *config, uint8_t *image_buf, uint32_t image_size) |
int | program_mp2985 (uint8_t bus, uint8_t addr, struct mp2985_config *config) |
bool | mp2985_fwupdate (uint8_t bus, uint8_t addr, uint8_t *img_buff, uint32_t img_size) |
int | mp2985_set_power_regular_mode (uint8_t bus, uint8_t addr) |
bool | mp2985_get_checksum (uint8_t bus, uint8_t addr, uint8_t *checksum) |
uint8_t | mp2985_read (sensor_cfg *cfg, int *reading) |
uint8_t | mp2985_init (sensor_cfg *cfg) |
#define CR_ASCII 0x0D |
#define ENABLE_LOW_POWER_MODE_BIT BIT(0) |
#define ENABLE_PROGRAM_MODE_BIT BIT(2) |
#define MFR_TEST_MODE_EN_BIT BIT(7) |
#define MP2985_4_DIGITAL_TAG "4-digital Code: " |
#define MP2985_CRC_CHECK_START_TAG "CRC_CHECK_START" |
#define MP2985_DATA_END_TAG "END" |
#define MP2985_MODULE_ID 0x0185 |
#define MP2985_PRODUCT_ID "MP2985H" |
#define MP2985_PRODUCT_ID_TAG "Product ID: " |
#define MP2985_VENDOR_ID 0x4D5053 |
#define NEW_LINE_ASCII 0x0A |
#define PASSWORD_MATCH_BIT BIT(3) |
#define TAB_ASCII 0x09 |
enum MP2985_REG |
LOG_MODULE_REGISTER | ( | mp2985 | ) |
bool mp2985_fwupdate | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint8_t * | img_buff, | ||
uint32_t | img_size | ||
) |
bool mp2985_get_checksum | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint8_t * | checksum | ||
) |
uint8_t mp2985_init | ( | sensor_cfg * | cfg | ) |
int mp2985_line_split | ( | char ** | str, |
uint8_t * | image_buf, | ||
uint32_t | start_index, | ||
uint32_t | end_index, | ||
int | max_size | ||
) |
int mp2985_parse_file | ( | struct mp2985_config * | config, |
uint8_t * | image_buf, | ||
uint32_t | image_size | ||
) |
uint8_t mp2985_read | ( | sensor_cfg * | cfg, |
int * | reading | ||
) |
int mp2985_set_power_regular_mode | ( | uint8_t | bus, |
uint8_t | addr | ||
) |
int program_mp2985 | ( | uint8_t | bus, |
uint8_t | addr, | ||
struct mp2985_config * | config | ||
) |