159 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			159 lines
		
	
	
		
			5.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_PROTO_DEV_TEST_H
 | 
						|
#define _IOT_PROTO_DEV_TEST_H
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
#pragma pack(push)      /* save the pack status */
 | 
						|
#pragma pack(1)         /* 1 byte align */
 | 
						|
 | 
						|
/* FN code stands for CIU's ack for push-data */
 | 
						|
#define IOT_DEV_TEST_645_FN_ACK_FROM_CIU    0x1F
 | 
						|
/* FN code stands for bootup indication's response */
 | 
						|
#define IOT_DEV_TEST_645_FN_RSP_BOOTUP_IND  0x13
 | 
						|
/* indicate whether the debug infor should be printed or not */
 | 
						|
#define IOT_DEV_TEST_DEBUG_EN               0
 | 
						|
/* define the buffer length for debug infor printing */
 | 
						|
#define IOT_DEV_TEST_LOG_BUF_LEN            128
 | 
						|
 | 
						|
enum dev_test_fn
 | 
						|
{
 | 
						|
    /* set band Fn */
 | 
						|
    IOT_DEV_TEST_FN_SET_BAND            = 0x01,
 | 
						|
    /* querry band Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_BAND         = 0x02,
 | 
						|
    /* querry software version Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_VER          = 0x03,
 | 
						|
    /* respons for querring band Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_BAND_RSP     = 0x04,
 | 
						|
    /* respons for querring software version Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_VER_RSP      = 0x05,
 | 
						|
    /* set local mac Fn */
 | 
						|
    IOT_DEV_TEST_FN_SET_MAC             = 0x06,
 | 
						|
    /* querry local mac Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_MAC          = 0x07,
 | 
						|
    /* respons for querring mac Fn */
 | 
						|
    IOT_DEV_TEST_FN_QUERRY_MAC_RSP      = 0x08,
 | 
						|
    /* set CKQ operation mode */
 | 
						|
    IOT_DEV_TEST_FN_SET_OP_MODE         = 0x09,
 | 
						|
    /* query CKQ operation mode */
 | 
						|
    IOT_DEV_TEST_FN_QUERY_OP_MODE       = 0x0A,
 | 
						|
    /* response for querying operation mode */
 | 
						|
    IOT_DEV_TEST_FN_QUERY_OP_MODE_RSP   = 0x0B,
 | 
						|
    /* set UART baudrate */
 | 
						|
    IOT_DEV_TEST_FN_SET_UART_BAUDRATE   = 0x0C,
 | 
						|
    /* query UART baudrate */
 | 
						|
    IOT_DEV_TEST_FN_QUERY_BAUDRATE      = 0x0D,
 | 
						|
    /* response for querying UART baudrate */
 | 
						|
    IOT_DEV_TEST_FN_QUERY_BAUD_RSP      = 0x0E,
 | 
						|
    /* set rf option and rf channel */
 | 
						|
    IOT_DEV_TEST_FN_SET_RF              = 0x0F,
 | 
						|
    /* set rf tx power */
 | 
						|
    IOT_DEV_TEST_FN_SET_RF_TX_POWER     = 0x10,
 | 
						|
    /* set hplc tx power */
 | 
						|
    IOT_DEV_TEST_FN_SET_HPLC_TX_POWER   = 0x11,
 | 
						|
    /* set tx link type */
 | 
						|
    IOT_DEV_TEST_FN_SET_TX_LINK_TYPE    = 0x12,
 | 
						|
    /* used Fn Max count */
 | 
						|
    IOT_DEV_TEST_FN_PRIVATE_MAX         = IOT_DEV_TEST_FN_SET_TX_LINK_TYPE
 | 
						|
};
 | 
						|
 | 
						|
/* minimal respons frame lenth  */
 | 
						|
#define IOT_DEV_TEST_RSP_FRAME_LEN_MIN  0x0C
 | 
						|
 | 
						|
/* response status */
 | 
						|
#define IOT_DEV_TEST_RSP_OK             0x00
 | 
						|
#define IOT_DEV_TEST_RSP_ERR            0x01
 | 
						|
 | 
						|
/* reaseon for response error */
 | 
						|
enum dev_test_rsp_reason
 | 
						|
{
 | 
						|
    /* no err */
 | 
						|
    IOT_DEV_TEST_REASON_OK              = 0x00,
 | 
						|
    /* out of range */
 | 
						|
    IOT_DEV_TEST_REASON_OUT_RNG         = 0x01,
 | 
						|
    /* double setting */
 | 
						|
    IOT_DEV_TEST_REASON_DUP_SET         = 0x02,
 | 
						|
    /* not supporting */
 | 
						|
    IOT_DEV_TEST_REASON_NOT_SUPPORT     = 0x03,
 | 
						|
    /* error mac */
 | 
						|
    IOT_DEV_TEST_REASON_MAC_INVALID     = 0x04,
 | 
						|
    /* saving error */
 | 
						|
    IOT_DEV_TEST_REASON_SAVE_ERR        = 0x05,
 | 
						|
    /* configuration invalid */
 | 
						|
    IOT_DEV_TEST_REASON_CFG_INVALID     = 0x06
 | 
						|
};
 | 
						|
 | 
						|
/* supporting max band */
 | 
						|
#define IOT_DEV_TEST_MAX_BAND           0x04
 | 
						|
 | 
						|
/* data lenth in response frame's data field */
 | 
						|
#define IOT_DEV_TEST_DATA_FIELD_LEN     0x04
 | 
						|
 | 
						|
typedef struct _dev_test_ext_cfg {
 | 
						|
    /* flag to mark if rf_option and rf_channel config is available */
 | 
						|
    uint8_t     rf_valid            :1,
 | 
						|
    /* flag to mark if rf_tx_power config is available */
 | 
						|
                rf_power_valid      :1,
 | 
						|
    /* flag to mark if hplc_tx_power config is available */
 | 
						|
                hplc_power_valid    :1,
 | 
						|
    /* rf tx only for app */
 | 
						|
                rf_tx_only          :1,
 | 
						|
    /* reserved for future */
 | 
						|
                rsvd1               :4;
 | 
						|
    /* rf option, see IOT_PLC_RF_OPTION_XX */
 | 
						|
    uint8_t     rf_option;
 | 
						|
    /* rf channel, see IOT_PLC_OPTION1_CHANNEL_ID_XX */
 | 
						|
    uint8_t     rf_channel;
 | 
						|
    /* tx power of rf, unit is 1 dbm */
 | 
						|
    int8_t      rf_tx_power;
 | 
						|
    /* tx power of hplc, unit is 1 dbuv */
 | 
						|
    uint8_t     hplc_tx_power;
 | 
						|
    /* reserved for future */
 | 
						|
    uint8_t     rsvd2[5];
 | 
						|
} dev_test_ext_cfg_t;
 | 
						|
 | 
						|
typedef struct _dev_test_mode_cfg {
 | 
						|
    /* band ID to be configured, see PLC_LIB_FREQ_BAND_X */
 | 
						|
    uint8_t     band_id;
 | 
						|
    /* configuring effective duration, uint is sec */
 | 
						|
    uint8_t     dur;
 | 
						|
    /* the target device ID group that needs to respond to this command.
 | 
						|
     * see IOT_DEV_TEST_TARGET_ID_MSK_XXX.
 | 
						|
     */
 | 
						|
    uint32_t    target_id_mask  :2,
 | 
						|
    /* reserved for future */
 | 
						|
                reserved        :29,
 | 
						|
    /* flag to mark if ext configuration is enabled.
 | 
						|
     * 1 means enable, 0 means disable
 | 
						|
     */
 | 
						|
                ext_cfg_en      :1;
 | 
						|
    /* ext configuration */
 | 
						|
    dev_test_ext_cfg_t ext_cfg[0];
 | 
						|
} dev_test_mode_cfg_t;
 | 
						|
 | 
						|
#pragma pack(pop)   /* restore the pack status */
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif  //_IOT_PROTO_DEV_TEST_H
 | 
						|
 |