📄 mac_sap.h
字号:
*/typedef struct{ MAC_Addr_s sSrcAddr; /**< Source address */ MAC_Addr_s sDstAddr; /**< Destination address */ uint8 u8TxOptions; /**< Transmit options */ uint8 u8SduLength; /**< Length of payload (MSDU) */ uint8 au8Sdu[MAC_MAX_DATA_PAYLOAD_LEN]; /**< Payload (MSDU) */} MAC_TxFrameData_s;/** * @brief Structure for MCPS-DATA.request * * Data transmit request. Use type MAC_MCPS_REQ_DATA */typedef struct{ uint8 u8Handle; /**< Handle of frame in queue */ MAC_TxFrameData_s sFrame; /**< Frame to send */} MAC_McpsReqData_s;/** * @brief Structure for MCPS-PURGE.request * * Purge request. Use type MAC_MCPS_REQ_PURGE */typedef struct{ uint8 u8Handle; /**< Handle of request to purge from queue */} MAC_McpsReqPurge_s;/* @} *//**********************//**** MCPS Confirm ****//**********************//** * @defgroup g_mac_sap_mcps_cfm MCPS Confirm objects * @ingroup g_mac_sap_mcps * * These come back synchronously as a returned parameter in the Request/Response call. * They can also be deferred and asynchronously posted via the Deferred Confirm/Indication callback. *//** * @defgroup g_mac_sap_mcps_cfm_15_4 MCPS Confirm 802.15.4 specification parameters * @ingroup g_mac_sap_mcps_cfm * * @{ *//** * @brief Structure for MCPS-DATA.confirm * * Data transmit confirm. Use type MAC_MCPS_CFM_DATA */typedef struct{ uint8 u8Handle; /**< Handle matching associated request */ uint8 u8Status; /**< Status of request @sa MAC_Enum_e */} MAC_McpsCfmData_s;/** * @brief Structure for MCPS-PURGE.confirm * * Data transmit confirm. Use type MAC_MCPS_CFM_PURGE */typedef struct{ uint8 u8Handle; /**< Handle matching associated request */ uint8 u8Status; /**< Status of request @sa MAC_Enum_e */} MAC_McpsCfmPurge_s;/* @} *//*************************//**** MCPS Indication ****//*************************//** * @defgroup g_mac_sap_mcps_ind MCPS Indication Object * @ingroup g_mac_sap_mcps * * These are sent asynchronously via the registered Deferred Confirm/Indication callback *//** * @defgroup g_mac_sap_mcps_ind_15_4 MCPS Indication 802.15.4 specification parameters * @ingroup g_mac_sap_mcps_ind * * @{ *//** * @brief Receive frame structure * * Used by Data indication */typedef struct{ MAC_Addr_s sSrcAddr; /**< Source address */ MAC_Addr_s sDstAddr; /**< Destination address */ uint8 u8LinkQuality; /**< Link quality of received frame */ uint8 u8SecurityUse; /**< True if security was used */ uint8 u8AclEntry; /**< Security suite used */ uint8 u8SduLength; /**< Length of payload (MSDU) */ uint8 au8Sdu[MAC_MAX_DATA_PAYLOAD_LEN]; /**< Payload (MSDU) */} MAC_RxFrameData_s;/** * @brief Structure for MCPS-DATA.indication * * Data received indication. Uses type MAC_MCPS_IND_DATA */typedef struct{ MAC_RxFrameData_s sFrame; /**< Frame received */} MAC_McpsIndData_s;/* @} *//***********************//**** MCPS Response ****//***********************//** * @defgroup g_mac_sap_mcps_rsp MCPS Response objects * @ingroup g_mac_sap_mcps * * @note There are currently no specified MCPS Responses *//*****************************************//**** MCPS Request/Response Interface ****//*****************************************//** * @defgroup g_mac_sap_mcps_req_rsp_if MCPS Request/Response interface * @ingroup g_mac_sap_mcps g_mac_VS * * The interface for the client to issue an MCPS Request or Response * is via a function call to MAC_vHandleMcpsReqRsp. * @li Request/Response parameters are passed in via psMcpsReqRsp * @li Synchronous Confirm parameters are passed out via psMcpsSyncCfm * @li Deferred Confirms are posted back asynchronously via the * Deferred Confirm/Indication callback. * @note There are currently no MCPS Responses specified * * @{ *//** * @brief MAC MCPS Request/Response enumeration. * * Enumeration of MAC MCPS Request/Response * @note Must not exceed 256 entries */typedef enum{ MAC_MCPS_REQ_DATA = 0, /**< Use with tagMAC_McpsReqData_s */ MAC_MCPS_REQ_PURGE, /**< Use with tagMAC_McpsReqPurge_s */ NUM_MAC_MCPS_REQ /**> (endstop) */} MAC_McpsReqRspType_e;/** * @brief MCPS Request/Response Parameter union * * Union of all the possible MCPS Requests and Responses * @note There are no Responses currently specified */typedef union{ MAC_McpsReqData_s sReqData; /**< Data request */ MAC_McpsReqPurge_s sReqPurge; /**< Purge request */} MAC_McpsReqRspParam_u;/** * @brief MCPS Request/Response object * * The object passed to MAC_vHandleMcpsReqRsp containing the request/response */typedef struct{ uint8 u8Type; /**< Request type (@sa MAC_McpsReqRspType_e) */ uint8 u8ParamLength; /**< Parameter length in following union */ uint16 u16Pad; /**< Padding to force alignment */ MAC_McpsReqRspParam_u uParam; /**< Union of all possible Requests */} MAC_McpsReqRsp_s;/** * @brief Synchronous confirm status * * Indicates in the synchronous confirm whether: * @li The Request was processed with or without error * @li The confirm will be deferred and posted via the Deferred Confirm/Indication callback * @li It is a dummy confirm to a Response. * @note NB Must not exceed 256 entries */typedef enum{ MAC_MCPS_CFM_OK, /**< Synchronous confirm without error */ MAC_MCPS_CFM_ERROR, /**< Synchronous confirm with error; see u8Status field */ MAC_MCPS_CFM_DEFERRED, /**< Asynchronous deferred confirm will occur */ NUM_MAC_MCPS_CFM /**< (endstop) */} MAC_McpsSyncCfmStatus_e;/** * @brief MCPS Synchronouse Confirm Parameter union * * Union of all the possible MCPS Synchronous Confirms */typedef union{ MAC_McpsCfmData_s sCfmData; MAC_McpsCfmPurge_s sCfmPurge;} MAC_McpsSyncCfmParam_u;/** * @brief MCPS Synchronous Confirm * * The object returned by MAC_vHandleMcpsReqRsp containing the synchronous confirm. * The confirm type is implied as corresponding to the request * @note All Confirms may also be sent asynchronously via the registered Deferred Confirm/Indication callback; * this is notified by returning MAC_MCPS_CFM_DEFERRED. */typedef struct{ uint8 u8Status; /**< Confirm status (@sa MAC_McpsSyncCfmStatus_e) */ uint8 u8ParamLength; /**< Parameter length in following union */ uint16 u16Pad; /**< Padding to force alignment */ MAC_McpsSyncCfmParam_u uParam; /**< Union of all possible Confirms */} MAC_McpsSyncCfm_s;/* @} *//****************************************************//**** MCPS Deferred Confirm/Indication Interface ****//****************************************************//** * @defgroup g_mac_sap_mcps_dcfm_ind_if MCPS Deferred Confirm/Indication Interface * @ingroup g_mac_sap_mcps g_mac_VS * * The interface for the client to receive an MCPS Deferred Confirm or Indication * is via a function callback to the function registered using MAC_vMcpsDcfmIndRegister * * @{ *//** * @brief Deferred Confirm/Indication type * * Indicates the type of deferred confirm or indication * @note NB Must not exceed 256 entries */typedef enum{ MAC_MCPS_DCFM_DATA, MAC_MCPS_DCFM_PURGE, MAC_MCPS_IND_DATA, NUM_MAC_MCPS_IND} MAC_McpsDcfmIndType_e;/** * @brief MCPS Deferred Confirm/Indication Parameter union * * Union of all the possible MCPS Deferred Confirms or Indications */typedef union{ MAC_McpsCfmData_s sDcfmData; /**< Deferred transmit data confirm */ MAC_McpsCfmPurge_s sDcfmPurge; /**< Deferred purge confirm */ MAC_McpsIndData_s sIndData; /**< Received data indication */} MAC_McpsDcfmIndParam_u;/** * @brief MCPS Deferred Confirm/Indication * * The object passed in the MCPS Deferred Confirm/Indication callback */typedef struct{ uint8 u8Type; /**< Indication type (@sa MAC_McpsDcfmIndType_e) */ uint8 u8ParamLength; /**< Parameter length in following union */ uint16 u16Pad; /**< Padding to force alignment */ MAC_McpsDcfmIndParam_u uParam; /**< Union of all possible Indications */} MAC_McpsDcfmInd_s;/* @} *//** * @defgroup g_mac_sap_gen Generic headers * @ingroup g_mac_sap * * Generic headers which abstract the parameter interfaces to the function calls. * The headers reflect the common structure at the head of the derived structures * for MLME/MCPS * * @{ *//** * @brief Generic Request/Response header * * Abstraction of the header used for all Requests/Responses * @note Must match with the first two fields of MCPS and MLME Requests/Responses */typedef struct{ uint8 u8Type; /**< Request/Response type */ uint8 u8ParamLength; /**< Parameter length */ uint16 u16Pad; /**< Padding to force alignment */} MAC_ReqRspHdr_s;/** * @brief Generic Synchronous Confirm header * * Abstraction of the header used for all Confirms * @note Must match with the first two fields of MCPS and MLME Confirms */typedef struct{ uint8 u8Status; /**< Confirm status */ uint8 u8ParamLength; /**< Parameter length */ uint16 u16Pad; /**< Padding to force alignment */} MAC_SyncCfmHdr_s;/** * @brief Generic Deferred Confirm/Indication header * * Abstraction of the header used for all Deferred Confirms and Indications * @note Must match with the first two fields of MCPS and MLME Deferred * Confirms and Indications */typedef struct{ uint8 u8Type; /**< Deferred confirm/Indication type */ uint8 u8ParamLength; /**< Parameter length */ uint16 u16Pad; /**< Padding to force alignment */} MAC_DcfmIndHdr_s;/* @} *//** * @ingroup grp_phy_sap_pib * @brief PHY PIB attribute. * * Enumerations of PIB attribute as defined in Table 19 (section 6.5.2) (d18) * @note Refer to specification for definitive definitions. */typedef enum{ PHY_PIB_ATTR_CURRENT_CHANNEL = 0, /**< */ PHY_PIB_ATTR_CHANNELS_SUPPORTED = 1, /**< */ PHY_PIB_ATTR_TX_POWER = 2, /**< */ PHY_PIB_ATTR_CCA_MODE = 3 /**< */} PHY_PibAttr_e;/** * @ingroup grp_phy_sap_pib * @brief PHY Enumeration Type. * * Enumerations as defined in Table 16 (section 6.2.3) (d18) * @note Refer to specification for definitive definitions. * @note NOT A FULL LIST! */typedef enum{ PHY_ENUM_INVALID_PARAMETER = 0x05, PHY_ENUM_SUCCESS = 0x07, PHY_ENUM_UNSUPPORTED_ATTRIBUTE = 0x0a} PHY_Enum_e;/****************************//**** EXPORTED VARIABLES ****//****************************//****************************//**** EXPORTED FUNCTIONS ****//****************************/PUBLIC voidMAC_vHandleMlmeReqRsp(void *pvMac, MAC_MlmeReqRsp_s *psMlmeReqRsp, MAC_MlmeSyncCfm_s *psMlmeSyncCfm);PUBLIC voidMAC_vHandleMcpsReqRsp(void *pvMac, MAC_McpsReqRsp_s *psMcpsReqRsp, MAC_McpsSyncCfm_s *psMcpsSyncCfm);PUBLIC voidMAC_vRegisterMlmeDcfmIndCallbacks(void *pvMac, MAC_DcfmIndHdr_s * (*prGetBufCB)(void *), void (*prPostCB)(void *, MAC_DcfmIndHdr_s *), void *pvParam);PUBLIC voidMAC_vRegisterMcpsDcfmIndCallbacks(void *pvMac, MAC_DcfmIndHdr_s * (*prGetBufCB)(void *), void (*prPostCB)(void *, MAC_DcfmIndHdr_s *), void *pvParam);PUBLIC PHY_Enum_ephy_ePibSet(void *pvMac, PHY_PibAttr_e ePhyPibAttribute, uint32 u32PhyPibValue);PUBLIC PHY_Enum_ephy_ePibGet(void *pvMac, PHY_PibAttr_e ePhyPibAttribute, uint32 *pu32PhyPibValue);#ifdef __cplusplus};#endif#endif /* _mac_sap_h_ *//* End of file $RCSfile: mac_sap.h,v $ *******************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -