Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mac_mcps.h Source File

mac_mcps.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2016-2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /** \file mac_mcps.h
00019  * \brief MAC Common Part Sublayer API
00020  */
00021 
00022 #ifndef MAC_MCPS_H
00023 #define MAC_MCPS_H
00024 
00025 #include <inttypes.h>
00026 #include "mac_common_defines.h"
00027 
00028 
00029 /**
00030  * @brief struct mcps_data_req_t Data request structure
00031  *
00032  * See IEEE standard 802.15.4-2006 (table 41) for more details
00033  */
00034 typedef struct mcps_data_req_s {
00035     unsigned SrcAddrMode: 2;        /**< Source address mode */
00036     unsigned DstAddrMode: 2;        /**< Destination address mode */
00037     uint16_t DstPANId;              /**< Destination PAN ID */
00038     uint8_t DstAddr[8];             /**< Destination address */
00039     uint16_t msduLength;            /**< Service data unit length */
00040     uint8_t *msdu;                  /**< Service data unit */
00041     uint8_t msduHandle;             /**< Handle associated with MSDU */
00042     bool TxAckReq: 1;               /**< Specifies whether ACK is needed or not */
00043     bool InDirectTx: 1;             /**< Specifies whether indirect or direct transmission is used */
00044     bool PendingBit: 1;             /**< Specifies whether more fragments are to be sent or not */
00045     bool SeqNumSuppressed: 1;       /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
00046     bool PanIdSuppressed: 1;        /**< True suppress PAN-id is done when possible from frame. This will be only checked when 2015 extension is enabled */
00047     mlme_security_t Key;            /**< Security key */
00048 } mcps_data_req_t;
00049 
00050 /**
00051  * @brief struct mcps_data_conf_t Data confirm structure
00052  *
00053  * See IEEE standard 802.15.4-2006 (table 42) for more details
00054  */
00055 typedef struct mcps_data_conf_s {
00056     uint8_t msduHandle;     /**< Handle associated with MSDU */
00057     uint8_t status;         /**< Status of the last MSDU transmission */
00058     uint32_t timestamp;     /**< Time, in symbols, at which the data were transmitted */
00059     //Non-standard extension
00060     uint8_t cca_retries;    /**< Number of CCA retries used during sending */
00061     uint8_t tx_retries;     /**< Number of retries done during sending, 0 means no retries */
00062 } mcps_data_conf_t;
00063 
00064 
00065 /**
00066  * @brief struct mcps_data_conf_payload_t Data confirmatio IE extension list and payload from enhanced ACK
00067  *
00068  */
00069 typedef struct mcps_data_conf_payload_s {
00070     uint8_t *headerIeList;              /**< Header information IE's list without terminator*/
00071     uint8_t *payloadIeList;             /**< Payload information IE's list without terminator*/
00072     uint8_t *payloadPtr;                /**< Ack payload pointer */
00073     uint16_t headerIeListLength;        /**< Header information IE's list length in bytes */
00074     uint16_t payloadIeListLength;       /**< Payload information IE's list length in bytes */
00075     uint16_t payloadLength;             /**< Payload length in bytes */
00076 } mcps_data_conf_payload_t;
00077 
00078 
00079 /**
00080  * @brief struct mcps_data_ind_t Data indication structure
00081  *
00082  * See IEEE standard 802.15.4-2006 (table 43) for more details
00083  */
00084 typedef struct mcps_data_ind_s {
00085     unsigned SrcAddrMode: 2;    /**< 0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
00086     uint16_t SrcPANId;          /**< Source PAN ID */
00087     uint8_t SrcAddr[8];         /**< Source address */
00088     unsigned DstAddrMode: 2;    /**< Destination address mode */
00089     uint16_t DstPANId;          /**< Destination PAN ID */
00090     uint8_t DstAddr[8];         /**< Destination address */
00091     uint8_t mpduLinkQuality;    /**< LQI value measured during reception of the MPDU */
00092     int8_t signal_dbm;          /**< This extension for normal IEEE 802.15.4 Data indication */
00093     uint32_t timestamp;         /**< The time, in symbols, at which the data were received */
00094     uint8_t DSN;                /**< Data sequence number */
00095     mlme_security_t Key;        /**< Security key */
00096     uint16_t msduLength;        /**< Data unit length */
00097     uint8_t *msdu_ptr;          /**< Data unit */
00098 } mcps_data_ind_t;
00099 
00100 /**
00101  * @brief struct mcps_data_ie_list_t MCPS data Information element list stucture
00102  *
00103  * Structure for IEEE 802.15.4-2015 MCPS data extension to Indication
00104  */
00105 typedef struct mcps_data_ie_list {
00106     uint8_t *headerIeList;              /**< Header information IE's list without terminator*/
00107     uint8_t *payloadIeList;             /**< Payload information IE's list without terminator*/
00108     uint16_t headerIeListLength;        /**< Header information IE's list length in bytes */
00109     uint16_t payloadIeListLength;       /**< Payload information IE's list length in bytes */
00110 } mcps_data_ie_list_t;
00111 
00112 /** \brief Scatter-gather descriptor for MCPS request IE Element list
00113  *
00114  * Slightly optimised for small platforms - we assume we won't need any
00115  * element bigger than 64K.
00116  */
00117 typedef struct ns_ie_iovec {
00118     void *ieBase;              /**< IE element pointer */
00119     uint_fast16_t iovLen;      /**< IE element length */
00120 } ns_ie_iovec_t;
00121 
00122 
00123 /**
00124  * @brief struct mcps_data_req_ie_list MCPS data Information element list stuctrure
00125  *
00126  * Structure for IEEE 802.15.4-2015 MCPS data extension to Request
00127  *
00128  * IE element could be divided to multiple vector which MAC just write to message direct.
00129  */
00130 typedef struct mcps_data_req_ie_list {
00131     ns_ie_iovec_t *headerIeVectorList;   /**< Header IE element list */
00132     ns_ie_iovec_t *payloadIeVectorList;  /**< Payload IE element list */
00133     uint16_t headerIovLength;            /**< Header IE element list size, set 0 when no elements */
00134     uint16_t payloadIovLength;           /**< Payload IE element list size, set 0 when no elements */
00135 } mcps_data_req_ie_list_t;
00136 
00137 
00138 /**
00139  * @brief struct mcps_ack_data_payload_t IE extension list and payload for enhanced ACK
00140  *
00141  */
00142 typedef struct mcps_ack_data_payload {
00143     struct mcps_data_req_ie_list ie_elements;   /**< IE hader and payload's elements */
00144     uint8_t *payloadPtr;                        /**< Ack payload pointer */
00145     uint16_t payloadLength;                     /**< Payload length in bytes */
00146 } mcps_ack_data_payload_t;
00147 
00148 /**
00149  * @brief struct mcps_purge_t Purge request structure
00150  *
00151  * See IEEE standard 802.15.4-2006 (table 44) for more details
00152  */
00153 typedef struct mcps_purge_s {
00154     uint8_t msduHandle;         /**< Handle associated with MSDU */
00155 } mcps_purge_t;
00156 
00157 /**
00158  * @brief struct mcps_purge_conf_t Purge confirm structure
00159  *
00160  * See IEEE standard 802.15.4-2006 (table 45) for more details
00161  */
00162 typedef struct mcps_purge_conf_s {
00163     uint8_t msduHandle;         /**< Handle associated with MSDU */
00164     uint8_t status;             /**< Status of the purge performed */
00165 } mcps_purge_conf_t;
00166 
00167 
00168 #endif // MAC_MCPS_H