初始提交
This commit is contained in:
38
driver/src/simu/ahb_simu.c
Normal file
38
driver/src/simu/ahb_simu.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
/* iot common header files */
|
||||
|
||||
#include "os_types.h"
|
||||
#include "iot_config_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
void system_cpu_sleep(bool_t tick)
|
||||
{
|
||||
(bool_t)tick;
|
||||
}
|
||||
|
||||
void system_cpu_wakeup(bool_t tick, uint32_t freq)
|
||||
{
|
||||
(void)tick;
|
||||
(void)freq;
|
||||
}
|
||||
|
||||
uint32_t clk_core_freq_get()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
300
driver/src/simu/board_info_simu.c
Normal file
300
driver/src/simu/board_info_simu.c
Normal file
@@ -0,0 +1,300 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
#include "iot_uart_api.h"
|
||||
#include "iot_board_api.h"
|
||||
#include "iot_system_api.h"
|
||||
#include "iot_pib.h"
|
||||
#include "iot_errno.h"
|
||||
#include "iot_version.h"
|
||||
#include "iot_oem_api.h"
|
||||
#include "iot_string_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
uint8_t iot_board_get_uart(uint8_t type)
|
||||
{
|
||||
(void)type;
|
||||
uint8_t port = 4;
|
||||
|
||||
switch(type){
|
||||
case UART_METER_PORT:
|
||||
port = 2;
|
||||
break;
|
||||
case UART_PRINT:
|
||||
port = 0;
|
||||
break;
|
||||
case UART_CLI_PORT:
|
||||
port = 1;
|
||||
break;
|
||||
case UART_IR_PORT:
|
||||
port = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
uint8_t iot_board_get_gpio(uint8_t type)
|
||||
{
|
||||
(void)type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void iot_board_reset_check(void)
|
||||
{
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void iot_board_soft_reset_mark(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t iot_board_get_reset_count(uint8_t type)
|
||||
{
|
||||
(void)type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t iot_board_get_boot_reason(uint8_t *reason)
|
||||
{
|
||||
*reason = IOT_SYS_RST_REASON_UNKNOWN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void iot_board_load_user_build_info()
|
||||
{
|
||||
uint8_t *secion;
|
||||
uint8_t pib_type, set = 0;
|
||||
iot_pib_r_board_cfg_t *pib_bd;
|
||||
iot_pib_w_board_cfg_t *pib_w_bd;
|
||||
iot_build_info_t user_info = { 0 };
|
||||
|
||||
if (iot_pib_get_section(IOT_PIB_BOARD_ID, &secion, &pib_type,
|
||||
IOT_PIB_GET_WRITE_SECTION) == ERR_OK) {
|
||||
pib_w_bd = (iot_pib_w_board_cfg_t *)secion;
|
||||
if (pib_w_bd->build_cfg.sw_ver) {
|
||||
set = 1;
|
||||
user_info.sw_ver = pib_w_bd->build_cfg.sw_ver;
|
||||
}
|
||||
if (pib_w_bd->build_cfg.year ||
|
||||
pib_w_bd->build_cfg.month ||
|
||||
pib_w_bd->build_cfg.day ||
|
||||
pib_w_bd->build_cfg.hour ||
|
||||
pib_w_bd->build_cfg.min ||
|
||||
pib_w_bd->build_cfg.sec) {
|
||||
set = 1;
|
||||
user_info.year = pib_w_bd->build_cfg.year;
|
||||
user_info.month = pib_w_bd->build_cfg.month;
|
||||
user_info.day = pib_w_bd->build_cfg.day;
|
||||
user_info.hour = pib_w_bd->build_cfg.hour;
|
||||
user_info.min = pib_w_bd->build_cfg.min;
|
||||
user_info.sec = pib_w_bd->build_cfg.sec;
|
||||
}
|
||||
}
|
||||
if (set) {
|
||||
iot_version_set_user_build_info(&user_info);
|
||||
} else {
|
||||
if (iot_pib_get_section(IOT_PIB_BOARD_ID, &secion, &pib_type,
|
||||
IOT_PIB_GET_READ_SECTION) == ERR_OK) {
|
||||
pib_bd = (iot_pib_r_board_cfg_t *)secion;
|
||||
user_info.sw_ver = pib_bd->build_cfg.sw_ver;
|
||||
user_info.year = pib_bd->build_cfg.year;
|
||||
user_info.month = pib_bd->build_cfg.month;
|
||||
user_info.day = pib_bd->build_cfg.day;
|
||||
user_info.hour = pib_bd->build_cfg.hour;
|
||||
user_info.min = pib_bd->build_cfg.min;
|
||||
user_info.sec = pib_bd->build_cfg.sec;
|
||||
iot_version_set_user_build_info(&user_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void iot_board_save_user_build_info(iot_build_info_t *info)
|
||||
{
|
||||
uint8_t *secion;
|
||||
uint8_t pib_type;
|
||||
iot_pib_w_board_cfg_t *pib_w_bd;
|
||||
uint8_t ref_cnt;
|
||||
uint16_t commit_ticket;
|
||||
|
||||
if (iot_pib_get_section(IOT_PIB_BOARD_ID, &secion, &pib_type,
|
||||
IOT_PIB_GET_WRITE_SECTION) == ERR_OK) {
|
||||
pib_w_bd = (iot_pib_w_board_cfg_t *)secion;
|
||||
if (info->sw_ver != pib_w_bd->build_cfg.sw_ver ||
|
||||
info->year != pib_w_bd->build_cfg.year ||
|
||||
info->month != pib_w_bd->build_cfg.month ||
|
||||
info->day != pib_w_bd->build_cfg.day ||
|
||||
info->hour != pib_w_bd->build_cfg.hour ||
|
||||
info->min != pib_w_bd->build_cfg.min ||
|
||||
info->sec != pib_w_bd->build_cfg.sec) {
|
||||
iot_pib_acquire_commit_ref(IOT_PIB_BOARD_ID, &ref_cnt);
|
||||
pib_w_bd->build_cfg.sw_ver = info->sw_ver;
|
||||
pib_w_bd->build_cfg.year = info->year;
|
||||
pib_w_bd->build_cfg.month = info->month;
|
||||
pib_w_bd->build_cfg.day = info->day;
|
||||
pib_w_bd->build_cfg.hour = info->hour;
|
||||
pib_w_bd->build_cfg.min = info->min;
|
||||
pib_w_bd->build_cfg.sec = info->sec;
|
||||
iot_pib_release_commit_ref(IOT_PIB_BOARD_ID, &ref_cnt);
|
||||
iot_pib_commit(IOT_PIB_BOARD_ID, COMMIT_TYPE_WAIT_REFZERO,
|
||||
&commit_ticket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t iot_board_load_user_vendor_id()
|
||||
{
|
||||
uint16_t vendor_id;
|
||||
uint8_t *secion;
|
||||
uint8_t pib_type;
|
||||
iot_pib_w_board_cfg_t *pib_w_bd;
|
||||
|
||||
vendor_id = iot_oem_get_vendor_id();
|
||||
if (iot_pib_get_section(IOT_PIB_BOARD_ID, &secion, &pib_type,
|
||||
IOT_PIB_GET_WRITE_SECTION) == ERR_OK) {
|
||||
pib_w_bd = (iot_pib_w_board_cfg_t *)secion;
|
||||
if (pib_w_bd->vendor_cfg.vendor_id) {
|
||||
vendor_id = pib_w_bd->vendor_cfg.vendor_id;
|
||||
} else {
|
||||
vendor_id = 0x4854;
|
||||
}
|
||||
}
|
||||
return vendor_id;
|
||||
}
|
||||
|
||||
void iot_board_save_user_vendor_id(uint16_t vendor_id)
|
||||
{
|
||||
uint8_t *secion;
|
||||
uint8_t pib_type;
|
||||
iot_pib_w_board_cfg_t *pib_w_bd;
|
||||
uint8_t ref_cnt;
|
||||
uint16_t commit_ticket;
|
||||
|
||||
if (iot_pib_get_section(IOT_PIB_BOARD_ID, &secion, &pib_type,
|
||||
IOT_PIB_GET_WRITE_SECTION) == ERR_OK) {
|
||||
pib_w_bd = (iot_pib_w_board_cfg_t *)secion;
|
||||
if (vendor_id != pib_w_bd->vendor_cfg.vendor_id) {
|
||||
iot_pib_acquire_commit_ref(IOT_PIB_BOARD_ID, &ref_cnt);
|
||||
pib_w_bd->vendor_cfg.vendor_id = vendor_id;
|
||||
iot_pib_release_commit_ref(IOT_PIB_BOARD_ID, &ref_cnt);
|
||||
iot_pib_commit(IOT_PIB_BOARD_ID, COMMIT_TYPE_WAIT_REFZERO,
|
||||
&commit_ticket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void iot_board_debug_uart_pin_bond(bool_t enable)
|
||||
{
|
||||
(bool_t)enable;
|
||||
}
|
||||
|
||||
uint32_t iot_board_hw_version_hex()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t iot_board_support_zc6()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t iot_board_support_zc_pulse(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t iot_board_zc_edge_is_failing(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t iot_board_support_zc_high_precision(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t iot_board_get_zc_ntb_offset(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t iot_board_support_rev_zc_ext_gpio_switch(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t iot_board_get_tsfm_mode(void)
|
||||
{
|
||||
return HW_REC_MODE_WQ;
|
||||
}
|
||||
|
||||
void iot_board_set_user_passcode(uint16_t passcode)
|
||||
{
|
||||
(uint16_t)passcode;
|
||||
}
|
||||
|
||||
uint16_t iot_board_get_user_passcode()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t iot_board_calc_data_check()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t iot_board_chip_name_get(uint8_t *buffer, uint8_t buffer_len)
|
||||
{
|
||||
(void)buffer_len;
|
||||
static const char chip_name_unknown[] = "UNKNOWN";
|
||||
os_mem_cpy(buffer, chip_name_unknown, sizeof(chip_name_unknown));
|
||||
return (uint8_t)iot_strlen(chip_name_unknown);
|
||||
}
|
||||
|
||||
uint32_t iot_board_fw_get_start_addr()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t iot_board_check_magic_no(uint32_t magic_no)
|
||||
{
|
||||
(void)magic_no;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t iot_board_get_pt_info(iot_board_pt_info_t *pt_info)
|
||||
{
|
||||
(void)pt_info;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t iot_board_set_ppm(int8_t ppm)
|
||||
{
|
||||
(void)ppm;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
|
||||
bool_t iot_board_is_5v_power_in(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
92
driver/src/simu/crypto_simu.c
Normal file
92
driver/src/simu/crypto_simu.c
Normal file
@@ -0,0 +1,92 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
|
||||
/* os shim includes */
|
||||
#include "os_types.h"
|
||||
|
||||
/* public api includes */
|
||||
#include "plc_fr.h"
|
||||
#include "iot_crypto_error_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
typedef enum {
|
||||
SM4_ECB,
|
||||
SM4_CBC,
|
||||
SM4_CFB,
|
||||
SM4_OFB
|
||||
} SEC_SYS_SM4_MODE;
|
||||
|
||||
typedef enum {
|
||||
SM4_OPT_DEC,
|
||||
SM4_OPT_ENC,
|
||||
} SEC_SYS_SM4_OPT_MODE;
|
||||
|
||||
uint32_t iot_crypto_sm4(SEC_SYS_SM4_OPT_MODE opt_mode,
|
||||
SEC_SYS_SM4_MODE mode, uint8_t *indata, uint32_t indata_len,
|
||||
uint8_t *outdata, uint32_t *outdata_len, uint8_t sm4_key[16],
|
||||
uint8_t iv[16], uint32_t round)
|
||||
{
|
||||
(void)opt_mode;
|
||||
(void)mode;
|
||||
(void)indata;
|
||||
(void)indata_len;
|
||||
(void)outdata;
|
||||
(void)outdata_len;
|
||||
(void)sm4_key;
|
||||
(void)iv;
|
||||
(void)round;
|
||||
|
||||
return CRYPTO_RET_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_crypto_aes_cbc_with_key(const uint8_t *key, uint32_t keybits,
|
||||
uint8_t mode, uint32_t len, uint8_t *in_iv, const uint8_t *input,
|
||||
uint8_t *output, uint8_t *out_iv, uint32_t round)
|
||||
{
|
||||
(void)key;
|
||||
(void)keybits;
|
||||
(void)mode;
|
||||
(void)len;
|
||||
(void)in_iv;
|
||||
(void)input;
|
||||
(void)output;
|
||||
(void)out_iv;
|
||||
(void)round;
|
||||
|
||||
return CRYPTO_RET_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_crypto_aes_gcm(uint8_t is_enc, uint8_t *key,
|
||||
uint32_t keybits, uint8_t *input, uint32_t input_len, uint8_t *iv,
|
||||
uint32_t iv_len, uint8_t *add, uint32_t add_len, uint8_t *output,
|
||||
uint8_t *tag)
|
||||
{
|
||||
(void)is_enc;
|
||||
(void)key;
|
||||
(void)keybits;
|
||||
(void)input;
|
||||
(void)input_len;
|
||||
(void)iv;
|
||||
(void)iv_len;
|
||||
(void)add;
|
||||
(void)add_len;
|
||||
(void)output;
|
||||
(void)tag;
|
||||
|
||||
return CRYPTO_RET_NOSUPP;
|
||||
}
|
||||
|
||||
#endif /* HW_PLATFORM == HW_PLATFORM_SIMU */
|
||||
96
driver/src/simu/gpio_simu.c
Normal file
96
driver/src/simu/gpio_simu.c
Normal file
@@ -0,0 +1,96 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
/* iot common header files */
|
||||
#include "iot_config_api.h"
|
||||
#include "iot_gpio_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
int iot_gpio_open_as_input(int gpio)
|
||||
{
|
||||
(void) gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_open_as_output(int gpio)
|
||||
{
|
||||
(void) gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_open_as_interrupt(int gpio)
|
||||
{
|
||||
(void) gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_switch_io_mode_dynamic(int gpio, enum gpio_mode mode)
|
||||
{
|
||||
(void) gpio;
|
||||
(void) mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_interrupt_config(int gpio, enum gpio_int_trigger_mode mode,
|
||||
iot_gpio_isr_func isr, int arg, int auto_stop)
|
||||
{
|
||||
(void) gpio;
|
||||
(void) mode;
|
||||
(void) isr;
|
||||
(void) arg;
|
||||
(void) auto_stop;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_set_pull_mode(int gpio, enum gpio_pull_mode pull_mode)
|
||||
{
|
||||
(void) gpio;
|
||||
(void) pull_mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_interrupt_enable(int gpio, int enable)
|
||||
{
|
||||
(void) gpio;
|
||||
(void) enable;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_value_get(int gpio)
|
||||
{
|
||||
(void) gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_value_set(int gpio, int value)
|
||||
{
|
||||
(void) gpio;
|
||||
(void) value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int iot_gpio_close(int gpio)
|
||||
{
|
||||
(void) gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int iot_gpio_get_trigger_ticks(int logic_gpio)
|
||||
{
|
||||
(void)logic_gpio;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
58
driver/src/simu/hw_tsfm_simu.c
Normal file
58
driver/src/simu/hw_tsfm_simu.c
Normal file
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
* be copied by any method or incorporated into another program without
|
||||
* the express written consent of Aerospace C.Power. This Information or any portion
|
||||
* thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
* is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
* liability for its use in any way and conveys no license or title under
|
||||
* any patent or copyright and makes no representation or warranty that this
|
||||
* Information is free from patent or copyright infringement.
|
||||
*
|
||||
* ****************************************************************************/
|
||||
|
||||
/* common includes */
|
||||
#include "iot_errno_api.h"
|
||||
#include "iot_plc_hw_tsfm_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
uint32_t iot_plc_hw_tsfm_send(uint8_t *data, uint8_t len,
|
||||
hw_tsfm_send_cfg_t *cfg)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
(void)cfg;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_plc_hw_tsfm_register_listener(
|
||||
iot_plc_hw_tsfm_listener_func_t exe_func)
|
||||
{
|
||||
(void)exe_func;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_plc_hw_tsfm_get_transmitter_state(void)
|
||||
{
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
uint8_t iot_plc_hw_tsfm_is_3p()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t iot_plc_hw_tsfm_get_supp_mode(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t iot_plc_hw_tsfm_get_load_capacity(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
41
driver/src/simu/iot_plc_hw_topo_simu.c
Normal file
41
driver/src/simu/iot_plc_hw_topo_simu.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
* be copied by any method or incorporated into another program without
|
||||
* the express written consent of Aerospace C.Power. This Information or any portion
|
||||
* thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
* is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
* liability for its use in any way and conveys no license or title under
|
||||
* any patent or copyright and makes no representation or warranty that this
|
||||
* Information is free from patent or copyright infringement.
|
||||
*
|
||||
* ****************************************************************************/
|
||||
|
||||
/* common includes */
|
||||
#include "iot_errno_api.h"
|
||||
#include "iot_plc_hw_topo_api.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
uint32_t iot_plc_hw_topo_rcv_cfg(hw_topo_rcv_cfg_t *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_plc_hw_topo_ratio_cfg(hw_topo_ratio_coeff_t *cfg)
|
||||
{
|
||||
(void)cfg;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
uint32_t iot_plc_hw_topo_rms2_get(uint8_t phase)
|
||||
{
|
||||
(void)phase;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
640
driver/src/simu/mtd_simu.c
Normal file
640
driver/src/simu/mtd_simu.c
Normal file
@@ -0,0 +1,640 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
* be copied by any method or incorporated into another program without
|
||||
* the express written consent of Aerospace C.Power. This Information or any portion
|
||||
* thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
* is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
* liability for its use in any way and conveys no license or title under
|
||||
* any patent or copyright and makes no representation or warranty that this
|
||||
* Information is free from patent or copyright infringement.
|
||||
*
|
||||
* ****************************************************************************/
|
||||
|
||||
/* os includes */
|
||||
#include "os_types.h"
|
||||
#include "os_mem.h"
|
||||
|
||||
/* iot includes */
|
||||
#include "iot_config.h"
|
||||
#include "iot_errno.h"
|
||||
#include "iot_mtd.h"
|
||||
#include "iot_string.h"
|
||||
#include "iot_io.h"
|
||||
|
||||
|
||||
#include "mtd.h"
|
||||
|
||||
/* mock flash on simulator platform */
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* include C library for file operation */
|
||||
#include "io.h"
|
||||
|
||||
uint8_t g_part_num_fw1 = PART_NUM_FW1;
|
||||
uint8_t g_part_num_fw2 = PART_NUM_FW2;
|
||||
|
||||
#define CUSTOM_DEV_RW_SIZE 65536
|
||||
#define CUSTOM_DEV_ERASE_ONECE_SIZE 256
|
||||
|
||||
typedef struct _flash_config {
|
||||
char file_name[20];
|
||||
uint8_t auto_create;
|
||||
uint32_t size;
|
||||
}flash_config_t;
|
||||
|
||||
/* file name and file creating option.
|
||||
* keep this array align to part_num_t in iot_mtd.h
|
||||
*/
|
||||
static flash_config_t flash_config[] = {
|
||||
{"sp.bin", 1, 0},
|
||||
{"sbl.bin", 1, 0},
|
||||
{"param.bin", 1, 0},
|
||||
{"oem.bin", 1, 0},
|
||||
{"pib.bin", 0, 0x00006000},
|
||||
{"log1.bin", 1, 0},
|
||||
{"pib2.bin", 1, 0x00006000},
|
||||
{"log2.bin", 1, 0},
|
||||
{"fw1.bin", 1, 0},
|
||||
{"fw2.bin", 1, 0},
|
||||
{"cus_data.bin", 1, 0},
|
||||
{"cal_data.bin", 1, 0},
|
||||
{"run.bin", 1, 0},
|
||||
{"sbl2.bin", 1, 0},
|
||||
{"cus_fw1.bin", 1, 0},
|
||||
{"cus_fw2.bin", 1, 0},
|
||||
{"pib1_ext.bin", 1, 0},
|
||||
{"pib2_ext.bin", 1, 0},
|
||||
};
|
||||
|
||||
typedef struct _flash_key_value {
|
||||
char key[20];
|
||||
char value[20];
|
||||
}flash_key_value_t;
|
||||
|
||||
static flash_key_value_t flash_value[] = {
|
||||
{"last_part", "1"},
|
||||
{"boot_part", "1"},
|
||||
{"start_part", "1"},
|
||||
{"fw_crc1", "0"},
|
||||
{"fw_size1", "0"},
|
||||
{"fw_sts1", "1"},
|
||||
{"fw_crc2", "12344321"},
|
||||
{"fw_size2", "43211234"},
|
||||
{"fw_sts2", "1"},
|
||||
{"fw_period1", "0"},
|
||||
{"fw_period2", "0"},
|
||||
{"fw_block1", "0"},
|
||||
{"fw_block2", "0"},
|
||||
};
|
||||
static uint32_t dev_file_exist(char* file_path)
|
||||
{
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
HANDLE hFind;
|
||||
|
||||
hFind = FindFirstFileA(file_path, &FindFileData);
|
||||
|
||||
if (hFind == INVALID_HANDLE_VALUE) {
|
||||
return 0; // file does not exist
|
||||
} else {
|
||||
FindClose(hFind);
|
||||
return 1; // file exist
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static uint32_t get_work_path(char* buf)
|
||||
{
|
||||
char exePath[MAX_PATH];
|
||||
DWORD dwFile = GetModuleFileName(NULL, exePath, MAX_PATH);
|
||||
if (ERROR_SUCCESS == dwFile) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *pLastSlash = strrchr(exePath, '\\');
|
||||
strncpy(buf, exePath, pLastSlash - exePath + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_pib_partition_num(uint8_t * num)
|
||||
{
|
||||
*num = PART_NUM_PIB1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* dev_open - open a file specified by num
|
||||
* @num: partition number
|
||||
* @flag: open file flag. not used.
|
||||
* @return: handle to the file.
|
||||
* 0 if failed.
|
||||
*/
|
||||
int dev_open(int num, uint32_t flags)
|
||||
{
|
||||
(void)flags;
|
||||
if (num < PART_NUM_MIN || num >= PART_NUM_MAX ||
|
||||
num >= sizeof(flash_config) / sizeof(flash_config[0])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char path_buf[MAX_PATH] = {0};
|
||||
if (!get_work_path(path_buf)) {
|
||||
strcat(path_buf, flash_config[num].file_name);
|
||||
|
||||
FILE* fd = NULL;
|
||||
if (dev_file_exist(path_buf)) {
|
||||
// if file exist, open it
|
||||
fd = fopen(path_buf, "rb+");
|
||||
IOT_ASSERT(fd);
|
||||
} else {
|
||||
// if file doesn't exist, create it or ASSERT as configured
|
||||
if (flash_config[num].auto_create) {
|
||||
uint8_t buf[1024] = {0};
|
||||
os_mem_set(buf, 0xFF, sizeof(buf));
|
||||
fd = fopen(path_buf, "wb+");
|
||||
for (uint32_t i = 0;i < 400;++i) {
|
||||
fwrite(buf, sizeof(buf), 1, fd);
|
||||
}
|
||||
fseek(fd, 0, SEEK_SET);
|
||||
} else {
|
||||
IOT_ASSERT(0); // PIB file shall exist
|
||||
}
|
||||
}
|
||||
|
||||
if (fd) {
|
||||
fseek(fd, 0, SEEK_SET);
|
||||
}
|
||||
return (int)fd;
|
||||
}
|
||||
|
||||
IOT_ASSERT(0); // failed to get pib file path. assert.
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dev_close(int fd)
|
||||
{
|
||||
if (fd) {
|
||||
return fclose((FILE*)fd);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dev_seek(int fd, uint32_t offset, uint8_t fromwhere)
|
||||
{
|
||||
if (fd) {
|
||||
return fseek((FILE*)fd, offset, fromwhere);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dev_read(int fd, void* buf, size_t count)
|
||||
{
|
||||
if (fd) {
|
||||
size_t read_size = fread(buf, 1, count, (FILE*)fd);
|
||||
if (count > read_size) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dev_write(int fd, void *buf, size_t count)
|
||||
{
|
||||
if (fd) {
|
||||
return fwrite(buf, 1, count, (FILE*)fd);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dev_erase(int fd, uint32_t addr, uint8_t mode)
|
||||
{
|
||||
if (fd) {
|
||||
(void)addr;
|
||||
(void)mode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int mtd_device_get_info(void* buf, uint32_t type)
|
||||
{
|
||||
(void*)buf;
|
||||
(void)type;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_param_gen_list(dev_param_t *param,
|
||||
const char *name, const char *value)
|
||||
{
|
||||
int len = 0;
|
||||
len = iot_strlen(name);
|
||||
if (len >= PARAM_NAME_LEN_MAX) {
|
||||
iot_printf("generate parameter structure failed\r\n");
|
||||
return 1;
|
||||
}
|
||||
os_mem_cpy(param->name, name, len);
|
||||
|
||||
len = iot_strlen(value);
|
||||
if (len > PARAM_VAL_LEN_MAX) {
|
||||
iot_printf("generate parameter structure failed\r\n");
|
||||
return 1;
|
||||
}
|
||||
os_mem_cpy(param->value, value, len);
|
||||
param->equal = PARAM_EQUAL_CHAR;
|
||||
param->end = PARAM_END_CHAR;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_param_get_value(const char *name, char *value, int *pos)
|
||||
{
|
||||
int i = 0;
|
||||
int k = 0;
|
||||
int fd = 0;
|
||||
int ret = 0;
|
||||
int name_len = 0;
|
||||
int value_len = 0;
|
||||
|
||||
dev_param_t param = {0};
|
||||
name_len = iot_strlen(name);
|
||||
fd = dev_open(PART_NUM_PARAM, 0);
|
||||
if (fd < 0) {
|
||||
iot_printf("open part %d failed\n", PART_NUM_PARAM);
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < PARAM_MAX_LENGTH; i++) {
|
||||
os_mem_set(¶m, 0, sizeof(dev_param_t));
|
||||
dev_read(fd, ¶m, sizeof(dev_param_t));
|
||||
if (fd < 0) {
|
||||
iot_printf("read part parameters failed\n");
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
if (param.end == PARAM_END_CHAR) {
|
||||
if (os_mem_cmp(name, param.name, name_len) == 0) {
|
||||
value_len = iot_strlen(param.value);
|
||||
os_mem_cpy(value, param.value, value_len);
|
||||
*pos = dev_seek(fd, 0, DEV_SEEK_CUR);
|
||||
*pos -= sizeof(dev_param_t);
|
||||
if (pos < 0) {
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
} else {
|
||||
iot_printf("part parameters not found. use mock data\n");
|
||||
for (k = 0; k < sizeof(flash_value) / sizeof(flash_value[0]); ++k) {
|
||||
if (os_mem_cmp(name, flash_value[k].key, name_len) == 0) {
|
||||
value_len = iot_strlen(flash_value[k].value);
|
||||
os_mem_cpy(value, flash_value[k].value, value_len);
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
out:
|
||||
dev_close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t dev_param_save_value(const char *name, char *value)
|
||||
{
|
||||
(void)name;
|
||||
(void)value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_param_value(const char *name, uint32_t *flag)
|
||||
{
|
||||
int ret = 0;
|
||||
int pos = 0;
|
||||
char value[PARAM_VAL_LEN_MAX] = {0};
|
||||
ret = dev_param_get_value(name, value, &pos);
|
||||
if (ret) {
|
||||
iot_printf("get start flag value error\n");
|
||||
return 1;
|
||||
}
|
||||
if (os_mem_cmp(value, "0", 1) == 0) {
|
||||
*flag = 0;
|
||||
} else if (os_mem_cmp(value, "1", 1) == 0) {
|
||||
*flag = 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_param_get_start_flag(uint32_t *flag)
|
||||
{
|
||||
*flag = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_param_get_last_flag(uint32_t *flag)
|
||||
{
|
||||
*flag = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_param_get_boot_flag(uint32_t *flag)
|
||||
{
|
||||
*flag = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_boot_fw_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_FW1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_boot_pib_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_PIB1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_boot_cus_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_INVALID;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t dev_get_upgrade_fw_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_FW2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_upgrade_pib_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_PIB2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_upgrade_cus_part_num(uint8_t *part)
|
||||
{
|
||||
*part = PART_NUM_INVALID;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t dev_get_pib_ext_part_num(uint8_t part)
|
||||
{
|
||||
(void)part;
|
||||
return PART_NUM_PIB1_EXT;
|
||||
}
|
||||
|
||||
uint32_t dev_get_part_size(uint8_t part)
|
||||
{
|
||||
if (part < PART_NUM_MIN || part >= PART_NUM_MAX) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return flash_config[part].size;
|
||||
}
|
||||
|
||||
void dev_switch_part_flag(uint8_t cause)
|
||||
{
|
||||
(void)cause;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t dev_startup_param_value_check(bool_t sync)
|
||||
{
|
||||
(void)sync;
|
||||
uint32_t boot = 0;
|
||||
uint32_t start = 0;
|
||||
uint32_t last = 0;
|
||||
if (dev_param_get_start_flag(&start)) {
|
||||
return 1;
|
||||
}
|
||||
if (dev_param_get_last_flag(&last)) {
|
||||
return 1;
|
||||
}
|
||||
if (dev_param_get_boot_flag(&boot)) {
|
||||
return 1;
|
||||
}
|
||||
iot_printf("boot: %d, start: %d, last: %d\n", boot, start, last);
|
||||
if (boot != 0) {
|
||||
iot_printf("boot: %d, then set boot=0\n", boot);
|
||||
dev_param_save_value(PARAM_STRING_BOOT_PART, "0");
|
||||
}
|
||||
if (last != start) {
|
||||
switch (start) {
|
||||
case 0:
|
||||
dev_param_save_value(PARAM_STRING_LAST_PART, "0");
|
||||
break;
|
||||
case 1:
|
||||
dev_param_save_value(PARAM_STRING_LAST_PART, "1");
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t dev_get_oem_part_num(uint8_t * num)
|
||||
{
|
||||
*num = PART_NUM_OEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t iot_log_save_done(uint8_t lock)
|
||||
{
|
||||
lock = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t mtd_get_flash_size(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t mtd_get_psram_state()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t custom_dev_query_rw_size()
|
||||
{
|
||||
return CUSTOM_DEV_RW_SIZE;
|
||||
}
|
||||
|
||||
int32_t custom_dev_open()
|
||||
{
|
||||
int fd = 0;
|
||||
fd = dev_open(PART_NUM_CUS_DATA, 0);
|
||||
if (fd < 0) {
|
||||
iot_printf("open custom part failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
int32_t custom_dev_close(int32_t fd)
|
||||
{
|
||||
return dev_close(fd);
|
||||
}
|
||||
|
||||
int32_t custom_dev_seek(int32_t fd, uint32_t offset, uint8_t fromwhere)
|
||||
{
|
||||
return dev_seek(fd, offset, fromwhere);
|
||||
}
|
||||
|
||||
int32_t custom_dev_read(int32_t fd, void* buf, size_t count)
|
||||
{
|
||||
return dev_read(fd, buf, count);
|
||||
}
|
||||
|
||||
int32_t custom_dev_write(int32_t fd, void*buf, size_t count)
|
||||
{
|
||||
return dev_write(fd, buf, count);
|
||||
}
|
||||
|
||||
int32_t custom_dev_erase(int32_t fd, uint32_t offset, size_t count)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
(void)count;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t custom_dev_write_without_erase(int32_t fd, void*buf, size_t count)
|
||||
{
|
||||
return dev_write(fd, buf, count);
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_open(uint8_t id)
|
||||
{
|
||||
(void)id;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_close(int32_t fd)
|
||||
{
|
||||
(void)fd;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_seek(int32_t fd, uint32_t offset, uint8_t fromwhere)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
(void)fromwhere;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_read(int32_t fd, void* buf, size_t count)
|
||||
{
|
||||
(void)fd;
|
||||
(void)buf;
|
||||
(void)count;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_write(int32_t fd, void* buf, size_t count)
|
||||
{
|
||||
(void)fd;
|
||||
(void)buf;
|
||||
(void)count;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_write_without_erase(int32_t fd, void* buf,
|
||||
size_t count)
|
||||
{
|
||||
(void)fd;
|
||||
(void)buf;
|
||||
(void)count;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_query_rw_size(int32_t fd)
|
||||
{
|
||||
(void)fd;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_erase(int32_t fd, uint32_t offset, size_t count)
|
||||
{
|
||||
(void)fd;
|
||||
(void)offset;
|
||||
(void)count;
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t dev_param_get_boot_after_burn(uint32_t *p_flag)
|
||||
{
|
||||
*p_flag = 0;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
uint32_t dev_param_clear_boot_after_burn(void)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
uint32_t mtd_running_fw_get_size(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t mtd_running_fw_read(uint32_t offset, uint8_t *buffer,
|
||||
uint32_t length)
|
||||
{
|
||||
(void)offset;
|
||||
(void)buffer;
|
||||
(void)length;
|
||||
return ERR_NOSUPP;
|
||||
}
|
||||
|
||||
int32_t custom_dev_get_size_of_erase_once(int32_t fd)
|
||||
{
|
||||
(void)fd;
|
||||
return CUSTOM_DEV_ERASE_ONECE_SIZE;
|
||||
}
|
||||
|
||||
int32_t custom_ext_dev_get_size_of_erase_once(int32_t fd)
|
||||
{
|
||||
(void)fd;
|
||||
return CUSTOM_DEV_ERASE_ONECE_SIZE;
|
||||
}
|
||||
|
||||
void dev_get_switch_part_info(uint8_t *cause, uint8_t *upgrade_flag)
|
||||
{
|
||||
*cause = DEV_SWITCH_PART_CAUSE_OTHER;
|
||||
*upgrade_flag = 0;
|
||||
}
|
||||
|
||||
uint32_t mtd_copy_part(uint8_t src_part, uint8_t dest_part)
|
||||
{
|
||||
(void)src_part;
|
||||
(void)dest_part;
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
98
driver/src/simu/system_simu.c
Normal file
98
driver/src/simu/system_simu.c
Normal file
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
/* os shim includes */
|
||||
#include "os_types.h"
|
||||
#include "os_timer.h"
|
||||
#include "os_utils.h"
|
||||
#include "os_mem.h"
|
||||
|
||||
#include "iot_config.h"
|
||||
#include "iot_io_api.h"
|
||||
#include "iot_img_hdr.h"
|
||||
|
||||
#include "iot_utils_api.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "iot_system.h"
|
||||
|
||||
#if HW_PLATFORM == HW_PLATFORM_SIMU
|
||||
|
||||
void iot_system_restart(uint8_t reason)
|
||||
{
|
||||
iot_printf("%s called reason %lu.\n", __FUNCTION__, reason);
|
||||
}
|
||||
|
||||
bool_t iot_data_addr_legal(uint32_t addr)
|
||||
{
|
||||
(void)addr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void iot_iram_cache_legal_cache()
|
||||
{
|
||||
iot_printf("%s called.\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
uint32_t iot_chip_id_check()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void iot_switch_boot_part(void)
|
||||
{
|
||||
iot_printf("%s is not support\n", __FUNCTION__);
|
||||
}
|
||||
|
||||
uint8_t iot_chip_get_xor_value()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t iot_chip_get_mac_addr(uint8_t *mac)
|
||||
{
|
||||
if (mac == NULL) {
|
||||
return (uint32_t)-1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t iot_chip_get_chip_info()
|
||||
{
|
||||
return CHIP_ID_HZ_K48V3A;
|
||||
}
|
||||
|
||||
uint8_t iot_chip_check_lic()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void iot_system_get_fw_boot_param(void *param)
|
||||
{
|
||||
(void)param;
|
||||
}
|
||||
|
||||
uint32_t iot_gp_timer_get_curr_ts(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
float iot_adc_get_core_temperature(uint8_t type)
|
||||
{
|
||||
(void)type;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HW_PLATFORM */
|
||||
41
driver/src/simu/wdg_simu.c
Normal file
41
driver/src/simu/wdg_simu.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
/* iot common header files */
|
||||
|
||||
#include "os_types.h"
|
||||
#include "iot_config_api.h"
|
||||
#include "iot_wdg.h"
|
||||
#include "iot_io.h"
|
||||
|
||||
#if (HW_PLATFORM == HW_PLATFORM_SIMU)
|
||||
|
||||
void iot_wdg_disable_feed_dog()
|
||||
{
|
||||
iot_printf("%s assert.\n", __FUNCTION__);
|
||||
IOT_ASSERT(0);
|
||||
}
|
||||
|
||||
void iot_wdg_enable_feed_dog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void iot_wdg_feed_dog()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user