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

140 lines
4.3 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_BOARD_MP_H
#define IOT_PT_BOARD_MP_H
/* os shim includes */
#include "os_types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define DUT_STA 0
#define DUT_TRI_PHASE 1
#define DUT_09_CCO 2
#define DUT_13_CCO 3
#define DUT_IIC 4
// PT_HARDWARE_VER, 1:normal 2:iic
#define PT_K48_HARDWARE_NORMAL (1)
#define PT_K48_HARDWARE_IIC (2)
#define PT_K76_HARDWARE_ID (3)
#ifndef PT_HARDWARE_VER
#define PT_HARDWARE_VER PT_K48_HARDWARE_NORMAL
#endif
/* pt board detect current status for dut */
typedef struct _current_dut_status {
/* dut current threshold */
uint16_t current_threshold;
/* dut current */
double current;
/* current detect circuit offset */
double current_offset;
/* current over statuts */
bool_t current_offset_status;
/* current over statuts */
bool_t current_status;
} current_dut_st;
/* pt board control id */
typedef struct _pt_board_control_id_ctxt {
/* control flag */
uint8_t control_flag;
/* timer pwr current det */
timer_id_t power_current_det;
/* timer pwr limit led */
timer_id_t power_limit_led;
/* timer pwr led */
timer_id_t power_running_led;
} pt_board_control_id_ctxt_t;
/* pt board current threshold */
typedef struct _pt_board_current_th {
uint16_t current_th;
} pt_board_current_th;
/* pt board gpio level set */
typedef struct _ex_gpio_level_set {
uint8_t device_type;
uint8_t set_level;
} ex_gpio_level_set;
/* pt board gpio level get */
typedef struct _ex_gpio_level_get {
uint8_t gpio_num;
uint8_t gpio_port;
} ex_gpio_level_get;
/* pt in bord gpio level set */
typedef struct _gpio_level_set {
uint8_t gpio_num;
uint8_t set_level;
} gpio_level_set;
/* ftm tx type id */
typedef enum _iot_ftm_dut_msgid {
DUT_POWER_OFF, /* msgid 0*/
DUT_POWER_ON, /* msgid 1*/
DUT_12V_OP_OK, /* msgid 2*/
DUT_RTS_H, /* msgid 3*/
DUT_RTS_L, /* msgid 4*/
DUT_RTS_OP_OK, /* msgid 5*/
DUT_STATUS_R, /* msgid 6*/
PT_JIG_STATUS, /* msgid 7*/
DUT_CURRENT_STATUS, /* msgid 8*/
DUT_CURRENT_TH, /* msgid 9*/
DUT_VOLTAGE_GET, /* msgid 10*/
GPIO_LEVEL_SET, /* msgid 11, set gpio value according device type */
GPIO_LEVEL_GET, /* msgid 12, */
DUT_CURRENT_GET, /* msgid 13*/
PT_RELAY_SET, /* msgid 14*/
PT_ACK, /* msgid 15*/
DUT_SEC_PULSE_ENABLE,/* msgid 16*/
DUT_PULSE_ENABLE, /* msgid 17*/
DUT_QUERY_GPB4_INT_CNT, /* msgid 18*/
DUT_QUERY_GPB1_2_INT_CNT, /* msgid 19*/
DUT_SET_GPB3_LEVEL, /* msgid 20*/
DUT_POWER_OFF_EXT = 21, /* msgid 21*/
DUT_POWER_ON_EXT = 22, /* msgid 22*/
SINGLE_GPIO_LEVEL_GET = 23, /* msgid 23, single gpio value get */
SINGLE_GPIO_LEVEL_SET = 24, /* msgid 24, single gpio value set */
SINGLE_EXT_GPIO_LEVEL_SET = 25, /* msgid 25, single extend gpio value set */
PT_HARDWARE_ID_GET = 26, /* msgid 26*/
PT_FW_VER_GET = 27, /* msgid 27*/
PT_SENSOR_TEMP_GET = 28, /* msgid 28, pt board sensor temperature get */
} iot_ftm_dut_msgid_t;
extern current_dut_st current_dut_status;
/**
* @brief iot_pt_init - initialize pt board mp module
* @param *dut_curr_ctxt [dut current control ctxt info.]
* @return [none.]
*/
void iot_pt_init(current_dut_st *dut_curr_ctxt);
#ifdef __cplusplus
}
#endif
#endif /* IOT_PT_BOARD_MP_H */