646 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			646 lines
		
	
	
		
			19 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_MPDU_HEADER_H
 | 
						|
#define PLC_MPDU_HEADER_H
 | 
						|
 | 
						|
///This file define data struct share between CVG and MAC
 | 
						|
 | 
						|
/* os shim includes */
 | 
						|
#include "os_types_api.h"
 | 
						|
 | 
						|
#include "plc_fr.h"
 | 
						|
#include "iot_utils_api.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 DBG_PKT_VERSION                 (0xf)
 | 
						|
 | 
						|
enum FC_DELIM_TYPE {
 | 
						|
    FC_DELIM_BEACON = 0,
 | 
						|
    DT_AV_BEACON = 0,
 | 
						|
    FC_DELIM_SOF = 1,
 | 
						|
    DT_AV_SOF = 1,
 | 
						|
    FC_DELIM_SACK = 2,
 | 
						|
    DT_AV_SACK = 2,
 | 
						|
    FC_DELIM_NNCCO = 3,
 | 
						|
    DT_AV_RTS_CTS = 3,
 | 
						|
    FC_DELIM_SOUND = 4,
 | 
						|
    DT_AV_SOUND = 4, //self defined type for dtest
 | 
						|
    I1901_RTS_CTS = 4,
 | 
						|
    DT_AV_RSOF = 5,
 | 
						|
    /* custom delimiter type for RF test */
 | 
						|
    FC_DELIM_RF_TEST = 7,
 | 
						|
};
 | 
						|
 | 
						|
/* define RF test type */
 | 
						|
typedef enum {
 | 
						|
    /* tx calibration */
 | 
						|
    RF_TEST_TYPE_TX_CALI = 0,
 | 
						|
} RF_TEST_TYPE_T;
 | 
						|
 | 
						|
/* define RF test tx calibration register type */
 | 
						|
typedef enum {
 | 
						|
    RF_TEST_TX_CALI_REG_IQ_MAG = 0,
 | 
						|
    RF_TEST_TX_CALI_REG_IQ_PHASE = 1,
 | 
						|
    RF_TEST_TX_CALI_REG_IQ_DC = 2,
 | 
						|
} RF_TEST_TX_CALI_REG_T;
 | 
						|
 | 
						|
#define PLC_MPDU_FC_LEN         16
 | 
						|
#define PLC_MPDU_FCCS_LEN       3
 | 
						|
#define SG_STANDARD_VERSION     0
 | 
						|
 | 
						|
/* MPDU Frame control */
 | 
						|
typedef PREPACK struct _frame_control {
 | 
						|
    union{
 | 
						|
        struct{
 | 
						|
            uint32_t delimiter_type : 3,        //Normal mode
 | 
						|
                network_type : 5,
 | 
						|
                nid : 24;
 | 
						|
        };
 | 
						|
        struct{
 | 
						|
            uint32_t delimiter_type_v3 : 3,    //encryption mode
 | 
						|
                aes_key_sel : 5,
 | 
						|
                nid_v3 : 24;
 | 
						|
        };
 | 
						|
    };
 | 
						|
    union {
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp : 32; /* NTB */
 | 
						|
            uint16_t src_tei : 12,
 | 
						|
                tmi : 4;
 | 
						|
            uint16_t sym_num : 9,
 | 
						|
                phase_num : 2,
 | 
						|
                resv : 5;
 | 
						|
            uint32_t resv2 : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } bcn;
 | 
						|
        struct {
 | 
						|
            uint32_t src_tei : 12,
 | 
						|
                dst_tei : 12,
 | 
						|
                lid : 8;
 | 
						|
            uint16_t frame_len : 12, /* unit 10us */
 | 
						|
                pb_num : 4;
 | 
						|
            uint16_t sym_num : 9,
 | 
						|
                bcast : 1,
 | 
						|
                retry : 1,
 | 
						|
                encry : 1,
 | 
						|
                tmi : 4;
 | 
						|
            union{
 | 
						|
                struct{
 | 
						|
                    uint32_t tmi_ext : 4,         //Normal mode
 | 
						|
                        version : 4,
 | 
						|
                        fccs : 24;
 | 
						|
                };
 | 
						|
                struct{
 | 
						|
                    uint32_t tmi_ext_v3 : 4,        //encryption mode
 | 
						|
                        decrypt_mode : 2,
 | 
						|
                        aes_key_table_sel : 2,
 | 
						|
                        fccs_v3 : 24;
 | 
						|
                };
 | 
						|
            };
 | 
						|
        } sof;
 | 
						|
        struct {
 | 
						|
            /* TODO */
 | 
						|
            uint32_t rx_result : 4,
 | 
						|
                rx_status : 4,
 | 
						|
                stei : 12,
 | 
						|
                dtei : 12;
 | 
						|
            uint32_t rx_pb : 3,
 | 
						|
                resv0 : 5,
 | 
						|
                snr : 8,
 | 
						|
                load : 8,
 | 
						|
                resv1 : 8;
 | 
						|
            uint32_t ext_deli : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sack;
 | 
						|
        /* neighbor network CCo communication */
 | 
						|
        struct {
 | 
						|
            /* TODO */
 | 
						|
            uint32_t duration : 16,
 | 
						|
                     sbandoffset : 16;
 | 
						|
            uint32_t receive_nid : 24,
 | 
						|
                     self_rf_channel : 8;
 | 
						|
            uint32_t self_rf_option  : 2,
 | 
						|
                     resv1 : 2,
 | 
						|
                     version : 4,
 | 
						|
                     fccs:24;
 | 
						|
        } nn_cco;
 | 
						|
        /* neighbor network CCO communication between MAC and ISR. for
 | 
						|
         * neighbor network negotiation frame tx, we have to make
 | 
						|
         * make sure the sbandoffset and duration as accurate as possible.
 | 
						|
         * We use this format to transfer useful info from MAC SW to ISR so
 | 
						|
         * that ISR can fill in accurate info right before each TX. Right
 | 
						|
         * before each TX, MAC HW will trigger interrupt and ISR will fill in
 | 
						|
         * right info before BB send it out.
 | 
						|
         * Note that for simulator case, we use nn_cco_sw for communication
 | 
						|
         * among CCO to make it simple.
 | 
						|
         */
 | 
						|
        struct {
 | 
						|
            /* lower 32bit start ntb of the protected region */
 | 
						|
            uint32_t start_ntb_l32;
 | 
						|
            /* watched neighbor network id */
 | 
						|
            uint64_t receive_nid : 24,
 | 
						|
            /* duration of the protected region */
 | 
						|
                     duration : 16,
 | 
						|
            /* higher 24bit start ntb of the protected region, we ignore the
 | 
						|
             * highest 8bit as 60 years are long enough.
 | 
						|
             */
 | 
						|
                     start_ntb_h24 : 24;
 | 
						|
        } nn_cco_sw;
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp : 32; /* NTB */
 | 
						|
            uint16_t stei : 12,
 | 
						|
                rsv0 : 4;
 | 
						|
            uint16_t rsv1 : 8,
 | 
						|
                rsv2 : 8;
 | 
						|
            uint32_t ext_type : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sync;
 | 
						|
        struct {
 | 
						|
            uint8_t mac_addr[IOT_MAC_ADDR_LEN];
 | 
						|
            uint16_t stei : 12,
 | 
						|
                     rsv4 : 4;
 | 
						|
            uint32_t ext_type : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } search;
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp : 32; /* NTB */
 | 
						|
            uint16_t src_tei : 12,
 | 
						|
                     mcs : 4;
 | 
						|
            uint16_t pb_sz_idx : 4,  /* pb size index */
 | 
						|
                     resv0 : 12;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                     version : 4,
 | 
						|
                     fccs : 24;
 | 
						|
        } rf_bcn;
 | 
						|
        struct {
 | 
						|
            uint32_t src_tei : 12,
 | 
						|
                     dst_tei : 12,
 | 
						|
                     lid : 8;
 | 
						|
            uint16_t frame_len : 12, /* unit 100us */
 | 
						|
                     pb_sz_idx : 4;
 | 
						|
            uint16_t resv0 : 9,
 | 
						|
                     bcast : 1,
 | 
						|
                     retry : 1,
 | 
						|
                     encry : 1,
 | 
						|
                     mcs : 4;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                     version : 4,
 | 
						|
                     fccs : 24;
 | 
						|
        } rf_sof;
 | 
						|
        struct {
 | 
						|
            uint32_t rx_result : 4,
 | 
						|
                     resv0 : 4,
 | 
						|
                     stei : 12,
 | 
						|
                     dtei : 12;
 | 
						|
            uint32_t resv1 : 8,
 | 
						|
                     snr : 8,
 | 
						|
                     load : 8,
 | 
						|
                     resv2 : 8;
 | 
						|
            uint32_t ext_deli : 4,
 | 
						|
                     version : 4,
 | 
						|
                     fccs : 24;
 | 
						|
        } rf_sack;
 | 
						|
        /* Rf test tx calibration fc variable region */
 | 
						|
        struct {
 | 
						|
            /* dvice id magic number */
 | 
						|
            uint16_t dev_id_magic;
 | 
						|
            /* tx calibration register combination magic number */
 | 
						|
            uint32_t reg_magic;
 | 
						|
            /* rf tx calibration register type, see RF_TEST_TX_CALI_REG_XXX */
 | 
						|
            uint16_t reg_type   :3,
 | 
						|
            /* rserved for future use */
 | 
						|
                     rsvd       :13;
 | 
						|
            /* test type, see RF_TEST_TYPE_XXX */
 | 
						|
            uint32_t test_type  :4,
 | 
						|
            /* protocol Version */
 | 
						|
                     version    :4,
 | 
						|
            /* check code */
 | 
						|
                     fccs       :24;
 | 
						|
        } rf_test_tx_cali;
 | 
						|
    } vf;
 | 
						|
} POSTPACK frame_control_t;
 | 
						|
 | 
						|
#define SPG_STANDARD_VERSION    1
 | 
						|
 | 
						|
typedef PREPACK struct _spg_frame_control {
 | 
						|
    uint8_t delimiter_type : 3,
 | 
						|
        access_ind : 1,
 | 
						|
        snid : 4;
 | 
						|
    union {
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp : 32;
 | 
						|
            uint32_t bcn_period_cnt : 32;
 | 
						|
            uint16_t src_tei : 12,
 | 
						|
                tmi : 4;
 | 
						|
            uint16_t sym_num : 9,
 | 
						|
                resv1 : 1,
 | 
						|
                phase_num : 2,
 | 
						|
                version : 4;
 | 
						|
            uint8_t fccs[3];
 | 
						|
        } bcn;
 | 
						|
        struct {
 | 
						|
            uint32_t src_tei : 12,
 | 
						|
                dst_tei : 12,
 | 
						|
                lid : 8;
 | 
						|
            union{
 | 
						|
                struct{
 | 
						|
                    uint16_t resv1 : 16;        //Normal mode
 | 
						|
                };
 | 
						|
                struct{
 | 
						|
                    uint16_t aes_key_sel : 5,   //encryption mode
 | 
						|
                        aes_key_table_sel : 2,
 | 
						|
                        resv1_v3 : 9;
 | 
						|
                };
 | 
						|
            };
 | 
						|
            uint8_t  pb_num : 4,
 | 
						|
                tmi : 4;
 | 
						|
            uint32_t frm_len : 12,
 | 
						|
                resv2 : 9,
 | 
						|
                tei_filter_flag : 1,
 | 
						|
                retry : 1,
 | 
						|
                sym_num : 9;
 | 
						|
            union{
 | 
						|
                struct{
 | 
						|
                    uint32_t tmi_ext : 4,   //Normal mode
 | 
						|
                        version : 4,
 | 
						|
                        fccs : 24;
 | 
						|
                };
 | 
						|
                struct{
 | 
						|
                    uint32_t tmi_ext_v3 : 4,   //encryption mode
 | 
						|
                        decrypt_mode : 4,
 | 
						|
                        fccs_v3 : 24;
 | 
						|
                };
 | 
						|
            };
 | 
						|
        } sof;
 | 
						|
        struct {
 | 
						|
            uint8_t rx_result : 4,
 | 
						|
                rx_status : 4;
 | 
						|
            uint16_t dtei : 12,
 | 
						|
                rx_pb : 4;
 | 
						|
            uint32_t resv1 : 32;
 | 
						|
            uint32_t resv2 : 32;
 | 
						|
            uint32_t ext_deli : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sack;
 | 
						|
        struct {
 | 
						|
            uint16_t neighbor_network : 16;
 | 
						|
            uint32_t self_rf_channel : 8,
 | 
						|
                resv0 : 10,
 | 
						|
                conti_time : 14;
 | 
						|
            uint8_t  resv1 : 1,
 | 
						|
                bwth_end_flag : 1,
 | 
						|
                self_rf_option : 2,
 | 
						|
                resv4 : 4;
 | 
						|
            uint16_t bwth_end_shift : 16;
 | 
						|
            uint16_t bwth_start_shift : 16;
 | 
						|
            uint32_t resv : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } nn_cco;
 | 
						|
        /* neighbor network CCO communication between MAC and ISR. for
 | 
						|
         * neighbor network negotiation frame tx, we have to make
 | 
						|
         * make sure the sbandoffset and duration as accurate as possible.
 | 
						|
         * We use this format to transfer useful info from MAC SW to ISR so
 | 
						|
         * that ISR can fill in accurate info right before each TX. Right
 | 
						|
         * before each TX, MAC HW will trigger interrupt and ISR will fill in
 | 
						|
         * right info before BB send it out.
 | 
						|
         * Note that for simulator case, we use nn_cco_sw for cummunication
 | 
						|
         * among CCO to make it simple.
 | 
						|
         */
 | 
						|
        struct {
 | 
						|
            /* lower 32bit start ntb of the protected region */
 | 
						|
            uint32_t start_ntb_l32;
 | 
						|
            /* watched neighbor network id */
 | 
						|
            uint32_t neighbor_network : 16,
 | 
						|
            /* duration of the protected region */
 | 
						|
                     duration : 14,
 | 
						|
                     resv4 : 2;
 | 
						|
 | 
						|
            /* higher 24bit start ntb of the protected region, we ignore the
 | 
						|
             * highest 8bit as 60 years are long enough.
 | 
						|
             */
 | 
						|
            uint32_t start_ntb_h24 : 24,
 | 
						|
                     resv0: 8;
 | 
						|
            uint16_t last_offsetl;
 | 
						|
            uint8_t last_offseth;  /* last_offset 24bit*/
 | 
						|
        } nn_cco_sw;
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp; /* NTB */
 | 
						|
            uint16_t stei : 12,
 | 
						|
                rsv0 : 4;
 | 
						|
            uint32_t rsv1;
 | 
						|
            uint8_t sn;
 | 
						|
            uint32_t ext_type : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sync;
 | 
						|
        struct {
 | 
						|
            uint8_t mac_addr[IOT_MAC_ADDR_LEN];
 | 
						|
            uint16_t stei : 12,
 | 
						|
                     rsv0 : 4;
 | 
						|
            uint16_t rsv1;
 | 
						|
            uint8_t sn;
 | 
						|
            uint32_t ext_type : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } search;
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp;
 | 
						|
            uint32_t bcn_period_cnt;
 | 
						|
            uint16_t src_tei : 12,
 | 
						|
                     mcs : 4;
 | 
						|
            uint16_t pb_sz_idx : 4,
 | 
						|
                     resv0 : 8,
 | 
						|
                     version : 4;
 | 
						|
            uint8_t  fccs[3];
 | 
						|
        } rf_bcn;
 | 
						|
        struct {
 | 
						|
            uint32_t src_tei : 12,
 | 
						|
                     dst_tei : 12,
 | 
						|
                     lid : 8;
 | 
						|
            uint16_t frame_len : 12, /* unit 100us */
 | 
						|
                     pb_sz_idx : 4;
 | 
						|
            uint8_t  mcs : 4,
 | 
						|
                     tei_filter_flag : 1,
 | 
						|
                     retry : 1,
 | 
						|
                     resv0 : 2;
 | 
						|
            uint32_t resv1;
 | 
						|
            uint32_t resv2 : 4,
 | 
						|
                     version : 4,
 | 
						|
                     fccs : 24;
 | 
						|
        } rf_sof;
 | 
						|
        struct {
 | 
						|
            uint32_t rx_result : 4,
 | 
						|
                     resv0 : 4,
 | 
						|
                     dtei : 12,
 | 
						|
                     resv1 : 12;
 | 
						|
            uint32_t resv2;
 | 
						|
            uint32_t resv3 : 24,
 | 
						|
                     ext_deli : 4,
 | 
						|
                     version : 4;
 | 
						|
            uint8_t  fccs[3];
 | 
						|
        } rf_sack;
 | 
						|
        /* Rf test tx calibration fc variable region */
 | 
						|
        struct {
 | 
						|
            /* dvice id magic number */
 | 
						|
            uint16_t dev_id_magic;
 | 
						|
            /* tx calibration register combination magic number */
 | 
						|
            uint32_t reg_magic;
 | 
						|
            /* rf tx calibration register type, see RF_TEST_TX_CALI_REG_XXX */
 | 
						|
            uint16_t reg_type   :3,
 | 
						|
            /* rserved for future use */
 | 
						|
                     resv0      :13;
 | 
						|
            uint32_t resv1      :24,
 | 
						|
            /* test type, see RF_TEST_TYPE_XXX */
 | 
						|
                     test_type  :4,
 | 
						|
            /* protocol Version */
 | 
						|
                     version    :4;
 | 
						|
            /* check code */
 | 
						|
            uint8_t  fccs[3];
 | 
						|
        } rf_test_tx_cali;
 | 
						|
    } vf;
 | 
						|
} POSTPACK spg_frame_control_t;
 | 
						|
 | 
						|
 | 
						|
typedef PREPACK struct _hp10_frame_control {
 | 
						|
    uint32_t cc : 1,
 | 
						|
        dt : 3,
 | 
						|
        vf : 13,
 | 
						|
        fccs : 8,
 | 
						|
        resv : 7;
 | 
						|
} POSTPACK hp10_frame_control;
 | 
						|
 | 
						|
#define HPAV_MPDU_FC_LEN      16
 | 
						|
#define HPAV_MPDU_FCCS_LEN    3
 | 
						|
 | 
						|
typedef PREPACK struct _hpav_frame_control {
 | 
						|
    uint8_t delimiter_type : 3,
 | 
						|
        access : 1,
 | 
						|
        snid : 4;
 | 
						|
    union {
 | 
						|
        struct {
 | 
						|
            uint32_t bts;
 | 
						|
            uint32_t bto0 : 16,
 | 
						|
                bto1 : 16;
 | 
						|
            uint32_t bto2 : 16,
 | 
						|
                bto3 : 16;
 | 
						|
        } bcn;
 | 
						|
        /* sof */
 | 
						|
        struct {
 | 
						|
            uint16_t src_tei : 8,
 | 
						|
                dst_tei : 8;
 | 
						|
            uint8_t lid;
 | 
						|
            uint32_t cfs : 1,
 | 
						|
                bdf : 1,
 | 
						|
                hp10df : 1,
 | 
						|
                hp11df : 1,
 | 
						|
                eks : 4,
 | 
						|
                pbb : 8,
 | 
						|
                ble : 8,
 | 
						|
                pbsz : 1,
 | 
						|
                numsym : 2,
 | 
						|
                tmi_av : 5;
 | 
						|
            uint32_t fl_av : 12,
 | 
						|
                mpdu_cnt : 2,
 | 
						|
                burst_cnt : 2,
 | 
						|
                bbf : 1,
 | 
						|
                mrtfl : 4,
 | 
						|
                dcppcf : 1,
 | 
						|
                mcf : 1,
 | 
						|
                mnbf : 1,
 | 
						|
                rsr : 1,
 | 
						|
                clst : 1,
 | 
						|
                mfs_cmd_mgmt : 3,
 | 
						|
                mfs_cmd_data : 3;
 | 
						|
            uint8_t mfs_rsp_mgmt : 2,
 | 
						|
                mfs_rsp_data : 2,
 | 
						|
                bm_sacki : 4;
 | 
						|
        } sof;
 | 
						|
        /* sack */
 | 
						|
        struct {
 | 
						|
            uint16_t dst_tei : 8,
 | 
						|
                cfs : 1,
 | 
						|
                bdf : 1,
 | 
						|
                svn : 1,
 | 
						|
                rrtf : 1,
 | 
						|
                mfs_rsp_data : 2,
 | 
						|
                mfs_rsp_mgmt : 2;
 | 
						|
            uint8_t sackt3 : 2,
 | 
						|
                sackt2: 2,
 | 
						|
                sackt1: 2,
 | 
						|
                sackt0: 2;
 | 
						|
            uint8_t sackd_bitpad_var[8];
 | 
						|
            uint8_t rx_winsz : 4,
 | 
						|
                rrtl : 4;
 | 
						|
        } sack;
 | 
						|
        /* rts cts */
 | 
						|
        struct {
 | 
						|
            uint16_t src_tei : 8,
 | 
						|
                dst_tei : 8;
 | 
						|
            uint8_t lid;
 | 
						|
            uint32_t cfs : 1,
 | 
						|
                bdf : 1,
 | 
						|
                hp10df : 1,
 | 
						|
                hp11df : 1,
 | 
						|
                rtsf : 1,
 | 
						|
                igf : 1,
 | 
						|
                mnbf : 1,
 | 
						|
                mcf : 1,
 | 
						|
                dur : 14,
 | 
						|
                rsvd0 : 10;
 | 
						|
            uint8_t rsvd1[5];
 | 
						|
        } rtscts;
 | 
						|
        /* sound */
 | 
						|
        struct {
 | 
						|
            uint32_t stei : 8,
 | 
						|
                dtei : 8,
 | 
						|
                lid : 8,
 | 
						|
                cfs : 1,
 | 
						|
                pbsz : 1,
 | 
						|
                bdf : 1,
 | 
						|
                saf : 1,
 | 
						|
                scf : 1,
 | 
						|
                req_tm : 3;
 | 
						|
            uint16_t fl_av : 12,
 | 
						|
                mpducnt : 2,
 | 
						|
                rsvd0 : 2;
 | 
						|
            uint8_t ppb;
 | 
						|
            uint8_t src;
 | 
						|
            uint32_t resvd;
 | 
						|
        } sound;
 | 
						|
        /* rsof */
 | 
						|
        struct {
 | 
						|
            uint16_t dst_tei : 8,
 | 
						|
                cfs : 1,
 | 
						|
                bdf : 1,
 | 
						|
                svn : 1,
 | 
						|
                rrtf : 1,
 | 
						|
                mfs_rsp_data : 2,
 | 
						|
                mfs_rsp_mgmt : 2;
 | 
						|
            uint8_t sackd_bitpad_var[6];
 | 
						|
            uint8_t rx_winsz : 4,
 | 
						|
                rrtl : 4;
 | 
						|
            uint16_t rsof_fl_av : 10,
 | 
						|
                tmi_av : 5,
 | 
						|
                pbsz : 1;
 | 
						|
            uint8_t num_sym : 2,
 | 
						|
                mfs_cmd_data : 3,
 | 
						|
                mfs_cmd_mgmt : 3;
 | 
						|
        }rsof;
 | 
						|
    } vf_av;
 | 
						|
    struct {
 | 
						|
        uint8_t fccs_av0;
 | 
						|
        uint8_t fccs_av1;
 | 
						|
        uint8_t fccs_av2;
 | 
						|
    } fccs_av;
 | 
						|
} POSTPACK hpav_frame_control;
 | 
						|
 | 
						|
typedef PREPACK struct _i1901_frame_control {
 | 
						|
    uint32_t delimiter_type : 3,
 | 
						|
        network_type : 5,
 | 
						|
        nid : 24;
 | 
						|
    union {
 | 
						|
        struct {
 | 
						|
            uint32_t time_stamp; /* NTB */
 | 
						|
            uint16_t stei : 12,
 | 
						|
                tmi : 4;
 | 
						|
            uint16_t phase_num : 2,
 | 
						|
                pss : 4,
 | 
						|
                resv : 10;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } bcn;
 | 
						|
        struct {
 | 
						|
            uint32_t stei : 12,
 | 
						|
                dtei : 12,
 | 
						|
                lid : 8;
 | 
						|
            uint16_t frame_len : 12, /* unit 10us */
 | 
						|
                pb_num : 4;
 | 
						|
            uint16_t bcast : 1,
 | 
						|
                retry : 1,
 | 
						|
                encry : 2,
 | 
						|
                tmi : 4,
 | 
						|
                tmi_ext : 1,
 | 
						|
                pss :4,
 | 
						|
                resv : 3;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sof;
 | 
						|
        struct {
 | 
						|
            uint32_t result : 4,
 | 
						|
                stei : 12,
 | 
						|
                dtei : 12,
 | 
						|
                rx_pb : 3,
 | 
						|
                resv : 1;
 | 
						|
            uint32_t snr : 8,
 | 
						|
                load : 8,
 | 
						|
                resv1 : 16;
 | 
						|
            uint32_t ext_deli : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } sack;
 | 
						|
        struct {
 | 
						|
            uint32_t duration : 16,
 | 
						|
                sbandoffset : 16;
 | 
						|
            uint32_t receive_nid : 24,
 | 
						|
                resv : 8;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } nn_cco;
 | 
						|
        struct {
 | 
						|
            uint32_t stei : 12,
 | 
						|
                dtei : 12,
 | 
						|
                lid : 8;
 | 
						|
            uint32_t mnbf : 1,
 | 
						|
                rtsf : 1,
 | 
						|
                encry : 2,
 | 
						|
                dur : 12,
 | 
						|
                resv : 16;
 | 
						|
            uint32_t resv1 : 4,
 | 
						|
                version : 4,
 | 
						|
                fccs : 24;
 | 
						|
        } rts_cts;
 | 
						|
    } vf;
 | 
						|
} POSTPACK i1901_frame_control_t;
 | 
						|
 | 
						|
#pragma pack(pop)    // restore the pack status
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif /* PLC_MPDU_HEADER_H */
 |