OpenBIC
OpenSource Bridge-IC
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <logging/log.h>
#include "hal_i2c.h"
#include "pldm_firmware_update.h"
#include "libutil.h"
#include "lattice.h"
Macros | |
#define | CHECK_STATUS_RETRY 100 |
#define | IDCODE_PUB 0xE0 |
#define | LSC_READ_STATUS 0x3C |
#define | LSC_READ_STATUS1 0x3D |
#define | LSC_INIT_ADDRESS 0x46 |
#define | LSC_INIT_ADDR_UFM 0x47 |
#define | LSC_CHECK_BUSY 0xF0 |
#define | LSC_PROG_INCR_NV 0x70 |
#define | USERCODE 0xC0 |
#define | ISC_PROGRAM_USERCODE 0xC2 |
#define | ISC_PROGRAM_DONE 0x5E |
#define | ISC_ENABLE_X 0x74 |
#define | ISC_ERASE 0x0E |
#define | ISC_DISABLE 0x26 |
#define | TAG_CFG_START_STR "L000" |
#define | TAG_CFG_END_STR "*" |
#define | TAG_USER_CODE_STR "UH" |
#define | CFG_BYTE_PER_LINE 128 |
#define | MAX_TRANS_LEN (CFG_BYTE_PER_LINE + 2) |
#define | CPLD_FW_BOTTOM_PART_LENGTH 260 |
Enumerations | |
enum | data_passing_state { DATA_PASSING_FIRST , DATA_PASSING_STARTED , DATA_PASSING_CFG_STARTED , DATA_PASSING_CFG_ENDED , DATA_PASSING_UC_STARTED , DATA_PASSING_UC_ENDED , DATA_PASSING_ENDED } |
Functions | |
LOG_MODULE_REGISTER (lattice) | |
lattice_dev_type_t | find_type_by_str (char *str) |
bool | cpld_i2c_get_id (uint8_t bus, uint8_t addr, uint32_t *dev_id) |
bool | cpld_i2c_get_usercode (uint8_t bus, uint8_t addr, uint32_t *usercode) |
bool | lattice_fwupdate (lattice_update_config_t *config) |
Variables | |
uint8_t | new_line [] = { 0x0d, 0x0a } |
struct lattice_dev_config | LATTICE_CFG_TABLE [] |
#define CFG_BYTE_PER_LINE 128 |
#define CHECK_STATUS_RETRY 100 |
#define CPLD_FW_BOTTOM_PART_LENGTH 260 |
#define IDCODE_PUB 0xE0 |
#define ISC_DISABLE 0x26 |
#define ISC_ENABLE_X 0x74 |
#define ISC_ERASE 0x0E |
#define ISC_PROGRAM_DONE 0x5E |
#define ISC_PROGRAM_USERCODE 0xC2 |
#define LSC_CHECK_BUSY 0xF0 |
#define LSC_INIT_ADDR_UFM 0x47 |
#define LSC_INIT_ADDRESS 0x46 |
#define LSC_PROG_INCR_NV 0x70 |
#define LSC_READ_STATUS 0x3C |
#define LSC_READ_STATUS1 0x3D |
#define MAX_TRANS_LEN (CFG_BYTE_PER_LINE + 2) |
#define TAG_CFG_END_STR "*" |
#define TAG_CFG_START_STR "L000" |
#define TAG_USER_CODE_STR "UH" |
#define USERCODE 0xC0 |
enum data_passing_state |
bool cpld_i2c_get_id | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint32_t * | dev_id | ||
) |
bool cpld_i2c_get_usercode | ( | uint8_t | bus, |
uint8_t | addr, | ||
uint32_t * | usercode | ||
) |
lattice_dev_type_t find_type_by_str | ( | char * | str | ) |
bool lattice_fwupdate | ( | lattice_update_config_t * | config | ) |
LOG_MODULE_REGISTER | ( | lattice | ) |
struct lattice_dev_config LATTICE_CFG_TABLE[] |
uint8_t new_line[] = { 0x0d, 0x0a } |