Files
kunlun/ftm/inc/iot_pt_func.h
2024-09-28 14:24:04 +08:00

93 lines
2.9 KiB
C
Executable File

/****************************************************************************
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_PT_FUNC_H
#define __IOT_PT_FUNC_H
#include "phy_phase.h"
#include "iot_ftm_msg.h"
#include "voltage_detec.h"
#include "zero_cross_detec.h"
#ifdef __cplusplus
extern "C" {
#endif
/* pkt expand detect thd for pt */
#define PT_PHY_PKT_TH 32
/* PT Tx break num for loop cnt */
#define PT_TX_NO_BREAK_NUM 0x00
/* PT mode reply ack */
#define PT_ACK_REPLY 0x01
/* PT mode invaluid data value */
#define PT_INVALID_DATA_VAL 0xFF
/* PT mode error data value */
#define PT_ERROR_DATA_VAL 0xFE
/* pt ctxt */
typedef struct _iot_pt_ctxt {
/* zero cross detection */
zc_circuit_check_status_t zc_circuit_check_status;
/* charge voltage detection */
dut_charge_control_ctxt_t dut_charge_control_ctxt;
} iot_pt_ctxt_t;
extern iot_pt_ctxt_t iot_pt_ctxt;
#pragma pack(push) // save the pack status
#pragma pack(1) // 1 byte align
/* golden pt info */
typedef struct _iot_pt_golden_info {
/* golden mac */
uint8_t mac[IOT_MAC_ADDR_LEN];
/* golden fw version */
uint32_t version;
} iot_pt_golden_info;
#pragma pack(pop) // restore the pack status
/**
*@brief mp_pt_dut_tx.
* This special API is designed for production line testing.
* Dut board need to tx packet for estimating self channel.
*
*@param tx_cmd [ftm cmd tx struct info]
*@param anf_en [notch filter enbale]
*@param power [power set]
*@param g_ppm [golden ppm]
*@param info [return back info]
*@exception [none.]
*@return [none.]
*/
void mp_pt_dut_tx(iot_ftm_tx_cmd_t *tx_cmd, \
uint8_t anf_en, uint8_t power, int16_t g_ppm, void *info);
/**
*@brief mp_pt_golden_unit_rx.
* This special API is designed for production line testing.
* Golden unit board need to rx packet for estimating dut channel.
*
*@param none [none.]
*@exception [none.]
*@return [none.]
*/
void mp_pt_golden_unit_rx();
#ifdef __cplusplus
}
#endif
#endif /* __IOT_PT_FUNC_H */