91 lines
2.6 KiB
C
91 lines
2.6 KiB
C
|
/****************************************************************************
|
||
|
|
||
|
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.
|
||
|
|
||
|
****************************************************************************/
|
||
|
#ifndef IOT_SG_DRV_H
|
||
|
#define IOT_SG_DRV_H
|
||
|
|
||
|
/* os shim includes */
|
||
|
#include "os_types_api.h"
|
||
|
|
||
|
/* smart grid internal header files */
|
||
|
#include "iot_sg_fr.h"
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
#define iot_sg_printf iot_printf
|
||
|
|
||
|
/* define firmware sha1 check code value len */
|
||
|
#define IOT_SG_SHA1_CHECK_CODE_LEN 20
|
||
|
|
||
|
#if SMART_GRID_DEBUG
|
||
|
|
||
|
/* iot_sg_data_print - data printing method
|
||
|
* @str: a short string to be printed before data
|
||
|
* @buf: buffer contain data to be printed
|
||
|
* @len: length of data in the buffer
|
||
|
*/
|
||
|
void iot_sg_data_print(const char* str, uint8_t* buf, uint32_t len);
|
||
|
|
||
|
#else // SMART_GRID_DEBUG
|
||
|
|
||
|
static inline void iot_sg_data_print(const char* str, uint8_t* buf,
|
||
|
uint32_t len)
|
||
|
{
|
||
|
(void)str;
|
||
|
(void)buf;
|
||
|
(void)len;
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|
||
|
/**
|
||
|
* @brief iot_sg_get_chip_code() - get fixed chip code
|
||
|
* @return: chip code
|
||
|
*/
|
||
|
uint16_t iot_sg_get_chip_code(void);
|
||
|
|
||
|
/**
|
||
|
* @brief iot_sg_get_vendor_id() - get fixed vendor id
|
||
|
* @return: vendor id
|
||
|
*/
|
||
|
uint16_t iot_sg_get_vendor_id(void);
|
||
|
|
||
|
/**
|
||
|
* @brief get phase count.
|
||
|
* @param phase: phase info, bit0~bit2 set 1 means phase A, phase B, phase C.
|
||
|
* @return: phase count.
|
||
|
*/
|
||
|
uint8_t iot_sg_get_phase_cnt(uint8_t phase);
|
||
|
|
||
|
/**
|
||
|
* @brief iot_sg_get_fw_sha1_value() - get firmware sha1 check code value.
|
||
|
* @param check_code: pointer to check code value.
|
||
|
* @param check_code_len: check code value len, see IOT_SG_SHA1_CHECK_CODE_LEN.
|
||
|
* @param check_addr: check start address.
|
||
|
* @param check_len: check len.
|
||
|
* @retval: ERR_OK - case successfully.
|
||
|
* @retval: otherwise - error code. see ERR_XXX
|
||
|
*/
|
||
|
uint32_t iot_sg_get_fw_sha1_value(uint8_t *check_code, uint8_t check_code_len,
|
||
|
uint32_t check_addr, uint16_t check_len);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#endif /* IOT_SG_DRV_H */
|
||
|
|