Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:a1734fe1ec4b 1 /**
vpcola 0:a1734fe1ec4b 2 ******************************************************************************
vpcola 0:a1734fe1ec4b 3 * @file SPIRIT_PktStack.h
vpcola 0:a1734fe1ec4b 4 * @author VMA division - AMS
vpcola 0:a1734fe1ec4b 5 * @version 3.2.2
vpcola 0:a1734fe1ec4b 6 * @date 08-July-2015
vpcola 0:a1734fe1ec4b 7 * @brief Configuration and management of SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 8 *
vpcola 0:a1734fe1ec4b 9 * @details
vpcola 0:a1734fe1ec4b 10 *
vpcola 0:a1734fe1ec4b 11 * This module can be used to manage the configuration of Spirit STack
vpcola 0:a1734fe1ec4b 12 * packets, and it is quite similar to the Basic packets one since the
vpcola 0:a1734fe1ec4b 13 * STack packets can be considered an extension of Basic.
vpcola 0:a1734fe1ec4b 14 * The user can obtain a packet configuration filling the structure
vpcola 0:a1734fe1ec4b 15 * <i>@ref PktStackInit</i>, defining in it some general parameters
vpcola 0:a1734fe1ec4b 16 * for the Spirit STack packet format.
vpcola 0:a1734fe1ec4b 17 * Another structure the user can fill is <i>@ref PktStackAddressesInit</i>
vpcola 0:a1734fe1ec4b 18 * to define the addresses which will be used during the communication.
vpcola 0:a1734fe1ec4b 19 * The structure <i>@ref PktStackLlpInit</i> is provided in order to configure
vpcola 0:a1734fe1ec4b 20 * the link layer protocol features like autoack, autoretransmission
vpcola 0:a1734fe1ec4b 21 * or piggybacking.
vpcola 0:a1734fe1ec4b 22 * Moreover, functions to set the payload length and the destination address
vpcola 0:a1734fe1ec4b 23 * are provided.
vpcola 0:a1734fe1ec4b 24 *
vpcola 0:a1734fe1ec4b 25 * <b>Example:</b>
vpcola 0:a1734fe1ec4b 26 * @code
vpcola 0:a1734fe1ec4b 27 *
vpcola 0:a1734fe1ec4b 28 * PktStackInit stackInit={
vpcola 0:a1734fe1ec4b 29 * PKT_PREAMBLE_LENGTH_08BYTES, // preamble length in bytes
vpcola 0:a1734fe1ec4b 30 * PKT_SYNC_LENGTH_4BYTES, // sync word length in bytes
vpcola 0:a1734fe1ec4b 31 * 0x1A2635A8, // sync word
vpcola 0:a1734fe1ec4b 32 * PKT_LENGTH_VAR, // variable or fixed payload length
vpcola 0:a1734fe1ec4b 33 * 7, // length field width in bits (used only for variable length)
vpcola 0:a1734fe1ec4b 34 * PKT_NO_CRC, // CRC mode
vpcola 0:a1734fe1ec4b 35 * PKT_CONTROL_LENGTH_0BYTES, // control field length
vpcola 0:a1734fe1ec4b 36 * S_DISABLE, // FEC
vpcola 0:a1734fe1ec4b 37 * S_ENABLE // whitening
vpcola 0:a1734fe1ec4b 38 * };
vpcola 0:a1734fe1ec4b 39 *
vpcola 0:a1734fe1ec4b 40 * PktStackAddressesInit addressInit={
vpcola 0:a1734fe1ec4b 41 * S_ENABLE, // enable/disable filtering on my address
vpcola 0:a1734fe1ec4b 42 * 0x34, // my address (address of the current node)
vpcola 0:a1734fe1ec4b 43 * S_DISABLE, // enable/disable filtering on multicast address
vpcola 0:a1734fe1ec4b 44 * 0xEE, // multicast address
vpcola 0:a1734fe1ec4b 45 * S_DISABLE, // enable/disable filtering on broadcast address
vpcola 0:a1734fe1ec4b 46 * 0xFF // broadcast address
vpcola 0:a1734fe1ec4b 47 * };
vpcola 0:a1734fe1ec4b 48 *
vpcola 0:a1734fe1ec4b 49 * PktStackLlpInit stackLLPInit ={
vpcola 0:a1734fe1ec4b 50 * S_DISABLE, // enable/disable the autoack feature
vpcola 0:a1734fe1ec4b 51 * S_DISABLE, // enable/disable the piggybacking feature
vpcola 0:a1734fe1ec4b 52 * PKT_DISABLE_RETX // set the max number of retransmissions or disable them
vpcola 0:a1734fe1ec4b 53 * };
vpcola 0:a1734fe1ec4b 54 * ...
vpcola 0:a1734fe1ec4b 55 *
vpcola 0:a1734fe1ec4b 56 * SpiritPktStackInit(&stackInit);
vpcola 0:a1734fe1ec4b 57 * SpiritPktStackAddressesInit(&addressInit);
vpcola 0:a1734fe1ec4b 58 * SpiritPktStackLlpInit(&stackLLPInit);
vpcola 0:a1734fe1ec4b 59 *
vpcola 0:a1734fe1ec4b 60 * ...
vpcola 0:a1734fe1ec4b 61 *
vpcola 0:a1734fe1ec4b 62 * SpiritPktStackSetPayloadLength(20);
vpcola 0:a1734fe1ec4b 63 * SpiritPktStackSetDestinationAddress(0x44);
vpcola 0:a1734fe1ec4b 64 *
vpcola 0:a1734fe1ec4b 65 * ...
vpcola 0:a1734fe1ec4b 66 *
vpcola 0:a1734fe1ec4b 67 * @endcode
vpcola 0:a1734fe1ec4b 68 *
vpcola 0:a1734fe1ec4b 69 * The module provides some other functions that can be used to modify
vpcola 0:a1734fe1ec4b 70 * or read only some configuration parameters.
vpcola 0:a1734fe1ec4b 71 *
vpcola 0:a1734fe1ec4b 72 *
vpcola 0:a1734fe1ec4b 73 * @attention
vpcola 0:a1734fe1ec4b 74 *
vpcola 0:a1734fe1ec4b 75 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
vpcola 0:a1734fe1ec4b 76 *
vpcola 0:a1734fe1ec4b 77 * Redistribution and use in source and binary forms, with or without modification,
vpcola 0:a1734fe1ec4b 78 * are permitted provided that the following conditions are met:
vpcola 0:a1734fe1ec4b 79 * 1. Redistributions of source code must retain the above copyright notice,
vpcola 0:a1734fe1ec4b 80 * this list of conditions and the following disclaimer.
vpcola 0:a1734fe1ec4b 81 * 2. Redistributions in binary form must reproduce the above copyright notice,
vpcola 0:a1734fe1ec4b 82 * this list of conditions and the following disclaimer in the documentation
vpcola 0:a1734fe1ec4b 83 * and/or other materials provided with the distribution.
vpcola 0:a1734fe1ec4b 84 * 3. Neither the name of STMicroelectronics nor the names of its contributors
vpcola 0:a1734fe1ec4b 85 * may be used to endorse or promote products derived from this software
vpcola 0:a1734fe1ec4b 86 * without specific prior written permission.
vpcola 0:a1734fe1ec4b 87 *
vpcola 0:a1734fe1ec4b 88 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
vpcola 0:a1734fe1ec4b 89 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
vpcola 0:a1734fe1ec4b 90 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
vpcola 0:a1734fe1ec4b 91 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
vpcola 0:a1734fe1ec4b 92 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
vpcola 0:a1734fe1ec4b 93 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
vpcola 0:a1734fe1ec4b 94 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
vpcola 0:a1734fe1ec4b 95 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
vpcola 0:a1734fe1ec4b 96 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
vpcola 0:a1734fe1ec4b 97 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vpcola 0:a1734fe1ec4b 98 *
vpcola 0:a1734fe1ec4b 99 ******************************************************************************
vpcola 0:a1734fe1ec4b 100 */
vpcola 0:a1734fe1ec4b 101
vpcola 0:a1734fe1ec4b 102 /* Define to prevent recursive inclusion -------------------------------------*/
vpcola 0:a1734fe1ec4b 103 #ifndef __SPIRIT_PKT_STACK_H
vpcola 0:a1734fe1ec4b 104 #define __SPIRIT_PKT_STACK_H
vpcola 0:a1734fe1ec4b 105
vpcola 0:a1734fe1ec4b 106 /* Includes ------------------------------------------------------------------*/
vpcola 0:a1734fe1ec4b 107
vpcola 0:a1734fe1ec4b 108 #include "SPIRIT_Regs.h"
vpcola 0:a1734fe1ec4b 109 #include "SPIRIT_Types.h"
vpcola 0:a1734fe1ec4b 110 #include "SPIRIT_PktCommon.h"
vpcola 0:a1734fe1ec4b 111
vpcola 0:a1734fe1ec4b 112 #ifdef __cplusplus
vpcola 0:a1734fe1ec4b 113 extern "C" {
vpcola 0:a1734fe1ec4b 114 #endif
vpcola 0:a1734fe1ec4b 115
vpcola 0:a1734fe1ec4b 116
vpcola 0:a1734fe1ec4b 117
vpcola 0:a1734fe1ec4b 118 /**
vpcola 0:a1734fe1ec4b 119 * @addtogroup SPIRIT_Libraries
vpcola 0:a1734fe1ec4b 120 * @{
vpcola 0:a1734fe1ec4b 121 */
vpcola 0:a1734fe1ec4b 122
vpcola 0:a1734fe1ec4b 123
vpcola 0:a1734fe1ec4b 124 /**
vpcola 0:a1734fe1ec4b 125 * @defgroup SPIRIT_PktStack Pkt STack
vpcola 0:a1734fe1ec4b 126 * @brief Configuration and management of SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 127 * @details See the file <i>@ref SPIRIT_PktStack.h</i> for more details.
vpcola 0:a1734fe1ec4b 128 * @{
vpcola 0:a1734fe1ec4b 129 */
vpcola 0:a1734fe1ec4b 130
vpcola 0:a1734fe1ec4b 131 /**
vpcola 0:a1734fe1ec4b 132 * @defgroup PktStack_Exported_Types Pkt STack Exported Types
vpcola 0:a1734fe1ec4b 133 * @{
vpcola 0:a1734fe1ec4b 134 */
vpcola 0:a1734fe1ec4b 135
vpcola 0:a1734fe1ec4b 136 /**
vpcola 0:a1734fe1ec4b 137 * @brief Preamble length in bytes enumeration.
vpcola 0:a1734fe1ec4b 138 */
vpcola 0:a1734fe1ec4b 139 typedef PktPreambleLength StackPreambleLength;
vpcola 0:a1734fe1ec4b 140
vpcola 0:a1734fe1ec4b 141 #define IS_STACK_PREAMBLE_LENGTH IS_PKT_PREAMBLE_LENGTH
vpcola 0:a1734fe1ec4b 142
vpcola 0:a1734fe1ec4b 143 /**
vpcola 0:a1734fe1ec4b 144 * @brief Sync length in bytes enumeration.
vpcola 0:a1734fe1ec4b 145 */
vpcola 0:a1734fe1ec4b 146 typedef PktSyncLength StackSyncLength;
vpcola 0:a1734fe1ec4b 147
vpcola 0:a1734fe1ec4b 148 #define IS_STACK_SYNC_LENGTH IS_PKT_SYNC_LENGTH
vpcola 0:a1734fe1ec4b 149
vpcola 0:a1734fe1ec4b 150
vpcola 0:a1734fe1ec4b 151
vpcola 0:a1734fe1ec4b 152 /**
vpcola 0:a1734fe1ec4b 153 * @brief CRC length in bytes enumeration.
vpcola 0:a1734fe1ec4b 154 */
vpcola 0:a1734fe1ec4b 155 typedef PktCrcMode StackCrcMode;
vpcola 0:a1734fe1ec4b 156
vpcola 0:a1734fe1ec4b 157 #define IS_STACK_CRC_MODE IS_PKT_CRC_MODE
vpcola 0:a1734fe1ec4b 158
vpcola 0:a1734fe1ec4b 159
vpcola 0:a1734fe1ec4b 160 /**
vpcola 0:a1734fe1ec4b 161 * @brief Fixed or variable payload length enumeration.
vpcola 0:a1734fe1ec4b 162 */
vpcola 0:a1734fe1ec4b 163 typedef PktFixVarLength StackFixVarLength;
vpcola 0:a1734fe1ec4b 164
vpcola 0:a1734fe1ec4b 165 #define IS_STACK_FIX_VAR_LENGTH IS_PKT_FIX_VAR_LENGTH
vpcola 0:a1734fe1ec4b 166
vpcola 0:a1734fe1ec4b 167 /**
vpcola 0:a1734fe1ec4b 168 * @brief Control length in bytes enumeration for SPIRIT.
vpcola 0:a1734fe1ec4b 169 */
vpcola 0:a1734fe1ec4b 170 typedef PktControlLength StackControlLength;
vpcola 0:a1734fe1ec4b 171
vpcola 0:a1734fe1ec4b 172 #define IS_STACK_CONTROL_LENGTH IS_PKT_CONTROL_LENGTH
vpcola 0:a1734fe1ec4b 173
vpcola 0:a1734fe1ec4b 174 /**
vpcola 0:a1734fe1ec4b 175 * @brief Sync words enumeration for SPIRIT.
vpcola 0:a1734fe1ec4b 176 */
vpcola 0:a1734fe1ec4b 177 typedef PktSyncX StackSyncX;
vpcola 0:a1734fe1ec4b 178
vpcola 0:a1734fe1ec4b 179 #define IS_STACK_SYNCx IS_PKT_SYNCx
vpcola 0:a1734fe1ec4b 180
vpcola 0:a1734fe1ec4b 181 /**
vpcola 0:a1734fe1ec4b 182 * @brief Max retransmission number enumeration for SPIRIT.
vpcola 0:a1734fe1ec4b 183 */
vpcola 0:a1734fe1ec4b 184 typedef PktNMaxReTx StackNMaxReTx;
vpcola 0:a1734fe1ec4b 185
vpcola 0:a1734fe1ec4b 186 #define IS_STACK_NMAX_RETX IS_PKT_NMAX_RETX
vpcola 0:a1734fe1ec4b 187
vpcola 0:a1734fe1ec4b 188
vpcola 0:a1734fe1ec4b 189 /**
vpcola 0:a1734fe1ec4b 190 * @brief SPIRIT STack Packet Init structure definition. This structure allows users to set the main options
vpcola 0:a1734fe1ec4b 191 * for the STack packet.
vpcola 0:a1734fe1ec4b 192 */
vpcola 0:a1734fe1ec4b 193 typedef struct
vpcola 0:a1734fe1ec4b 194 {
vpcola 0:a1734fe1ec4b 195
vpcola 0:a1734fe1ec4b 196 StackPreambleLength xPreambleLength; /*!< Specifies the preamble length of packet.
vpcola 0:a1734fe1ec4b 197 This parameter can be any value of @ref StackPreambleLength */
vpcola 0:a1734fe1ec4b 198 StackSyncLength xSyncLength; /*!< Specifies the sync word length of packet.
vpcola 0:a1734fe1ec4b 199 This parameter can be any value of @ref StackSyncLength */
vpcola 0:a1734fe1ec4b 200 uint32_t lSyncWords; /*!< Specifies the sync words.
vpcola 0:a1734fe1ec4b 201 This parameter is a uint32_t word with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4| */
vpcola 0:a1734fe1ec4b 202 StackFixVarLength xFixVarLength; /*!< Specifies if a fixed length of packet has to be used.
vpcola 0:a1734fe1ec4b 203 This parameter can be any value of @ref StackFixVarLength */
vpcola 0:a1734fe1ec4b 204 uint8_t cPktLengthWidth; /*!< Specifies the size of the length of packet in bits. This field is useful only if
vpcola 0:a1734fe1ec4b 205 the field xFixVarLength is set to STACK_LENGTH_VAR. For STack packets the length width
vpcola 0:a1734fe1ec4b 206 is log2( max payload length + control length (0 to 4) + address length (always 2)).
vpcola 0:a1734fe1ec4b 207 This parameter is an uint8_t */
vpcola 0:a1734fe1ec4b 208 StackCrcMode xCrcMode; /*!< Specifies the CRC word length of packet.
vpcola 0:a1734fe1ec4b 209 This parameter can be any value of @ref StackCrcMode */
vpcola 0:a1734fe1ec4b 210 StackControlLength xControlLength; /*!< Specifies the length of a control field to be sent.
vpcola 0:a1734fe1ec4b 211 This parameter can be any value of @ref StackControlLength */
vpcola 0:a1734fe1ec4b 212 SpiritFunctionalState xFec; /*!< Specifies if FEC has to be enabled.
vpcola 0:a1734fe1ec4b 213 This parameter can be any value of @ref SpiritFunctionalState */
vpcola 0:a1734fe1ec4b 214 SpiritFunctionalState xDataWhitening; /*!< Specifies if data whitening has to be enabled.
vpcola 0:a1734fe1ec4b 215 This parameter can be any value of @ref SpiritFunctionalState */
vpcola 0:a1734fe1ec4b 216
vpcola 0:a1734fe1ec4b 217 }PktStackInit;
vpcola 0:a1734fe1ec4b 218
vpcola 0:a1734fe1ec4b 219
vpcola 0:a1734fe1ec4b 220 /**
vpcola 0:a1734fe1ec4b 221 * @brief SPIRIT STack packet address structure definition. This structure allows users to specify
vpcola 0:a1734fe1ec4b 222 * the node/multicast/broadcast addresses and the correspondent filtering options.
vpcola 0:a1734fe1ec4b 223 */
vpcola 0:a1734fe1ec4b 224 typedef struct
vpcola 0:a1734fe1ec4b 225 {
vpcola 0:a1734fe1ec4b 226
vpcola 0:a1734fe1ec4b 227 SpiritFunctionalState xFilterOnMyAddress; /*!< If set RX packet is accepted if its destination address matches with cMyAddress.
vpcola 0:a1734fe1ec4b 228 This parameter can be S_ENABLE or S_DISABLE */
vpcola 0:a1734fe1ec4b 229 uint8_t cMyAddress; /*!< Specifies the TX packet source address (address of this node).
vpcola 0:a1734fe1ec4b 230 This parameter is an uint8_t */
vpcola 0:a1734fe1ec4b 231 SpiritFunctionalState xFilterOnMulticastAddress; /*!< If set RX packet is accepted if its destination address matches with cMulticastAddress.
vpcola 0:a1734fe1ec4b 232 This parameter can be S_ENABLE or S_DISABLE */
vpcola 0:a1734fe1ec4b 233 uint8_t cMulticastAddress; /*!< Specifies the Multicast group address for this node.
vpcola 0:a1734fe1ec4b 234 This parameter is an uint8_t */
vpcola 0:a1734fe1ec4b 235 SpiritFunctionalState xFilterOnBroadcastAddress; /*!< If set RX packet is accepted if its destination address matches with cBroadcastAddress.
vpcola 0:a1734fe1ec4b 236 This parameter can be S_ENABLE or S_DISABLE */
vpcola 0:a1734fe1ec4b 237 uint8_t cBroadcastAddress; /*!< Specifies the Broadcast address for this node.
vpcola 0:a1734fe1ec4b 238 This parameter is an uint8_t */
vpcola 0:a1734fe1ec4b 239 }PktStackAddressesInit;
vpcola 0:a1734fe1ec4b 240
vpcola 0:a1734fe1ec4b 241
vpcola 0:a1734fe1ec4b 242 /**
vpcola 0:a1734fe1ec4b 243 * @brief SPIRIT STack packet LLP structure definition. This structure allows users to configure
vpcola 0:a1734fe1ec4b 244 * all the LLP options for STack packets.
vpcola 0:a1734fe1ec4b 245 */
vpcola 0:a1734fe1ec4b 246 typedef struct
vpcola 0:a1734fe1ec4b 247 {
vpcola 0:a1734fe1ec4b 248
vpcola 0:a1734fe1ec4b 249 SpiritFunctionalState xAutoAck; /*!< Specifies if the auto ACK feature is used or not.
vpcola 0:a1734fe1ec4b 250 This parameter can be a value of @ref SpiritFunctionalState */
vpcola 0:a1734fe1ec4b 251 SpiritFunctionalState xPiggybacking; /*!< Specifies if the piggybacking feature is used or not.
vpcola 0:a1734fe1ec4b 252 This parameter can be a value of @ref SpiritFunctionalState */
vpcola 0:a1734fe1ec4b 253 StackNMaxReTx xNMaxRetx; /*!< Specifies the number of MAX-Retransmissions.
vpcola 0:a1734fe1ec4b 254 This parameter can be a value of @ref StackNMaxReTx */
vpcola 0:a1734fe1ec4b 255 }PktStackLlpInit;
vpcola 0:a1734fe1ec4b 256
vpcola 0:a1734fe1ec4b 257
vpcola 0:a1734fe1ec4b 258
vpcola 0:a1734fe1ec4b 259 /**
vpcola 0:a1734fe1ec4b 260 *@}
vpcola 0:a1734fe1ec4b 261 */
vpcola 0:a1734fe1ec4b 262
vpcola 0:a1734fe1ec4b 263
vpcola 0:a1734fe1ec4b 264 /**
vpcola 0:a1734fe1ec4b 265 * @defgroup PktStack_Exported_Constants Pkt STack Exported Constants
vpcola 0:a1734fe1ec4b 266 * @{
vpcola 0:a1734fe1ec4b 267 */
vpcola 0:a1734fe1ec4b 268
vpcola 0:a1734fe1ec4b 269 #define IS_STACK_LENGTH_WIDTH_BITS IS_PKT_LENGTH_WIDTH_BITS
vpcola 0:a1734fe1ec4b 270
vpcola 0:a1734fe1ec4b 271 /**
vpcola 0:a1734fe1ec4b 272 *@}
vpcola 0:a1734fe1ec4b 273 */
vpcola 0:a1734fe1ec4b 274
vpcola 0:a1734fe1ec4b 275
vpcola 0:a1734fe1ec4b 276 /**
vpcola 0:a1734fe1ec4b 277 * @defgroup PktStack_Exported_Macros Pkt STack Exported Macros
vpcola 0:a1734fe1ec4b 278 * @{
vpcola 0:a1734fe1ec4b 279 */
vpcola 0:a1734fe1ec4b 280
vpcola 0:a1734fe1ec4b 281 /**
vpcola 0:a1734fe1ec4b 282 * @brief Macro used to compute the lower part of the packet length
vpcola 0:a1734fe1ec4b 283 * for Spirit STack packets, to write in the PCKTLEN0 register.
vpcola 0:a1734fe1ec4b 284 * @param nLength length of the packet payload.
vpcola 0:a1734fe1ec4b 285 * This parameter is an uint16_t.
vpcola 0:a1734fe1ec4b 286 * @retval None.
vpcola 0:a1734fe1ec4b 287 */
vpcola 0:a1734fe1ec4b 288 #define STACK_BUILD_PCKTLEN0(nLength) BUILD_PCKTLEN0(nLength)
vpcola 0:a1734fe1ec4b 289
vpcola 0:a1734fe1ec4b 290
vpcola 0:a1734fe1ec4b 291 /**
vpcola 0:a1734fe1ec4b 292 * @brief Macro used to compute the upper part of the packet length
vpcola 0:a1734fe1ec4b 293 * for Spirit STack packets, to write the PCKTLEN1 register.
vpcola 0:a1734fe1ec4b 294 * @param nLength length of the packet payload.
vpcola 0:a1734fe1ec4b 295 * This parameter is an uint16_t.
vpcola 0:a1734fe1ec4b 296 * @retval None.
vpcola 0:a1734fe1ec4b 297 */
vpcola 0:a1734fe1ec4b 298 #define STACK_BUILD_PCKTLEN1(nLength) BUILD_PCKTLEN1(nLength)
vpcola 0:a1734fe1ec4b 299
vpcola 0:a1734fe1ec4b 300
vpcola 0:a1734fe1ec4b 301 /**
vpcola 0:a1734fe1ec4b 302 * @brief Sets the CONTROL length for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 303 * @param xControlLength length of CONTROL field in bytes.
vpcola 0:a1734fe1ec4b 304 * This parameter can be any value of @ref StackControlLength.
vpcola 0:a1734fe1ec4b 305 * @retval None.
vpcola 0:a1734fe1ec4b 306 */
vpcola 0:a1734fe1ec4b 307 #define SpiritPktStackSetControlLength(xControlLength) SpiritPktCommonSetControlLength(xControlLength)
vpcola 0:a1734fe1ec4b 308
vpcola 0:a1734fe1ec4b 309
vpcola 0:a1734fe1ec4b 310 /**
vpcola 0:a1734fe1ec4b 311 * @brief Returns the CONTROL length for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 312 * @param None.
vpcola 0:a1734fe1ec4b 313 * @retval Control length.
vpcola 0:a1734fe1ec4b 314 */
vpcola 0:a1734fe1ec4b 315 #define SpiritPktStackGetControlLength() SpiritPktCommonGetControlLength()
vpcola 0:a1734fe1ec4b 316
vpcola 0:a1734fe1ec4b 317
vpcola 0:a1734fe1ec4b 318 /**
vpcola 0:a1734fe1ec4b 319 * @brief Sets the PREAMBLE Length mode for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 320 * @param xPreambleLength length of PREAMBLE field in bytes.
vpcola 0:a1734fe1ec4b 321 * This parameter can be any value of @ref StackPreambleLength.
vpcola 0:a1734fe1ec4b 322 * @retval None.
vpcola 0:a1734fe1ec4b 323 */
vpcola 0:a1734fe1ec4b 324 #define SpiritPktStackSetPreambleLength(xPreambleLength) SpiritPktCommonSetPreambleLength((PktPreambleLength)xPreambleLength)
vpcola 0:a1734fe1ec4b 325
vpcola 0:a1734fe1ec4b 326
vpcola 0:a1734fe1ec4b 327 /**
vpcola 0:a1734fe1ec4b 328 * @brief Returns the PREAMBLE Length mode for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 329 * @param None.
vpcola 0:a1734fe1ec4b 330 * @retval uint8_t Preamble length in bytes.
vpcola 0:a1734fe1ec4b 331 */
vpcola 0:a1734fe1ec4b 332 #define SpiritPktStackGetPreambleLength() SpiritPktCommonGetPreambleLength()
vpcola 0:a1734fe1ec4b 333
vpcola 0:a1734fe1ec4b 334
vpcola 0:a1734fe1ec4b 335 /**
vpcola 0:a1734fe1ec4b 336 * @brief Sets the SYNC Length for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 337 * @param xSyncLength length of SYNC field in bytes.
vpcola 0:a1734fe1ec4b 338 * This parameter can be any value of @ref StackSyncLength.
vpcola 0:a1734fe1ec4b 339 * @retval None.
vpcola 0:a1734fe1ec4b 340 */
vpcola 0:a1734fe1ec4b 341 #define SpiritPktStackSetSyncLength(xSyncLength) SpiritPktCommonSetSyncLength((PktSyncLength)xSyncLength)
vpcola 0:a1734fe1ec4b 342
vpcola 0:a1734fe1ec4b 343
vpcola 0:a1734fe1ec4b 344 /**
vpcola 0:a1734fe1ec4b 345 * @brief Returns the SYNC Length for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 346 * @param None.
vpcola 0:a1734fe1ec4b 347 * @retval uint8_t Sync length in bytes.
vpcola 0:a1734fe1ec4b 348 */
vpcola 0:a1734fe1ec4b 349 #define SpiritPktStackGetSyncLength() SpiritPktCommonGetSyncLength()
vpcola 0:a1734fe1ec4b 350
vpcola 0:a1734fe1ec4b 351
vpcola 0:a1734fe1ec4b 352 /**
vpcola 0:a1734fe1ec4b 353 * @brief Sets fixed or variable payload length mode for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 354 * @param xFixVarLength variable or fixed length.
vpcola 0:a1734fe1ec4b 355 * PKT_FIXED_LENGTH_VAR -> variable (the length is extracted from the received packet).
vpcola 0:a1734fe1ec4b 356 * PKT_FIXED_LENGTH_FIX -> fix (the length is set by PCKTLEN0 and PCKTLEN1).
vpcola 0:a1734fe1ec4b 357 * @retval None.
vpcola 0:a1734fe1ec4b 358 */
vpcola 0:a1734fe1ec4b 359 #define SpiritPktStackSetFixVarLength(xFixVarLength) SpiritPktCommonSetFixVarLength((PktFixVarLength)xFixVarLength)
vpcola 0:a1734fe1ec4b 360
vpcola 0:a1734fe1ec4b 361
vpcola 0:a1734fe1ec4b 362 /**
vpcola 0:a1734fe1ec4b 363 * @brief Enables or Disables the CRC filtering.
vpcola 0:a1734fe1ec4b 364 * @param xNewState new state for CRC_CHECK.
vpcola 0:a1734fe1ec4b 365 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 366 * @retval None.
vpcola 0:a1734fe1ec4b 367 */
vpcola 0:a1734fe1ec4b 368 #define SpiritPktStackFilterOnCrc(xNewState) SpiritPktCommonFilterOnCrc(xNewState)
vpcola 0:a1734fe1ec4b 369
vpcola 0:a1734fe1ec4b 370
vpcola 0:a1734fe1ec4b 371 /**
vpcola 0:a1734fe1ec4b 372 * @brief Returns the CRC filtering bit.
vpcola 0:a1734fe1ec4b 373 * @param None.
vpcola 0:a1734fe1ec4b 374 * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 375 */
vpcola 0:a1734fe1ec4b 376 #define SpiritPktStackGetFilterOnCrc() SpiritPktCommonGetFilterOnCrc()
vpcola 0:a1734fe1ec4b 377
vpcola 0:a1734fe1ec4b 378
vpcola 0:a1734fe1ec4b 379 /**
vpcola 0:a1734fe1ec4b 380 * @brief Sets the CRC mode for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 381 * @param xCrcMode CRC mode.
vpcola 0:a1734fe1ec4b 382 * This parameter can be any value of @ref StackCrcMode.
vpcola 0:a1734fe1ec4b 383 * @retval None.
vpcola 0:a1734fe1ec4b 384 */
vpcola 0:a1734fe1ec4b 385 #define SpiritPktStackSetCrcMode(xCrcMode) SpiritPktCommonSetCrcMode((PktCrcMode)xCrcMode)
vpcola 0:a1734fe1ec4b 386
vpcola 0:a1734fe1ec4b 387
vpcola 0:a1734fe1ec4b 388 /**
vpcola 0:a1734fe1ec4b 389 * @brief Returns the CRC mode for SPIRIT packets.
vpcola 0:a1734fe1ec4b 390 * @param None.
vpcola 0:a1734fe1ec4b 391 * @retval StackCrcMode Crc mode.
vpcola 0:a1734fe1ec4b 392 */
vpcola 0:a1734fe1ec4b 393 #define SpiritPktStackGetCrcMode() (StackCrcMode)SpiritPktCommonGetCrcMode()
vpcola 0:a1734fe1ec4b 394
vpcola 0:a1734fe1ec4b 395
vpcola 0:a1734fe1ec4b 396 /**
vpcola 0:a1734fe1ec4b 397 * @brief Enables or Disables WHITENING for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 398 * @param xNewState new state for WHITENING mode.
vpcola 0:a1734fe1ec4b 399 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 400 * @retval None.
vpcola 0:a1734fe1ec4b 401 */
vpcola 0:a1734fe1ec4b 402 #define SpiritPktStackWhitening(xNewState) SpiritPktCommonWhitening(xNewState)
vpcola 0:a1734fe1ec4b 403
vpcola 0:a1734fe1ec4b 404
vpcola 0:a1734fe1ec4b 405 /**
vpcola 0:a1734fe1ec4b 406 * @brief Enables or Disables FEC for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 407 * @param xNewState new state for FEC mode.
vpcola 0:a1734fe1ec4b 408 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 409 * @retval None.
vpcola 0:a1734fe1ec4b 410 */
vpcola 0:a1734fe1ec4b 411 #define SpiritPktStackFec(xNewState) SpiritPktCommonFec(xNewState)
vpcola 0:a1734fe1ec4b 412
vpcola 0:a1734fe1ec4b 413
vpcola 0:a1734fe1ec4b 414 /**
vpcola 0:a1734fe1ec4b 415 * @brief Sets a specific SYNC word for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 416 * @param xSyncX SYNC word number to be set.
vpcola 0:a1734fe1ec4b 417 * This parameter can be any value of @ref StackSyncX.
vpcola 0:a1734fe1ec4b 418 * @param cSyncWord SYNC word.
vpcola 0:a1734fe1ec4b 419 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 420 * @retval None.
vpcola 0:a1734fe1ec4b 421 */
vpcola 0:a1734fe1ec4b 422 #define SpiritPktStackSetSyncxWord(xSyncX, cSyncWord) SpiritPktCommonSetSyncxWord((PktSyncX)xSyncX,cSyncWord)
vpcola 0:a1734fe1ec4b 423
vpcola 0:a1734fe1ec4b 424
vpcola 0:a1734fe1ec4b 425 /**
vpcola 0:a1734fe1ec4b 426 * @brief Returns a specific SYNC word for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 427 * @param xSyncX SYNC word number to be get.
vpcola 0:a1734fe1ec4b 428 * This parameter can be any value of @ref StackSyncX.
vpcola 0:a1734fe1ec4b 429 * @retval uint8_t Sync word x.
vpcola 0:a1734fe1ec4b 430 */
vpcola 0:a1734fe1ec4b 431 #define SpiritPktStackGetSyncxWord(xSyncX) SpiritPktCommonGetSyncxWord(xSyncX)
vpcola 0:a1734fe1ec4b 432
vpcola 0:a1734fe1ec4b 433
vpcola 0:a1734fe1ec4b 434 /**
vpcola 0:a1734fe1ec4b 435 * @brief Sets multiple SYNC words for SPIRIT STack packets.
vpcola 0:a1734fe1ec4b 436 * @param lSyncWords SYNC words to be set with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4|.
vpcola 0:a1734fe1ec4b 437 * This parameter is a uint32_t.
vpcola 0:a1734fe1ec4b 438 * @param xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb
vpcola 0:a1734fe1ec4b 439 * until the number of bytes in xSyncLength has been stored.
vpcola 0:a1734fe1ec4b 440 * This parameter is a @ref StackSyncLength.
vpcola 0:a1734fe1ec4b 441 * @retval None.
vpcola 0:a1734fe1ec4b 442 */
vpcola 0:a1734fe1ec4b 443 #define SpiritPktStackSetSyncWords(lSyncWords, xSyncLength) SpiritPktCommonSetSyncWords(lSyncWords,(PktSyncLength)xSyncLength)
vpcola 0:a1734fe1ec4b 444
vpcola 0:a1734fe1ec4b 445
vpcola 0:a1734fe1ec4b 446 /**
vpcola 0:a1734fe1ec4b 447 * @brief Returns multiple SYNC words for SPIRIT packets.
vpcola 0:a1734fe1ec4b 448 * @param xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb
vpcola 0:a1734fe1ec4b 449 * until the number of bytes in xSyncLength has been stored.
vpcola 0:a1734fe1ec4b 450 * This parameter is a pointer to @ref StackSyncLength.
vpcola 0:a1734fe1ec4b 451 * @retval uint32_t Sync words. The format of the read 32 bit word is 0x|SYNC1|SYNC2|SYNC3|SYNC4|.
vpcola 0:a1734fe1ec4b 452 */
vpcola 0:a1734fe1ec4b 453 #define SpiritPktStackGetSyncWords(xSyncLength) SpiritPktCommonGetSyncWords((PktSyncLength)xSyncLength)
vpcola 0:a1734fe1ec4b 454
vpcola 0:a1734fe1ec4b 455
vpcola 0:a1734fe1ec4b 456 /**
vpcola 0:a1734fe1ec4b 457 * @brief Returns the SPIRIT variable length width (in number of bits).
vpcola 0:a1734fe1ec4b 458 * @param None.
vpcola 0:a1734fe1ec4b 459 * @retval uint8_t Variable length width in bits.
vpcola 0:a1734fe1ec4b 460 */
vpcola 0:a1734fe1ec4b 461 #define SpiritPktStackGetVarLengthWidth() SpiritPktCommonGetVarLengthWidth()
vpcola 0:a1734fe1ec4b 462
vpcola 0:a1734fe1ec4b 463
vpcola 0:a1734fe1ec4b 464 /**
vpcola 0:a1734fe1ec4b 465 * @brief Sets the destination address for the Tx packet.
vpcola 0:a1734fe1ec4b 466 * @param cAddress destination address.
vpcola 0:a1734fe1ec4b 467 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 468 * @retval None.
vpcola 0:a1734fe1ec4b 469 */
vpcola 0:a1734fe1ec4b 470 #define SpiritPktStackSetDestinationAddress(cAddress) SpiritPktCommonSetDestinationAddress(cAddress)
vpcola 0:a1734fe1ec4b 471
vpcola 0:a1734fe1ec4b 472
vpcola 0:a1734fe1ec4b 473 /**
vpcola 0:a1734fe1ec4b 474 * @brief Sets the Rx packet reference source address. The source address extracted from the received packet is masked
vpcola 0:a1734fe1ec4b 475 * with the source reference mask and then compared to the masked reference value.
vpcola 0:a1734fe1ec4b 476 * @param cAddress Reference source address.
vpcola 0:a1734fe1ec4b 477 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 478 * @retval None.
vpcola 0:a1734fe1ec4b 479 */
vpcola 0:a1734fe1ec4b 480 #define SpiritPktStackSetSourceReferenceAddress(cAddress) SpiritPktCommonSetDestinationAddress(cAddress)
vpcola 0:a1734fe1ec4b 481
vpcola 0:a1734fe1ec4b 482
vpcola 0:a1734fe1ec4b 483 /**
vpcola 0:a1734fe1ec4b 484 * @brief Returns the Rx packet reference source address. The source address extracted from the received packet is masked
vpcola 0:a1734fe1ec4b 485 * with the source reference mask and then compared to the masked reference value.
vpcola 0:a1734fe1ec4b 486 * @param cAddress Reference source address.
vpcola 0:a1734fe1ec4b 487 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 488 * @retval None.
vpcola 0:a1734fe1ec4b 489 */
vpcola 0:a1734fe1ec4b 490 #define SpiritPktStackGetSourceReferenceAddress() SpiritPktCommonGetTransmittedDestAddress()
vpcola 0:a1734fe1ec4b 491
vpcola 0:a1734fe1ec4b 492
vpcola 0:a1734fe1ec4b 493 /**
vpcola 0:a1734fe1ec4b 494 * @brief Returns the settled destination address.
vpcola 0:a1734fe1ec4b 495 * @param None.
vpcola 0:a1734fe1ec4b 496 * @retval uint8_t Transmitted destination address.
vpcola 0:a1734fe1ec4b 497 */
vpcola 0:a1734fe1ec4b 498 #define SpiritPktStackGetTransmittedDestAddress() SpiritPktCommonGetTransmittedDestAddress()
vpcola 0:a1734fe1ec4b 499
vpcola 0:a1734fe1ec4b 500
vpcola 0:a1734fe1ec4b 501 /**
vpcola 0:a1734fe1ec4b 502 * @brief Sets the node address. When the filtering on my address is on, if the destination address extracted from the received packet is equal to the content of the
vpcola 0:a1734fe1ec4b 503 * my address, then the packet is accepted (this is the address of the node).
vpcola 0:a1734fe1ec4b 504 * @param cAddress Address of the present node.
vpcola 0:a1734fe1ec4b 505 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 506 * @retval None.
vpcola 0:a1734fe1ec4b 507 */
vpcola 0:a1734fe1ec4b 508 #define SpiritPktStackSetMyAddress(cAddress) SpiritPktCommonSetMyAddress(cAddress)
vpcola 0:a1734fe1ec4b 509
vpcola 0:a1734fe1ec4b 510
vpcola 0:a1734fe1ec4b 511 /**
vpcola 0:a1734fe1ec4b 512 * @brief Returns the address of the present node.
vpcola 0:a1734fe1ec4b 513 * @param None.
vpcola 0:a1734fe1ec4b 514 * @retval uint8_t My address (address of this node).
vpcola 0:a1734fe1ec4b 515 */
vpcola 0:a1734fe1ec4b 516 #define SpiritPktStackGetMyAddress() SpiritPktCommonGetMyAddress()
vpcola 0:a1734fe1ec4b 517
vpcola 0:a1734fe1ec4b 518
vpcola 0:a1734fe1ec4b 519 /**
vpcola 0:a1734fe1ec4b 520 * @brief Sets the broadcast address. When the broadcast filtering is on, if the destination address extracted from the received packet is equal to the content of the
vpcola 0:a1734fe1ec4b 521 * BROADCAST_ADDR register, then the packet is accepted.
vpcola 0:a1734fe1ec4b 522 * @param cAddress Broadcast address.
vpcola 0:a1734fe1ec4b 523 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 524 * @retval None.
vpcola 0:a1734fe1ec4b 525 */
vpcola 0:a1734fe1ec4b 526 #define SpiritPktStackSetBroadcastAddress(cAddress) SpiritPktCommonSetBroadcastAddress(cAddress)
vpcola 0:a1734fe1ec4b 527
vpcola 0:a1734fe1ec4b 528
vpcola 0:a1734fe1ec4b 529 /**
vpcola 0:a1734fe1ec4b 530 * @brief Returns the broadcast address.
vpcola 0:a1734fe1ec4b 531 * @param None.
vpcola 0:a1734fe1ec4b 532 * @retval uint8_t Broadcast address.
vpcola 0:a1734fe1ec4b 533 */
vpcola 0:a1734fe1ec4b 534 #define SpiritPktStackGetBroadcastAddress() SpiritPktCommonGetBroadcastAddress()
vpcola 0:a1734fe1ec4b 535
vpcola 0:a1734fe1ec4b 536
vpcola 0:a1734fe1ec4b 537 /**
vpcola 0:a1734fe1ec4b 538 * @brief Sets the multicast address. When the multicast filtering is on, if the destination address extracted from the received packet is equal to the content of the
vpcola 0:a1734fe1ec4b 539 * MULTICAST_ADDR register, then the packet is accepted.
vpcola 0:a1734fe1ec4b 540 * @param cAddress Multicast address.
vpcola 0:a1734fe1ec4b 541 * This parameter is an uint8_t.
vpcola 0:a1734fe1ec4b 542 * @retval None.
vpcola 0:a1734fe1ec4b 543 */
vpcola 0:a1734fe1ec4b 544 #define SpiritPktStackSetMulticastAddress(cAddress) SpiritPktCommonSetMulticastAddress(cAddress)
vpcola 0:a1734fe1ec4b 545
vpcola 0:a1734fe1ec4b 546
vpcola 0:a1734fe1ec4b 547 /**
vpcola 0:a1734fe1ec4b 548 * @brief Returns the multicast address.
vpcola 0:a1734fe1ec4b 549 * @param None.
vpcola 0:a1734fe1ec4b 550 * @retval uint8_t Multicast address.
vpcola 0:a1734fe1ec4b 551 */
vpcola 0:a1734fe1ec4b 552 #define SpiritPktStackGetMulticastAddress() SpiritPktCommonGetMulticastAddress()
vpcola 0:a1734fe1ec4b 553
vpcola 0:a1734fe1ec4b 554
vpcola 0:a1734fe1ec4b 555 /**
vpcola 0:a1734fe1ec4b 556 * @brief Sets the control mask. The 1 bits of the CONTROL_MASK indicate the
vpcola 0:a1734fe1ec4b 557 * bits to be used in filtering. (All 0s no filtering)
vpcola 0:a1734fe1ec4b 558 * @param lMask Control mask.
vpcola 0:a1734fe1ec4b 559 * This parameter is an uint32_t.
vpcola 0:a1734fe1ec4b 560 * @retval None.
vpcola 0:a1734fe1ec4b 561 */
vpcola 0:a1734fe1ec4b 562 #define SpiritPktStackSetCtrlMask(lMask) SpiritPktCommonSetCtrlMask(lMask)
vpcola 0:a1734fe1ec4b 563
vpcola 0:a1734fe1ec4b 564
vpcola 0:a1734fe1ec4b 565 /**
vpcola 0:a1734fe1ec4b 566 * @brief Returns the control mask. The 1 bits of the CONTROL_MASK indicate the
vpcola 0:a1734fe1ec4b 567 * bits to be used in filtering. (All 0s no filtering)
vpcola 0:a1734fe1ec4b 568 * @param None.
vpcola 0:a1734fe1ec4b 569 * @retval uint32_t Control mask.
vpcola 0:a1734fe1ec4b 570 */
vpcola 0:a1734fe1ec4b 571 #define SpiritPktStackGetCtrlMask() SpiritPktCommonGetCtrlMask()
vpcola 0:a1734fe1ec4b 572
vpcola 0:a1734fe1ec4b 573
vpcola 0:a1734fe1ec4b 574 /**
vpcola 0:a1734fe1ec4b 575 * @brief Sets the control field reference. If the bits enabled by the
vpcola 0:a1734fe1ec4b 576 * CONTROL_MASK match the ones of the control fields extracted from the received packet
vpcola 0:a1734fe1ec4b 577 * then the packet is accepted.
vpcola 0:a1734fe1ec4b 578 * @param lReference Control reference.
vpcola 0:a1734fe1ec4b 579 * This parameter is an uint32_t.
vpcola 0:a1734fe1ec4b 580 * @retval None.
vpcola 0:a1734fe1ec4b 581 */
vpcola 0:a1734fe1ec4b 582 #define SpiritPktStackSetCtrlReference(lReference) SpiritPktCommonSetCtrlReference(lReference)
vpcola 0:a1734fe1ec4b 583
vpcola 0:a1734fe1ec4b 584
vpcola 0:a1734fe1ec4b 585 /**
vpcola 0:a1734fe1ec4b 586 * @brief Returns the control field reference.
vpcola 0:a1734fe1ec4b 587 * @param None.
vpcola 0:a1734fe1ec4b 588 * @retval uint32_t Control reference.
vpcola 0:a1734fe1ec4b 589 */
vpcola 0:a1734fe1ec4b 590 #define SpiritPktStackGetCtrlReference() SpiritPktCommonGetCtrlReference()
vpcola 0:a1734fe1ec4b 591
vpcola 0:a1734fe1ec4b 592
vpcola 0:a1734fe1ec4b 593 /**
vpcola 0:a1734fe1ec4b 594 * @brief Sets the TX control field.
vpcola 0:a1734fe1ec4b 595 * @param lField TX CONTROL FIELD.
vpcola 0:a1734fe1ec4b 596 * This parameter is an uint32_t.
vpcola 0:a1734fe1ec4b 597 * @retval None.
vpcola 0:a1734fe1ec4b 598 */
vpcola 0:a1734fe1ec4b 599 #define SpiritPktStackSetTransmittedCtrlField(lField) SpiritPktCommonSetTransmittedCtrlField(lField)
vpcola 0:a1734fe1ec4b 600
vpcola 0:a1734fe1ec4b 601
vpcola 0:a1734fe1ec4b 602 /**
vpcola 0:a1734fe1ec4b 603 * @brief Returns the TX control field.
vpcola 0:a1734fe1ec4b 604 * @param None.
vpcola 0:a1734fe1ec4b 605 * @retval uint32_t Control field of the transmitted packet.
vpcola 0:a1734fe1ec4b 606 */
vpcola 0:a1734fe1ec4b 607 #define SpiritPktStackGetTransmittedCtrlField() SpiritPktCommonGetTransmittedCtrlField()
vpcola 0:a1734fe1ec4b 608
vpcola 0:a1734fe1ec4b 609
vpcola 0:a1734fe1ec4b 610 /**
vpcola 0:a1734fe1ec4b 611 * @brief If enabled RX packet is accepted if its destination address matches with TX_SOURCE_ADDRESS.
vpcola 0:a1734fe1ec4b 612 * @param xNewState new state for DEST_VS_SOURCE_ADDRESS.
vpcola 0:a1734fe1ec4b 613 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 614 * @retval None.
vpcola 0:a1734fe1ec4b 615 */
vpcola 0:a1734fe1ec4b 616 #define SpiritPktStackFilterOnMyAddress(xNewState) SpiritPktCommonFilterOnMyAddress(xNewState)
vpcola 0:a1734fe1ec4b 617
vpcola 0:a1734fe1ec4b 618
vpcola 0:a1734fe1ec4b 619 /**
vpcola 0:a1734fe1ec4b 620 * @brief If enabled RX packet is accepted if its destination address matches with MULTICAST_ADDRESS.
vpcola 0:a1734fe1ec4b 621 * @param xNewState new state for DEST_VS_MULTICAST_ADDRESS.
vpcola 0:a1734fe1ec4b 622 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 623 * @retval None.
vpcola 0:a1734fe1ec4b 624 */
vpcola 0:a1734fe1ec4b 625 #define SpiritPktStackFilterOnMulticastAddress(xNewState) SpiritPktCommonFilterOnMulticastAddress(xNewState)
vpcola 0:a1734fe1ec4b 626
vpcola 0:a1734fe1ec4b 627
vpcola 0:a1734fe1ec4b 628 /**
vpcola 0:a1734fe1ec4b 629 * @brief If enabled RX packet is accepted if its destination address matches with BROADCAST_ADDRESS.
vpcola 0:a1734fe1ec4b 630 * @param xNewState new state for DEST_VS_BROADCAST_ADDRESS.
vpcola 0:a1734fe1ec4b 631 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 632 * @retval None.
vpcola 0:a1734fe1ec4b 633 */
vpcola 0:a1734fe1ec4b 634 #define SpiritPktStackFilterOnBroadcastAddress(xNewState) SpiritPktCommonFilterOnBroadcastAddress(xNewState)
vpcola 0:a1734fe1ec4b 635
vpcola 0:a1734fe1ec4b 636
vpcola 0:a1734fe1ec4b 637 /**
vpcola 0:a1734fe1ec4b 638 * @brief Returns the enable bit of the my address filtering.
vpcola 0:a1734fe1ec4b 639 * @param None.
vpcola 0:a1734fe1ec4b 640 * @retval SpiritFunctionalStateThis parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 641 */
vpcola 0:a1734fe1ec4b 642 #define SpiritPktStackGetFilterOnMyAddress() SpiritPktCommonGetFilterOnMyAddress();
vpcola 0:a1734fe1ec4b 643
vpcola 0:a1734fe1ec4b 644
vpcola 0:a1734fe1ec4b 645 /**
vpcola 0:a1734fe1ec4b 646 * @brief Returns the enable bit of the multicast address filtering.
vpcola 0:a1734fe1ec4b 647 * @param None.
vpcola 0:a1734fe1ec4b 648 * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 649 */
vpcola 0:a1734fe1ec4b 650 #define SpiritPktStackGetFilterOnMulticastAddress() SpiritPktCommonGetFilterOnMulticastAddress();
vpcola 0:a1734fe1ec4b 651
vpcola 0:a1734fe1ec4b 652
vpcola 0:a1734fe1ec4b 653 /**
vpcola 0:a1734fe1ec4b 654 * @brief Returns the enable bit of the broadcast address filtering.
vpcola 0:a1734fe1ec4b 655 * @param None.
vpcola 0:a1734fe1ec4b 656 * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 657 */
vpcola 0:a1734fe1ec4b 658 #define SpiritPktStackGetFilterOnBroadcastAddress() SpiritPktCommonGetFilterOnBroadcastAddress();
vpcola 0:a1734fe1ec4b 659
vpcola 0:a1734fe1ec4b 660
vpcola 0:a1734fe1ec4b 661 /**
vpcola 0:a1734fe1ec4b 662 * @brief Returns the control field of the received packet.
vpcola 0:a1734fe1ec4b 663 * @param None.
vpcola 0:a1734fe1ec4b 664 * @retval uint32_t Received control field.
vpcola 0:a1734fe1ec4b 665 */
vpcola 0:a1734fe1ec4b 666 #define SpiritPktStackGetReceivedCtrlField() SpiritPktCommonGetReceivedCtrlField()
vpcola 0:a1734fe1ec4b 667
vpcola 0:a1734fe1ec4b 668
vpcola 0:a1734fe1ec4b 669 /**
vpcola 0:a1734fe1ec4b 670 * @brief Returns the CRC field of the received packet.
vpcola 0:a1734fe1ec4b 671 * @param cCrcFieldVect array in which the CRC field has to be stored.
vpcola 0:a1734fe1ec4b 672 * This parameter is an uint8_t array of 3 elements.
vpcola 0:a1734fe1ec4b 673 * @retval None.
vpcola 0:a1734fe1ec4b 674 */
vpcola 0:a1734fe1ec4b 675 #define SpiritPktStackGetReceivedCrcField(cCrcFieldVect) SpiritPktCommonGetReceivedCrcField(cCrcFieldVect)
vpcola 0:a1734fe1ec4b 676
vpcola 0:a1734fe1ec4b 677 /**
vpcola 0:a1734fe1ec4b 678 * @brief Sets the AUTO ACKNOLEDGEMENT mechanism on the receiver. When the feature is enabled and
vpcola 0:a1734fe1ec4b 679 * a data packet has been correctly received, then an acknowledgement packet is sent back to the originator of the received
vpcola 0:a1734fe1ec4b 680 * packet. If the PIGGYBACKING bit is also set, payload data will be read from the FIFO; otherwise an empty packet is sent
vpcola 0:a1734fe1ec4b 681 * only containing the source and destination addresses and the sequence number of the packet being acknowledged.
vpcola 0:a1734fe1ec4b 682 * @param xAutoAck new state for autoack.
vpcola 0:a1734fe1ec4b 683 * This parameter can be: S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 684 * @param xPiggybacking new state for autoack.
vpcola 0:a1734fe1ec4b 685 * This parameter can be: S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 686 * @retval None.
vpcola 0:a1734fe1ec4b 687 */
vpcola 0:a1734fe1ec4b 688 #define SpiritPktStackAutoAck(xAutoAck, xPiggybacking) SpiritPktCommonAutoAck(xAutoAck, xPiggybacking)
vpcola 0:a1734fe1ec4b 689
vpcola 0:a1734fe1ec4b 690
vpcola 0:a1734fe1ec4b 691 /**
vpcola 0:a1734fe1ec4b 692 * @brief Sets the AUTO ACKNOLEDGEMENT mechanism on the transmitter. On the transmitter side, the NACK_TX field can be used to require or not an acknowledgment for each individual packet: if
vpcola 0:a1734fe1ec4b 693 * NACK_TX is set to "1" then acknowledgment will not be required; if NACK_TX is set to "0" then acknowledgment will be
vpcola 0:a1734fe1ec4b 694 * required.
vpcola 0:a1734fe1ec4b 695 * @param xNewState new state for TX_AUTOACK.
vpcola 0:a1734fe1ec4b 696 * This parameter can be: S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 697 * @retval None.
vpcola 0:a1734fe1ec4b 698 */
vpcola 0:a1734fe1ec4b 699 #define SpiritPktStackRequireAck(xNewState) SpiritPktCommonRequireAck(xNewState)
vpcola 0:a1734fe1ec4b 700
vpcola 0:a1734fe1ec4b 701
vpcola 0:a1734fe1ec4b 702 /**
vpcola 0:a1734fe1ec4b 703 * @brief Sets the TX sequence number to be used to start counting.
vpcola 0:a1734fe1ec4b 704 * @param cSeqNumberReload new value for Tx seq number reload.
vpcola 0:a1734fe1ec4b 705 * This parameter can be: S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 706 * @retval None.
vpcola 0:a1734fe1ec4b 707 */
vpcola 0:a1734fe1ec4b 708 #define SpiritPktStackSetTransmittedSeqNumberReload(cSeqNumberReload) SpiritPktCommonSetTransmittedSeqNumberReload(cSeqNumberReload)
vpcola 0:a1734fe1ec4b 709
vpcola 0:a1734fe1ec4b 710
vpcola 0:a1734fe1ec4b 711 /**
vpcola 0:a1734fe1ec4b 712 * @brief Sets the max number of automatic retransmission.
vpcola 0:a1734fe1ec4b 713 * @param xNMaxReTx max number of retransmission.
vpcola 0:a1734fe1ec4b 714 * This parameter can be any value of @ref PktNMaxReTx.
vpcola 0:a1734fe1ec4b 715 * @retval None.
vpcola 0:a1734fe1ec4b 716 */
vpcola 0:a1734fe1ec4b 717 #define SpiritPktStackSetNMaxReTx(xNMaxReTx) SpiritPktCommonSetNMaxReTx((PktNMaxReTx)xNMaxReTx)
vpcola 0:a1734fe1ec4b 718
vpcola 0:a1734fe1ec4b 719
vpcola 0:a1734fe1ec4b 720 /**
vpcola 0:a1734fe1ec4b 721 * @brief Returns the max number of automatic retransmission.
vpcola 0:a1734fe1ec4b 722 * @param None.
vpcola 0:a1734fe1ec4b 723 * @retval uint8_t Max number of retransmissions.
vpcola 0:a1734fe1ec4b 724 */
vpcola 0:a1734fe1ec4b 725 #define SpiritPktStackGetNMaxReTx() SpiritPktCommonGetNMaxReTx()
vpcola 0:a1734fe1ec4b 726
vpcola 0:a1734fe1ec4b 727
vpcola 0:a1734fe1ec4b 728 /**
vpcola 0:a1734fe1ec4b 729 * @brief Returns the TX ACK request.
vpcola 0:a1734fe1ec4b 730 * @param None.
vpcola 0:a1734fe1ec4b 731 * @retval SpiritFunctionalState.
vpcola 0:a1734fe1ec4b 732 */
vpcola 0:a1734fe1ec4b 733 #define SpiritPktStackGetGetTxAckRequest() SpiritPktCommonGetTxAckRequest()
vpcola 0:a1734fe1ec4b 734
vpcola 0:a1734fe1ec4b 735 /**
vpcola 0:a1734fe1ec4b 736 * @brief Returns the destination address of the received packet.
vpcola 0:a1734fe1ec4b 737 * @param None.
vpcola 0:a1734fe1ec4b 738 * @retval uint8_t Destination address of the received packet.
vpcola 0:a1734fe1ec4b 739 */
vpcola 0:a1734fe1ec4b 740 #define SpiritPktStackGetReceivedDestAddress() SpiritPktCommonGetReceivedDestAddress()
vpcola 0:a1734fe1ec4b 741
vpcola 0:a1734fe1ec4b 742
vpcola 0:a1734fe1ec4b 743 /**
vpcola 0:a1734fe1ec4b 744 * @brief Returns the source address of the received packet.
vpcola 0:a1734fe1ec4b 745 * @param None.
vpcola 0:a1734fe1ec4b 746 * @retval uint8_t Source address of the received packet.
vpcola 0:a1734fe1ec4b 747 */
vpcola 0:a1734fe1ec4b 748 #define SpiritPktStackGetReceivedSourceAddress() SpiritPktCommonGetReceivedSourceAddress()
vpcola 0:a1734fe1ec4b 749
vpcola 0:a1734fe1ec4b 750
vpcola 0:a1734fe1ec4b 751 /**
vpcola 0:a1734fe1ec4b 752 * @brief Returns the sequence number of the received packet.
vpcola 0:a1734fe1ec4b 753 * @param None.
vpcola 0:a1734fe1ec4b 754 * @retval uint8_t Received Sequence number.
vpcola 0:a1734fe1ec4b 755 */
vpcola 0:a1734fe1ec4b 756 #define SpiritPktStackGetReceivedSeqNumber() SpiritPktCommonGetReceivedSeqNumber()
vpcola 0:a1734fe1ec4b 757
vpcola 0:a1734fe1ec4b 758
vpcola 0:a1734fe1ec4b 759 /**
vpcola 0:a1734fe1ec4b 760 * @brief Returns the Nack bit of the received packet
vpcola 0:a1734fe1ec4b 761 * @param None.
vpcola 0:a1734fe1ec4b 762 * @retval uint8_t Value of the NAck bit.
vpcola 0:a1734fe1ec4b 763 */
vpcola 0:a1734fe1ec4b 764 #define SpiritPktStackGetReceivedNackRx() SpiritPktCommonGetReceivedNackRx()
vpcola 0:a1734fe1ec4b 765
vpcola 0:a1734fe1ec4b 766
vpcola 0:a1734fe1ec4b 767 /**
vpcola 0:a1734fe1ec4b 768 * @brief Returns the sequence number of the transmitted packet.
vpcola 0:a1734fe1ec4b 769 * @param None.
vpcola 0:a1734fe1ec4b 770 * @retval uint8_t Sequence number of the transmitted packet.
vpcola 0:a1734fe1ec4b 771 */
vpcola 0:a1734fe1ec4b 772 #define SpiritPktStackGetTransmittedSeqNumber() SpiritPktCommonGetTransmittedSeqNumber()
vpcola 0:a1734fe1ec4b 773
vpcola 0:a1734fe1ec4b 774
vpcola 0:a1734fe1ec4b 775 /**
vpcola 0:a1734fe1ec4b 776 * @brief Returns the number of retransmission done on the transmitted packet.
vpcola 0:a1734fe1ec4b 777 * @param None.
vpcola 0:a1734fe1ec4b 778 * @retval uint8_t Number of retransmissions done until now.
vpcola 0:a1734fe1ec4b 779 */
vpcola 0:a1734fe1ec4b 780 #define SpiritPktStackGetNReTx() SpiritPktCommonGetNReTx()
vpcola 0:a1734fe1ec4b 781
vpcola 0:a1734fe1ec4b 782
vpcola 0:a1734fe1ec4b 783 /**
vpcola 0:a1734fe1ec4b 784 * @brief If enabled RX packet is accepted only if the masked control field matches the
vpcola 0:a1734fe1ec4b 785 * masked control field reference (CONTROL_MASK & CONTROL_FIELD_REF == CONTROL_MASK & RX_CONTROL_FIELD).
vpcola 0:a1734fe1ec4b 786 * @param xNewState new state for Control filtering enable bit.
vpcola 0:a1734fe1ec4b 787 * This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 788 * @retval None.
vpcola 0:a1734fe1ec4b 789 * @note This filtering control is enabled by default but the control mask is by default set to 0.
vpcola 0:a1734fe1ec4b 790 * As a matter of fact the user has to enable the control filtering bit after the packet initialization
vpcola 0:a1734fe1ec4b 791 * because the PktInit routine disables it.
vpcola 0:a1734fe1ec4b 792 */
vpcola 0:a1734fe1ec4b 793 #define SpiritPktStackFilterOnControlField(xNewState) SpiritPktCommonFilterOnControlField(xNewState)
vpcola 0:a1734fe1ec4b 794
vpcola 0:a1734fe1ec4b 795
vpcola 0:a1734fe1ec4b 796 /**
vpcola 0:a1734fe1ec4b 797 * @brief Returns the enable bit of the control field filtering.
vpcola 0:a1734fe1ec4b 798 * @param None.
vpcola 0:a1734fe1ec4b 799 * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
vpcola 0:a1734fe1ec4b 800 */
vpcola 0:a1734fe1ec4b 801 #define SpiritPktStackGetFilterOnControlField() SpiritPktCommonGetFilterOnControlField();
vpcola 0:a1734fe1ec4b 802
vpcola 0:a1734fe1ec4b 803
vpcola 0:a1734fe1ec4b 804 /**
vpcola 0:a1734fe1ec4b 805 *@}
vpcola 0:a1734fe1ec4b 806 */
vpcola 0:a1734fe1ec4b 807
vpcola 0:a1734fe1ec4b 808
vpcola 0:a1734fe1ec4b 809 /**
vpcola 0:a1734fe1ec4b 810 * @defgroup PktStack_Exported_Functions Pkt STack Exported Functions
vpcola 0:a1734fe1ec4b 811 * @{
vpcola 0:a1734fe1ec4b 812 */
vpcola 0:a1734fe1ec4b 813
vpcola 0:a1734fe1ec4b 814 void SpiritPktStackInit(PktStackInit* pxPktStackInit);
vpcola 0:a1734fe1ec4b 815 void SpiritPktStackGetInfo(PktStackInit* pxPktStackInit);
vpcola 0:a1734fe1ec4b 816 void SpiritPktStackAddressesInit(PktStackAddressesInit* pxPktStackAddresses);
vpcola 0:a1734fe1ec4b 817 void SpiritPktStackGetAddressesInfo(PktStackAddressesInit* pxPktStackAddresses);
vpcola 0:a1734fe1ec4b 818 void SpiritPktStackLlpInit(PktStackLlpInit* pxPktStackLlpInit);
vpcola 0:a1734fe1ec4b 819 void SpiritPktStackLlpGetInfo(PktStackLlpInit* pxPktStackLlpInit);
vpcola 0:a1734fe1ec4b 820 void SpiritPktStackSetFormat(void);
vpcola 0:a1734fe1ec4b 821 void SpiritPktStackSetPayloadLength(uint16_t nPayloadLength);
vpcola 0:a1734fe1ec4b 822 uint16_t SpiritPktStackGetPayloadLength(void);
vpcola 0:a1734fe1ec4b 823 void SpiritPktStackSetVarLengthWidth(uint16_t nMaxPayloadLength, StackControlLength xControlLength);
vpcola 0:a1734fe1ec4b 824 void SpiritPktStackSetRxSourceMask(uint8_t cMask);
vpcola 0:a1734fe1ec4b 825 uint8_t SpiritPktStackGetRxSourceMask(void);
vpcola 0:a1734fe1ec4b 826 uint16_t SpiritPktStackGetReceivedPktLength(void);
vpcola 0:a1734fe1ec4b 827 void SpiritPktStackFilterOnSourceAddress(SpiritFunctionalState xNewState);
vpcola 0:a1734fe1ec4b 828 void SpiritPktStackSetAddressLength(void);
vpcola 0:a1734fe1ec4b 829
vpcola 0:a1734fe1ec4b 830 /**
vpcola 0:a1734fe1ec4b 831 *@}
vpcola 0:a1734fe1ec4b 832 */
vpcola 0:a1734fe1ec4b 833
vpcola 0:a1734fe1ec4b 834 /**
vpcola 0:a1734fe1ec4b 835 *@}
vpcola 0:a1734fe1ec4b 836 */
vpcola 0:a1734fe1ec4b 837
vpcola 0:a1734fe1ec4b 838
vpcola 0:a1734fe1ec4b 839 /**
vpcola 0:a1734fe1ec4b 840 *@}
vpcola 0:a1734fe1ec4b 841 */
vpcola 0:a1734fe1ec4b 842
vpcola 0:a1734fe1ec4b 843 #ifdef __cplusplus
vpcola 0:a1734fe1ec4b 844 }
vpcola 0:a1734fe1ec4b 845 #endif
vpcola 0:a1734fe1ec4b 846
vpcola 0:a1734fe1ec4b 847 #endif
vpcola 0:a1734fe1ec4b 848
vpcola 0:a1734fe1ec4b 849 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/