274 lines
6.4 KiB
C
274 lines
6.4 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 MPDU_FRAME_H
|
|
#define MPDU_FRAME_H
|
|
|
|
#include "plc_fr.h"
|
|
#include "os_types.h"
|
|
#include "plc_mpdu_header.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* this file contains FC defination for different
|
|
* mpdus, such as beacon, sof, sack, etc. and also
|
|
* would include PB's frame format defination such as PB header.
|
|
* Packed for the structures in the whole file,
|
|
* little endian.
|
|
*/
|
|
#pragma pack(push) // save the pack status
|
|
#pragma pack(1) // 1 byte align
|
|
|
|
/*
|
|
* PB defination
|
|
*/
|
|
|
|
/* SOF */
|
|
#define SG_SOF_PB_HDR_CRC_LEN 4
|
|
#define SG_SOF_PB_CRC_LEN 3
|
|
#define SG_SOF_PB_HDR_LEN 1
|
|
|
|
typedef struct _sg_sof_pb_hdr {
|
|
uint8_t seq : 6,
|
|
mac_frame_start : 1,
|
|
mac_frame_end : 1;
|
|
} sg_sof_pb_hdr_t;
|
|
|
|
typedef struct _sg_sof_pb_72 {
|
|
sg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[68];
|
|
uint8_t icv[3];
|
|
} sg_sof_pb_72_t;
|
|
|
|
typedef struct _sg_sof_pb_136 {
|
|
sg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[132];
|
|
uint8_t icv[3];
|
|
} sg_sof_pb_136_t;
|
|
|
|
typedef struct _sg_sof_pb_264 {
|
|
sg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[260];
|
|
uint8_t icv[3];
|
|
} sg_sof_pb_264_t;
|
|
|
|
typedef struct _sg_sof_pb_520 {
|
|
sg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[516];
|
|
uint8_t icv[3];
|
|
} sg_sof_pb_520_t;
|
|
|
|
/* beacon - only 1 pb allowed
|
|
* default 520 and 136
|
|
* optional 72 and 264
|
|
*/
|
|
#define SG_BCN_PB_HDR_CRC_LEN 3
|
|
#define SG_BCN_PB_CRC_LEN 3
|
|
#define SG_BCN_PB_PAYLOAD_CRC_LEN 4
|
|
typedef struct _sg_bcn_pb_520 {
|
|
uint8_t payload[517];
|
|
uint8_t icv[3];
|
|
} sg_bcn_pb_520_t;
|
|
|
|
typedef struct _sg_bcn_pb_136 {
|
|
uint8_t payload[133];
|
|
uint8_t icv[3];
|
|
} sg_bcn_pb_136_t;
|
|
|
|
typedef struct _sg_bcn_pb_72 {
|
|
uint8_t payload[69];
|
|
uint8_t icv[3];
|
|
} sg_bcn_pb_72_t;
|
|
|
|
typedef struct _sg_bcn_pb_264 {
|
|
uint8_t payload[261];
|
|
uint8_t icv[3];
|
|
} sg_bcn_pb_264_t;
|
|
|
|
/* SPG define start */
|
|
|
|
/* SOF pd header len+pbcs len = 4+3*/
|
|
#define SPG_SOF_PB_HDR_CRC_LEN 7
|
|
#define SPG_SOF_PB_CRC_LEN 3
|
|
#define SPG_SOF_PB_HDR_LEN 4
|
|
#define SPG_SOF_PB_RESV_LEN 1
|
|
|
|
typedef struct _spg_sof_pb_hdr {
|
|
uint16_t seq;
|
|
uint16_t resv;
|
|
} spg_sof_pb_hdr_t;
|
|
typedef struct _spg_sof_pb_136 {
|
|
spg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[128];
|
|
uint8_t resv;
|
|
uint8_t icv[3];
|
|
} spg_sof_pb_136_t;
|
|
typedef struct _spg_sof_pb_520 {
|
|
spg_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[512];
|
|
uint8_t resv;
|
|
uint8_t icv[3];
|
|
} spg_sof_pb_520_t;
|
|
/* beacon - only 1 pb allowed
|
|
* default 520 and 136
|
|
*/
|
|
#define SPG_BCN_PB_HDR_CRC_LEN 3
|
|
#define SPG_BCN_PB_CRC_LEN 3
|
|
#define SPG_BCN_PB_PAYLOAD_CRC_LEN 4
|
|
#define SPG_BCN_PB_RESV_LEN 1
|
|
|
|
typedef struct _spg_bcn_pb_136 {
|
|
uint8_t payload[132];
|
|
uint8_t resv;
|
|
uint8_t icv[3];
|
|
} spg_bcn_pb_136_t;
|
|
typedef struct _spg_bcn_pb_520 {
|
|
uint8_t payload[516];
|
|
uint8_t resv;
|
|
uint8_t icv[3];
|
|
} spg_bcn_pb_520_t;
|
|
|
|
/* SPG define end */
|
|
|
|
#if SUPPORT_GREEN_PHY
|
|
|
|
/* pb header */
|
|
typedef struct _gp_sof_pb_hdr {
|
|
uint16_t ssn;
|
|
uint16_t mfbo : 9,
|
|
vpf : 1,
|
|
mmqf : 1,
|
|
mfbf : 1,
|
|
opsf : 1,
|
|
rsvd0 : 3;
|
|
} gp_sof_pb_hdr_t;
|
|
|
|
/*
|
|
* PB defination
|
|
*/
|
|
/* beacon - only 1 pb allowed
|
|
* default 136
|
|
*/
|
|
#define GP_BCN_PB_HDR_CRC_LEN 4
|
|
#define GP_BCN_PB_CRC_LEN 4
|
|
typedef struct _gp_bcn_pb_136 {
|
|
uint8_t payload[132];
|
|
uint8_t icv[4];
|
|
} gp_bcn_pb_136_t;
|
|
|
|
/* SOF */
|
|
#define GP_SOF_PB_HDR_CRC_LEN 8
|
|
#define GP_SOF_PB_CRC_LEN 4
|
|
#define GP_SOF_PB_HDR_LEN 4
|
|
|
|
|
|
typedef struct _gp_sof_pb_136 {
|
|
gp_sof_pb_hdr_t header;
|
|
uint8_t payload[128];
|
|
uint8_t icv[4];
|
|
} gp_sof_pb_136_t;
|
|
|
|
typedef struct _gp_sof_pb_520 {
|
|
gp_sof_pb_hdr_t header;
|
|
uint8_t payload[512];
|
|
uint8_t icv[4];
|
|
} gp_sof_pb_520_t;
|
|
|
|
|
|
/* SOUND */
|
|
#define GP_SOUND_PB_HDR_CRC_LEN 4
|
|
#define GP_SOUND_PB_CRC_LEN 4
|
|
|
|
|
|
typedef struct _gp_sound_pb_136 {
|
|
uint8_t payload[136 - 4];
|
|
uint8_t icv[4];
|
|
} gp_sound_pb_136_t;
|
|
|
|
typedef struct _gp_sound_pb_520 {
|
|
uint8_t payload[520 - 4];
|
|
uint8_t icv[4];
|
|
} gp_sound_pb_520_t;
|
|
|
|
#endif
|
|
|
|
/* ieee1901 define start */
|
|
/* SOF */
|
|
#define I1901_SOF_PB_CRC_LEN 4
|
|
#define I1901_SOF_PB_HDR_LEN 4
|
|
#define I1901_SOF_PB_HDR_CRC_LEN (I1901_SOF_PB_CRC_LEN \
|
|
+ I1901_SOF_PB_HDR_LEN)
|
|
|
|
typedef struct _i1901_sof_pb_hdr {
|
|
uint8_t seq : 6,
|
|
mac_frame_start : 1,
|
|
mac_frame_end : 1;
|
|
uint8_t rsvd0;
|
|
uint16_t rsvd1;
|
|
} i1901_sof_pb_hdr_t;
|
|
|
|
typedef struct _i1901_sof_pb_72 {
|
|
i1901_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[64];
|
|
uint8_t icv[I1901_SOF_PB_CRC_LEN];
|
|
} i1901_sof_pb_72_t;
|
|
|
|
typedef struct _i1901_sof_pb_136 {
|
|
i1901_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[128];
|
|
uint8_t icv[I1901_SOF_PB_CRC_LEN];
|
|
} i1901_sof_pb_136_t;
|
|
|
|
typedef struct _i1901_sof_pb_520 {
|
|
i1901_sof_pb_hdr_t pb_hdr;
|
|
uint8_t payload[512];
|
|
uint8_t icv[I1901_SOF_PB_CRC_LEN];
|
|
} i1901_sof_pb_520_t;
|
|
|
|
/* BEACON */
|
|
#define I1901_BCN_PB_CRC_LEN 4
|
|
#define I1901_BCN_PB_PAYLOAD_CRC_LEN 4
|
|
#define I1901_BCN_PB_HDR_CRC_LEN I1901_BCN_PB_CRC_LEN
|
|
|
|
typedef struct _i1901_bcn_pb_72 {
|
|
uint8_t payload[64];
|
|
uint8_t bpcs[I1901_BCN_PB_PAYLOAD_CRC_LEN];
|
|
uint8_t icv[I1901_BCN_PB_CRC_LEN];
|
|
} i1901_bcn_pb_72_t;
|
|
|
|
typedef struct _i1901_bcn_pb_136 {
|
|
uint8_t payload[128];
|
|
uint8_t bpcs[I1901_BCN_PB_PAYLOAD_CRC_LEN];
|
|
uint8_t icv[I1901_BCN_PB_CRC_LEN];
|
|
} i1901_bcn_pb_136_t;
|
|
|
|
typedef struct _i1901_bcn_pb_520 {
|
|
uint8_t payload[512];
|
|
uint8_t bpcs[I1901_BCN_PB_PAYLOAD_CRC_LEN];
|
|
uint8_t icv[I1901_BCN_PB_CRC_LEN];
|
|
} i1901_bcn_pb_520_t;
|
|
|
|
/* ieee1901 define end */
|
|
|
|
#pragma pack(pop) // restore the pack status
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // !MPDU_FRAME_H
|