Files
kunlun/export/inc/bsp/iot_plc_hw_topo_api.h
2024-09-28 14:24:04 +08:00

91 lines
3.1 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_PLC_HW_TOPO_API_H
#define IOT_PLC_HW_TOPO_API_H
#include "os_types_api.h"
#include "iot_plc_msg_api.h"
#ifdef __cplusplus
extern "C" {
#endif
/* load mode encode frequncy. unit: 0.01Hz */
#define IOT_HW_TOPO_DECODE_FREQ_LOAD_DEF (83333)
/* define maximum number of codes. At present, branch identification supports
* transmission of up to four bytes.
*/
#define IOT_HW_TOPO_MAX_NUMBER_OF_CODES (16)
/* define hw topo cfg structure */
typedef struct _hw_topo_rcv_cfg {
/* flag to mark to if the "fc" field is valid */
uint16_t fc_valid : 1,
/* flag to mark to if the "chara_bit_dur" field is valid */
dur_valid : 1,
/* specified phase, see IOT_PLC_PHASE_XXX */
phase : 2,
/* reserved for further use */
rsvd : 12;
/* characteristics data per bit duration time, unit: 1ms. */
uint16_t chara_bit_dur;
/* center frequency, uint is 0.01HZ */
uint32_t fc;
/* similarity threshold, uint is 0.1& */
uint16_t similarity_thr;
/* characteristics code length, can not exceeded
* IOT_HW_TOPO_MAX_NUMBER_OF_CODES.
*/
uint8_t data_len;
/* characteristics code */
uint8_t data[IOT_HW_TOPO_MAX_NUMBER_OF_CODES];
} hw_topo_rcv_cfg_t;
/* define hw ratio coefficient structure */
typedef struct _hw_topo_ratio_coeff {
/* A/B/C phase current ratio coefficient, unit: 0.0001 */
uint32_t i_ratio_coeff[IOT_PLC_PHASE_CNT];
} hw_topo_ratio_coeff_t;
/**
* @brief iot_plc_hw_topo_cfg_rcv_mode() - config hw topo receive info.
* @param cfg: pointer to hw_topo_rcv_cfg_t structure
* @retval 0 - successful, other case - fail.
*/
uint32_t iot_plc_hw_topo_rcv_cfg(hw_topo_rcv_cfg_t *cfg);
/**
* @brief iot_plc_hw_topo_ratio_cfg() - config hw topo ratio.
* @param cfg: pointer to hw_topo_ratio_cfg_t structure
* @retval 0 - successful, other case - fail.
*/
uint32_t iot_plc_hw_topo_ratio_cfg(hw_topo_ratio_coeff_t *cfg);
/**
* @brief iot_plc_hw_topo_rms2_get() - get mean square value of current.
* @param phase: get witch phase
* @retval mean square value of current.
*/
uint32_t iot_plc_hw_topo_rms2_get(uint8_t phase);
#ifdef __cplusplus
}
#endif
#endif /* IOT_PLC_HW_TOPO_API_H */