Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

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