📄 mac_802_15_4.h
字号:
//---------------- BOOL mlme_associate_request; UInt8 mlme_associate_request_STEP; char mlme_associate_request_frFunc[81]; BOOL mlme_associate_request_SecurityEnable; UInt8 mlme_associate_request_CoordAddrMode; Message* mlme_associate_request_pendPkt; //---------------- BOOL mlme_associate_response; UInt8 mlme_associate_response_STEP; char mlme_associate_response_frFunc[81]; MACADDR mlme_associate_response_DeviceAddress; Message* mlme_associate_response_pendPkt; //---------------- BOOL mlme_disassociate_request; UInt8 mlme_disassociate_request_STEP; char mlme_disassociate_request_frFunc[81]; BOOL mlme_disassociate_request_toCoor; Message* mlme_disassociate_request_pendPkt; //---------------- BOOL mlme_orphan_response; UInt8 mlme_orphan_response_STEP; char mlme_orphan_response_frFunc[81]; MACADDR mlme_orphan_response_OrphanAddress; //---------------- BOOL mlme_reset_request; UInt8 mlme_reset_request_STEP; char mlme_reset_request_frFunc[81]; BOOL mlme_reset_request_SetDefaultPIB; //---------------- BOOL mlme_rx_enable_request; UInt8 mlme_rx_enable_request_STEP; char mlme_rx_enable_request_frFunc[81]; UInt32 mlme_rx_enable_request_RxOnTime; UInt32 mlme_rx_enable_request_RxOnDuration; clocktype mlme_rx_enable_request_currentTime; //---------------- BOOL mlme_scan_request; UInt8 mlme_scan_request_STEP; char mlme_scan_request_frFunc[81]; UInt8 mlme_scan_request_ScanType; UInt8 mlme_scan_request_orig_macBeaconOrder; UInt8 mlme_scan_request_orig_macBeaconOrder2; UInt8 mlme_scan_request_orig_macBeaconOrder3; UInt16 mlme_scan_request_orig_macPANId; UInt32 mlme_scan_request_ScanChannels; UInt8 mlme_scan_request_ScanDuration; UInt8 mlme_scan_request_CurrentChannel; UInt8 mlme_scan_request_ListNum; UInt8 mlme_scan_request_EnergyDetectList[27]; M802_15_4PanEle mlme_scan_request_PANDescriptorList[27]; //---------------- BOOL mlme_start_request; UInt8 mlme_start_request_STEP; char mlme_start_request_frFunc[81]; UInt8 mlme_start_request_BeaconOrder; UInt8 mlme_start_request_SuperframeOrder; BOOL mlme_start_request_BatteryLifeExtension; BOOL mlme_start_request_SecurityEnable; BOOL mlme_start_request_PANCoordinator; UInt16 mlme_start_request_PANId; UInt8 mlme_start_request_LogicalChannel; //---------------- BOOL mlme_sync_request; UInt8 mlme_sync_request_STEP; char mlme_sync_request_frFunc[81]; UInt8 mlme_sync_request_numSearchRetry; BOOL mlme_sync_request_tracking; //---------------- BOOL mlme_poll_request; UInt8 mlme_poll_request_STEP; char mlme_poll_request_frFunc[81]; UInt8 mlme_poll_request_CoordAddrMode; UInt16 mlme_poll_request_CoordPANId; MACADDR mlme_poll_request_CoordAddress; BOOL mlme_poll_request_SecurityEnable; BOOL mlme_poll_request_autoRequest; BOOL mlme_poll_request_pending; //---------------- BOOL CCA_csmaca; UInt8 CCA_csmaca_STEP; //---------------- BOOL RX_ON_csmaca; UInt8 RX_ON_csmaca_STEP;}M802_15_4TaskPending;// /**// STRUCT :: M802_15_4Timer// DESCRIPTION :: Timer type for MAC 802.15.4// **/typedef struct mac_802_15_4_timer_str{ M802_15_4TimerType timerType;}M802_15_4Timer;// /**// STRUCT :: M802_15_4PanAddrInfo// DESCRIPTION :: PAN Address Information// **/typedef struct mac_802_15_4_panaddrinfo_str{ UInt16 panID; union { UInt16 addr_16; MACADDR addr_64; //using 48-bit instead of 64-bit };}M802_15_4PanAddrInfo;// /**// STRUCT :: M802_15_4GTSDescriptor// DESCRIPTION :: GTS descriptor// **/typedef struct mac_802_15_4_gtsdescriptor_str{ UInt16 devAddr16; UInt8 slotSpec; // --(0123): GTS starting slot // --(4567): GTS length}M802_15_4GTSDescriptor;// /**// STRUCT :: M802_15_4GTSFields// DESCRIPTION :: GTS fields// **/typedef struct mac_802_15_4_gtsfields_str{ UInt8 spec; //GTS specification // --(012): GTS descriptor count // --(3456): reserved // --(7): GTS permit UInt8 dir; //GTS directions // --(0123456): for up to 7 descriptors: // 1 = receive only (w.r.t. data transmission by the device) // 0 = transmit only (w.r.t. data transmission by the device) // --(7): reserved M802_15_4GTSDescriptor list[7]; //GTS descriptor list}M802_15_4GTSFields;// /**// STRUCT :: M802_15_4GTSSpec// DESCRIPTION :: GTS specifications// **/typedef struct mac_802_15_4_gtsspec_str{ M802_15_4GTSFields fields; UInt8 count; //GTS descriptor count BOOL permit; //GTS permit BOOL recvOnly[7]; //reception only UInt8 slotStart[7]; //starting slot UInt8 length[7]; //length in slots}M802_15_4GTSSpec;// /**// STRUCT :: M802_15_4PendAddrField// DESCRIPTION :: Pending Address field// **/typedef struct mac_802_15_4_pendaddrfield_str{ UInt8 spec; //Pending address specification field // --(012): num of short addresses pending // --(3): reserved // --(456): num of extended addresses pending // --(7): reserved MACADDR addrList[7]; //pending address list}M802_15_4PendAddrField;// /**// STRUCT :: M802_15_4PendAddrSpec// DESCRIPTION :: Pending Address specification// **/typedef struct mac_802_15_4_pendaddrspec_str{ M802_15_4PendAddrField fields; UInt8 numShortAddr; //num of short addresses pending UInt8 numExtendedAddr; //num of extended addresses pending}M802_15_4PendAddrSpec;// /**// STRUCT :: M802_15_4DevCapability// DESCRIPTION :: Device capabilities// **/typedef struct mac_802_15_4_devcapability_str{ UInt8 cap; // --(0): alternate PAN coordinator // --(1): device type (1=FFD,0=RFD) // --(2): power source(1=mains powered,0=non mains powered) // --(3): receiver on when idle // --(45): reserved // --(6): security capability // --(7): allocate address) BOOL alterPANCoor; BOOL FFD; BOOL mainsPower; BOOL recvOnWhenIdle; BOOL secuCapable; BOOL alloShortAddr;}M802_15_4DevCapability;// /**// STRUCT :: M802_15_4FrameCtrl// DESCRIPTION :: MAC Frame control// **/typedef struct mac_802_15_4_framectrl_str{ UInt16 FrmCtrl; //(PSDU/MPDU) Frame Control (Figure 35) // --leftmost bit numbered 0 and transmitted first // --(012): Frame type (Table 65) // --(210)=000: Beacon // --(210)=001: Data // --(210)=010: Ack. // --(210)=011: MAC command // --(210)=others: Reserved // --(3): Security enabled // --(4): Frame pending // --(5): Ack. req. // --(6): Intra PAN // --(789): Reserved // --(ab): Dest. addressing mode (Table 66) // --(ba)=00: PAN ID and Addr. field not present // --(ba)=01: Reserved // --(ba)=10: 16-bit short address // --(ba)=11: 64-bit extended address // --(cd): Reserved // --(ef): Source addressing mode UInt8 frmType; BOOL secu; BOOL frmPending; BOOL ackReq; BOOL intraPan; UInt8 dstAddrMode; UInt8 srcAddrMode;}M802_15_4FrameCtrl;// /**// STRUCT :: M802_15_4SuperframeSpec// DESCRIPTION :: MAC Superframe specification// **/typedef struct mac_802_15_4_superframespec_str{ UInt16 SuperSpec; //(MSDU) Superframe Specification (Figure 40) // --(0123): Beacon order // --(4567): Superframe order // --(89ab): Final CAP slot // --(c): Battery life extension // --(d): Reserved // --(e): PAN Coordinator // --(f): Association permit UInt8 BO; UInt32 BI; UInt8 SO; UInt32 SD; UInt32 sd; UInt8 FinCAP; BOOL BLE; BOOL PANCoor; BOOL AssoPmt;}M802_15_4SuperframeSpec;// /**// STRUCT :: M802_15_4BeaconFrame// DESCRIPTION :: 802_15_4 Beacon Frame Header// **/typedef struct mac_802_15_4_beacon_frame_str{ //---beacon frame (Figures 10,37)--- UInt16 MSDU_SuperSpec; //(MSDU) Superframe Specification // --(0123): Beacon order // --(4567): Superframe order // --(89ab): Final CAP slot // --(c): Battery life extension // --(d): Reserved // --(e): PAN Coordinator // --(f): Association permit M802_15_4GTSFields MSDU_GTSFields; //GTS Fields (Figure 38) M802_15_4PendAddrField MSDU_PendAddrFields; //(MSDU) Address Fields // --(012): # of short addressing pending // --(3): Reserved // --(456): # of extended addressing pending // --(7): Reserved //MSDU_BeaconPL; //(MSDU) Beacon Payload// UInt16 MFR_FCS; //(PSDU/MPDU) FCS}M802_15_4BeaconFrame;// /**// STRUCT :: M802_15_4DataFrame// DESCRIPTION :: 802_15_4 Data Frame Header// **/typedef struct mac_802_15_4_data_frame_str{ //---data frame}M802_15_4DataFrame;// /**// STRUCT :: M802_15_4AckFrame// DESCRIPTION :: 802_15_4 Ack Frame Header// **/typedef struct mac_802_15_4_ack_frame_str{ //---acknowledgement frame}M802_15_4AckFrame;// /**// STRUCT :: M802_15_4CommandFrame// DESCRIPTION :: 802_15_4 MAC command Frame Header// **/typedef struct mac_802_15_4_cmd_frame_str{ //---MAC command frame UInt8 MSDU_CmdType; //(MSDU) Command Type/Command frame //identifier // --0x01: Association request // --0x02: Association response // --0x03: Disassociation notification // --0x04: Data request // --0x05: PAN ID conflict notification // --0x06: Orphan notification // --0x07: Beacon request // --0x08: Coordinator realignment // --0x09: GTS request // --0x0a-0xff: Reserved //MSDU_CmdPL; //(MSDU) Command Payload UInt16 MFR_FCS; //same as above}M802_15_4CommandFrame;// /**// STRUCT :: M802_15_4Header// DESCRIPTION :: 802_15_4 MAC header// **/typedef struct mac_802_15_4_header_str{ //---MAC header--- UInt16 MHR_FrmCtrl; UInt8 MHR_BDSN; M802_15_4PanAddrInfo MHR_DstAddrInfo; M802_15_4PanAddrInfo MHR_SrcAddrInfo; UInt16 MHR_FCS; UInt8 MSDU_CmdType; UInt8 msduHandle; BOOL indirect; UInt8 phyCurrentChannel;/* //---MAC sublayer--- UInt16 MFR_FCS; UInt16 MSDU_SuperSpec; M802_15_4GTSFields MSDU_GTSFields; M802_15_4PendAddrField MSDU_PendAddrFields; UInt8 MSDU_CmdType; UInt8 MSDU_PayloadLen; UInt16 pad; UInt8 MSDU_Payload[aMaxMACFrameSize]; BOOL SecurityUse; UInt8 ACLEntry;*/}M802_15_4Header;//--------------------------------------------------------------------------// Layer structure//--------------------------------------------------------------------------// /**// STRUCT :: M802_15_4Statistics// DESCRIPTION :: Statistics of MAC802.15.4// **/typedef struct mac_802_15_4_stats_str{ //Data related long numDataPktSent; long numDataPktRecd; //Mgmt related long numDataReqSent; long numDataReqRecd; long numAssociateReqSent; long numAssociateReqRecd; long numAssociateResSent; long numAssociateResRecd; long numDisassociateReqSent; long numDisassociateReqRecd; long numOrphanIndRecd; long numOrphanResSent; long numBeaconsSent; long numBeaconsReqSent; long numBeaconsReqRecd; long numBeaconsRecd; long numPollReqSent; //common long numAckSent; long numAckRecd; long numPktDropped;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -