892 lines
		
	
	
		
			32 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			892 lines
		
	
	
		
			32 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 PLC_BEACON_H
							 | 
						||
| 
								 | 
							
								#define PLC_BEACON_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								///This file define data struct share between CVG and MAC
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* os shim includes */
							 | 
						||
| 
								 | 
							
								#include "os_types_api.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "plc_fr.h"
							 | 
						||
| 
								 | 
							
								#include "plc_mpdu_header.h"
							 | 
						||
| 
								 | 
							
								#include "plc_protocol.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								extern "C" {
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* This file contains the beacon structure definition
							 | 
						||
| 
								 | 
							
								* and function to get/set the related field for packed
							 | 
						||
| 
								 | 
							
								* structure
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* pack for the structures in the whole file */
							 | 
						||
| 
								 | 
							
								#pragma pack(push)  /* save the pack status */
							 | 
						||
| 
								 | 
							
								#pragma pack(1)     /* 1 byte align */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID0 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_0           0
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID1 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_1           1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID2 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_2           2
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID3 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_3           3
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID4 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_4           4
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID8 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_8           8
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID9 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_9           9
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID10 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_10          10
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID11 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_11          11
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID12 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_12          12
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID13 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_13          13
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID14 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_14          14
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target band ID15 in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_15          15
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the target multi band in the frequency change entry */
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_MULTI_1_2   (128)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_MAX         BEACON_FREQ_BAND_ID_MULTI_1_2
							 | 
						||
| 
								 | 
							
								#define BEACON_FREQ_BAND_ID_INVALID     0xFF
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define the beacon send type */
							 | 
						||
| 
								 | 
							
								/* sent only hplc beacon */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_ONLY_HPLC             0
							 | 
						||
| 
								 | 
							
								/* send only rf standard beacon */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_ONLY_RF               1
							 | 
						||
| 
								 | 
							
								/* send hplc beacon, and send rf standard beacon at the end of the hplc slot */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_HPLC_RF               2
							 | 
						||
| 
								 | 
							
								/* send hplc beacon, and send rf simple beacon at the end of the hplc slot */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_HPLC_SIMPLE_RF        3
							 | 
						||
| 
								 | 
							
								/* send hplc beacon, and send rf simple beacon in csma slot */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_HPLC_CSMA_SIMPLE_RF   4
							 | 
						||
| 
								 | 
							
								/* send hplc beacon, and send rf standard beacon synchronously */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_HPLC_RF_SYNC          5
							 | 
						||
| 
								 | 
							
								/* send hplc beacon, and send rf simple beacon synchronously */
							 | 
						||
| 
								 | 
							
								#define BEACON_TX_HPLC_SIMPLE_RF_SYNC   6
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//TODO:the protocol has not yet defined the channel number
							 | 
						||
| 
								 | 
							
								/* define the target rf channel ID, min */
							 | 
						||
| 
								 | 
							
								#define RF_CHANNEL_ID_1                 1
							 | 
						||
| 
								 | 
							
								/* default channel id */
							 | 
						||
| 
								 | 
							
								#define RF_CHANNEL_ID_16                16
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* invalid channel id */
							 | 
						||
| 
								 | 
							
								#define RF_CHANNEL_ID_INVALID           0
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define encryption compatible mode */
							 | 
						||
| 
								 | 
							
								#define ENCRYPT_MODE_COMPAT             0
							 | 
						||
| 
								 | 
							
								/* define encryption forced mode */
							 | 
						||
| 
								 | 
							
								#define ENCRYPT_MODE_FORCE              1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define national encryption algorithm */
							 | 
						||
| 
								 | 
							
								#define ENCRYPT_ALGO_NATION             0
							 | 
						||
| 
								 | 
							
								/* define international encryption algorithm */
							 | 
						||
| 
								 | 
							
								#define ENCRYPT_ALGO_INTERNATION        1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define international encryption algorithm type */
							 | 
						||
| 
								 | 
							
								#define ECDHE_ECDSA_WITH_AES_128_CBC    0
							 | 
						||
| 
								 | 
							
								#define ECDHE_ECDSA_WITH_AES_128_GCM    1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define national encryption algorithm type */
							 | 
						||
| 
								 | 
							
								#define ECDHE_ECDSA_WITH_SM4_CBC_SM3    0
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef enum _beacon_entry_type_id {
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_STA_CAP = 0x00,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_RT_PARAM = 0x01,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_FREQ_CHQ = 0x02,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_RF_ROUTE = 0x03,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_RF_CHANNEL_CHQ = 0x04,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_RF_SIMPLE_PARAM = 0x05,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_RTC = 0x06,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_SPEC = 0xB1,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_ROAM = 0xB2,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_DATA = 0xB3,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_DEBUG = 0xB4,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_TSFM = 0xB5,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_SECURITY = 0xB6,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_VENDOR_RF = 0xB7,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_UNKNOWN = 0xBF,
							 | 
						||
| 
								 | 
							
								    MAC_BCN_TYPE_ID_TIME_SLOT = 0xC0
							 | 
						||
| 
								 | 
							
								} beacon_entry_type_id_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* header type + header len */
							 | 
						||
| 
								 | 
							
								#define get_bcn_entry_hdr_len(bcn_tid) \
							 | 
						||
| 
								 | 
							
								    ((bcn_tid >= MAC_BCN_TYPE_ID_TIME_SLOT)?3:2)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								* beacon frame payload common fixed structure
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_payload_fixed_header {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_type     : 3,        // byte 0 [0, 2]
							 | 
						||
| 
								 | 
							
								        sg_forming_complete : 1,        // byte 0 [3]
							 | 
						||
| 
								 | 
							
								        simple_beacon       : 1,        // byte 0 [4]
							 | 
						||
| 
								 | 
							
								        auth_enable         : 1,        // byte 0 [5]
							 | 
						||
| 
								 | 
							
								        allow_assoc         : 1,        // byte 0 [6]
							 | 
						||
| 
								 | 
							
								        allow_chan_eval     : 1;        // byte 0 [7]
							 | 
						||
| 
								 | 
							
								    uint8_t sg_forming_cnt;             // byte 1
							 | 
						||
| 
								 | 
							
								    uint8_t cco_mac_addr[6];            // byte 2-7
							 | 
						||
| 
								 | 
							
								    uint32_t beacon_seq_num;            // byte 8-11
							 | 
						||
| 
								 | 
							
								} beacon_payload_fixed_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* standard beacon frame payload structure */
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_payload_std_header {
							 | 
						||
| 
								 | 
							
								    beacon_payload_fixed_header_t fixed_hdr;
							 | 
						||
| 
								 | 
							
								    uint32_t rf_channel     : 8,
							 | 
						||
| 
								 | 
							
								             rf_option      : 2,
							 | 
						||
| 
								 | 
							
								             encrypt_mode   : 1,
							 | 
						||
| 
								 | 
							
								             cek_seq        : 2,
							 | 
						||
| 
								 | 
							
								             encrypt_algo   : 1,
							 | 
						||
| 
								 | 
							
								             rsvd1          : 18;
							 | 
						||
| 
								 | 
							
								    uint32_t rsvd2;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_num;
							 | 
						||
| 
								 | 
							
								    /* sizeof(struct _beacon_entry_sta_cap) */
							 | 
						||
| 
								 | 
							
								    /* sizeof(struct _beacon_entry_route) */
							 | 
						||
| 
								 | 
							
								    /* 0 or 1 x sizeof(struct _beacon_entry_freq_change) */
							 | 
						||
| 
								 | 
							
								    /* sizeof(struct _beacon_entry_time_slot_alloc) */
							 | 
						||
| 
								 | 
							
								    /* sizeof(payload ICV) */
							 | 
						||
| 
								 | 
							
								} beacon_payload_std_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* simple beacon frame payload structure */
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_payload_simple_header {
							 | 
						||
| 
								 | 
							
								    beacon_payload_fixed_header_t fixed_hdr;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_num;
							 | 
						||
| 
								 | 
							
								    /* sizeof(struct _beacon_entry_simple_param) */
							 | 
						||
| 
								 | 
							
								    /* sizeof(payload ICV) */
							 | 
						||
| 
								 | 
							
								} beacon_payload_simple_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_sta_cap {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x00 */
							 | 
						||
| 
								 | 
							
								    uint32_t beacon_entry_len   : 8,
							 | 
						||
| 
								 | 
							
								        tei                     : 12,
							 | 
						||
| 
								 | 
							
								        pco_tei                 : 12;
							 | 
						||
| 
								 | 
							
								    uint8_t reach_rate_to_cco;
							 | 
						||
| 
								 | 
							
								    uint8_t src_mac_addr[6];
							 | 
						||
| 
								 | 
							
								    uint8_t node_role           : 4,
							 | 
						||
| 
								 | 
							
								        node_level              : 4;
							 | 
						||
| 
								 | 
							
								    int8_t  snr_to_pco;
							 | 
						||
| 
								 | 
							
								    uint8_t phase               : 2,
							 | 
						||
| 
								 | 
							
								    /* rf hop to cco */
							 | 
						||
| 
								 | 
							
								            rf_hop              : 4,
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								            rsvd                : 2;
							 | 
						||
| 
								 | 
							
								} beacon_entry_sta_cap_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_route {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x01 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint16_t routing_update_intval;     /* unit second */
							 | 
						||
| 
								 | 
							
								    uint16_t next_update_countdown;     /* unit second */
							 | 
						||
| 
								 | 
							
								    uint16_t pco_discover_list_intval;  /* unit second */
							 | 
						||
| 
								 | 
							
								    uint16_t sta_discover_list_intval;  /* unit second */
							 | 
						||
| 
								 | 
							
								} beacon_entry_route_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_freq_change {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x02 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t target_freq;                /* target freq, chan 0 or 1 */
							 | 
						||
| 
								 | 
							
								    uint32_t change_countdown;          /* unit ms */
							 | 
						||
| 
								 | 
							
								} beacon_entry_freq_change_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_rf_route {
							 | 
						||
| 
								 | 
							
								    /* 0x03 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* rf discover list period, unit 1s */
							 | 
						||
| 
								 | 
							
								    uint8_t rf_dis_period;
							 | 
						||
| 
								 | 
							
								    /* rf traffic success ratio expired period, unit is 1 rf_dis_period */
							 | 
						||
| 
								 | 
							
								    uint8_t rf_age_period;
							 | 
						||
| 
								 | 
							
								} beacon_entry_rf_route_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_rf_channel_change {
							 | 
						||
| 
								 | 
							
								    /* 0x04 */
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_type;
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* target rf channel */
							 | 
						||
| 
								 | 
							
								    uint8_t  target_rf;
							 | 
						||
| 
								 | 
							
								    /* unit is 1ms */
							 | 
						||
| 
								 | 
							
								    uint32_t time_left;
							 | 
						||
| 
								 | 
							
								    /* target rf option */
							 | 
						||
| 
								 | 
							
								    uint8_t  target_option          :2,
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								             rsvd                   :6;
							 | 
						||
| 
								 | 
							
								} beacon_entry_rf_channel_chg_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_rtc {
							 | 
						||
| 
								 | 
							
								    /* entry type is 0x06 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;
							 | 
						||
| 
								 | 
							
								    /* entry len is 0x0A */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* stand for the delta between cco rtc and the base timer
							 | 
						||
| 
								 | 
							
								     * 2000.1.1 00:00:00, unit is 1s
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t cco_date;
							 | 
						||
| 
								 | 
							
								    /* cco ntb of corresponding date  */
							 | 
						||
| 
								 | 
							
								    uint32_t cco_ntb;
							 | 
						||
| 
								 | 
							
								} beacon_entry_rtc_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* vendor specific entry. this is a vendor specific beacon entry
							 | 
						||
| 
								 | 
							
								 * and is not defined in the CPLC spec. note that if any beacon entry
							 | 
						||
| 
								 | 
							
								 * are being used, beacon_entry_vendor_spec_t must exist and be the front
							 | 
						||
| 
								 | 
							
								 * of other vendor entries.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_spec {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb1 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* flag to mark if this network is for debug purpose */
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_debug           :1,
							 | 
						||
| 
								 | 
							
								    /* proxy selection duration required to join the ntwork. unit is 1 route
							 | 
						||
| 
								 | 
							
								     * period.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								                proxy_select_dur    :3,
							 | 
						||
| 
								 | 
							
								    /* flag to mark if fix rate should be used in the whole network */
							 | 
						||
| 
								 | 
							
								                fixed_rate          :1,
							 | 
						||
| 
								 | 
							
								    /* flag to mark if PCO should report SNR with it's direct sub STA
							 | 
						||
| 
								 | 
							
								     * periodically.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								                pco_snr_rpt         :1,
							 | 
						||
| 
								 | 
							
								    /* dual mode device tx config, 0 - invalid, 1 - async tx, 2 - sync tx */
							 | 
						||
| 
								 | 
							
								                dm_tx_cfg           :2;
							 | 
						||
| 
								 | 
							
								    uint8_t     allowed_cco_tf_sr;
							 | 
						||
| 
								 | 
							
								    uint16_t    vendor_id;
							 | 
						||
| 
								 | 
							
								    uint8_t     power;
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_spec_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_roam {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb2 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* define the rank from which the cco/pco role candidate start to take
							 | 
						||
| 
								 | 
							
								     * higher priority, this value must be equal or smaller than
							 | 
						||
| 
								 | 
							
								     * CANDIDATE_PROXY_COUNT.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     sta_proxy_weight_rank   :4,
							 | 
						||
| 
								 | 
							
								    /* for (level - base_level) <= level_score_high_th, level_score_l
							 | 
						||
| 
								 | 
							
								     * will take effect. Otherwise, level_score_h will take effect. The
							 | 
						||
| 
								 | 
							
								     * purpose is to try to minimize the topo tree depth while giving enough
							 | 
						||
| 
								 | 
							
								     * flexibility for candidate pco selection.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								                level_score_h_th        :4;
							 | 
						||
| 
								 | 
							
								    /* define sta proxy traffic success ratio threshold */
							 | 
						||
| 
								 | 
							
								    uint8_t     sta_proxy_good_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    /* define proxy roaming gap. if the new proxy is better enough than current
							 | 
						||
| 
								 | 
							
								     * proxy, then roaming to the new proxy.
							 | 
						||
| 
								 | 
							
								     * new_proxy_score > (cur_proxy_score + roaming_gap)
							 | 
						||
| 
								 | 
							
								     * the smaller the gap, the easier to roaming to a better proxy.
							 | 
						||
| 
								 | 
							
								     * if traffic success ratio with proxy lower than sta_proxy_good_tf_sr_th,
							 | 
						||
| 
								 | 
							
								     * local device will start to use sta_roaming_gap_l while selecting
							 | 
						||
| 
								 | 
							
								     * candidate pco. otherwise, sta_roaming_gap_h will be used.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     sta_roaming_gap_h;
							 | 
						||
| 
								 | 
							
								    uint8_t     sta_roaming_gap_l;
							 | 
						||
| 
								 | 
							
								    /* define cco phase traffic success ratio threshold */
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_phase_check_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    /* define level 1 device switch phase gap. if the new phase is better enough
							 | 
						||
| 
								 | 
							
								     * than current phase, then switch to the new phase.
							 | 
						||
| 
								 | 
							
								     * new_phase_score > (cur_phase_score + phase_gap)
							 | 
						||
| 
								 | 
							
								     * the smaller the gap, the easier to switch the phase.
							 | 
						||
| 
								 | 
							
								     * if traffic success ratio with cco higher than cco_phase_check_tf_sr_th,
							 | 
						||
| 
								 | 
							
								     * local device will start to use cco_phase_gap_other while selecting
							 | 
						||
| 
								 | 
							
								     * logical phase. if traffic success ratio with cco lower than
							 | 
						||
| 
								 | 
							
								     * sta_proxy_good_tf_sr_th, use cco_phase_gap_own_l, otherwise
							 | 
						||
| 
								 | 
							
								     * cco_phase_gap_own_h will be used.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_phase_gap_own_h;
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_phase_gap_own_l;
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_phase_gap_other;
							 | 
						||
| 
								 | 
							
								    /* define 1 level corresponding to how many score while calculating path
							 | 
						||
| 
								 | 
							
								     * score.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     level_score_h;
							 | 
						||
| 
								 | 
							
								    uint8_t     level_score_l;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_CCO_GOOD_XXX */
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_good_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_good_tx_sr_th;
							 | 
						||
| 
								 | 
							
								    uint8_t     cco_good_rx_sr_th;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_PCO_GOOD_XXX */
							 | 
						||
| 
								 | 
							
								    uint8_t     pco_good_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    uint8_t     pco_good_tx_sr_th;
							 | 
						||
| 
								 | 
							
								    uint8_t     pco_good_rx_sr_th;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_CLAMBER_TF_SR_TH */
							 | 
						||
| 
								 | 
							
								    uint8_t     clamber_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_CLAMBER_TARGET_TF_SR_TH */
							 | 
						||
| 
								 | 
							
								    uint8_t     clamber_target_tf_sr_th;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_PROXY_TF_SR_RANK */
							 | 
						||
| 
								 | 
							
								    uint8_t     proxy_tf_sr_rank;
							 | 
						||
| 
								 | 
							
								    /* see CVG_RT_STA_ROAM_LEARNING_CNT */
							 | 
						||
| 
								 | 
							
								    uint8_t     roam_learn_cnt;
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_roam_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_data {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb3 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* vendor app data */
							 | 
						||
| 
								 | 
							
								    uint8_t     data[14];
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_data_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_debug {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb4 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* target sta mac address */
							 | 
						||
| 
								 | 
							
								    uint8_t     addr[6];
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_debug_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_tsfm {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb5 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* interval that  sta should report calculated tsfm detection data to
							 | 
						||
| 
								 | 
							
								     * cco. unit is 1s.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint16_t    rpt_tsfm_dur;
							 | 
						||
| 
								 | 
							
								    /* algorithm to be used for transformer detection */
							 | 
						||
| 
								 | 
							
								    uint16_t    tsfm_algorithm          :4,
							 | 
						||
| 
								 | 
							
								    /* flag to mark if tsfm cco direct network detection enable */
							 | 
						||
| 
								 | 
							
								                tsfm_cco_detect_en      :1,
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								                rsvd                    :7,
							 | 
						||
| 
								 | 
							
								    /* level difference threshold if two networks level has big difference */
							 | 
						||
| 
								 | 
							
								                tsfm_level_big_diff_th  :4;
							 | 
						||
| 
								 | 
							
								    /* lowest valid snr threshold for tsfm, unit is 1 db */
							 | 
						||
| 
								 | 
							
								    int8_t      tsfm_low_snr_th;
							 | 
						||
| 
								 | 
							
								    /* percentage of highest snr statistics collected to be used for tsfm */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_snr_stat_high_th;
							 | 
						||
| 
								 | 
							
								    /* interval that sta should do tsfm detection check to unit is 1s. */
							 | 
						||
| 
								 | 
							
								    uint16_t    check_tsfm_dur;
							 | 
						||
| 
								 | 
							
								    /* snr difference threshold if two networks level is same, unit is 1 db */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_snr_diff_th1;
							 | 
						||
| 
								 | 
							
								    /* snr difference threshold if two networks level is same, unit is 1 db */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_snr_diff_th2;
							 | 
						||
| 
								 | 
							
								    /* cco lowest valid snr threshold for tsfm, unit is 1 db */
							 | 
						||
| 
								 | 
							
								    int8_t      tsfm_cco_low_snr_th;
							 | 
						||
| 
								 | 
							
								    /* penalty value if no cco snr was received in this statistical period,
							 | 
						||
| 
								 | 
							
								     * unit is 1 db.
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_cco_snr_penal;
							 | 
						||
| 
								 | 
							
								    /* cco difference threshold if two networks level is same, unit is 1 db */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_cco_diff_th1;
							 | 
						||
| 
								 | 
							
								    /* cco difference threshold if two networks level is same, unit is 1 times
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_cco_diff_th2;
							 | 
						||
| 
								 | 
							
								    /* zc ntb delta threshold for tsfm, unit is 100 ntb */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_zc_diff_th1;
							 | 
						||
| 
								 | 
							
								    /* zc ntb delta variance threshold for tsfm, unit is 1 times */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_zc_diff_th2;
							 | 
						||
| 
								 | 
							
								    /* zc period delta variance threshold for tsfm, unit is 1 times */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_zc_diff_th3;
							 | 
						||
| 
								 | 
							
								    /* zc ntb delta threshold for tsfm, unit is 1 times or 100 ntb */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_zc_diff_th4;
							 | 
						||
| 
								 | 
							
								    /* weight factor of received beacon snr for tsfm */
							 | 
						||
| 
								 | 
							
								    uint8_t     tsfm_snr_bc_factor    :4,
							 | 
						||
| 
								 | 
							
								    /* weight factor of received sof snr for tsfm */
							 | 
						||
| 
								 | 
							
								                tsfm_snr_sof_factor   :4;
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_tsfm_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_security {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb6 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* simple pair passcode */
							 | 
						||
| 
								 | 
							
								    uint16_t    passcode;
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								    uint16_t    rsvd;
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_security_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_vendor_rf {
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_type;      /* 0xb7 */
							 | 
						||
| 
								 | 
							
								    uint8_t     beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* rf tx power cap, unit is 1dbm */
							 | 
						||
| 
								 | 
							
								    int8_t      rf_power;
							 | 
						||
| 
								 | 
							
								    /* flag to mark if force link communication */
							 | 
						||
| 
								 | 
							
								    uint8_t     force_link_valid    : 1,
							 | 
						||
| 
								 | 
							
								    /* link type, 1 - force rf, 0 - force hplc */
							 | 
						||
| 
								 | 
							
								                force_rf_link       : 1,
							 | 
						||
| 
								 | 
							
								    /* flag to mark if rf power is valid */
							 | 
						||
| 
								 | 
							
								                rf_power_valid      : 1,
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								                rsvd1               : 5;
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								    uint8_t     rsvd[2];
							 | 
						||
| 
								 | 
							
								} beacon_entry_vendor_rf_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_time_slot_alloc {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0xc0 */
							 | 
						||
| 
								 | 
							
								    uint16_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t total_slot_non_cco_beacon;
							 | 
						||
| 
								 | 
							
								    uint16_t total_slot_cco_beacon  : 4,
							 | 
						||
| 
								 | 
							
								        csma_phase_num              : 2,
							 | 
						||
| 
								 | 
							
								        rsvd1                       : 10;
							 | 
						||
| 
								 | 
							
								    uint8_t total_slot_pco_beacon;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_slot_period;         /* unit ms */
							 | 
						||
| 
								 | 
							
								    uint8_t csma_slot_period;           /* unit 10ms */
							 | 
						||
| 
								 | 
							
								    uint8_t bind_csma_phase_num;        /* 1-3 */
							 | 
						||
| 
								 | 
							
								    uint8_t bind_csma_lid;
							 | 
						||
| 
								 | 
							
								    uint8_t tdma_period;                /* unit ms */
							 | 
						||
| 
								 | 
							
								    uint8_t tdma_lid;
							 | 
						||
| 
								 | 
							
								    uint32_t cur_beacon_timestamp;      /* NTB */
							 | 
						||
| 
								 | 
							
								    uint32_t beacon_period;             /* unit ms */
							 | 
						||
| 
								 | 
							
								    uint16_t rf_bc_slot_period      : 10,/* unit ms */
							 | 
						||
| 
								 | 
							
								             rsvd2                  : 6;
							 | 
						||
| 
								 | 
							
								    /* N x sizeof(struct _sub_beacon_entry_non_cco_beacon) */
							 | 
						||
| 
								 | 
							
								    /* (1,2,3) x sizeof(struct _sub_beacon_entry_csma_slot) */
							 | 
						||
| 
								 | 
							
								    /* (1,2,3) x sizeof(struct _sub_beacon_entry_bind_csma_slot) */
							 | 
						||
| 
								 | 
							
								    /* 1 x sizeof(beacon_payload_icv_t) */
							 | 
						||
| 
								 | 
							
								} beacon_entry_time_slot_alloc_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _sub_beacon_entry_non_cco_beacon {
							 | 
						||
| 
								 | 
							
								    uint16_t tei_to_send    : 12, /* designated TEI to send beacon */
							 | 
						||
| 
								 | 
							
								        beacon_type         : 1,  /* 0x0 - discovery, 0x1 - proxy */
							 | 
						||
| 
								 | 
							
								        tx_flag             : 3;  /* tx type flag, see BEACON_TX_XXX */
							 | 
						||
| 
								 | 
							
								} sub_beacon_entry_non_cco_beacon_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _sub_beacon_entry_csma_slot {
							 | 
						||
| 
								 | 
							
								    uint32_t csma_period    : 24, /* unit ms */
							 | 
						||
| 
								 | 
							
								        phase               : 2, /* corresponding phase */
							 | 
						||
| 
								 | 
							
								        resv                : 6;
							 | 
						||
| 
								 | 
							
								} sub_beacon_entry_csma_slot_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _sub_beacon_entry_bind_csma_slot {
							 | 
						||
| 
								 | 
							
								    uint32_t bind_csma_period   : 24, /* unit ms */
							 | 
						||
| 
								 | 
							
								        phase                   : 2, /* corresponding phase */
							 | 
						||
| 
								 | 
							
								        resv                    : 6;
							 | 
						||
| 
								 | 
							
								} sub_beacon_entry_bind_csma_slot_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* simple param entry */
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_entry_simple_param {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x05 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* tei */
							 | 
						||
| 
								 | 
							
								    uint32_t tei                : 12,
							 | 
						||
| 
								 | 
							
								    /* proxy tei */
							 | 
						||
| 
								 | 
							
								             pco_tei            : 12,
							 | 
						||
| 
								 | 
							
								    /* role */
							 | 
						||
| 
								 | 
							
								             role               : 4,
							 | 
						||
| 
								 | 
							
								    /* level */
							 | 
						||
| 
								 | 
							
								             level              : 4;
							 | 
						||
| 
								 | 
							
								    /* mac addr */
							 | 
						||
| 
								 | 
							
								    uint8_t  src_mac_addr[6];
							 | 
						||
| 
								 | 
							
								    /* rf hop to cco */
							 | 
						||
| 
								 | 
							
								    uint8_t  rf_hop             : 4,
							 | 
						||
| 
								 | 
							
								    /* encryption mode, see ENCRYPTION_MODE_XXX */
							 | 
						||
| 
								 | 
							
								             encrypt_mode       : 1,
							 | 
						||
| 
								 | 
							
								    /* encryption_algorithm, see ENCRYPTION_ALGORITHM_XXX */
							 | 
						||
| 
								 | 
							
								             encrypt_algo       : 1,
							 | 
						||
| 
								 | 
							
								             rsvd               : 2;
							 | 
						||
| 
								 | 
							
								    /* csma slot start ntb */
							 | 
						||
| 
								 | 
							
								    uint32_t csma_start_ntb;
							 | 
						||
| 
								 | 
							
								    /* csma slot duration, unit 1ms */
							 | 
						||
| 
								 | 
							
								    uint16_t csma_dur;
							 | 
						||
| 
								 | 
							
								} beacon_entry_simple_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _beacon_payload_icv {
							 | 
						||
| 
								 | 
							
								    uint32_t icv;
							 | 
						||
| 
								 | 
							
								} beacon_payload_icv_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if (SUPPORT_IEEE_1901)
							 | 
						||
| 
								 | 
							
								/* pb136 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_PB136_BC_PAYLOAD_SIZE       128
							 | 
						||
| 
								 | 
							
								/* pb520 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_PB520_BC_PAYLOAD_SIZE       512
							 | 
						||
| 
								 | 
							
								#else /* (SUPPORT_IEEE_1901) */
							 | 
						||
| 
								 | 
							
								/* pb136 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_PB136_BC_PAYLOAD_SIZE       129
							 | 
						||
| 
								 | 
							
								/* pb520 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_PB520_BC_PAYLOAD_SIZE       513
							 | 
						||
| 
								 | 
							
								#endif /* (SUPPORT_IEEE_1901) */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* maximum allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_MAX_BC_PAYLOAD_SIZE         PLC_PB520_BC_PAYLOAD_SIZE
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* maximum allowed beacon payload size for non cco beacon slot */
							 | 
						||
| 
								 | 
							
								#define PLC_MAX_BC_NON_CCO_SLOT_SIZE(_bc_pld_size_, _bcsma_valid_) \
							 | 
						||
| 
								 | 
							
								    ((_bc_pld_size_) \
							 | 
						||
| 
								 | 
							
								    - sizeof(beacon_payload_std_header_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(beacon_entry_sta_cap_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(beacon_entry_route_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(beacon_entry_time_slot_alloc_t) \
							 | 
						||
| 
								 | 
							
								    - (PLC_PHASE_CNT * sizeof(sub_beacon_entry_csma_slot_t)) \
							 | 
						||
| 
								 | 
							
								    - ((_bcsma_valid_) ? \
							 | 
						||
| 
								 | 
							
								    (PLC_PHASE_CNT * sizeof(sub_beacon_entry_bind_csma_slot_t)) : 0) \
							 | 
						||
| 
								 | 
							
								    - (HPLC_RF_SUPPORT ? sizeof(beacon_entry_rf_route_t) : 0))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define calculation method of beacon payload size */
							 | 
						||
| 
								 | 
							
								#define PLC_BC_PLD_SIZE(_phase_cnt_, _non_cco_slot_cnt_, _bcsma_valid_, \
							 | 
						||
| 
								 | 
							
								    _vendor_spec_valid_)   \
							 | 
						||
| 
								 | 
							
								    (sizeof(beacon_payload_std_header_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(beacon_entry_sta_cap_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(beacon_entry_route_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(beacon_entry_time_slot_alloc_t) \
							 | 
						||
| 
								 | 
							
								    + ((_phase_cnt_) * sizeof(sub_beacon_entry_csma_slot_t)) \
							 | 
						||
| 
								 | 
							
								    + ((_bcsma_valid_) ? \
							 | 
						||
| 
								 | 
							
								    ((_phase_cnt_) * sizeof(sub_beacon_entry_bind_csma_slot_t)) : 0) \
							 | 
						||
| 
								 | 
							
								    + ((_non_cco_slot_cnt_) * sizeof(sub_beacon_entry_non_cco_beacon_t)) \
							 | 
						||
| 
								 | 
							
								    + (HPLC_RF_SUPPORT ? sizeof(beacon_entry_rf_route_t) : 0) \
							 | 
						||
| 
								 | 
							
								    + ((_vendor_spec_valid_) ? sizeof(beacon_entry_vendor_spec_t) : 0))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* SPG define start */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/*
							 | 
						||
| 
								 | 
							
								 * beacon frame payload structure
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_payload_fixed_header {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_type         : 3,
							 | 
						||
| 
								 | 
							
								        spg_forming_complete    : 1,
							 | 
						||
| 
								 | 
							
								        simple_beacon           : 1,
							 | 
						||
| 
								 | 
							
								        multi_select_func_swt   : 1,
							 | 
						||
| 
								 | 
							
								        allow_assoc             : 1, /* con_start_flag */
							 | 
						||
| 
								 | 
							
								        allow_chan_eval         : 1; /* valid when simple_beacon == 1 */
							 | 
						||
| 
								 | 
							
								    uint8_t spg_forming_sn;
							 | 
						||
| 
								 | 
							
								} spg_beacon_payload_fixed_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* standard beacon frame payload structure */
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_payload_std_header {
							 | 
						||
| 
								 | 
							
								    spg_beacon_payload_fixed_header_t fixed_hdr;
							 | 
						||
| 
								 | 
							
								    uint32_t short_network_id   : 4,
							 | 
						||
| 
								 | 
							
								        rf_option               : 2,
							 | 
						||
| 
								 | 
							
								        rsvd1                   : 2,
							 | 
						||
| 
								 | 
							
								        rf_channel              : 8,
							 | 
						||
| 
								 | 
							
								        rsvd2                   : 16;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_num;
							 | 
						||
| 
								 | 
							
								} spg_beacon_payload_std_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* simple beacon frame payload structure */
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_payload_simple_header {
							 | 
						||
| 
								 | 
							
								    spg_beacon_payload_fixed_header_t fixed_hdr;
							 | 
						||
| 
								 | 
							
								    uint8_t cco_mac_addr[6];
							 | 
						||
| 
								 | 
							
								    uint32_t beacon_seq_num;
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_num;
							 | 
						||
| 
								 | 
							
								    /* sizeof(struct _spg_beacon_entry_simple_param) */
							 | 
						||
| 
								 | 
							
								    /* sizeof(payload ICV) */
							 | 
						||
| 
								 | 
							
								} spg_beacon_payload_simple_header_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/** SPG beacon entry type                 | length of beacon entry(byte(s))
							 | 
						||
| 
								 | 
							
								*
							 | 
						||
| 
								 | 
							
								*   0x00:invalible value                  |
							 | 
						||
| 
								 | 
							
								*   0x01:station capability               |     1
							 | 
						||
| 
								 | 
							
								*   0x02:time slot allocation             |     2
							 | 
						||
| 
								 | 
							
								*   0x03:resv                             |
							 | 
						||
| 
								 | 
							
								*   0x04:resv                             |
							 | 
						||
| 
								 | 
							
								*   0x05:resv                             |
							 | 
						||
| 
								 | 
							
								*   0x06:route parameter entry type       |     1
							 | 
						||
| 
								 | 
							
								*   0x07:freuency change entry type       |     1
							 | 
						||
| 
								 | 
							
								*   0x08:occupy                           |     2
							 | 
						||
| 
								 | 
							
								*   0x09:used for meter reading
							 | 
						||
| 
								 | 
							
								*   0x0A~0xFF:resv                        |
							 | 
						||
| 
								 | 
							
								*
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								typedef enum _spg_beacon_entry_type_id {
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_STA_CAP     = 0x01,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_TIME_SLOT   = 0x02,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_RT_PARAM    = 0x06,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_FREQ_CHQ    = 0x07,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_OCCUPY      = 0x08,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_METER       = 0x09,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_FB_DETECT   = 0x0a,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_RTC         = 0x0b,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_RF_ROUTE    = 0x0c,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_RF_CHANNEL_CHQ = 0x0d,
							 | 
						||
| 
								 | 
							
								    SPG_MAC_BCN_TYPE_ID_RF_SIMPLE_PARAM = 0x0e,
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_type_id_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* get entry_header len + length_field len , entry_header always 1byte */
							 | 
						||
| 
								 | 
							
								/* length_field len reference _spg_beacon_entry_type_id */
							 | 
						||
| 
								 | 
							
								#define get_bcn_entry_hdr_len_spg(bcn_tid) \
							 | 
						||
| 
								 | 
							
								    (((bcn_tid == SPG_MAC_BCN_TYPE_ID_TIME_SLOT) || \
							 | 
						||
| 
								 | 
							
								    (bcn_tid == SPG_MAC_BCN_TYPE_ID_OCCUPY))?3:2)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_sta_cap {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x01 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t node_level      : 6,
							 | 
						||
| 
								 | 
							
								        phase               : 2;
							 | 
						||
| 
								 | 
							
								    uint16_t tei            : 12,
							 | 
						||
| 
								 | 
							
								        node_role           : 4;
							 | 
						||
| 
								 | 
							
								    uint8_t bcn_used_flag;
							 | 
						||
| 
								 | 
							
								    uint8_t src_mac_addr[6];
							 | 
						||
| 
								 | 
							
								    uint16_t pco_tei        : 12,
							 | 
						||
| 
								 | 
							
								        rf_hop              : 4;
							 | 
						||
| 
								 | 
							
								    uint32_t reach_rate_to_cco;
							 | 
						||
| 
								 | 
							
								    uint32_t rsvd;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_sta_cap_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_route {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x06 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint16_t routing_update_intval;     /* unit second */
							 | 
						||
| 
								 | 
							
								    uint16_t rsvd1;
							 | 
						||
| 
								 | 
							
								    uint16_t next_update_countdown;     /* unit second */
							 | 
						||
| 
								 | 
							
								    uint8_t rsvd2[20];
							 | 
						||
| 
								 | 
							
								    uint8_t cco_mac_addr[6];
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_route_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_freq_change {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x07 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t target_freq;
							 | 
						||
| 
								 | 
							
								    uint32_t change_countdown;          /* unit ms */
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_freq_change_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_time_slot_alloc {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x02 */
							 | 
						||
| 
								 | 
							
								    uint16_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t total_slot_non_cco_beacon;
							 | 
						||
| 
								 | 
							
								    uint8_t total_slot_cco_beacon;
							 | 
						||
| 
								 | 
							
								    uint8_t csma_phase_num;             /* 0~3 */
							 | 
						||
| 
								 | 
							
								    uint8_t total_slot_pco_beacon;
							 | 
						||
| 
								 | 
							
								    uint16_t beacon_slot_period;        /* unit: 100us */
							 | 
						||
| 
								 | 
							
								    uint8_t csma_slot_period;           /* unit: 1ms or 10ms */
							 | 
						||
| 
								 | 
							
								    uint8_t bind_csma_phase_num;        /* 0~3 */
							 | 
						||
| 
								 | 
							
								    uint8_t bind_csma_lid;
							 | 
						||
| 
								 | 
							
								    uint16_t tdma_period;               /* unit: 100us */
							 | 
						||
| 
								 | 
							
								    uint8_t tdma_lid;
							 | 
						||
| 
								 | 
							
								    uint32_t cur_beacon_timestamp;      /* NTB */
							 | 
						||
| 
								 | 
							
								    uint32_t beacon_period;             /* unit: 100us */
							 | 
						||
| 
								 | 
							
								    uint32_t rf_bc_slot_period    : 10, /* unit ms */
							 | 
						||
| 
								 | 
							
								             rsvd                 : 22;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_time_slot_alloc_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_sub_beacon_entry_non_cco_beacon {
							 | 
						||
| 
								 | 
							
								    uint16_t tei_to_send    : 12,
							 | 
						||
| 
								 | 
							
								        beacon_type         : 1,
							 | 
						||
| 
								 | 
							
								        tx_flag             : 3;  /* tx type flag, see BEACON_TX_XXX */
							 | 
						||
| 
								 | 
							
								} spg_sub_beacon_entry_non_cco_beacon_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_sub_beacon_entry_csma_slot {
							 | 
						||
| 
								 | 
							
								    uint32_t csma_period    : 24,       /* unit:100us */
							 | 
						||
| 
								 | 
							
								        phase               : 8;
							 | 
						||
| 
								 | 
							
								} spg_sub_beacon_entry_csma_slot_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_sub_beacon_entry_bind_csma_slot {
							 | 
						||
| 
								 | 
							
								    uint32_t bind_csma_period   : 24,   /* unit:100us */
							 | 
						||
| 
								 | 
							
								        phase                   : 8;
							 | 
						||
| 
								 | 
							
								} spg_sub_beacon_entry_bind_csma_slot_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_payload_icv {
							 | 
						||
| 
								 | 
							
								    uint32_t icv;
							 | 
						||
| 
								 | 
							
								} spg_beacon_payload_icv_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_meter {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x09 */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    uint8_t data[0];
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_meter_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_fb_detect {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x0a */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* target frequency band id of detection */
							 | 
						||
| 
								 | 
							
								    uint8_t band_id;
							 | 
						||
| 
								 | 
							
								    /* dedicated csma slot supported link id */
							 | 
						||
| 
								 | 
							
								    uint8_t d_csma_lid;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_fb_detect_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_rtc {
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_type;          /* 0x0b */
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_len;           /* 0x0a */
							 | 
						||
| 
								 | 
							
								    /* stand for the delta between cco rtc and the base timer 2000.1.1 00:00:00,
							 | 
						||
| 
								 | 
							
								     * unit is 1s
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    uint32_t cco_date;
							 | 
						||
| 
								 | 
							
								    /* cco ntb of corresponding date, unit is 1NTB */
							 | 
						||
| 
								 | 
							
								    uint32_t cco_ntb;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_rtc_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_rf_route {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x0c */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* rf discover list period, unit 1s */
							 | 
						||
| 
								 | 
							
								    uint8_t rf_dis_period;
							 | 
						||
| 
								 | 
							
								    /* rf traffic success ratio aging period, unit is 1 rf_dis_period */
							 | 
						||
| 
								 | 
							
								    uint8_t rf_age_period;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_rf_route_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_rf_channel_change {
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_type;         /* 0x0d */
							 | 
						||
| 
								 | 
							
								    uint8_t  beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* target rf channel */
							 | 
						||
| 
								 | 
							
								    uint8_t  target_rf;
							 | 
						||
| 
								 | 
							
								    /* target rf option */
							 | 
						||
| 
								 | 
							
								    uint8_t  target_option          :2,
							 | 
						||
| 
								 | 
							
								    /* reserved for future */
							 | 
						||
| 
								 | 
							
								             rsvd                   :6;
							 | 
						||
| 
								 | 
							
								    /* unit is 1ms */
							 | 
						||
| 
								 | 
							
								    uint32_t time_left;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_rf_channel_chg_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* simple param entry */
							 | 
						||
| 
								 | 
							
								typedef struct _spg_beacon_entry_simple_param {
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_type;          /* 0x0e */
							 | 
						||
| 
								 | 
							
								    uint8_t beacon_entry_len;
							 | 
						||
| 
								 | 
							
								    /* tei */
							 | 
						||
| 
								 | 
							
								    uint32_t tei                : 12,
							 | 
						||
| 
								 | 
							
								    /* proxy tei */
							 | 
						||
| 
								 | 
							
								             pco_tei            : 12,
							 | 
						||
| 
								 | 
							
								    /* role */
							 | 
						||
| 
								 | 
							
								             role               : 4,
							 | 
						||
| 
								 | 
							
								    /* level */
							 | 
						||
| 
								 | 
							
								             level              : 4;
							 | 
						||
| 
								 | 
							
								    /* mac addr */
							 | 
						||
| 
								 | 
							
								    uint8_t  src_mac_addr[6];
							 | 
						||
| 
								 | 
							
								    /* rf hop to cco */
							 | 
						||
| 
								 | 
							
								    uint8_t  rf_hop             : 4,
							 | 
						||
| 
								 | 
							
								    /* hplc frequency band, see BEACON_FREQ_BAND_ID_XXX */
							 | 
						||
| 
								 | 
							
								             freq_band          : 2,
							 | 
						||
| 
								 | 
							
								             rsvd               : 2;
							 | 
						||
| 
								 | 
							
								    /* csma slot start ntb */
							 | 
						||
| 
								 | 
							
								    uint32_t csma_start_ntb;
							 | 
						||
| 
								 | 
							
								    /* csma slot duration, unit 1ms */
							 | 
						||
| 
								 | 
							
								    uint16_t csma_dur;
							 | 
						||
| 
								 | 
							
								} spg_beacon_entry_simple_param_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* pb136 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define SPG_PLC_PB136_BC_PAYLOAD_SIZE       128
							 | 
						||
| 
								 | 
							
								/* pb520 allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define SPG_PLC_PB520_BC_PAYLOAD_SIZE       512
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* maximum allowed beacon payload size */
							 | 
						||
| 
								 | 
							
								#define SPG_PLC_MAX_BC_PAYLOAD_SIZE         SPG_PLC_PB520_BC_PAYLOAD_SIZE
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* maximum allowed beacon payload size for non cco beacon slot */
							 | 
						||
| 
								 | 
							
								#define SPG_PLC_MAX_BC_NON_CCO_SLOT_SIZE \
							 | 
						||
| 
								 | 
							
								    (SPG_PLC_MAX_BC_PAYLOAD_SIZE \
							 | 
						||
| 
								 | 
							
								    - sizeof(spg_beacon_payload_std_header_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(spg_beacon_entry_sta_cap_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(spg_beacon_entry_route_t) \
							 | 
						||
| 
								 | 
							
								    - sizeof(spg_beacon_entry_time_slot_alloc_t) \
							 | 
						||
| 
								 | 
							
								    - (PLC_PHASE_CNT * sizeof(spg_sub_beacon_entry_csma_slot_t)) \
							 | 
						||
| 
								 | 
							
								    - (PLC_PHASE_CNT * sizeof(spg_sub_beacon_entry_bind_csma_slot_t)) \
							 | 
						||
| 
								 | 
							
								    - (HPLC_RF_SUPPORT ? sizeof(beacon_entry_rf_route_t) : 0))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* define calculation method of beacon payload size */
							 | 
						||
| 
								 | 
							
								#define SPG_PLC_BC_PLD_SIZE(_phase_cnt_, _non_cco_slot_cnt_, _bcsma_valid_, \
							 | 
						||
| 
								 | 
							
								    _vendor_spec_valid_)   \
							 | 
						||
| 
								 | 
							
								    (sizeof(spg_beacon_payload_std_header_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(spg_beacon_entry_sta_cap_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(spg_beacon_entry_route_t) \
							 | 
						||
| 
								 | 
							
								    + sizeof(spg_beacon_entry_time_slot_alloc_t) \
							 | 
						||
| 
								 | 
							
								    + ((_phase_cnt_) * sizeof(spg_sub_beacon_entry_csma_slot_t)) \
							 | 
						||
| 
								 | 
							
								    + ((_bcsma_valid_) ? \
							 | 
						||
| 
								 | 
							
								    ((_phase_cnt_) * sizeof(spg_sub_beacon_entry_bind_csma_slot_t)) : 0) \
							 | 
						||
| 
								 | 
							
								    + ((_non_cco_slot_cnt_) * sizeof(spg_sub_beacon_entry_non_cco_beacon_t)) \
							 | 
						||
| 
								 | 
							
								    + ((_vendor_spec_valid_) ? sizeof(beacon_entry_vendor_spec_t) : 0))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* SPG define end */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* GREEN PHY define start */
							 | 
						||
| 
								 | 
							
								typedef PREPACK struct _hp_bcn_bmi_entry_hdr {
							 | 
						||
| 
								 | 
							
								    uint8_t behdr;
							 | 
						||
| 
								 | 
							
								    uint8_t belen;
							 | 
						||
| 
								 | 
							
								} POSTPACK hp_bcn_bmi_entry_hdr;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* none persist sch - start */
							 | 
						||
| 
								 | 
							
								typedef PREPACK struct _hp_bcn_bmi_np_sch_hdr {
							 | 
						||
| 
								 | 
							
								    uint8_t ns  : 6,
							 | 
						||
| 
								 | 
							
								        rsvd    : 2;
							 | 
						||
| 
								 | 
							
								} POSTPACK hp_bcn_bmi_np_sch_entry;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef PREPACK struct _hp_bcn_bmi_np_sch_sai_wo_st {
							 | 
						||
| 
								 | 
							
								    uint8_t stpf    : 1,
							 | 
						||
| 
								 | 
							
								        glid        : 7;
							 | 
						||
| 
								 | 
							
								    uint16_t et     : 12,
							 | 
						||
| 
								 | 
							
								        rsvd        : 4;
							 | 
						||
| 
								 | 
							
								} POSTPACK hp_bcn_bmi_np_sch_sai_wo_st;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef PREPACK struct _hp_bcn_bmi_np_sch_sai_w_st {
							 | 
						||
| 
								 | 
							
								    uint32_t stpf   : 1,
							 | 
						||
| 
								 | 
							
								        glid        : 7,
							 | 
						||
| 
								 | 
							
								        st          : 12,
							 | 
						||
| 
								 | 
							
								        et          : 12;
							 | 
						||
| 
								 | 
							
								} POSTPACK hp_bcn_bmi_np_sch_sai_w_st;
							 | 
						||
| 
								 | 
							
								/* none persist sch - end */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef PREPACK struct _hp_beacon_payload_fixed_header {
							 | 
						||
| 
								 | 
							
								    uint64_t nid    : 54,
							 | 
						||
| 
								 | 
							
								        hm          : 2,
							 | 
						||
| 
								 | 
							
								        stei        : 8;
							 | 
						||
| 
								 | 
							
								    uint64_t bt     : 3,
							 | 
						||
| 
								 | 
							
								        ncnr        : 1,
							 | 
						||
| 
								 | 
							
								        npsm        : 1,
							 | 
						||
| 
								 | 
							
								        numslots    : 3,
							 | 
						||
| 
								 | 
							
								        slotusage   : 8,
							 | 
						||
| 
								 | 
							
								        slotid      : 3,
							 | 
						||
| 
								 | 
							
								        aclss       : 3,
							 | 
						||
| 
								 | 
							
								        hoip        : 1,
							 | 
						||
| 
								 | 
							
								        rtsbf       : 1,
							 | 
						||
| 
								 | 
							
								        nm          : 2,
							 | 
						||
| 
								 | 
							
								        ccocap      : 2,
							 | 
						||
| 
								 | 
							
								        rsf         : 1,
							 | 
						||
| 
								 | 
							
								        plevel      : 3;
							 | 
						||
| 
								 | 
							
								    union {
							 | 
						||
| 
								 | 
							
								        /* BMI */
							 | 
						||
| 
								 | 
							
								        struct {
							 | 
						||
| 
								 | 
							
								            uint8_t nbe;
							 | 
						||
| 
								 | 
							
								            /* size of hp_bcn_bmi_entry_hdr */
							 | 
						||
| 
								 | 
							
								            /* size of entry content */
							 | 
						||
| 
								 | 
							
								            /* ... */
							 | 
						||
| 
								 | 
							
								            /* size of hp_bcn_bmi_entry_hdr */
							 | 
						||
| 
								 | 
							
								            /* size of entry content */
							 | 
						||
| 
								 | 
							
								            /* size of hp_bcn_bmi_entry_hdr */
							 | 
						||
| 
								 | 
							
								            /* size of entry content */
							 | 
						||
| 
								 | 
							
								        } bmi_hdr;
							 | 
						||
| 
								 | 
							
								        /* OPAD PAD */
							 | 
						||
| 
								 | 
							
								        uint32_t opad[30];
							 | 
						||
| 
								 | 
							
								    } bmi;
							 | 
						||
| 
								 | 
							
								    uint32_t bpcs;
							 | 
						||
| 
								 | 
							
								} POSTPACK hp_beacon_payload_fixed_header;
							 | 
						||
| 
								 | 
							
								/* GREEM PHY define end */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ieee1901 define start */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								typedef struct _i1901_beacon_payload_icv {
							 | 
						||
| 
								 | 
							
								    uint32_t icv;
							 | 
						||
| 
								 | 
							
								} i1901_beacon_payload_icv_t;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* ieee1901 define end */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#if SUPPORT_GREEN_PHY == 0 \
							 | 
						||
| 
								 | 
							
								 && SUPPORT_SMART_GRID == 0 \
							 | 
						||
| 
								 | 
							
								 && SUPPORT_SOUTHERN_POWER_GRID == 0
							 | 
						||
| 
								 | 
							
								#error("no PLC network type defined.")
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#pragma pack(pop)   // restore the pack status
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifdef __cplusplus
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /* PLC_BEACON_H */
							 |