1272 lines
		
	
	
		
			42 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			1272 lines
		
	
	
		
			42 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_FTM_MSG_H
 | |
| #define IOT_FTM_MSG_H
 | |
| 
 | |
| /* os shim includes */
 | |
| #include "os_types.h"
 | |
| #include "mac_sched_hw.h"
 | |
| #include "plc_protocol.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| /* pack for the structures in the whole file */
 | |
| #pragma pack(push)  /* save the pack status */
 | |
| #pragma pack(1)     /* 1 byte align */
 | |
| 
 | |
| /* define max packet length for command */
 | |
| #define IOT_FTM_CMD_MAX_LEN         8000
 | |
| 
 | |
| /* define max packet length for event */
 | |
| #define IOT_FTM_EVENT_MAX_LEN       8000
 | |
| 
 | |
| #define MAX_FTM_CMD_CNT             6
 | |
| #define MAX_FTM_HWQ_NUM             24
 | |
| #define MAX_FTM_RF_HWQ_NUM          8
 | |
| #define MAX_PKT_SIZE                520
 | |
| 
 | |
| /* ftm command id definition */
 | |
| #define IOT_FTM_CMD_ID_PING                0x0001 /* ping command for test purose */
 | |
| #define IOT_FTM_CMD_ID_READ                0x0002
 | |
| #define IOT_FTM_CMD_ID_WRITE               0x0003
 | |
| #define IOT_FTM_CMD_ID_TX                  0x0004
 | |
| #define IOT_FTM_CMD_ID_RX                  0x0005
 | |
| #define IOT_FTM_CMD_ID_TONE                0x0006
 | |
| #define IOT_FTM_CMD_ID_STS                 0x0007
 | |
| #define IOT_FTM_CMD_ID_SET                 0x0008
 | |
| #define IOT_FTM_CMD_ID_GET                 0x0009
 | |
| #define IOT_FTM_CMD_ID_SCAN                0x000a
 | |
| #define IOT_FTM_CMD_ID_HWQCFG              0X000b
 | |
| #define IOT_FTM_CMD_ID_PKTCFG              0X000c
 | |
| #define IOT_FTM_CMD_ID_TESTCASE            0X000d
 | |
| #define IOT_FTM_CMD_ID_MAC_RECE            0X000e
 | |
| #define IOT_FTM_CMD_ID_MAC_RECE_SNIFFER    0X000f
 | |
| #define IOT_FTM_CMD_ID_RINGCFG             0x0010
 | |
| #define IOT_FTM_CMD_ID_SET_FILTERSEL       0x0011
 | |
| #define IOT_FTM_CMD_ID_SET_FILTER          0x0012
 | |
| #define IOT_FTM_CMD_ID_SET_RINGDIS         0x0013
 | |
| #define IOT_FTM_CMD_ID_SNIFFERCFG          0x0014
 | |
| #define IOT_FTM_CMD_ID_RX_MSG_SHOW         0x0015
 | |
| #define IOT_FTM_CMD_ID_CMD_CFG             0x0016
 | |
| #define IOT_FTM_CMD_ID_CRC_CFG             0x0017
 | |
| #define IOT_FTM_CMD_ID_MAC_PING            0x0018
 | |
| #define IOT_FTM_CMD_ID_SET_TEINID          0x0019
 | |
| #define IOT_FTM_CMD_ID_CLEAR_COUNT         0x001A
 | |
| #define IOT_FTM_CMD_ID_SEND_COUNT          0x001B
 | |
| #define IOT_FTM_CMD_ID_TPUT_TEST           0x001C
 | |
| #define IOT_FTM_CMD_ID_DIS_HWQ             0x001D
 | |
| #define IOT_FTM_CMD_ID_LOAD_DATA           0x001E
 | |
| #define IOT_FTM_CMD_ID_I2C_WRITE           0x001F
 | |
| #define IOT_FTM_CMD_ID_I2C_READ            0x0020
 | |
| #define IOT_FTM_CMD_ID_GPIO_OUT            0x0021
 | |
| #define IOT_FTM_CMD_ID_GPIO_IN             0x0022
 | |
| #define IOT_FTM_CMD_ID_UART_LOOPBACK       0x0023
 | |
| #define IOT_FTM_CMD_ID_SPI_FLASH           0x0024
 | |
| #define IOT_FTM_CMD_ID_READ_CHIPID         0x0025
 | |
| #define IOT_FTM_CMD_ID_READ_FW_VER         0x0026
 | |
| #define IOT_FTM_CMD_ID_BURN_MAC            0x0027
 | |
| #define IOT_FTM_CMD_ID_SEND_REV_DATA       0x0028
 | |
| #define IOT_FTM_CMD_ID_GOLDEN_REV_DATA     0x0029
 | |
| #define IOT_FTM_CMD_ID_SET_PHY_PARA        0x002a
 | |
| #define IOT_FTM_CMD_ID_READ_MAC            0x002b
 | |
| #define IOT_FTM_CMD_ID_INIT_DONE           0x002c
 | |
| #define IOT_FTM_CMD_ID_EFUSE_LOCK          0x002d
 | |
| #define IOT_FTM_CMD_ID_SPUR_MASK_SET       0x002e
 | |
| #define IOT_FTM_CMD_ID_OEM_MODULETYPE_SET  0x002f
 | |
| #define IOT_FTM_CMD_ID_OEM_MODULETYPE_GET  0x0030
 | |
| #define IOT_FTM_CMD_ID_VENDOR_ID_SET       0x0031
 | |
| #define IOT_FTM_CMD_ID_CHIP_CODE_SET       0x0032
 | |
| #define IOT_FTM_CMD_ID_CHIP_CODE_GET       0x0033
 | |
| #define IOT_FTM_CMD_ID_SET_PPM_NID         0x0034
 | |
| #define IOT_FTM_CMD_ID_GLB_NID_SET         0x0035
 | |
| #define IOT_FTM_CMD_ID_CUS_CMD             0x0036
 | |
| #define IOT_FTM_CMD_ID_VENDOR_ID_GET       0x0037
 | |
| #define IOT_FTM_CMD_ID_CHIP_MMID_GET       0x0038
 | |
| #define IOT_FTM_CMD_ID_ZC_CIRCUIT_CHECK    0x0039
 | |
| #define IOT_FTM_CMD_ID_DISABEL_GPIO_RESET  0x003a
 | |
| #define IOT_FTM_CMD_ID_DUT_CHARGE_VOL_GET  0x003b
 | |
| #define IOT_FTM_CMD_ID_FW_CRC_CHECK        0x003c
 | |
| #define IOT_FTM_CMD_ID_DEV_ID_SET          0x003d
 | |
| #define IOT_FTM_CMD_ID_DEV_ID_GET          0x003e
 | |
| #define IOT_FTM_CMD_ID_PT_FW_VER_GET       0x003f
 | |
| #define IOT_FTM_CMD_ID_HW_VER_SET          0x0040
 | |
| #define IOT_FTM_CMD_ID_HW_VER_GET          0x0041
 | |
| #define IOT_FTM_CMD_ID_DUT_CHANNEL_VOL_GET 0x0042
 | |
| #define IOT_FTM_CMD_ID_DUT_TXRX_MODE_SET   0x0043
 | |
| #define IOT_FTM_CMD_ID_FLASH_ID_GET        0x0044
 | |
| #define IOT_FTM_CMD_ID_MAC_ADDR_UPDATE     0x0045
 | |
| #define IOT_FTM_CMD_ID_BURN_IP_INFO        0x0046
 | |
| #define IOT_FTM_CMD_ID_READ_IP_INFO        0x0047
 | |
| #define IOT_FTM_CMD_ID_CHIP_MMID_SET       0x0048
 | |
| #define IOT_FTM_CMD_ID_CHECK_IMG_CRC       0x0049
 | |
| #define IOT_FTM_CMD_ID_METER_CROSSTALK_SET 0x004a
 | |
| #define IOT_FTM_CMD_ID_METER_CROSSTALK_GET 0x004b
 | |
| #define IOT_FTM_CMD_ID_SOFT_RESTART        0x004c
 | |
| #define IOT_FTM_CMD_ID_EM_EXT_FUNC         0x004d
 | |
| #define IOT_FTM_CMD_ID_PASSCODE_GET        0x004e
 | |
| #define IOT_FTM_CMD_ID_EXT_FLASH_CHECK     0x004f
 | |
| #define IOT_FTM_CMD_ID_BRK_START_STOP_LOOPBACK     0x0050
 | |
| #define IOT_FTM_CMD_ID_BRK_ENABLE_INT      0x0051
 | |
| #define IOT_FTM_CMD_ID_BRK_QUERY_TRIGGER_CNT 0x0052
 | |
| #define IOT_FTM_CMD_ID_READ_BCD_MAC        0x0053
 | |
| #define IOT_FTM_CMD_ID_LOADER_TSFM         0x0054
 | |
| #define IOT_FTM_CMD_ID_CHANNEL_ADC_READ    0x0055
 | |
| #define IOT_FTM_CMD_ID_METER_PORT_UART_LOOPBACK    0x0056
 | |
| #define IOT_FTM_CMD_ID_SET_PT_FW_VER       0x0057
 | |
| #define IOT_FTM_CMD_ID_TEMP_CALI_SET       0x0058
 | |
| #define IOT_FTM_CMD_ID_TEMP_CALI_GET       0x0059
 | |
| #define IOT_FTM_CMD_ID_MAC_PHY_DIAGNOSTIC  0x005A
 | |
| #define IOT_FTM_CMD_ID_ADC_CALI_SET        0x005B
 | |
| #define IOT_FTM_CMD_ID_ADC_CALI_GET        0x005C
 | |
| #define IOT_FTM_CMD_ID_ADC_READ_REAL       0x005D
 | |
| #define IOT_FTM_CMD_ID_PHY_RF_TXIQM_CAL_W  0x005E
 | |
| #define IOT_FTM_CMD_ID_PHY_RF_TXIQM_CAL_R  0x005F
 | |
| #define IOT_FTM_CMD_ID_RF_PHY_TX_TONE      0x0060
 | |
| #define IOT_FTM_CMD_ID_RF_SPI_SYNC         0x0061
 | |
| #define IOT_FTM_CMD_ID_PHY_RF_TXF_CAL_W    0x0062
 | |
| #define IOT_FTM_CMD_ID_PHY_RF_TXF_CAL_R    0x0063
 | |
| #define IOT_FTM_CMD_ID_MP_RF_TEST          0x0064
 | |
| #define IOT_FTM_CMD_ID_RF_TRS_CHK          0x0065
 | |
| #define IOT_FTM_CMD_ID_EFUSE_CHECK         0x0066
 | |
| #define IOT_FTM_CMD_ID_MP_RF_CAL_CFG       0x0067
 | |
| #define IOT_FTM_CMD_ID_MP_RF_CAL_MEAS      0x0068
 | |
| #define IOT_FTM_CMD_ID_MP_RF_CAL_UPDATE    0x0069
 | |
| #define IOT_FTM_CMD_ID_POWER_SYNC          0x006A
 | |
| #define IOT_FTM_CMD_ID_SECURITY_CFG_SET    0x006B
 | |
| #define IOT_FTM_CMD_ID_SECURITY_CFG_GET    0x006C
 | |
| #define IOT_FTM_CMD_ID_RF_PHY_TX_TONE_RAW  0x006D
 | |
| #define IOT_FTM_CMD_ID_TOPO_ADC_DUMP       0x006E
 | |
| #define IOT_FTM_CMD_ID_IR_LOOPBACK_TEST    0x006F
 | |
| #define IOT_FTM_CMD_ID_RF_TX_DC_LOOP_CALI  0x0070
 | |
| #define IOT_FTM_CMD_ID_SET_GET_PT_INFO     0x0071
 | |
| #define IOT_FTM_CMD_ID_DUMP_TO_MEM         0x0072
 | |
| #define IOT_FTM_CMD_ID_MAX                 0x0072  /* total event supported */
 | |
| 
 | |
| /* ftm event id definition */
 | |
| #define IOT_FTM_EVENT_ID_PONG                0x0001 /* pong event for test purose */
 | |
| #define IOT_FTM_EVENT_ID_READ                0x0002
 | |
| #define IOT_FTM_EVENT_ID_WRITE               0x0003
 | |
| #define IOT_FTM_EVENT_ID_TX                  0x0004
 | |
| #define IOT_FTM_EVENT_ID_RX                  0x0005
 | |
| #define IOT_FTM_EVENT_ID_TONE                0x0006
 | |
| #define IOT_FTM_EVENT_ID_STS                 0x0007
 | |
| #define IOT_FTM_EVENT_ID_SET                 0x0008
 | |
| #define IOT_FTM_EVENT_ID_GET                 0x0009
 | |
| #define IOT_FTM_EVENT_ID_SCAN                0x000a
 | |
| #define IOT_FTM_EVENT_ID_HWQCFG              0X000b
 | |
| #define IOT_FTM_EVENT_ID_PKTCFG              0X000c
 | |
| #define IOT_FTM_EVENT_ID_TESTCASE            0X000d
 | |
| #define IOT_FTM_EVENT_ID_MAC_RECE            0X000e
 | |
| #define IOT_FTM_EVENT_ID_MAC_RECE_SNIFFER    0x000f
 | |
| #define IOT_FTM_EVENT_ID_RINGCFG             0x0010
 | |
| #define IOT_FTM_EVENT_ID_SET_FILTERSEL       0x0011
 | |
| #define IOT_FTM_EVENT_ID_SET_FILTER          0x0012
 | |
| #define IOT_FTM_EVENT_ID_SET_RINGDIS         0x0013
 | |
| #define IOT_FTM_EVENT_ID_SNIFFERCFG          0x0014
 | |
| #define IOT_FTM_EVENT_ID_RX_MSG_SHOW         0x0015
 | |
| #define IOT_FTM_EVENT_ID_CMDCFG              0x0016
 | |
| #define IOT_FTM_EVENT_ID_CRC_CFG             0x0017
 | |
| #define IOT_FTM_EVENT_ID_MAC_PING            0x0018
 | |
| #define IOT_FTM_EVENT_ID_SET_TEINID          0x0019
 | |
| #define IOT_FTM_EVENT_ID_CLEAR_COUNT         0x001A
 | |
| #define IOT_FTM_EVENT_ID_SEND_COUNT          0x001B
 | |
| #define IOT_FTM_EVENT_ID_TPUT_TEST           0x001C
 | |
| #define IOT_FTM_EVENT_ID_DIS_HWQ             0x001D
 | |
| #define IOT_FTM_EVENT_ID_LOAD_DATA           0x001E
 | |
| #define IOT_FTM_EVENT_ID_I2C_WRITE           0x001F
 | |
| #define IOT_FTM_EVENT_ID_I2C_READ            0x0020
 | |
| #define IOT_FTM_EVENT_ID_GPIO_OUT            0x0021
 | |
| #define IOT_FTM_EVENT_ID_GPIO_IN             0x0022
 | |
| #define IOT_FTM_EVENT_ID_UART_LOOPBACK       0x0023
 | |
| #define IOT_FTM_EVENT_ID_SPI_FLASH           0x0024
 | |
| #define IOT_FTM_EVENT_ID_READ_CHIPID         0x0025
 | |
| #define IOT_FTM_EVENT_ID_READ_FW_VER         0x0026
 | |
| #define IOT_FTM_EVENT_ID_BURN_MAC            0x0027
 | |
| #define IOT_FTM_EVENT_ID_SEND_REV_DATA       0x0028
 | |
| #define IOT_FTM_EVENT_ID_GOLDEN_REV_DATA     0x0029
 | |
| #define IOT_FTM_EVENT_ID_SET_PHY_PARA        0x002a
 | |
| #define IOT_FTM_EVENT_ID_READ_MAC            0x002b
 | |
| #define IOT_FTM_EVENT_ID_INIT_DONE           0x002c
 | |
| #define IOT_FTM_EVENT_ID_EFUSE_LOCK          0x002d
 | |
| #define IOT_FTM_EVENT_ID_SPUR_MASK_SET       0x002e
 | |
| #define IOT_FTM_EVENT_ID_OEM_MODULETYPE_SET  0x002f
 | |
| #define IOT_FTM_EVENT_ID_OEM_MODULETYPE_GET  0x0030
 | |
| #define IOT_FTM_EVENT_ID_VENDOR_ID_SET       0x0031
 | |
| #define IOT_FTM_EVENT_ID_CHIP_CODE_SET       0x0032
 | |
| #define IOT_FTM_EVENT_ID_CHIP_CODE_GET       0x0033
 | |
| #define IOT_FTM_EVENT_ID_SET_PPM_NID         0x0034
 | |
| #define IOT_FTM_EVENT_ID_GLB_NID_SET         0x0035
 | |
| #define IOT_FTM_EVENT_ID_CUS_CMD             0x0036
 | |
| #define IOT_FTM_EVENT_ID_VENDOR_ID_GET       0x0037
 | |
| #define IOT_FTM_EVENT_ID_CHIP_MMID_GET       0x0038
 | |
| #define IOT_FTM_EVENT_ID_ZC_CIRCUIT_CHECK    0x0039
 | |
| #define IOT_FTM_EVENT_ID_DISABEL_GPIO_RESET  0x003a
 | |
| #define IOT_FTM_EVENT_ID_DUT_CHARGE_VOL_GET  0x003b
 | |
| #define IOT_FTM_EVENT_ID_FW_CRC_CHECK        0x003c
 | |
| #define IOT_FTM_EVENT_ID_DEV_ID_SET          0x003d
 | |
| #define IOT_FTM_EVENT_ID_DEV_ID_GET          0x003e
 | |
| #define IOT_FTM_EVENT_ID_PT_FW_VER_GET       0x003f
 | |
| #define IOT_FTM_EVENT_ID_HW_VER_SET          0x0040
 | |
| #define IOT_FTM_EVENT_ID_HW_VER_GET          0x0041
 | |
| #define IOT_FTM_EVENT_ID_DUT_CHANNEL_VOL_GET 0x0042
 | |
| #define IOT_FTM_EVENT_ID_DUT_TXRX_MODE_SET   0x0043
 | |
| #define IOT_FTM_EVENT_ID_FLASH_ID_GET        0x0044
 | |
| #define IOT_FTM_EVENT_ID_MAC_ADDR_UPDATE     0x0045
 | |
| #define IOT_FTM_EVENT_ID_BURN_IP_INFO        0x0046
 | |
| #define IOT_FTM_EVENT_ID_READ_IP_INFO        0x0047
 | |
| #define IOT_FTM_EVENT_ID_CHIP_MMID_SET       0x0048
 | |
| #define IOT_FTM_EVENT_ID_CHECK_IMG_CRC       0x0049
 | |
| #define IOT_FTM_EVENT_ID_METER_CROSSTALK_SET 0x004a
 | |
| #define IOT_FTM_EVENT_ID_METER_CROSSTALK_GET 0x004b
 | |
| #define IOT_FTM_EVENT_ID_SOFT_RESTART        0x004c
 | |
| #define IOT_FTM_EVENT_ID_EM_EXT_FUNC         0x004d
 | |
| #define IOT_FTM_EVENT_ID_PASSCODE_GET        0x004e
 | |
| #define IOT_FTM_EVENT_ID_EXT_FLASH_CHECK     0x004f
 | |
| #define IOT_FTM_EVENT_ID_BRK_START_STOP_LOOPBACK    0x0050
 | |
| #define IOT_FTM_EVENT_ID_BRK_ENABLE_INT      0x0051
 | |
| #define IOT_FTM_EVENT_ID_BRK_QUERY_TRIGGER_CNT      0x0052
 | |
| #define IOT_FTM_EVENT_ID_READ_BCD_MAC        0x0053
 | |
| #define IOT_FTM_EVENT_ID_LOADER_TSFM         0x0054
 | |
| #define IOT_FTM_EVENT_ID_CHANNEL_ADC_READ    0x0055
 | |
| #define IOT_FTM_EVENT_ID_METER_PORT_UART_LOOPBACK   0x0056
 | |
| #define IOT_FTM_EVENT_ID_SET_PT_FW_VER       0x0057
 | |
| #define IOT_FTM_EVENT_ID_TEMP_CALI_SET       0x0058
 | |
| #define IOT_FTM_EVENT_ID_TEMP_CALI_GET       0x0059
 | |
| #define IOT_FTM_EVENT_ID_MAC_PHY_DIAGNOSTIC  0x005A
 | |
| #define IOT_FTM_EVENT_ID_ADC_CALI_SET        0x005B
 | |
| #define IOT_FTM_EVENT_ID_ADC_CALI_GET        0x005C
 | |
| #define IOT_FTM_EVENT_ID_ADC_READ_REAL       0x005D
 | |
| #define IOT_FTM_EVENT_ID_PHY_RF_TXIQM_CAL_W  0x005E
 | |
| #define IOT_FTM_EVENT_ID_PHY_RF_TXIQM_CAL_R  0x005F
 | |
| #define IOT_FTM_EVENT_ID_RF_PHY_TX_TONE      0x0060
 | |
| #define IOT_FTM_EVENT_ID_RF_SPI_SYNC         0x0061
 | |
| #define IOT_FTM_EVENT_ID_PHY_RF_TXF_CAL_W    0x0062
 | |
| #define IOT_FTM_EVENT_ID_PHY_RF_TXF_CAL_R    0x0063
 | |
| #define IOT_FTM_EVENT_ID_MP_RF_TEST          0x0064
 | |
| #define IOT_FTM_CMD_ID_RF_TRS_CHK            0x0065
 | |
| #define IOT_FTM_EVENT_ID_EFUSE_CHECK         0x0066
 | |
| #define IOT_FTM_EVENT_ID_MP_RF_CAL_CFG       0x0067
 | |
| #define IOT_FTM_EVENT_ID_MP_RF_CAL_MEAS      0x0068
 | |
| #define IOT_FTM_EVENT_ID_MP_RF_CAL_UPDATE    0x0069
 | |
| #define IOT_FTM_EVENT_ID_POWER_SYNC          0x006A
 | |
| #define IOT_FTM_EVENT_ID_SECURITY_CFG_SET    0x006B
 | |
| #define IOT_FTM_EVENT_ID_SECURITY_CFG_GET    0x006C
 | |
| #define IOT_FTM_EVENT_ID_RF_PHY_TX_TONE_RAW  0x006D
 | |
| #define IOT_FTM_EVENT_ID_TOPO_ADC_DUMP       0x006E
 | |
| #define IOT_FTM_EVENT_ID_IR_LOOPBACK_TEST    0x006F
 | |
| #define IOT_FTM_EVENT_ID_RF_TX_DC_LOOP_CALI  0x0070
 | |
| #define IOT_FTM_EVENT_ID_SET_GET_PT_INFO     0x0071
 | |
| #define IOT_FTM_EVENT_ID_DUMP_TO_MEM         0x0072
 | |
| #define IOT_FTM_EVENT_ID_MAX                 0x0072  /* total event supported */
 | |
| 
 | |
| 
 | |
| /* PT K48 ftm command id definition */
 | |
| #define IOT_PT_FTM_CMD_ID_PWR_OFF             0x0000
 | |
| #define IOT_PT_FTM_CMD_ID_PWR_ON              0x0001
 | |
| /* future add */
 | |
| #define IOT_PT_FTM_CMD_ID_STATUS_R            0x0006
 | |
| #define IOT_PT_FTM_CMD_ID_GET_JIG             0x0007
 | |
| #define IOT_PT_FTM_CMD_ID_GET_CURRENT         0x0008
 | |
| #define IOT_PT_FTM_CMD_ID_THD_CURRENT         0x0009
 | |
| #define IOT_PT_FTM_CMD_ID_VOLTAGE_GET         0x000a
 | |
| #define IOT_PT_FTM_CMD_ID_GPIO_LEVEL_SET      0x000b
 | |
| #define IOT_PT_FTM_CMD_ID_GPIO_LEVEL_GET      0x000c
 | |
| #define IOT_PT_FTM_CMD_ID_PT_RELAY_SET        0x000d
 | |
| #define IOT_PT_FTM_CMD_ID_PT_ACK              0x000e
 | |
| #define IOT_PT_FTM_CMD_ID_SINGLE_GPIO_LEVEL_SET  0x000f
 | |
| #define IOT_PT_FTM_CMD_ID_PT_HARDWARE_ID_GET     0x0010
 | |
| 
 | |
| /* future add */
 | |
| #define IOT_PT_FTM_CMD_ID_EDGE_RISE           0x0011
 | |
| #define IOT_PT_FTM_CMD_ID_EDGE_FALL           0x0012
 | |
| #define IOT_PT_FTM_CMD_ID_GPB4_INT_CNT        0x0013
 | |
| #define IOT_PT_FTM_CMD_ID_GPB1_2_INT_CNT      0x0014
 | |
| #define IOT_PT_FTM_CMD_ID_SET_GPB3_LEVEL      0x0015
 | |
| #define IOT_PT_FTM_CMD_ID_DUT_SEC_PULSE_ENABLE 0x0016
 | |
| #define IOT_PT_FTM_CMD_ID_DUT_PULSE_ENABLE    0x0017
 | |
| #define IOT_PT_FTM_CMD_ID_OPEN_UART1          0x0018
 | |
| #define IOT_PT_FTM_CMD_ID_UART1_RECV          0x0019
 | |
| #define IOT_PT_FTM_CMD_ID_PT_FW_VER_GET       0x001a
 | |
| #define IOT_PT_FTM_CMD_ID_PT_SENSOR_TEMP_GET  0x001c
 | |
| 
 | |
| 
 | |
| /* FTM PHY type */
 | |
| #define IOT_FTM_PHY_TYPE_PLC                  0
 | |
| #define IOT_FTM_PHY_TYPE_RF                   1
 | |
| 
 | |
| /* FTM HWQ type */
 | |
| #define IOT_FTM_HWQ_TYPE_PLC                  0
 | |
| #define IOT_FTM_HWQ_TYPE_RF                   1
 | |
| 
 | |
| #define IOT_FTM_CMD_DUMP_TYPE_FFT             1
 | |
| 
 | |
| /* ftm command from host to target */
 | |
| typedef struct _iot_ftm_cmd {
 | |
|     /* command id, see IOT_FTM_CMD_ID_XXX */
 | |
|     uint16_t    cmd_id;
 | |
|     /* total data length of the command. one command can be splitted into
 | |
|      * multiple packets.
 | |
|      */
 | |
|     uint16_t    total_len;
 | |
|     /* data length in current packet */
 | |
|     uint16_t    len;
 | |
|     /* data in current packet */
 | |
|     uint8_t     data[0];
 | |
| } iot_ftm_cmd_t;
 | |
| 
 | |
| /* ftm event from target to host */
 | |
| typedef struct _iot_ftm_event {
 | |
|     /* event id, see IOT_FTM_EVENT_ID_XXX */
 | |
|     uint16_t    event_id;
 | |
|     /* total data length of the event. one event can be splitted into
 | |
|      * multiple packets.
 | |
|      */
 | |
|     uint16_t    total_len;
 | |
|     /* data length in current packet */
 | |
|     uint16_t    len;
 | |
|     /* data in current packet */
 | |
|     uint8_t     data[0];
 | |
| } iot_ftm_event_t;
 | |
| 
 | |
| /* ftm cmd tx from host to target */
 | |
| typedef struct _iot_ftm_tx_cmd {
 | |
|     /* phase */
 | |
|     uint8_t phase;
 | |
|     /* mac type */
 | |
|     uint8_t m_type;
 | |
|     /* packet type */
 | |
|     uint16_t p_type;
 | |
|     /* tx total num */
 | |
|     uint32_t total_num;
 | |
|     /* tmi or ext tmi */
 | |
|     uint8_t mac_tmi;
 | |
| } iot_ftm_tx_cmd_t;
 | |
| 
 | |
| /* ftm cmd txrx mode set */
 | |
| typedef struct _iot_ftm_txrx_mode_cmd {
 | |
|     /* mode en */
 | |
|     uint8_t mode_en;
 | |
|     /* mode value */
 | |
|     uint8_t mode_val;
 | |
| } iot_ftm_txrx_mode_cmd_t;
 | |
| 
 | |
| /* define ftm tx cmd parameters */
 | |
| typedef enum _iot_ftm_tx_cmdid {
 | |
|     FTM_CMD_TX_PHASE = 1,        /* tx phase id */
 | |
|     FTM_CMD_TX_CALI,             /* tx calibration id */
 | |
|     FTM_CMD_TX_CSI,              /* tx csi dump id */
 | |
|     FTM_CMD_TX_CSR,              /* tx csr detection id */
 | |
|     FTM_CMD_TX_MODE_OFFSET = 4,  /* tx ftm/mp mode id */
 | |
|     FTM_CMD_TX_BAND,             /* tx band id */
 | |
|     FTM_CMD_TX_GET_GOLDEN_INFO,  /* tx query golden info id */
 | |
|     FTM_CMD_TX_GAIN = 0xFC,      /* tx gain set id */
 | |
|     FTM_CMD_TX_END,              /* tx end id */
 | |
|     FTM_CMD_TX_LONG,             /* tx long id */
 | |
|     FTM_CMD_TX_INIT,             /* tx init id */
 | |
| } iot_ftm_tx_cmdid_t;
 | |
| 
 | |
| /* mp rx command id define */
 | |
| typedef enum _iot_ftm_rx_cmdid {
 | |
|     FTM_CMD_RX_GOLDEN,   /* rx pt golden mode */
 | |
|     FTM_CMD_RX_INIT,     /* rx init */
 | |
|     FTM_CMD_RX_START,    /* rx single mode start */
 | |
|     FTM_CMD_RX_END,      /* rx mode end */
 | |
| } iot_ftm_rx_cmdid_t;
 | |
| 
 | |
| /* ftm cmd read from host to target */
 | |
| typedef struct _iot_ftm_read_cmd {
 | |
|     /* addr */
 | |
|     uint32_t    addr;
 | |
|     /* len */
 | |
|     uint16_t    len;
 | |
| } iot_ftm_read_cmd_t;
 | |
| 
 | |
| /* ftm cmd write from host to target */
 | |
| typedef struct _iot_ftm_write_cmd {
 | |
|     /* addr */
 | |
|     uint32_t    addr;
 | |
|     /* data */
 | |
|     uint32_t    data;
 | |
| } iot_ftm_write_cmd_t;
 | |
| 
 | |
| typedef struct _ana_i2c_cmd {
 | |
|     uint8_t reg_id;
 | |
|     uint32_t wdata;
 | |
|     uint32_t mask;
 | |
| } ana_i2c_cmd_t;
 | |
| 
 | |
| /* ftm scan id */
 | |
| typedef enum _iot_ftm_scan_id {
 | |
|     AUTO_ALL        =0,
 | |
|     AUTO_DUMP       =1,
 | |
|     AUTO_UART       =2,
 | |
|     AUTO_VPP        =3,
 | |
|     AUTO_SNR        =4,
 | |
|     AUTO_FA         =5,
 | |
|     AUTO_CSI        =6,
 | |
|     AUTO_LOOPBACK   =7,
 | |
|     AUTO_NF         =8,
 | |
|     AUTO_DC_TX      =9,
 | |
|     AUTO_DC_RX      =10,
 | |
|     AUTO_END        =11,
 | |
|     AUTO_FFT        =12,
 | |
| } iot_ftm_scan_id_t;
 | |
| 
 | |
| /* ext flash cfg*/
 | |
| typedef enum _iot_ftm_ext_flash_funcid {
 | |
|     FTM_CMD_EXT_QUERY,   /* quert ext flash chip size */
 | |
|     FTM_CMD_EXT_CHECK,     /* check ext flash */
 | |
| } iot_ftm_ext_flash_funcid_t;
 | |
| 
 | |
| typedef struct _iot_ftm_ext_flash_cfg {
 | |
|     uint8_t flash_func;
 | |
|     uint16_t flash_offset;
 | |
|     uint16_t flash_index;
 | |
| } iot_ftm_ext_flash_cfg_t;
 | |
| 
 | |
| typedef struct _iot_ftm_disable_hwq {
 | |
|     /* hwq num */
 | |
|     uint8_t hwq_num  : 4,
 | |
|     /* the high 4bit indicates plc or rf, see IOT_FTM_HWQ_TYPE_XXX */
 | |
|             hwq_type : 4;
 | |
| } iot_ftm_disable_hwq_t;
 | |
| 
 | |
| typedef struct _phy_proto_parameter_set {
 | |
|     /* phy protocol type, see PLC_PROTO_TYPE_XXX */
 | |
|     uint8_t phy_proto : 4,
 | |
|     /* physical layer type, see IOT_FTM_PHY_TYPE_XXX */
 | |
|             phy_type  : 4;
 | |
|     union {
 | |
|         /* when phy_type is IOT_FTM_PHY_TYPE_PLC,
 | |
|          * plc_band mean band id of plc.
 | |
|          */
 | |
|         uint8_t    plc_band;
 | |
|         /* when phy_type is IOT_FTM_PHY_TYPE_RF,
 | |
|          * rf_option mean option of rf.
 | |
|          */
 | |
|         uint8_t    rf_option;
 | |
|     };
 | |
|     union {
 | |
|         /* when phy_type is IOT_FTM_PHY_TYPE_PLC,
 | |
|          * plc_maskid mean mask id of plc.
 | |
|          */
 | |
|         uint8_t    plc_maskid;
 | |
|         /* when phy_type is IOT_FTM_PHY_TYPE_RF,
 | |
|          * rf_channel mean channel of rf.
 | |
|          */
 | |
|         uint8_t    rf_channel;
 | |
|     };
 | |
| } phy_proto_parameter_set;
 | |
| 
 | |
| /* rf version and phy tx iqm calibration info */
 | |
| typedef struct _iot_ftm_phy_rf_ver_txiqm_cal {
 | |
|     /* tx I MAG balance calibration value, range range: 0~15 */
 | |
|     uint8_t     tx_i_mag : 4,
 | |
|     /* rf version, see RF_VER_XXX */
 | |
|                 rf_ver   : 4;
 | |
|     /* tx Q MAG balance calibration value, range range: 0~15 */
 | |
|     uint8_t     tx_q_mag;
 | |
|     /* tx I phase calibration value, range range: 0~31 */
 | |
|     uint8_t     tx_i_phase;
 | |
|     /* tx Q phase calibration value, range range: 0~31 */
 | |
|     uint8_t     tx_q_phase;
 | |
|     /* tx I dc calibration value, range range: -127~127 */
 | |
|     int8_t      tx_i_dc;
 | |
|     /* tx I dc calibration value, range range: -127~127 */
 | |
|     int8_t      tx_q_dc;
 | |
| } iot_ftm_phy_rf_ver_txiqm_cal_t;
 | |
| 
 | |
| /* rf phy tx fiter calibration info */
 | |
| typedef struct _iot_ftm_phy_rf_txf_cal {
 | |
|     /* flag mark if the value of the corresponding option is valid */
 | |
|     uint8_t    valid_mask;
 | |
|     /* tx filter bw calibration value for each option */
 | |
|     uint16_t   bw_sel_value[RF_OPTION_MAX];
 | |
| } iot_ftm_phy_rf_txf_cal_t;
 | |
| 
 | |
| typedef struct _rf_phy_tx_tone_set {
 | |
|     /* rf tx tone on or off, 1: on, 0: off */
 | |
|     uint32_t rf_txtone_onoff;
 | |
|     /* rf option */
 | |
|     uint32_t rf_option;
 | |
|     /* local frequence */
 | |
|     uint32_t freq;
 | |
|     /* tone num */
 | |
|     uint32_t tone_num   : 13,
 | |
|     /* tone attenuation */
 | |
|              tone_att   : 3,
 | |
|     /* reserved for future */
 | |
|              rsvd       : 16;
 | |
| } rf_phy_tx_tone_set_t;
 | |
| 
 | |
| typedef struct _rf_spi_sync_ctxt {
 | |
|     /* read or write, 1:write, 0:read */
 | |
|     uint8_t r_w;
 | |
|     /* rf spi addr */
 | |
|     uint16_t spi_addr;
 | |
|     /* rf spi value */
 | |
|     uint16_t spi_value;
 | |
| } rf_spi_sync_ctxt_t;
 | |
| 
 | |
| /* phy tx power sync massage */
 | |
| typedef struct _phy_power_sync {
 | |
|     /* set or get, 1:set, 0:get */
 | |
|     uint8_t  r_w;
 | |
|     /* tx power, rf:unit is dBm, hplc: unit is dBuV */
 | |
|     int8_t  power;
 | |
|     /* flag to mark if it is test mode power, only valid for rf msg */
 | |
|     uint8_t  is_test_mode  : 1,
 | |
|     /* test mode code, only valid for rf msg */
 | |
|              test_mode     : 2,
 | |
|     /* flag to mark if it is for hplc or not */
 | |
|              is_hplc       : 1,
 | |
|     /* reserved for further use */
 | |
|              rsvd          : 4;
 | |
| } phy_power_sync_t;
 | |
| 
 | |
| /* topo adc data dump */
 | |
| typedef struct _topo_adc_dump {
 | |
|     /* select dump phase, 1 - phase A, 2 - phase B, 3 - phase C */
 | |
|     uint8_t phase;
 | |
|     /* pga 1 gain index */
 | |
|     uint8_t gain1 : 4,
 | |
|     /* pga 2 gain index */
 | |
|             gain2 : 4;
 | |
|     /* adc data right shift num */
 | |
|     uint8_t shift_num;
 | |
|     /* discard num for each sample */
 | |
|     uint16_t discard_num;
 | |
|     /* data num for each sample */
 | |
|     uint16_t data_num;
 | |
|     /* number of samples to be sampled */
 | |
|     uint32_t samp_num;
 | |
| } topo_adc_dump_t;
 | |
| 
 | |
| /* topo adc data dump response */
 | |
| typedef struct _topo_adc_dump_rsp {
 | |
|     /* data buffer address */
 | |
|     uint32_t data_addr;
 | |
| } topo_adc_dump_rsp_t;
 | |
| 
 | |
| typedef struct _iot_ftm_mac_recv_sniffer {
 | |
|     /* sniffer log seq */
 | |
|     uint32_t seq    : 30,
 | |
|     /* indicates plc or rf, see FTM_INIT_xx_MODE */
 | |
|              mode   : 2;
 | |
|     /* payload label */
 | |
|     uint8_t data[0];
 | |
| } iot_ftm_mac_recv_sniffer_t;
 | |
| 
 | |
| /* define MP rf test case id */
 | |
| #define IOT_FTM_MP_RF_CASE_ID_CSI               0
 | |
| #define IOT_FTM_MP_RF_CASE_ID_CSR               1
 | |
| #define IOT_FTM_MP_RF_CASE_ID_TX_EVM            2
 | |
| #define IOT_FTM_MP_RF_CASE_ID_CHG_PHY           3
 | |
| #define IOT_FTM_MP_RF_CASE_ID_TX_CALI_BY_SNR    4
 | |
| 
 | |
| /* rf power up/down cmd and rf version check request */
 | |
| typedef struct _iot_ftm_mp_rf_chk_req {
 | |
|     /* read reg addr, after power up and power done, 0xffff is invalid addr */
 | |
|     uint16_t reg_addr;
 | |
| } iot_ftm_mp_rf_chk_req_t;
 | |
| 
 | |
| /* rf power up/down cmd and rf version check response */
 | |
| typedef struct _iot_ftm_mp_rf_chk_rsp {
 | |
|     /* rf check result, 0: ok, 1: fail */
 | |
|     uint8_t ret;
 | |
|     /* read reg value , after power down */
 | |
|     uint16_t reg_value_pd;
 | |
|     /* read reg value , after power up */
 | |
|     uint16_t reg_value_pu;
 | |
|     /* rf version, see RF_VER_XXX */
 | |
|     uint8_t ver;
 | |
| } iot_ftm_mp_rf_chk_rsp_t;
 | |
| 
 | |
| /* MP rf test cmd header */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_hdr {
 | |
|     /* test case id, see IOT_FTM_MP_RF_CASE_ID_XXX */
 | |
|     uint8_t  id;
 | |
|     /* rf option, see RF_OPTION_XXX */
 | |
|     uint8_t  option;
 | |
|     /* rf channel, see RF_CHANNEL_XXX */
 | |
|     uint8_t  channel;
 | |
|     /* payload header, see MCS_ID_XXX */
 | |
|     uint8_t  phr_mcs;
 | |
|     /* payload msc, see MCS_ID_XXX */
 | |
|     uint8_t  pld_mcs;
 | |
|     /* payload block size, see BLOCK_SIZE_XXX */
 | |
|     uint8_t  pld_blkz;
 | |
|     /* dut tx power, unit is dbm */
 | |
|     int8_t   dut_power;
 | |
|     /*  golden tx power, uint is dbm */
 | |
|     int8_t   golden_power;
 | |
|     /* cmd paload label */
 | |
|     uint8_t  data[0];
 | |
| } iot_ftm_mp_rf_cmd_hdr_t;
 | |
| 
 | |
| /* MP rf golden test cmd header */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_rx {
 | |
|     /* ftm rx command id, see FTM_CMD_RX_XXX */
 | |
|     uint8_t id;
 | |
|     /* rf option, see RF_OPTION_XXX */
 | |
|     uint8_t option;
 | |
|     /* rf channel, RF_CHANNEL_ID_XXX */
 | |
|     uint8_t channel;
 | |
| } iot_ftm_mp_rf_cmd_rx_t;
 | |
| 
 | |
| /* MP rf test case CSI cmd payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_csi {
 | |
|     /* threshold of tx rssi */
 | |
|     int8_t  tx_rssi_thr;
 | |
|     /* threshold of rx rssi */
 | |
|     int8_t  rx_rssi_thr;
 | |
|     /* Threshold of tx snr */
 | |
|     int8_t  tx_snr_thr;
 | |
|     /* Threshold of rx snr */
 | |
|     int8_t  rx_snr_thr;
 | |
|     /* reserved for further use */
 | |
|     uint8_t rsvd[8];
 | |
| } iot_ftm_mp_rf_cmd_csi_t;
 | |
| 
 | |
| /* MP rf test case CSR cmd payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_csr {
 | |
|     /* tx packet count */
 | |
|     uint16_t packet_num;
 | |
|     /* wait recv timeout, uint is ms */
 | |
|     uint16_t timeout;
 | |
|     /* if set, golden uses test mode power configuration. */
 | |
|     uint8_t  is_test_mode  : 1,
 | |
|     /* reserved field 0 for further use  */
 | |
|              rsvd0          : 7;
 | |
|     /* golden sends sample packet interval, unit: us. */
 | |
|     uint16_t interval;
 | |
|     /* reserved field 0 for further use  */
 | |
|     uint8_t  rsvd1[5];
 | |
| } iot_ftm_mp_rf_cmd_csr_t;
 | |
| 
 | |
| /* MP rf test case TX_EVM cmd payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_tx_evm {
 | |
|     /* tx packet count */
 | |
|     uint16_t packet_num;
 | |
|     /* flag to mark if normal power configuration is used */
 | |
|     uint8_t  is_nor_pwr  : 1,
 | |
|     /* not request rx result flag from golden */
 | |
|              no_req_flag : 1,
 | |
|     /* reserved for further use */
 | |
|              rsvd0       : 6;
 | |
|     /* DUT sends sample packet interval, unit: us. */
 | |
|     uint16_t interval;
 | |
|     /* reserved for further use */
 | |
|     uint8_t  rsvd1[7];
 | |
| } iot_ftm_mp_rf_cmd_tx_evm_t;
 | |
| 
 | |
| /* MP rf test case TX CALI cmd payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_tx_cali {
 | |
|     /* tx cali type, see RF_TEST_TX_CALI_REG_IQ_XXX */
 | |
|     uint8_t    type;
 | |
|     /* step units when changing i/q */
 | |
|     uint8_t    step;
 | |
|     /* number of times each data is sent repeatedly */
 | |
|     uint8_t    repeat_cnt;
 | |
|     /* tx I/Q MAG calibration value, range range: 0~15 */
 | |
|     /* tx I/Q PHASE calibration value, range range: 0~31 */
 | |
|     /* tx I/Q DC calibration value, range range: -127~127 */
 | |
|     int8_t     i_min;
 | |
|     int8_t     i_max;
 | |
|     int8_t     q_min;
 | |
|     int8_t     q_max;
 | |
|     /* flag to mark using real data or fitted data */
 | |
|     uint8_t    liner_fit_en : 1,
 | |
|     /* flag to mark if normal power configuration is used */
 | |
|                is_nor_pwr   : 1,
 | |
|     /* indicates the number of rounds to send packets */
 | |
|                rounds       : 3,
 | |
|     /* flag to mark whether to use i/q difference for calibration */
 | |
|                iq_delta_en  : 1,
 | |
|     /* reserved for further use */
 | |
|                rsvd         : 2;
 | |
|     /* reserved for further use */
 | |
|     uint8_t    rsvd1[9];
 | |
| } iot_ftm_mp_rf_cmd_tx_cali_t;
 | |
| 
 | |
| /* MP rf tx dc loop calibraton command */
 | |
| typedef struct _iot_ftm_rf_tx_dc_loop_cali {
 | |
|     /* rf option, see RF_OPTION_XXX */
 | |
|     uint8_t  option;
 | |
|     /* rf center frequency, unit Hz */
 | |
|     uint32_t freq;
 | |
|     /* delay time for obtaining adc data */
 | |
|     uint8_t  interval;
 | |
|     /* step value of traversing iq */
 | |
|     uint8_t  step;
 | |
|     /* pa power set */
 | |
|     uint16_t ldovs;
 | |
|     /* tx rf_att */
 | |
|     uint8_t  rf_att;
 | |
|     /* rsvd for future */
 | |
|     uint8_t  rsvd[4];
 | |
| } iot_ftm_rf_tx_dc_loop_cali_t;
 | |
| 
 | |
| /* MP rf tx dc loop calibraton response */
 | |
| typedef struct _iot_ftm_rf_tx_dc_loop_cali_rsp {
 | |
|     /* test result, see ERR_XXX */
 | |
|     uint8_t  result;
 | |
|     /* compensation value of DC i */
 | |
|     int8_t   i;
 | |
|     /* compensation value of DC q */
 | |
|     int8_t   q;
 | |
|     /* rsvd for future */
 | |
|     uint8_t  rsvd[4];
 | |
| } iot_ftm_rf_tx_dc_loop_cali_rsp_t;
 | |
| 
 | |
| /* MP rf test CHG PHY cmd payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_cmd_chg_phy {
 | |
|     /* rf option, see RF_OPTION_XXX */
 | |
|     uint8_t option;
 | |
|     /* rf channel, RF_CHANNEL_ID_XXX */
 | |
|     uint8_t channel;
 | |
| } iot_ftm_mp_rf_cmd_chg_phy_t;
 | |
| 
 | |
| /* MP rf test response header */
 | |
| typedef struct _iot_ftm_mp_rf_rsp_hdr {
 | |
|     /* test result, see ERR_XXX */
 | |
|     uint8_t  result;
 | |
|     /* test case id, see IOT_FTM_MP_RF_CASE_ID_XXX */
 | |
|     uint8_t  id;
 | |
|     /* resp payload label */
 | |
|     uint8_t  data[0];
 | |
| } iot_ftm_mp_rf_rsp_hdr_t;
 | |
| 
 | |
| /* MP rf test CSI response payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_rsp_csi {
 | |
|     /* tx rssi */
 | |
|     int8_t  tx_rssi;
 | |
|     /* rx rssi */
 | |
|     int8_t  rx_rssi;
 | |
|     /* tx snr */
 | |
|     int8_t  tx_snr;
 | |
|     /* rx snr */
 | |
|     int8_t  rx_snr;
 | |
|     /* tx gain */
 | |
|     uint8_t tx_gain;
 | |
|     /* rx gain */
 | |
|     uint8_t rx_gain;
 | |
|     /* reserved for further use */
 | |
|     uint8_t rsvd[14];
 | |
| } iot_ftm_mp_rf_rsp_csi_t;
 | |
| 
 | |
| /* MP rf test CSR response payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_rsp_csr {
 | |
|     /* rx success count */
 | |
|     uint16_t  rx_cnt;
 | |
|     /* rx average rssi */
 | |
|     int8_t    avg_rssi;
 | |
|     /* rx average snr */
 | |
|     int8_t    avg_snr;
 | |
|     /* reserved for further use */
 | |
|     uint8_t   rsvd[15];
 | |
| } iot_ftm_mp_rf_rsp_csr_t;
 | |
| 
 | |
| /* MP rf test TX EVM response payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_rsp_tx_evm {
 | |
|     /* rx success count */
 | |
|     uint16_t  rx_cnt;
 | |
|     /* 10 times the average RSSI of DUT tx evaluated by golden */
 | |
|     int16_t   avg_rssi;
 | |
|     /* 10 times the average snr of DUT tx evaluated by golden */
 | |
|     int16_t   avg_snr;
 | |
|     /* reserved for further use */
 | |
|     uint8_t   rsvd[14];
 | |
| } iot_ftm_mp_rf_rsp_tx_evm_t;
 | |
| 
 | |
| /* TX CALI result structure */
 | |
| typedef struct {
 | |
|     /* rf phy i value of MAG/PHASE register */
 | |
|     int8_t   i;
 | |
|     /* rf phy q value of MAG/PHASE register */
 | |
|     int8_t   q;
 | |
|     /* snr */
 | |
|     float    snr;
 | |
| } iot_ftm_mp_rf_tx_cali_comen_result_t;
 | |
| 
 | |
| /* MP rf test TX CALI response payload layout */
 | |
| typedef struct _iot_ftm_mp_rf_rsp_tx_cali {
 | |
|     /* indicates how many sets of i/q data are available next */
 | |
|     uint8_t   cnt;
 | |
|     /* TX CALI result payload */
 | |
|     iot_ftm_mp_rf_tx_cali_comen_result_t result[0];
 | |
| } iot_ftm_mp_rf_rsp_tx_cali_t;
 | |
| 
 | |
| /* MP rf calibration measurement cfg msg layout */
 | |
| typedef struct _iot_ftm_mp_rf_cal_meas_cfg {
 | |
|     /* configure golden to measurement mode, 1 - enable / 0 - disable */
 | |
|     uint8_t  meas_en;
 | |
|     /* rf option */
 | |
|     uint8_t  option;
 | |
|     /* rf channel */
 | |
|     uint8_t  ch;
 | |
|     /* communication power between DUT and golden (HPLC), uint is dBuV */
 | |
|     uint8_t  comm_pwr;
 | |
|     /* communication power between DUT and golden (HPLC), see MAC_TMI_XX */
 | |
|     uint8_t  comm_tmi;
 | |
| } iot_ftm_mp_rf_cal_meas_cfg_t;
 | |
| 
 | |
| /* MP rf calibration measurement req msg layout */
 | |
| typedef struct _iot_ftm_mp_rf_tx_cal_update {
 | |
|     /* tx I MAG balance calibration value, range range: 0~15 */
 | |
|     uint8_t     tx_i_mag;
 | |
|     /* tx Q MAG balance calibration value, range range: 0~15 */
 | |
|     uint8_t     tx_q_mag;
 | |
|     /* tx I phase calibration value, range range: 0~31 */
 | |
|     uint8_t     tx_i_phase;
 | |
|     /* tx Q phase calibration value, range range: 0~31 */
 | |
|     uint8_t     tx_q_phase;
 | |
|     /* tx I dc calibration value, range range: -127~127 */
 | |
|     int8_t      tx_i_dc;
 | |
|     /* tx Q dc calibration value, range range: -127~127 */
 | |
|     int8_t      tx_q_dc;
 | |
|     /* filter bandwidth sel value */
 | |
|     uint16_t    filter_bw_sel;
 | |
|     /* options corresponding to filter bandwidth sel value */
 | |
|     uint8_t     filter_option;
 | |
|     /* flag to mark if member tx_i_mag and tx_q_mag needs to be updated to RF */
 | |
|     uint8_t     tx_iq_mag_update   : 1,
 | |
|     /* flag to mark if member tx_i_phase and tx_q_phase needs to be updated
 | |
|      * to RF.
 | |
|      */
 | |
|                 tx_iq_phase_update : 1,
 | |
|     /* flag to mark if member tx_i_dc and tx_q_dc needs to be updated to RF */
 | |
|                 tx_iq_dc_update    : 1,
 | |
|     /* flag to mark if member filter_bw_sel needs to be updated to RF */
 | |
|                 filter_update      : 1,
 | |
|     /* reserved for further use */
 | |
|                 rsvd               : 4;
 | |
| } iot_ftm_mp_rf_tx_cal_update_t;
 | |
| 
 | |
| 
 | |
| /* MP rf calibration measurement req msg layout --  */
 | |
| typedef struct _iot_ftm_mp_rf_cal_meas_req {
 | |
|     /* tx calibration update info */
 | |
|     iot_ftm_mp_rf_tx_cal_update_t tx_cal;
 | |
|     /* receiving LO frequency used in measurement, uint is Hz*/
 | |
|     uint32_t    lo_freq;
 | |
|     /* index of tone signal in fft result */
 | |
|     uint16_t    tone_idx;
 | |
|     /* index of dc signal in fft result */
 | |
|     uint16_t    dc_idx;
 | |
|     /* index of img signal in fft result */
 | |
|     uint16_t    img_idx;
 | |
|     /* wait meas result timeout, uint is 1ms */
 | |
|     uint16_t    timeout;
 | |
|     /* request meas try cnt */
 | |
|     uint8_t     try_cnt;
 | |
|     /* average number of measurements */
 | |
|     uint8_t     avg_cnt;
 | |
|     /* reserved for further use */
 | |
|     uint8_t     rsvd[3];
 | |
| } iot_ftm_mp_rf_cal_meas_req_t;
 | |
| 
 | |
| /* MP rf calibration measurement response msg layout */
 | |
| typedef struct _iot_ftm_mp_rf_cal_meas_rsp {
 | |
|     /* error code, see ERR_XX */
 | |
|     uint8_t     err_no;
 | |
|     /* tone signal power, no gain compensation */
 | |
|     uint32_t    tone_pwr;
 | |
|     /* dc signal power, no gain compensation */
 | |
|     uint32_t    dc_pwr;
 | |
|     /* img signal power, no gain compensation */
 | |
|     uint32_t    img_pwr;
 | |
|     /* receive gain, uint is 0.01 */
 | |
|     uint16_t    gain;
 | |
|     /* reserved for further use */
 | |
|     uint8_t     rsvd[4];
 | |
| } iot_ftm_mp_rf_cal_meas_rsp_t;
 | |
| 
 | |
| typedef struct _iot_ftm_loader_tsfm_cfg{
 | |
|     uint16_t pulse_high_dur;
 | |
|     uint16_t pulse_low_dur;
 | |
|     uint32_t chara_bit_dur;
 | |
|     uint8_t data[2];
 | |
| }iot_ftm_loader_tsfm_cfg;
 | |
| 
 | |
| /* security data struct */
 | |
| typedef struct _iot_ftm_security_cfg {
 | |
|     /* security data version */
 | |
|     uint8_t version;
 | |
|     /* security data length */
 | |
|     uint16_t len;
 | |
|     /* security data */
 | |
|     uint8_t data[0];
 | |
| }iot_ftm_security_cfg_t;
 | |
| 
 | |
| typedef enum _iot_ftm_pt_info_operation_type {
 | |
|     PT_INFO_OPERATION_GET,      /* get pt info operation */
 | |
|     PT_INFO_OPERATION_SET,      /* set pt info operation */
 | |
| } iot_ftm_pt_info_operation_type;
 | |
| 
 | |
| /* pt info */
 | |
| typedef struct _iot_ftm_pt_info_hdr {
 | |
|     uint8_t operation_type;
 | |
| } iot_ftm_pt_info_hdr_t;
 | |
| 
 | |
| typedef struct _iot_ftm_get_pt_info {
 | |
|     /* indicate the result, 0:pass, 1:fail */
 | |
|     uint8_t ret;
 | |
|     /* the golden mac */
 | |
|     uint8_t golden_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* the bcd format of the time when pt taken */
 | |
|     uint8_t year;
 | |
|     uint8_t month;
 | |
|     uint8_t day;
 | |
|     uint8_t hour;
 | |
|     uint8_t min;
 | |
|     /* the fw version of golden */
 | |
|     uint32_t golden_fw_ver;
 | |
|     /* the version of pt tool */
 | |
|     uint32_t pt_tool_ver;
 | |
|     /* the fw version of pt board */
 | |
|     uint32_t pt_board_ver;
 | |
|     /* the fw version of dut */
 | |
|     uint32_t dut_fw_ver;
 | |
| } iot_ftm_get_pt_info_t;
 | |
| 
 | |
| typedef struct _iot_ftm_set_pt_info {
 | |
|     /* the golden mac */
 | |
|     uint8_t golden_mac[IOT_MAC_ADDR_LEN];
 | |
|     /* the bcd format of the time when pt taken */
 | |
|     uint8_t year;
 | |
|     uint8_t month;
 | |
|     uint8_t day;
 | |
|     uint8_t hour;
 | |
|     uint8_t min;
 | |
|     /* the fw version of golden */
 | |
|     uint32_t golden_fw_ver;
 | |
|     /* the version of pt tool */
 | |
|     uint32_t pt_tool_ver;
 | |
|     /* the fw version of pt board */
 | |
|     uint32_t pt_board_ver;
 | |
| } iot_ftm_set_pt_info_t;
 | |
| 
 | |
| typedef struct _iot_ftm_dump_to_mem_req {
 | |
|     /* dump which type of data into memory, see IOT_FTM_CMD_DUMP_TYPE_XXX */
 | |
|     uint8_t dump_type;
 | |
|     /* gain, unit is 1 dB */
 | |
|     int8_t gain;
 | |
| } iot_ftm_dump_to_mem_req_t;
 | |
| 
 | |
| typedef struct _iot_ftm_dump_to_mem_rsp {
 | |
|     /* indicate the result, 0: success, 1: fail */
 | |
|     uint8_t ret;
 | |
|     /* dump which type of data into memory, see IOT_FTM_CMD_DUMP_TYPE_XXX */
 | |
|     uint8_t dump_type;
 | |
|     /* gain, unit is 1 dB */
 | |
|     int8_t gain;
 | |
|     /* dump data memory address */
 | |
|     uint32_t dump_addr;
 | |
|     /* dump data len, unit is 1 byte */
 | |
|     uint32_t dump_len;
 | |
| } iot_ftm_dump_to_mem_rsp_t;
 | |
| 
 | |
| #if (IOT_MP_SUPPORT == 0)
 | |
| /* ftm tx type id */
 | |
| typedef enum _iot_ftm_tx_type_id {
 | |
|     DT_BCN          =0,
 | |
|     DT_SOF          ,
 | |
|     DT_SACK         ,
 | |
|     DT_RTS_CTS      ,
 | |
|     DT_SOUND        ,
 | |
|     DT_RSOF         ,
 | |
|     DT_END          ,
 | |
| } iot_ftm_tx_type_id_t;
 | |
| 
 | |
| /* tx case cfg */
 | |
| typedef struct _mpdu_send_case_cfg {
 | |
|     uint32_t interval_time; //unit 1'ms
 | |
|     uint32_t packe_num; // total numbers
 | |
|     uint32_t user_updata_time;
 | |
| } mpdu_send_case_cfg;
 | |
| 
 | |
| /* tx packet cfg */
 | |
| typedef struct _mpdu_send_pkt_cfg {
 | |
|     uint8_t  proto : 4,
 | |
|     /* the high 4bit indicates plc or rf, see FTM_INIT_xx_MODE */
 | |
|              work_mode : 4;
 | |
|     uint8_t  qid;
 | |
|     uint8_t  bcast;
 | |
|     uint8_t  delimiter_type;
 | |
|     uint32_t nid;
 | |
|     uint32_t dtei;
 | |
|     uint32_t stei;
 | |
|     uint8_t  tmi;
 | |
|     uint8_t  ext_tmi;
 | |
|     uint8_t  lid;
 | |
|     uint8_t  pb_num;
 | |
|     uint8_t  need_ack;
 | |
|     uint8_t  need_encry;             //encryption
 | |
|     uint8_t  need_decrypt;                //decrypt
 | |
|     uint32_t avln_idx_in_desc;
 | |
|     uint32_t key_table_idx_in_desc;
 | |
|     uint32_t key_idx_in_desc;
 | |
|     uint8_t  hw_retry_cnt;
 | |
|     uint8_t phase;
 | |
|     uint8_t pkt_idx;
 | |
| } mpdu_send_pkt_cfg;
 | |
| 
 | |
| /* rf tx packet cfg */
 | |
| typedef struct _mpdu_rf_send_pkt_cfg {
 | |
|     uint8_t  proto : 4,
 | |
|     /* the high 4bit indicates plc or rf, see FTM_INIT_xx_MODE */
 | |
|              work_mode : 4;
 | |
|     uint8_t  qid;
 | |
|     uint8_t  bcast;
 | |
|     uint8_t  delimiter_type;
 | |
|     uint32_t nid;
 | |
|     uint32_t dtei;
 | |
|     uint32_t stei;
 | |
|     uint8_t  phr_mcs;
 | |
|     uint8_t  pld_mcs;
 | |
|     uint8_t  pld_idx;
 | |
|     uint8_t  pb_num;
 | |
|     uint8_t  need_ack;
 | |
|     uint8_t  rx_result;
 | |
|     uint8_t  snr;
 | |
|     uint8_t  load;
 | |
|     uint8_t  ext_dli;
 | |
|     uint8_t pkt_idx;
 | |
| } mpdu_rf_send_pkt_cfg;
 | |
| 
 | |
| typedef struct _pkt_data_cfg {
 | |
|     uint32_t data_len;
 | |
|     uint8_t *data_pkt;
 | |
| }pkt_data_cfg_t;
 | |
| 
 | |
| typedef struct _cmd_cfg {
 | |
|     uint8_t  st_flag;
 | |
|     uint8_t  r_flag;
 | |
|     uint8_t  r_start_flag;
 | |
|     uint8_t  r_end_flag;
 | |
|     uint8_t  phase;
 | |
|     uint8_t  idle_bit;
 | |
|     uint8_t  req_int;
 | |
|     uint8_t  rx_rate_mode;
 | |
|     uint8_t  narrow_band;
 | |
|     uint32_t enable_bitmap;
 | |
|     uint32_t start_time;
 | |
|     uint32_t end_time;
 | |
| } cmd_cfg_t;
 | |
| 
 | |
| typedef struct _mpdu_send_pkt_cfg_list {
 | |
|     mpdu_send_pkt_cfg pktcfg;
 | |
|     uint8_t qenable;
 | |
| } mpdu_send_pkt_cfg_list;
 | |
| 
 | |
| typedef struct _mpdu_rf_send_pkt_cfg_list {
 | |
|     mpdu_rf_send_pkt_cfg pktcfg;
 | |
|     uint8_t qenable;
 | |
| } mpdu_rf_send_pkt_cfg_list;
 | |
| 
 | |
| typedef struct _pkt_cfg_list {
 | |
|     mpdu_send_pkt_cfg_list sg_spg_gp_pktcfg_list[MAX_FTM_HWQ_NUM];
 | |
|     mpdu_rf_send_pkt_cfg_list rf_pktcfg_list[MAX_FTM_RF_HWQ_NUM];
 | |
| }pkt_cfg_list;
 | |
| 
 | |
| typedef struct _send_case_ctxt{
 | |
|     pkt_cfg_list pktcfg_list;
 | |
|     mpdu_send_case_cfg casecfg;
 | |
|     uint8_t case_num;
 | |
| }send_case_ctxt_t;
 | |
| 
 | |
| /* sche test cfg*/
 | |
| typedef struct _sche_cfg {
 | |
|     uint8_t ping_cmd_num;
 | |
|     uint32_t ping_bcn_period;
 | |
|     uint8_t pong_cmd_num;
 | |
|     uint32_t pong_bcn_period;
 | |
|     cmd_cfg_t cmd_cfg[MAX_FTM_CMD_CNT];
 | |
| } sche_cfg_t;
 | |
| 
 | |
| /* tx mode cfg */
 | |
| typedef struct _txq_cfg {
 | |
|     uint8_t hwqid; // dbg mode 0-4, sch mode 0-24
 | |
|     uint8_t qtype; // 0 - tdma; 1 - csma
 | |
|     uint8_t qcap; // 0-4 for connectionless lid
 | |
| } txq_cfg_t;
 | |
| 
 | |
| typedef struct _mpdu_send_mode_cfg {
 | |
|     /* 0: sch; 1: dbg mode */
 | |
|     uint8_t tx_mode : 4,
 | |
|     /* the high 4bit indicates plc or rf, see FTM_INIT_xx_MODE */
 | |
|             work_mode : 4;
 | |
|     txq_cfg_t qcfg[MAX_FTM_HWQ_NUM]; // dbg cfg struct for hwq
 | |
| } mpdu_send_mode_cfg;
 | |
| 
 | |
| /* rx result */
 | |
| typedef struct _rx_report {
 | |
|     uint32_t time_used;
 | |
|     uint32_t rx_mpdus;
 | |
|     uint32_t succ_mpdus;
 | |
|     uint32_t total_bytes;
 | |
| } rx_report_t;
 | |
| typedef struct _ring_cfg {
 | |
|     uint8_t cfg_type;
 | |
|     uint8_t cfg_offset;
 | |
|     uint8_t cfg_enable;
 | |
| } ring_cfg_t;
 | |
| typedef struct _rx_cfg {
 | |
|     uint8_t ring_id : 4,
 | |
|     /* the high 4bit indicates plc or rf, see FTM_INIT_xx_MODE */
 | |
|             work_mode : 4;
 | |
|     uint8_t ring_sz;
 | |
|     uint32_t buf_sz;
 | |
|     uint8_t bufsz_filter_sel;
 | |
|     uint8_t filter;
 | |
|     ring_cfg_t ringcfg[2];  //desc and pb
 | |
|     uint8_t cert_flag;
 | |
| } rx_cfg_t;
 | |
| typedef struct _rx_filter_sel {
 | |
|     uint8_t ring_id;
 | |
|     uint8_t bufsz_filtr_sel;
 | |
| } filter_sel_t;
 | |
| typedef struct _rx_filter {
 | |
|     uint8_t ring_id;
 | |
|     uint8_t filter;
 | |
| } filter_t;
 | |
| typedef struct _sniffer_cfg {
 | |
|     uint8_t enable;
 | |
|     uint8_t sel;   //0: all desc+pb  1: only desc   2: only pb
 | |
|     uint16_t pb_dump_len;      //pb
 | |
| } sniffer_cfg_t;
 | |
| 
 | |
| typedef struct _crc_cfg {
 | |
|     /* generate crc mode */
 | |
|     uint8_t  fccs_by_sw;
 | |
|     uint8_t  pb_crc_by_sw;
 | |
|     uint8_t  bcn_crc_by_sw;
 | |
|     /* check mode */
 | |
|     uint8_t is_verify_fc;
 | |
|     uint8_t is_verify_pb;
 | |
|     uint8_t is_verify_payload;
 | |
| } crc_cfg_t;
 | |
| 
 | |
| typedef struct _mac_ping_tput {
 | |
|     uint32_t stei;
 | |
|     uint32_t dtei;
 | |
|     uint32_t nid;
 | |
|     uint8_t tmi;
 | |
|     uint8_t ext_tmi;
 | |
|     uint8_t pb_num;
 | |
|     uint32_t cont;
 | |
|     uint8_t ping_or_tput; //0:ping  1:tput
 | |
| } mac_ping_tput_t;
 | |
| 
 | |
| typedef struct _tei_nid_cfg {
 | |
|     uint32_t stei;
 | |
|     uint32_t nid;
 | |
| } tei_nid_t;
 | |
| typedef struct _rx_tput_cfg {
 | |
|     uint8_t tput_enable;
 | |
|     uint8_t tput_time;
 | |
| } rx_tput_cfg;
 | |
| 
 | |
| /*******************global bariable**********************/
 | |
| /* mpdu_send_cfg*/
 | |
| typedef struct _g_ftm_mpdu_send_cfg {
 | |
|     send_case_ctxt_t *g_mpdu_sendcase;
 | |
|     pkt_data_cfg_t pkt_data_cfg[MAX_FTM_HWQ_NUM];
 | |
|     timer_id_t send_pkt;
 | |
|     uint8_t tx_msg_cnt;
 | |
| } g_ftm_mpdu_send_cfg;
 | |
| 
 | |
| /* sniffer_cfg*/
 | |
| typedef struct _g_ftm_sniffer_cfg {
 | |
|     sniffer_cfg_t *g_sniffer_cfg;
 | |
|     /* sniffer log seq */
 | |
|     uint32_t sniffer_log_seq    : 30,
 | |
|     /* reserved */
 | |
|              rsv                : 2;
 | |
| } g_ftm_sniffer_cfg;
 | |
| 
 | |
| /* ping and tput cfg*/
 | |
| typedef struct _g_ftm_ping_tput_cfg {
 | |
|     rx_tput_cfg *rec_tput_cfg;
 | |
|     timer_id_t tput_timer_id;
 | |
|     uint32_t start_time_stamp;
 | |
|     uint32_t rx_sof_count;
 | |
|     uint32_t rx_sof_right_count;
 | |
|     uint32_t rx_beacon_count;
 | |
|     uint32_t rx_beacon_right_count;
 | |
|     uint32_t rx_pkt_seqnum;
 | |
| } g_ftm_ping_tput_cfg;
 | |
| 
 | |
| /* sche test cfg*/
 | |
| typedef struct _g_ftm_sche_cfg {
 | |
|     uint8_t ping_cmd_num;
 | |
|     uint8_t pong_cmd_num;
 | |
|     uint32_t ping_bcn_period;
 | |
|     uint32_t pong_bcn_period;
 | |
|     hw_sched_cmd_t *ping_cmdlist;
 | |
|     hw_sched_cmd_t *pong_cmdlist;
 | |
|     hw_sched_cmd_t *rf_ping_cmdlist;
 | |
|     hw_sched_cmd_t *rf_pong_cmdlist;
 | |
|     timer_id_t cmdlist_sch;
 | |
|     uint8_t sched_flag;
 | |
| } g_ftm_sche_cfg;
 | |
| 
 | |
| /* crc_cfg*/
 | |
| typedef struct _g_ftm_crc_cfg {
 | |
|     iot_pkt_t *ftm_msdu;
 | |
|     crc_cfg_t g_crc_cfg;
 | |
| } g_ftm_crc_cfg;
 | |
| 
 | |
| /* global variable*/
 | |
| typedef struct _g_ftm {
 | |
|     g_ftm_mpdu_send_cfg ftm_mpdu_send_cfg;
 | |
|     g_ftm_sniffer_cfg ftm_sniffer_cfg;
 | |
|     g_ftm_ping_tput_cfg ftm_ping_tput_cfg;
 | |
|     uint8_t rx_msg_show;
 | |
|     g_ftm_sche_cfg ftm_sche_cfg;
 | |
|     g_ftm_crc_cfg ftm_crc_cfg;
 | |
|     uint32_t nid_for_sync_ppm;
 | |
|     uint8_t cert_flag;
 | |
|     uint8_t hwq_inited : 1,
 | |
|             rf_hwq_inited : 1,
 | |
|             /*see FTM_INIT_WORK_MODE */
 | |
|             plc_rf_mode : 2,
 | |
|             rev0 : 4;
 | |
| } g_ftm;
 | |
| 
 | |
| #endif/* IOT_MP_SUPPORT == 0 */
 | |
| 
 | |
| /**
 | |
|   * @brief ftm_send_msg_helper()        -ftm send msg
 | |
|   * @param int msgid                    -msg id
 | |
|   * @param iot_pkt_t *buffer            -send buffer
 | |
|   * @param bool_t *need_free            -need free or not
 | |
|   * @return void
 | |
| */
 | |
| void ftm_send_msg_helper(int msgid, iot_pkt_t *buffer, bool_t *need_free);
 | |
| 
 | |
| #pragma pack(pop)   /* restore the pack status */
 | |
| 
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif /* IOT_FTM_MSG_H */
 |