Added support for the WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Easy Connect

Easily add all supported connectivity methods to your mbed OS project

This project is derived from https://developer.mbed.org/teams/sandbox/code/simple-mbed-client-example/file/dd6231df71bb/easy-connect.lib. It give user the ability to switch between connectivity methods and includes support for the WNC14A2A Data Module. The `NetworkInterface` API makes this easy, but you still need a mechanism for the user to select the connection method, The selection is made by modifying the `mbed_app.json` file and using `easy_connect()` from your application.

Specifying connectivity method

To add support for the WNC14A2A, add the following to your ``mbed_app.json`` file:

mbed_app.json

{
    "config": {
        "network-interface":{
            "help": "options are ETHERNET,WIFI_ESP8266,WIFI_ODIN,MESH_LOWPAN_ND,MESH_THREAD,WNC14A2A",
            "value": "WNC14A2A"
        }
    },
}

After you choose `WNC14A2A` you'll also need to indicate if you want debug output or not by Enabling (true) or Disabling (false) WNC_DEBUG.

If WNC_DEBUG is enabled, there are 3 different levels of debug output (selected via bit settings). These debug levels are set using the following values:

ValueDescription
1Basic WNC driver debug output
2Comprehensive WNC driver debug output
4Network Layer debug output

You can have any combination of these three bit values for a total value of 0 – 7.

WNC Debug Settings

    "config": {
        "WNC_DEBUG": {
            "value": false
        },
        "WNC_DEBUG_SETTING": {
            "value": 4
        },
    }

Using Easy Connect from your application

Easy Connect has just one function which will either return a `NetworkInterface`-pointer or `NULL`:

Sample Code

#include "easy-connect.h"

int main(int, char**) {
    NetworkInterface* network = easy_connect(true); /* has 1 argument, enable_logging (pass in true to log to serial port) */
    if (!network) {
        printf("Connecting to the network failed... See serial output.\r\n");
        return 1;
    }
 
    // Rest of your program
}

Tested on

  • K64F with Ethernet.
  • AT&T Cellular IoT Starter Kit with WNC M14A2A Cellular Data Module

The WNCInterface class currently supports the following version(s):

  • MPSS: M14A2A_v11.50.164451 APSS: M14A2A_v11.53.164451

License

This library is released under the Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License and may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Committer:
group-Avnet
Date:
Wed Apr 19 01:08:11 2017 +0000
Revision:
0:478cfd88041f
Initial commit

Who changed what in which revision?

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