301 lines
		
	
	
		
			9.3 KiB
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			301 lines
		
	
	
		
			9.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 MAC_UNI_CFG_API_H
 | |
| #define MAC_UNI_CFG_API_H
 | |
| #include "os_types.h"
 | |
| 
 | |
| #include "mac_rf_scan.h"
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| typedef struct _cfg_data_tlv {
 | |
|     uint32_t type;
 | |
|     uint32_t len;
 | |
| } cfg_data_tlv;
 | |
| 
 | |
| /* get phy support band range*/
 | |
| #define PLC_GET_SUPPORT_BAND               0
 | |
| /* get plc scan band range*/
 | |
| #define PLC_GET_SCAN_BAND                  1
 | |
| 
 | |
| /* type id of cfg */
 | |
| /* vdev region */
 | |
| #define PLC_VDEV_CFG                        50
 | |
| 
 | |
| #define PLC_VDEV_CFG_SET_SELF_TEI           (PLC_VDEV_CFG + 0)
 | |
| #define PLC_VDEV_CFG_GET_SELF_TEI           (PLC_VDEV_CFG + 1)
 | |
| #define PLC_VDEV_CFG_SET_STA_INFO           (PLC_VDEV_CFG + 2)
 | |
| #define PLC_VDEV_CFG_GET_STA_INFO           (PLC_VDEV_CFG + 3)
 | |
| #define PLC_VDEV_CFG_ADD_D_SUB_STA          (PLC_VDEV_CFG + 4)
 | |
| #define PLC_VDEV_CFG_DELETE_D_SUB_STA       (PLC_VDEV_CFG + 5)
 | |
| #define PLC_VDEV_CFG_SET_BL_NID             (PLC_VDEV_CFG + 6)
 | |
| #define PLC_VDEV_CFG_SET_PREFER_NID         (PLC_VDEV_CFG + 7)
 | |
| #define PLC_VDEV_CFG_SET_FIXED_RATE         (PLC_VDEV_CFG + 8)
 | |
| #define PLC_VDEV_CFG_SET_TX_POWER_CAP       (PLC_VDEV_CFG + 9)
 | |
| #define PLC_VDEV_CFG_SET_NID_ONLY           (PLC_VDEV_CFG + 10)
 | |
| #define PLC_VDEV_CFG_SET_TEI_ONLY           (PLC_VDEV_CFG + 11)
 | |
| #define PLC_VDEV_CFG_DUMP_REQ               (PLC_VDEV_CFG + 12)
 | |
| #define PLC_VDEV_CFG_SET_NW_VALID           (PLC_VDEV_CFG + 13)
 | |
| #define PLC_VDEV_CFG_SET_PM_SAVE_CFG        (PLC_VDEV_CFG + 14)
 | |
| #define PLC_VDEV_CFG_CTL_CHECK_SPUR         (PLC_VDEV_CFG + 15)
 | |
| #define PLC_VDEV_CFG_SET_RF_CHANNEL         (PLC_VDEV_CFG + 16)
 | |
| #define PLC_VDEV_CFG_SET_FORCE_PHASE        (PLC_VDEV_CFG + 17)
 | |
| #define PLC_VDEV_CFG_SET_STA_JOIN           (PLC_VDEV_CFG + 18)
 | |
| #define PLC_VDEV_CFG_SET_HPLC_RF_ASYNC_TX   (PLC_VDEV_CFG + 19)
 | |
| #define PLC_VDEV_CFG_SET_NW_NEGO            (PLC_VDEV_CFG + 20)
 | |
| #define PLC_VDEV_CFG_SET_SEC_KEY            (PLC_VDEV_CFG + 21)
 | |
| #define PLC_VDEV_CFG_SET_FORCE_LINK         (PLC_VDEV_CFG + 22)
 | |
| #define PLC_VDEV_CFG_GET_NID_PPM            (PLC_VDEV_CFG + 23)
 | |
| #define PLC_VDEV_CFG_SET_3PS_OPPOSITE       (PLC_VDEV_CFG + 24)
 | |
| 
 | |
| #define PLC_PDEV_CFG                        80
 | |
| 
 | |
| #define PLC_PDEV_CFG_SET_BAND               (PLC_PDEV_CFG + 0)
 | |
| #define PLC_PDEV_CFG_SET_SWAGC              (PLC_PDEV_CFG + 1)
 | |
| #define PLC_PDEV_CFG_SET_SCAN_BAND_TBL      (PLC_PDEV_CFG + 2)
 | |
| #define PLC_PDEV_CFG_GET_BAND_TBL           (PLC_PDEV_CFG + 3)
 | |
| #define PLC_PDEV_CFG_SET_RF_SCAN_TBL        (PLC_PDEV_CFG + 4)
 | |
| 
 | |
| #define PLC_BL_NID_LIST_MAX                 32
 | |
| 
 | |
| /* rate adaptation fixed low rate */
 | |
| #define PLC_RATE_ADAPT_RATE_LOW             1
 | |
| /* rate adaptation fixed medium rate */
 | |
| #define PLC_RATE_ADAPT_RATE_MEDIUM          2
 | |
| /* rate adaptation fixed high rate */
 | |
| #define PLC_RATE_ADAPT_RATE_HIGH            3
 | |
| 
 | |
| #define MAC_ENCRYPT_SG_MSDU_AES_CBC         1
 | |
| #define MAC_ENCRYPT_SG_MSDU_AES_GCM         2
 | |
| #define MAC_ENCRYPT_SG_MSDU_SM4_CBC         3
 | |
| #define MAC_ENCRYPT_IEEE1901_1_PB_AES_CBC   4
 | |
| 
 | |
| #define MAC_ENCRYPT_KEY_BIT_LEN_128         128
 | |
| #define MAC_ENCRYPT_KEY_BIT_LEN_192         192
 | |
| #define MAC_ENCRYPT_KEY_BIT_LEN_256         256
 | |
| 
 | |
| #define MAC_SEC_KEY_COUNT_MAX               2
 | |
| #define MAC_SEC_KEY_LEN                     32
 | |
| 
 | |
| typedef struct _mac_sec_key {
 | |
|     /* encryption algorithm type, see MAC_ENCRYPT_XXX */
 | |
|     uint8_t  encrypt_type   :4,
 | |
|     /* encryption key type, see ENCRYPT_KEY_TYPE_xxx */
 | |
|              key_type       :2,
 | |
|     /* reserved for future */
 | |
|              rsvd           :2;
 | |
|     /* key bit length, see MAC_ENCRYPT_KEY_BIT_LEN_XXX */
 | |
|     uint16_t keybits;
 | |
|     /* this cek corresponds to the following key */
 | |
|     uint8_t  cek_seq[MAC_SEC_KEY_COUNT_MAX];
 | |
|     /* key data */
 | |
|     uint8_t  key[MAC_SEC_KEY_COUNT_MAX][MAC_SEC_KEY_LEN];
 | |
| } mac_sec_key_t;
 | |
| 
 | |
| typedef struct _plc_ppm_status {
 | |
|     uint32_t nid;
 | |
|     /* ntb ppm err, unit: 1 ppm */
 | |
|     int16_t ppm_err;
 | |
| } plc_ppm_status_t;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv hdr;
 | |
|     uint16_t self_tei;
 | |
| } PLC_VDEV_CFG_SET_SELF_TEI_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint16_t        self_tei;
 | |
|     uint16_t        proxy_tei;
 | |
|     uint8_t         phase;
 | |
| } PLC_VDEV_CFG_SET_STA_INFO_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     tei_t           sub_sta;
 | |
| } PLC_VDEV_CFG_D_SUB_STA_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* number of valid nid in the list */
 | |
|     uint32_t        cnt;
 | |
|     /* black list nid */
 | |
|     uint32_t        nid[PLC_BL_NID_LIST_MAX];
 | |
| } PLC_VDEV_CFG_SET_BL_NID_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* preferred nid */
 | |
|     uint32_t        nid;
 | |
|     /* preferred proxy tei */
 | |
|     tei_t           proxy;
 | |
| } PLC_VDEV_CFG_SET_PREFER_NID_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if fixed rate enabled */
 | |
|     uint8_t         enable;
 | |
|     /* fixed rate level, see PLC_RATE_ADAPT_RATE_XXX*/
 | |
|     uint8_t         rate_level;
 | |
| } PLC_VDEV_CFG_SET_FIXED_RATE_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if hplc power config is valid*/
 | |
|     uint8_t         hplc_valid :1,
 | |
|     /* flag to mark if rf power config is valid*/
 | |
|                     rf_valid   :1,
 | |
|                     rsvd       :6;
 | |
|     /* hplc tx power cap to be set. unit is 1 dbuv, range 95 - 137 */
 | |
|     uint8_t         hplc_power;
 | |
|     /* rf tx power cap to be set. unit is 1 dbm, range -35 - 20 */
 | |
|     int8_t          rf_power;
 | |
| } PLC_VDEV_CFG_SET_TX_POWER_CAP_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint8_t         rf_channel;  //rf channel
 | |
|     uint8_t         rf_option;
 | |
| } PLC_VDEV_CFG_SET_RF_CHANNEL_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* cco:flag to mark if force phase enabled
 | |
|      * sta/3ps: not used.
 | |
|      */
 | |
|     uint8_t         enable;
 | |
|     /* cco: force phy phase. see PLC_PHASE_xx.
 | |
|      * sta/3ps: force tx switch gpio phase. see PLC_PHASE_xx.
 | |
|      */
 | |
|     uint8_t         phase;
 | |
| } PLC_VDEV_CFG_SET_FORCE_PHASE_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if sta joined network */
 | |
|     uint8_t         join_flag;
 | |
| } PLC_VDEV_CFG_SET_STA_JOIN_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if 3ps sta physical phase is opposite */
 | |
|     uint8_t         opposite_3ps;
 | |
| } PLC_VDEV_CFG_SET_3PS_OPPOSITE_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint32_t        band_id;     //band id
 | |
| } PLC_PDEV_CFG_SET_BANDID_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint32_t        nid;     //nid
 | |
| } PLC_PDEV_CFG_SET_NID_ONLY_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint16_t        self_tei;
 | |
| } PLC_PDEV_CFG_SET_TEI_ONLY_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint32_t        ena;     //ena/dis
 | |
| } PLC_PDEV_CFG_SET_SWAGC_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv        hdr;
 | |
|     /* get support band or scan band.
 | |
|      * 0: SUPPORT BAND.
 | |
|      * 1: SCAN BAND.
 | |
|      */
 | |
|     uint8_t             is_scan_band;
 | |
|     /* number of valid band in plc scan table */
 | |
|     uint8_t             plc_scan_cnt;
 | |
|     /* plc scan table */
 | |
|     plc_scan_band_t     plc_scan_tbl[PLC_SCAN_BAND_MAX_CNT];
 | |
| } PLC_PDEV_CFG_BAND_RANGE_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* number of valid rf in rf scan table */
 | |
|     uint8_t         rf_cnt;
 | |
|     /* rf scan table */
 | |
|     mac_rf_scan_op_chn_t  rf_scan_tbl[MAC_RF_SCAN_OP_CHN_MAX];
 | |
| } PLC_PDEV_CFG_RF_RANGE_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
| } PLC_VDEV_CFG_DUMP_REQ_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
| } PLC_VDEV_CFG_SET_NW_VALID_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint8_t         allow_sleep;
 | |
| } PLC_VDEV_CFG_SET_PM_SAVE_CFG_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint8_t         is_start;
 | |
| } PLC_PDEV_CFG_CTL_CK_SPUR_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     uint8_t         hplc_rf_async_tx;
 | |
| } PLC_PDEV_CFG_SET_HPLC_RF_ASYNC_TX;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if neighbour network negotiation enabled */
 | |
|     uint8_t         enable;
 | |
| } PLC_VDEV_CFG_SET_NW_NEGO_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* the security key information */
 | |
|     mac_sec_key_t   key_info;
 | |
| } PLC_VDEV_CFG_SET_SEC_KEY_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* flag to mark if force link enabled */
 | |
|     uint8_t         force_link_en : 1,
 | |
|     /* force link type, 1 - force rf, 0 - force hplc */
 | |
|                     force_rf_link : 1,
 | |
|     /* reserved for future */
 | |
|                     rsvd          : 6;
 | |
| } PLC_VDEV_CFG_SET_FORCE_LINK_STRUCT;
 | |
| 
 | |
| typedef struct {
 | |
|     cfg_data_tlv    hdr;
 | |
|     /* number of valid nid ppm */
 | |
|     uint8_t         vaild_nid_cnt;
 | |
|     /* point to plc_ppm_status_t  nid_ppm_tbl[PLC_MAX_NEIGHBOR_NETWORK] */
 | |
|     void            *ppm_tbl;
 | |
| } PLC_VDEV_CFG_NID_PPM_STRUCT;
 | |
| 
 | |
| // place other cfg in the following
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 | |
| 
 | |
| #endif // !MAC_UNI_CFG_API_H
 |