Vergil Cola
/
MQTTGateway2
Fork of my original MQTTGateway
easy-connect/stm-spirit1-rf-driver/source/libs/spirit1/SPIRIT1_Library/Inc/SPIRIT_PktBasic.h@0:a1734fe1ec4b, 2017-04-08 (annotated)
- Committer:
- vpcola
- Date:
- Sat Apr 08 14:43:14 2017 +0000
- Revision:
- 0:a1734fe1ec4b
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vpcola | 0:a1734fe1ec4b | 1 | /** |
vpcola | 0:a1734fe1ec4b | 2 | ****************************************************************************** |
vpcola | 0:a1734fe1ec4b | 3 | * @file SPIRIT_PktBasic.h |
vpcola | 0:a1734fe1ec4b | 4 | * @author VMA division - AMS |
vpcola | 0:a1734fe1ec4b | 5 | * @version 3.2.2 |
vpcola | 0:a1734fe1ec4b | 6 | * @date 08-July-2015 |
vpcola | 0:a1734fe1ec4b | 7 | * @brief Configuration and management of SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 8 | * |
vpcola | 0:a1734fe1ec4b | 9 | * @details |
vpcola | 0:a1734fe1ec4b | 10 | * |
vpcola | 0:a1734fe1ec4b | 11 | * This module can be used to manage the configuration of Spirit Basic |
vpcola | 0:a1734fe1ec4b | 12 | * packets. |
vpcola | 0:a1734fe1ec4b | 13 | * The user can obtain a packet configuration filling the structure |
vpcola | 0:a1734fe1ec4b | 14 | * <i>@ref PktBasicInit</i>, defining in it some general parameters |
vpcola | 0:a1734fe1ec4b | 15 | * for the Spirit Basic packet format. |
vpcola | 0:a1734fe1ec4b | 16 | * Another structure the user can fill is <i>@ref PktBasicAddressesInit</i> |
vpcola | 0:a1734fe1ec4b | 17 | * to define the addresses which will be used during the communication. |
vpcola | 0:a1734fe1ec4b | 18 | * Moreover, functions to set the payload length and the destination address |
vpcola | 0:a1734fe1ec4b | 19 | * are provided. |
vpcola | 0:a1734fe1ec4b | 20 | * |
vpcola | 0:a1734fe1ec4b | 21 | * <b>Example:</b> |
vpcola | 0:a1734fe1ec4b | 22 | * @code |
vpcola | 0:a1734fe1ec4b | 23 | * |
vpcola | 0:a1734fe1ec4b | 24 | * PktBasicInit basicInit={ |
vpcola | 0:a1734fe1ec4b | 25 | * PKT_PREAMBLE_LENGTH_08BYTES, // preamble length in bytes |
vpcola | 0:a1734fe1ec4b | 26 | * PKT_SYNC_LENGTH_4BYTES, // sync word length in bytes |
vpcola | 0:a1734fe1ec4b | 27 | * 0x1A2635A8, // sync word |
vpcola | 0:a1734fe1ec4b | 28 | * PKT_LENGTH_VAR, // variable or fixed payload length |
vpcola | 0:a1734fe1ec4b | 29 | * 7, // length field width in bits (used only for variable length) |
vpcola | 0:a1734fe1ec4b | 30 | * PKT_NO_CRC, // CRC mode |
vpcola | 0:a1734fe1ec4b | 31 | * PKT_CONTROL_LENGTH_0BYTES, // control field length |
vpcola | 0:a1734fe1ec4b | 32 | * S_ENABLE, // address field |
vpcola | 0:a1734fe1ec4b | 33 | * S_DISABLE, // FEC |
vpcola | 0:a1734fe1ec4b | 34 | * S_ENABLE // whitening |
vpcola | 0:a1734fe1ec4b | 35 | * }; |
vpcola | 0:a1734fe1ec4b | 36 | * |
vpcola | 0:a1734fe1ec4b | 37 | * PktBasicAddressesInit addressInit={ |
vpcola | 0:a1734fe1ec4b | 38 | * S_ENABLE, // enable/disable filtering on my address |
vpcola | 0:a1734fe1ec4b | 39 | * 0x34, // my address (address of the current node) |
vpcola | 0:a1734fe1ec4b | 40 | * S_DISABLE, // enable/disable filtering on multicast address |
vpcola | 0:a1734fe1ec4b | 41 | * 0xEE, // multicast address |
vpcola | 0:a1734fe1ec4b | 42 | * S_DISABLE, // enable/disable filtering on broadcast address |
vpcola | 0:a1734fe1ec4b | 43 | * 0xFF // broadcast address |
vpcola | 0:a1734fe1ec4b | 44 | * }; |
vpcola | 0:a1734fe1ec4b | 45 | * |
vpcola | 0:a1734fe1ec4b | 46 | * ... |
vpcola | 0:a1734fe1ec4b | 47 | * |
vpcola | 0:a1734fe1ec4b | 48 | * SpiritPktBasicInit(&basicInit); |
vpcola | 0:a1734fe1ec4b | 49 | * SpiritPktBasicAddressesInit(&addressInit); |
vpcola | 0:a1734fe1ec4b | 50 | * |
vpcola | 0:a1734fe1ec4b | 51 | * ... |
vpcola | 0:a1734fe1ec4b | 52 | * |
vpcola | 0:a1734fe1ec4b | 53 | * SpiritPktBasicSetPayloadLength(20); |
vpcola | 0:a1734fe1ec4b | 54 | * SpiritPktBasicSetDestinationAddress(0x44); |
vpcola | 0:a1734fe1ec4b | 55 | * |
vpcola | 0:a1734fe1ec4b | 56 | * ... |
vpcola | 0:a1734fe1ec4b | 57 | * |
vpcola | 0:a1734fe1ec4b | 58 | * @endcode |
vpcola | 0:a1734fe1ec4b | 59 | * |
vpcola | 0:a1734fe1ec4b | 60 | * The module provides some other functions that can be used to modify |
vpcola | 0:a1734fe1ec4b | 61 | * or read only some configuration parameters. |
vpcola | 0:a1734fe1ec4b | 62 | * |
vpcola | 0:a1734fe1ec4b | 63 | * |
vpcola | 0:a1734fe1ec4b | 64 | * @attention |
vpcola | 0:a1734fe1ec4b | 65 | * |
vpcola | 0:a1734fe1ec4b | 66 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
vpcola | 0:a1734fe1ec4b | 67 | * |
vpcola | 0:a1734fe1ec4b | 68 | * Redistribution and use in source and binary forms, with or without modification, |
vpcola | 0:a1734fe1ec4b | 69 | * are permitted provided that the following conditions are met: |
vpcola | 0:a1734fe1ec4b | 70 | * 1. Redistributions of source code must retain the above copyright notice, |
vpcola | 0:a1734fe1ec4b | 71 | * this list of conditions and the following disclaimer. |
vpcola | 0:a1734fe1ec4b | 72 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
vpcola | 0:a1734fe1ec4b | 73 | * this list of conditions and the following disclaimer in the documentation |
vpcola | 0:a1734fe1ec4b | 74 | * and/or other materials provided with the distribution. |
vpcola | 0:a1734fe1ec4b | 75 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
vpcola | 0:a1734fe1ec4b | 76 | * may be used to endorse or promote products derived from this software |
vpcola | 0:a1734fe1ec4b | 77 | * without specific prior written permission. |
vpcola | 0:a1734fe1ec4b | 78 | * |
vpcola | 0:a1734fe1ec4b | 79 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
vpcola | 0:a1734fe1ec4b | 80 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
vpcola | 0:a1734fe1ec4b | 81 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
vpcola | 0:a1734fe1ec4b | 82 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
vpcola | 0:a1734fe1ec4b | 83 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
vpcola | 0:a1734fe1ec4b | 84 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
vpcola | 0:a1734fe1ec4b | 85 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
vpcola | 0:a1734fe1ec4b | 86 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
vpcola | 0:a1734fe1ec4b | 87 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
vpcola | 0:a1734fe1ec4b | 88 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
vpcola | 0:a1734fe1ec4b | 89 | * |
vpcola | 0:a1734fe1ec4b | 90 | ****************************************************************************** |
vpcola | 0:a1734fe1ec4b | 91 | */ |
vpcola | 0:a1734fe1ec4b | 92 | |
vpcola | 0:a1734fe1ec4b | 93 | /* Define to prevent recursive inclusion -------------------------------------*/ |
vpcola | 0:a1734fe1ec4b | 94 | #ifndef __SPIRIT_PKT_BASIC_H |
vpcola | 0:a1734fe1ec4b | 95 | #define __SPIRIT_PKT_BASIC_H |
vpcola | 0:a1734fe1ec4b | 96 | |
vpcola | 0:a1734fe1ec4b | 97 | /* Includes ------------------------------------------------------------------*/ |
vpcola | 0:a1734fe1ec4b | 98 | |
vpcola | 0:a1734fe1ec4b | 99 | #include "SPIRIT_Regs.h" |
vpcola | 0:a1734fe1ec4b | 100 | #include "SPIRIT_Types.h" |
vpcola | 0:a1734fe1ec4b | 101 | #include "SPIRIT_PktCommon.h" |
vpcola | 0:a1734fe1ec4b | 102 | |
vpcola | 0:a1734fe1ec4b | 103 | #ifdef __cplusplus |
vpcola | 0:a1734fe1ec4b | 104 | extern "C" { |
vpcola | 0:a1734fe1ec4b | 105 | #endif |
vpcola | 0:a1734fe1ec4b | 106 | |
vpcola | 0:a1734fe1ec4b | 107 | |
vpcola | 0:a1734fe1ec4b | 108 | |
vpcola | 0:a1734fe1ec4b | 109 | /** |
vpcola | 0:a1734fe1ec4b | 110 | * @addtogroup SPIRIT_Libraries |
vpcola | 0:a1734fe1ec4b | 111 | * @{ |
vpcola | 0:a1734fe1ec4b | 112 | */ |
vpcola | 0:a1734fe1ec4b | 113 | |
vpcola | 0:a1734fe1ec4b | 114 | |
vpcola | 0:a1734fe1ec4b | 115 | /** |
vpcola | 0:a1734fe1ec4b | 116 | * @defgroup SPIRIT_PktBasic Pkt Basic |
vpcola | 0:a1734fe1ec4b | 117 | * @brief Configuration and management of SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 118 | * @details See the file <i>@ref SPIRIT_PktBasic.h</i> for more details. |
vpcola | 0:a1734fe1ec4b | 119 | * @{ |
vpcola | 0:a1734fe1ec4b | 120 | */ |
vpcola | 0:a1734fe1ec4b | 121 | |
vpcola | 0:a1734fe1ec4b | 122 | /** |
vpcola | 0:a1734fe1ec4b | 123 | * @defgroup PktBasic_Exported_Types Pkt Basic Exported Types |
vpcola | 0:a1734fe1ec4b | 124 | * @{ |
vpcola | 0:a1734fe1ec4b | 125 | */ |
vpcola | 0:a1734fe1ec4b | 126 | |
vpcola | 0:a1734fe1ec4b | 127 | |
vpcola | 0:a1734fe1ec4b | 128 | /** |
vpcola | 0:a1734fe1ec4b | 129 | * @brief Preamble length in bytes enumeration. |
vpcola | 0:a1734fe1ec4b | 130 | */ |
vpcola | 0:a1734fe1ec4b | 131 | typedef PktPreambleLength BasicPreambleLength; |
vpcola | 0:a1734fe1ec4b | 132 | |
vpcola | 0:a1734fe1ec4b | 133 | #define IS_BASIC_PREAMBLE_LENGTH IS_PKT_PREAMBLE_LENGTH |
vpcola | 0:a1734fe1ec4b | 134 | |
vpcola | 0:a1734fe1ec4b | 135 | /** |
vpcola | 0:a1734fe1ec4b | 136 | * @brief Sync length in bytes enumeration. |
vpcola | 0:a1734fe1ec4b | 137 | */ |
vpcola | 0:a1734fe1ec4b | 138 | typedef PktSyncLength BasicSyncLength; |
vpcola | 0:a1734fe1ec4b | 139 | |
vpcola | 0:a1734fe1ec4b | 140 | #define IS_BASIC_SYNC_LENGTH IS_PKT_SYNC_LENGTH |
vpcola | 0:a1734fe1ec4b | 141 | |
vpcola | 0:a1734fe1ec4b | 142 | |
vpcola | 0:a1734fe1ec4b | 143 | |
vpcola | 0:a1734fe1ec4b | 144 | /** |
vpcola | 0:a1734fe1ec4b | 145 | * @brief CRC length in bytes enumeration. |
vpcola | 0:a1734fe1ec4b | 146 | */ |
vpcola | 0:a1734fe1ec4b | 147 | typedef PktCrcMode BasicCrcMode; |
vpcola | 0:a1734fe1ec4b | 148 | |
vpcola | 0:a1734fe1ec4b | 149 | #define IS_BASIC_CRC_MODE IS_PKT_CRC_MODE |
vpcola | 0:a1734fe1ec4b | 150 | |
vpcola | 0:a1734fe1ec4b | 151 | |
vpcola | 0:a1734fe1ec4b | 152 | /** |
vpcola | 0:a1734fe1ec4b | 153 | * @brief Fixed or variable payload length enumeration. |
vpcola | 0:a1734fe1ec4b | 154 | */ |
vpcola | 0:a1734fe1ec4b | 155 | typedef PktFixVarLength BasicFixVarLength; |
vpcola | 0:a1734fe1ec4b | 156 | |
vpcola | 0:a1734fe1ec4b | 157 | #define IS_BASIC_FIX_VAR_LENGTH IS_PKT_FIX_VAR_LENGTH |
vpcola | 0:a1734fe1ec4b | 158 | |
vpcola | 0:a1734fe1ec4b | 159 | /** |
vpcola | 0:a1734fe1ec4b | 160 | * @brief Control length in bytes enumeration. |
vpcola | 0:a1734fe1ec4b | 161 | */ |
vpcola | 0:a1734fe1ec4b | 162 | typedef PktControlLength BasicControlLength; |
vpcola | 0:a1734fe1ec4b | 163 | |
vpcola | 0:a1734fe1ec4b | 164 | #define IS_BASIC_CONTROL_LENGTH IS_PKT_CONTROL_LENGTH |
vpcola | 0:a1734fe1ec4b | 165 | |
vpcola | 0:a1734fe1ec4b | 166 | /** |
vpcola | 0:a1734fe1ec4b | 167 | * @brief Sync words enumeration. |
vpcola | 0:a1734fe1ec4b | 168 | */ |
vpcola | 0:a1734fe1ec4b | 169 | typedef PktSyncX BasicSyncX; |
vpcola | 0:a1734fe1ec4b | 170 | |
vpcola | 0:a1734fe1ec4b | 171 | #define IS_BASIC_SYNCx IS_PKT_SYNCx |
vpcola | 0:a1734fe1ec4b | 172 | |
vpcola | 0:a1734fe1ec4b | 173 | |
vpcola | 0:a1734fe1ec4b | 174 | /** |
vpcola | 0:a1734fe1ec4b | 175 | * @brief SPIRIT Basic Packet Init structure definition. This structure allows users to set the main options |
vpcola | 0:a1734fe1ec4b | 176 | * for the Basic packet. |
vpcola | 0:a1734fe1ec4b | 177 | */ |
vpcola | 0:a1734fe1ec4b | 178 | typedef struct |
vpcola | 0:a1734fe1ec4b | 179 | { |
vpcola | 0:a1734fe1ec4b | 180 | |
vpcola | 0:a1734fe1ec4b | 181 | BasicPreambleLength xPreambleLength; /*!< Specifies the preamble length. |
vpcola | 0:a1734fe1ec4b | 182 | This parameter can be any value of @ref BasicPreambleLength */ |
vpcola | 0:a1734fe1ec4b | 183 | BasicSyncLength xSyncLength; /*!< Specifies the sync word length. The 32bit word passed (lSyncWords) will be stored in the SYNCx registers from the MSb |
vpcola | 0:a1734fe1ec4b | 184 | until the number of bytes in xSyncLength has been stored. |
vpcola | 0:a1734fe1ec4b | 185 | This parameter can be any value of @ref BasicSyncLength */ |
vpcola | 0:a1734fe1ec4b | 186 | uint32_t lSyncWords; /*!< Specifies the sync words. |
vpcola | 0:a1734fe1ec4b | 187 | This parameter is a uint32_t word with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4| */ |
vpcola | 0:a1734fe1ec4b | 188 | BasicFixVarLength xFixVarLength; /*!< Specifies if a fixed length of packet has to be used. |
vpcola | 0:a1734fe1ec4b | 189 | This parameter can be any value of @ref BasicFixVarLength */ |
vpcola | 0:a1734fe1ec4b | 190 | uint8_t cPktLengthWidth; /*!< Specifies the size of the length of packet in bits. This field is useful only if |
vpcola | 0:a1734fe1ec4b | 191 | the field xFixVarLength is set to BASIC_LENGTH_VAR. For Basic packets the length width |
vpcola | 0:a1734fe1ec4b | 192 | is log2( max payload length + control length (0 to 4) + address length (0 or 1)). |
vpcola | 0:a1734fe1ec4b | 193 | This parameter is an uint8_t */ |
vpcola | 0:a1734fe1ec4b | 194 | BasicCrcMode xCrcMode; /*!< Specifies the CRC word length of packet. |
vpcola | 0:a1734fe1ec4b | 195 | This parameter can be any value of @ref BasicCrcMode */ |
vpcola | 0:a1734fe1ec4b | 196 | BasicControlLength xControlLength; /*!< Specifies the length of a control field to be sent. |
vpcola | 0:a1734fe1ec4b | 197 | This parameter can be any value of @ref BasicControlLength */ |
vpcola | 0:a1734fe1ec4b | 198 | SpiritFunctionalState xAddressField; /*!< Specifies if the destination address has to be sent. |
vpcola | 0:a1734fe1ec4b | 199 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 200 | SpiritFunctionalState xFec; /*!< Specifies if FEC has to be enabled. |
vpcola | 0:a1734fe1ec4b | 201 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 202 | SpiritFunctionalState xDataWhitening; /*!< Specifies if data whitening has to be enabled. |
vpcola | 0:a1734fe1ec4b | 203 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 204 | }PktBasicInit; |
vpcola | 0:a1734fe1ec4b | 205 | |
vpcola | 0:a1734fe1ec4b | 206 | |
vpcola | 0:a1734fe1ec4b | 207 | /** |
vpcola | 0:a1734fe1ec4b | 208 | * @brief SPIRIT Basic Packet address structure definition. This structure allows users to specify |
vpcola | 0:a1734fe1ec4b | 209 | * the node/multicast/broadcast addresses and the correspondent filtering options. |
vpcola | 0:a1734fe1ec4b | 210 | */ |
vpcola | 0:a1734fe1ec4b | 211 | typedef struct |
vpcola | 0:a1734fe1ec4b | 212 | { |
vpcola | 0:a1734fe1ec4b | 213 | |
vpcola | 0:a1734fe1ec4b | 214 | SpiritFunctionalState xFilterOnMyAddress; /*!< If set RX packet is accepted if its destination address matches with cMyAddress. |
vpcola | 0:a1734fe1ec4b | 215 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 216 | uint8_t cMyAddress; /*!< Specifies the TX packet source address (address of this node). |
vpcola | 0:a1734fe1ec4b | 217 | This parameter is an uint8_t */ |
vpcola | 0:a1734fe1ec4b | 218 | SpiritFunctionalState xFilterOnMulticastAddress; /*!< If set RX packet is accepted if its destination address matches with cMulticastAddress. |
vpcola | 0:a1734fe1ec4b | 219 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 220 | uint8_t cMulticastAddress; /*!< Specifies the Multicast group address for this node. |
vpcola | 0:a1734fe1ec4b | 221 | This parameter is an uint8_t */ |
vpcola | 0:a1734fe1ec4b | 222 | SpiritFunctionalState xFilterOnBroadcastAddress; /*!< If set RX packet is accepted if its destination address matches with cBroadcastAddress. |
vpcola | 0:a1734fe1ec4b | 223 | This parameter can be S_ENABLE or S_DISABLE */ |
vpcola | 0:a1734fe1ec4b | 224 | uint8_t cBroadcastAddress; /*!< Specifies the Broadcast address for this node. |
vpcola | 0:a1734fe1ec4b | 225 | This parameter is an uint8_t */ |
vpcola | 0:a1734fe1ec4b | 226 | }PktBasicAddressesInit; |
vpcola | 0:a1734fe1ec4b | 227 | |
vpcola | 0:a1734fe1ec4b | 228 | /** |
vpcola | 0:a1734fe1ec4b | 229 | *@} |
vpcola | 0:a1734fe1ec4b | 230 | */ |
vpcola | 0:a1734fe1ec4b | 231 | |
vpcola | 0:a1734fe1ec4b | 232 | |
vpcola | 0:a1734fe1ec4b | 233 | /** |
vpcola | 0:a1734fe1ec4b | 234 | * @defgroup PktBasic_Exported_Constants Pkt Basic Exported Constants |
vpcola | 0:a1734fe1ec4b | 235 | * @{ |
vpcola | 0:a1734fe1ec4b | 236 | */ |
vpcola | 0:a1734fe1ec4b | 237 | |
vpcola | 0:a1734fe1ec4b | 238 | #define IS_BASIC_LENGTH_WIDTH_BITS IS_PKT_LENGTH_WIDTH_BITS |
vpcola | 0:a1734fe1ec4b | 239 | |
vpcola | 0:a1734fe1ec4b | 240 | |
vpcola | 0:a1734fe1ec4b | 241 | /** |
vpcola | 0:a1734fe1ec4b | 242 | *@} |
vpcola | 0:a1734fe1ec4b | 243 | */ |
vpcola | 0:a1734fe1ec4b | 244 | |
vpcola | 0:a1734fe1ec4b | 245 | |
vpcola | 0:a1734fe1ec4b | 246 | /** |
vpcola | 0:a1734fe1ec4b | 247 | * @defgroup PktBasic_Exported_Macros Pkt Basic Exported Macros |
vpcola | 0:a1734fe1ec4b | 248 | * @{ |
vpcola | 0:a1734fe1ec4b | 249 | */ |
vpcola | 0:a1734fe1ec4b | 250 | |
vpcola | 0:a1734fe1ec4b | 251 | /** |
vpcola | 0:a1734fe1ec4b | 252 | * @brief Macro used to compute per lower part of the packet length |
vpcola | 0:a1734fe1ec4b | 253 | * for Spirit Basic packets, to write in the PCKTLEN0 register. |
vpcola | 0:a1734fe1ec4b | 254 | * @param nLength Length of the packet payload. |
vpcola | 0:a1734fe1ec4b | 255 | * This parameter is an uint16_t. |
vpcola | 0:a1734fe1ec4b | 256 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 257 | */ |
vpcola | 0:a1734fe1ec4b | 258 | #define BASIC_BUILD_PCKTLEN0(nLength) BUILD_PCKTLEN0(nLength) |
vpcola | 0:a1734fe1ec4b | 259 | |
vpcola | 0:a1734fe1ec4b | 260 | |
vpcola | 0:a1734fe1ec4b | 261 | /** |
vpcola | 0:a1734fe1ec4b | 262 | * @brief Macro used to compute per upper part of the packet length |
vpcola | 0:a1734fe1ec4b | 263 | * for Spirit Basic packets, to write the PCKTLEN1 register. |
vpcola | 0:a1734fe1ec4b | 264 | * @param nLengthLength of the packet payload. |
vpcola | 0:a1734fe1ec4b | 265 | * This parameter is an uint16_t. |
vpcola | 0:a1734fe1ec4b | 266 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 267 | */ |
vpcola | 0:a1734fe1ec4b | 268 | #define BASIC_BUILD_PCKTLEN1(nLength) BUILD_PCKTLEN1(nLength) |
vpcola | 0:a1734fe1ec4b | 269 | |
vpcola | 0:a1734fe1ec4b | 270 | /** |
vpcola | 0:a1734fe1ec4b | 271 | * @brief Sets the CONTROL field length for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 272 | * @param xControlLength length of CONTROL field in bytes. |
vpcola | 0:a1734fe1ec4b | 273 | * This parameter can be any value of @ref PktControlLength. |
vpcola | 0:a1734fe1ec4b | 274 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 275 | */ |
vpcola | 0:a1734fe1ec4b | 276 | #define SpiritPktBasicSetControlLength(xControlLength) SpiritPktCommonSetControlLength(xControlLength) |
vpcola | 0:a1734fe1ec4b | 277 | |
vpcola | 0:a1734fe1ec4b | 278 | |
vpcola | 0:a1734fe1ec4b | 279 | /** |
vpcola | 0:a1734fe1ec4b | 280 | * @brief Returns the CONTROL field length for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 281 | * @param None. |
vpcola | 0:a1734fe1ec4b | 282 | * @retval uint8_t Control field length. |
vpcola | 0:a1734fe1ec4b | 283 | */ |
vpcola | 0:a1734fe1ec4b | 284 | #define SpiritPktBasicGetControlLength() SpiritPktCommonGetControlLength() |
vpcola | 0:a1734fe1ec4b | 285 | |
vpcola | 0:a1734fe1ec4b | 286 | |
vpcola | 0:a1734fe1ec4b | 287 | /** |
vpcola | 0:a1734fe1ec4b | 288 | * @brief Sets the PREAMBLE field length for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 289 | * @param xPreambleLength length of PREAMBLE field in bytes. |
vpcola | 0:a1734fe1ec4b | 290 | * This parameter can be any value of @ref BasicPreambleLength. |
vpcola | 0:a1734fe1ec4b | 291 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 292 | */ |
vpcola | 0:a1734fe1ec4b | 293 | #define SpiritPktBasicSetPreambleLength(xPreambleLength) SpiritPktCommonSetPreambleLength((PktPreambleLength)xPreambleLength) |
vpcola | 0:a1734fe1ec4b | 294 | |
vpcola | 0:a1734fe1ec4b | 295 | |
vpcola | 0:a1734fe1ec4b | 296 | /** |
vpcola | 0:a1734fe1ec4b | 297 | * @brief Returns the PREAMBLE field length mode for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 298 | * @param None. |
vpcola | 0:a1734fe1ec4b | 299 | * @retval uint8_t Preamble field length in bytes. |
vpcola | 0:a1734fe1ec4b | 300 | */ |
vpcola | 0:a1734fe1ec4b | 301 | #define SpiritPktBasicGetPreambleLength() SpiritPktCommonGetPreambleLength() |
vpcola | 0:a1734fe1ec4b | 302 | |
vpcola | 0:a1734fe1ec4b | 303 | |
vpcola | 0:a1734fe1ec4b | 304 | /** |
vpcola | 0:a1734fe1ec4b | 305 | * @brief Sets the SYNC field length for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 306 | * @param xSyncLength length of SYNC field in bytes. |
vpcola | 0:a1734fe1ec4b | 307 | * This parameter can be any value of @ref BasicSyncLength. |
vpcola | 0:a1734fe1ec4b | 308 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 309 | */ |
vpcola | 0:a1734fe1ec4b | 310 | #define SpiritPktBasicSetSyncLength(xSyncLength) SpiritPktCommonSetSyncLength((PktSyncLength)xSyncLength) |
vpcola | 0:a1734fe1ec4b | 311 | |
vpcola | 0:a1734fe1ec4b | 312 | |
vpcola | 0:a1734fe1ec4b | 313 | /** |
vpcola | 0:a1734fe1ec4b | 314 | * @brief Returns the SYNC field length for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 315 | * @param None. |
vpcola | 0:a1734fe1ec4b | 316 | * @retval uint8_t SYNC field length in bytes. |
vpcola | 0:a1734fe1ec4b | 317 | */ |
vpcola | 0:a1734fe1ec4b | 318 | #define SpiritPktBasicGetSyncLength() SpiritPktCommonGetSyncLength() |
vpcola | 0:a1734fe1ec4b | 319 | |
vpcola | 0:a1734fe1ec4b | 320 | |
vpcola | 0:a1734fe1ec4b | 321 | /** |
vpcola | 0:a1734fe1ec4b | 322 | * @brief Sets fixed or variable payload length mode for SPIRIT packets. |
vpcola | 0:a1734fe1ec4b | 323 | * @param xFixVarLength variable or fixed length. |
vpcola | 0:a1734fe1ec4b | 324 | * BASIC_FIXED_LENGTH_VAR -> variable (the length is extracted from the received packet). |
vpcola | 0:a1734fe1ec4b | 325 | * BASIC_FIXED_LENGTH_FIX -> fix (the length is set by PCKTLEN0 and PCKTLEN1). |
vpcola | 0:a1734fe1ec4b | 326 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 327 | */ |
vpcola | 0:a1734fe1ec4b | 328 | #define SpiritPktBasicSetFixVarLength(xFixVarLength) SpiritPktCommonSetFixVarLength((PktFixVarLength)xFixVarLength) |
vpcola | 0:a1734fe1ec4b | 329 | |
vpcola | 0:a1734fe1ec4b | 330 | |
vpcola | 0:a1734fe1ec4b | 331 | /** |
vpcola | 0:a1734fe1ec4b | 332 | * @brief Enables or Disables the CRC filtering. |
vpcola | 0:a1734fe1ec4b | 333 | * @param xNewState new state for CRC_CHECK. |
vpcola | 0:a1734fe1ec4b | 334 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 335 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 336 | */ |
vpcola | 0:a1734fe1ec4b | 337 | #define SpiritPktBasicFilterOnCrc(xNewState) SpiritPktCommonFilterOnCrc(xNewState) |
vpcola | 0:a1734fe1ec4b | 338 | |
vpcola | 0:a1734fe1ec4b | 339 | |
vpcola | 0:a1734fe1ec4b | 340 | /** |
vpcola | 0:a1734fe1ec4b | 341 | * @brief Returns the CRC filtering bit. |
vpcola | 0:a1734fe1ec4b | 342 | * @param None. |
vpcola | 0:a1734fe1ec4b | 343 | * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 344 | */ |
vpcola | 0:a1734fe1ec4b | 345 | #define SpiritPktBasicGetFilterOnCrc() SpiritPktCommonGetFilterOnCrc() |
vpcola | 0:a1734fe1ec4b | 346 | |
vpcola | 0:a1734fe1ec4b | 347 | |
vpcola | 0:a1734fe1ec4b | 348 | /** |
vpcola | 0:a1734fe1ec4b | 349 | * @brief Sets the CRC mode for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 350 | * @param xCrcMode CRC mode. |
vpcola | 0:a1734fe1ec4b | 351 | * This parameter can be any value of @ref BasicCrcMode. |
vpcola | 0:a1734fe1ec4b | 352 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 353 | */ |
vpcola | 0:a1734fe1ec4b | 354 | #define SpiritPktBasicSetCrcMode(xCrcMode) SpiritPktCommonSetCrcMode((PktCrcMode)xCrcMode) |
vpcola | 0:a1734fe1ec4b | 355 | |
vpcola | 0:a1734fe1ec4b | 356 | |
vpcola | 0:a1734fe1ec4b | 357 | /** |
vpcola | 0:a1734fe1ec4b | 358 | * @brief Returns the CRC mode for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 359 | * @param None. |
vpcola | 0:a1734fe1ec4b | 360 | * @retval BasicCrcMode Crc mode. |
vpcola | 0:a1734fe1ec4b | 361 | */ |
vpcola | 0:a1734fe1ec4b | 362 | #define SpiritPktBasicGetCrcMode() (BasicCrcMode)SpiritPktCommonGetCrcMode() |
vpcola | 0:a1734fe1ec4b | 363 | |
vpcola | 0:a1734fe1ec4b | 364 | |
vpcola | 0:a1734fe1ec4b | 365 | /** |
vpcola | 0:a1734fe1ec4b | 366 | * @brief Enables or Disables WHITENING for SPIRIT packets. |
vpcola | 0:a1734fe1ec4b | 367 | * @param xNewState new state for WHITENING mode. |
vpcola | 0:a1734fe1ec4b | 368 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 369 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 370 | */ |
vpcola | 0:a1734fe1ec4b | 371 | #define SpiritPktBasicWhitening(xNewState) SpiritPktCommonWhitening(xNewState) |
vpcola | 0:a1734fe1ec4b | 372 | |
vpcola | 0:a1734fe1ec4b | 373 | |
vpcola | 0:a1734fe1ec4b | 374 | /** |
vpcola | 0:a1734fe1ec4b | 375 | * @brief Enables or Disables FEC for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 376 | * @param xNewState new state for FEC mode. |
vpcola | 0:a1734fe1ec4b | 377 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 378 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 379 | */ |
vpcola | 0:a1734fe1ec4b | 380 | #define SpiritPktBasicFec(xNewState) SpiritPktCommonFec(xNewState) |
vpcola | 0:a1734fe1ec4b | 381 | |
vpcola | 0:a1734fe1ec4b | 382 | |
vpcola | 0:a1734fe1ec4b | 383 | /** |
vpcola | 0:a1734fe1ec4b | 384 | * @brief Sets a specific SYNC word for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 385 | * @param xSyncX SYNC word number to be set. |
vpcola | 0:a1734fe1ec4b | 386 | * This parameter can be any value of @ref BasicSyncX. |
vpcola | 0:a1734fe1ec4b | 387 | * @param cSyncWord SYNC word. |
vpcola | 0:a1734fe1ec4b | 388 | * This parameter is an uint8_t. |
vpcola | 0:a1734fe1ec4b | 389 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 390 | */ |
vpcola | 0:a1734fe1ec4b | 391 | #define SpiritPktBasicSetSyncxWord(xSyncX, cSyncWord) SpiritPktCommonSetSyncxWord((PktSyncX)xSyncX, cSyncWord) |
vpcola | 0:a1734fe1ec4b | 392 | |
vpcola | 0:a1734fe1ec4b | 393 | |
vpcola | 0:a1734fe1ec4b | 394 | /** |
vpcola | 0:a1734fe1ec4b | 395 | * @brief Returns a specific SYNC words for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 396 | * @param xSyncX SYNC word number to be get. |
vpcola | 0:a1734fe1ec4b | 397 | * This parameter can be any value of @ref BasicSyncX. |
vpcola | 0:a1734fe1ec4b | 398 | * @retval uint8_t Sync word x. |
vpcola | 0:a1734fe1ec4b | 399 | */ |
vpcola | 0:a1734fe1ec4b | 400 | #define SpiritPktBasicGetSyncxWord(xSyncX) SpiritPktCommonGetSyncxWord(xSyncX) |
vpcola | 0:a1734fe1ec4b | 401 | |
vpcola | 0:a1734fe1ec4b | 402 | |
vpcola | 0:a1734fe1ec4b | 403 | /** |
vpcola | 0:a1734fe1ec4b | 404 | * @brief Sets multiple SYNC words for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 405 | * @param lSyncWords SYNC words to be set with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4|. |
vpcola | 0:a1734fe1ec4b | 406 | * This parameter is a uint32_t. |
vpcola | 0:a1734fe1ec4b | 407 | * @param xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb |
vpcola | 0:a1734fe1ec4b | 408 | * until the number of bytes in xSyncLength has been stored. |
vpcola | 0:a1734fe1ec4b | 409 | * This parameter is a @ref BasicSyncLength. |
vpcola | 0:a1734fe1ec4b | 410 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 411 | */ |
vpcola | 0:a1734fe1ec4b | 412 | #define SpiritPktBasicSetSyncWords(lSyncWords, xSyncLength) SpiritPktCommonSetSyncWords(lSyncWords, (PktSyncLength)xSyncLength) |
vpcola | 0:a1734fe1ec4b | 413 | |
vpcola | 0:a1734fe1ec4b | 414 | |
vpcola | 0:a1734fe1ec4b | 415 | /** |
vpcola | 0:a1734fe1ec4b | 416 | * @brief Returns multiple SYNC words for SPIRIT Basic packets. |
vpcola | 0:a1734fe1ec4b | 417 | * @param xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb |
vpcola | 0:a1734fe1ec4b | 418 | * until the number of bytes in xSyncLength has been stored. |
vpcola | 0:a1734fe1ec4b | 419 | * This parameter is a pointer to @ref BasicSyncLength. |
vpcola | 0:a1734fe1ec4b | 420 | * @retval uint32_t Sync words. The format of the read 32 bit word is 0x|SYNC1|SYNC2|SYNC3|SYNC4|. |
vpcola | 0:a1734fe1ec4b | 421 | */ |
vpcola | 0:a1734fe1ec4b | 422 | #define SpiritPktBasicGetSyncWords(xSyncLength) SpiritPktCommonGetSyncWords((PktSyncLength)xSyncLength) |
vpcola | 0:a1734fe1ec4b | 423 | |
vpcola | 0:a1734fe1ec4b | 424 | |
vpcola | 0:a1734fe1ec4b | 425 | /** |
vpcola | 0:a1734fe1ec4b | 426 | * @brief Returns the SPIRIT variable length width (in number of bits). |
vpcola | 0:a1734fe1ec4b | 427 | * @param None. |
vpcola | 0:a1734fe1ec4b | 428 | * @retval Variable length width in bits. |
vpcola | 0:a1734fe1ec4b | 429 | */ |
vpcola | 0:a1734fe1ec4b | 430 | #define SpiritPktBasicGetVarLengthWidth() SpiritPktCommonGetVarLengthWidth() |
vpcola | 0:a1734fe1ec4b | 431 | |
vpcola | 0:a1734fe1ec4b | 432 | |
vpcola | 0:a1734fe1ec4b | 433 | /** |
vpcola | 0:a1734fe1ec4b | 434 | * @brief Sets the destination address for the Tx packet. |
vpcola | 0:a1734fe1ec4b | 435 | * @param cAddress destination address. |
vpcola | 0:a1734fe1ec4b | 436 | * This parameter is an uint8_t. |
vpcola | 0:a1734fe1ec4b | 437 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 438 | */ |
vpcola | 0:a1734fe1ec4b | 439 | #define SpiritPktBasicSetDestinationAddress(cAddress) SpiritPktCommonSetDestinationAddress(cAddress) |
vpcola | 0:a1734fe1ec4b | 440 | |
vpcola | 0:a1734fe1ec4b | 441 | |
vpcola | 0:a1734fe1ec4b | 442 | /** |
vpcola | 0:a1734fe1ec4b | 443 | * @brief Returns the settled destination address. |
vpcola | 0:a1734fe1ec4b | 444 | * @param None. |
vpcola | 0:a1734fe1ec4b | 445 | * @retval uint8_t Transmitted destination address. |
vpcola | 0:a1734fe1ec4b | 446 | */ |
vpcola | 0:a1734fe1ec4b | 447 | #define SpiritPktBasicGetTransmittedDestAddress() SpiritPktCommonGetTransmittedDestAddress() |
vpcola | 0:a1734fe1ec4b | 448 | |
vpcola | 0:a1734fe1ec4b | 449 | |
vpcola | 0:a1734fe1ec4b | 450 | /** |
vpcola | 0:a1734fe1ec4b | 451 | * @brief Sets the node address. When the filtering on my address is on, if the destination address extracted from the received packet is equal to the content of the |
vpcola | 0:a1734fe1ec4b | 452 | * my address, then the packet is accepted (this is the address of the node). |
vpcola | 0:a1734fe1ec4b | 453 | * @param cAddress Address of the present node. |
vpcola | 0:a1734fe1ec4b | 454 | * This parameter is an uint8_t. |
vpcola | 0:a1734fe1ec4b | 455 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 456 | */ |
vpcola | 0:a1734fe1ec4b | 457 | #define SpiritPktBasicSetMyAddress(cAddress) SpiritPktCommonSetMyAddress(cAddress) |
vpcola | 0:a1734fe1ec4b | 458 | |
vpcola | 0:a1734fe1ec4b | 459 | |
vpcola | 0:a1734fe1ec4b | 460 | /** |
vpcola | 0:a1734fe1ec4b | 461 | * @brief Returns the address of the present node. |
vpcola | 0:a1734fe1ec4b | 462 | * @param None. |
vpcola | 0:a1734fe1ec4b | 463 | * @retval uint8_t My address (address of this node). |
vpcola | 0:a1734fe1ec4b | 464 | */ |
vpcola | 0:a1734fe1ec4b | 465 | #define SpiritPktBasicGetMyAddress() SpiritPktCommonGetMyAddress() |
vpcola | 0:a1734fe1ec4b | 466 | |
vpcola | 0:a1734fe1ec4b | 467 | |
vpcola | 0:a1734fe1ec4b | 468 | /** |
vpcola | 0:a1734fe1ec4b | 469 | * @brief Sets the broadcast address. When the broadcast filtering is on, if the destination address extracted from the received packet is equal to the content of the |
vpcola | 0:a1734fe1ec4b | 470 | * BROADCAST_ADDR register, then the packet is accepted. |
vpcola | 0:a1734fe1ec4b | 471 | * @param cAddress Broadcast address. |
vpcola | 0:a1734fe1ec4b | 472 | * This parameter is an uint8_t. |
vpcola | 0:a1734fe1ec4b | 473 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 474 | */ |
vpcola | 0:a1734fe1ec4b | 475 | #define SpiritPktBasicSetBroadcastAddress(cAddress) SpiritPktCommonSetBroadcastAddress(cAddress) |
vpcola | 0:a1734fe1ec4b | 476 | |
vpcola | 0:a1734fe1ec4b | 477 | |
vpcola | 0:a1734fe1ec4b | 478 | /** |
vpcola | 0:a1734fe1ec4b | 479 | * @brief Returns the broadcast address. |
vpcola | 0:a1734fe1ec4b | 480 | * @param None. |
vpcola | 0:a1734fe1ec4b | 481 | * @retval uint8_t Broadcast address. |
vpcola | 0:a1734fe1ec4b | 482 | */ |
vpcola | 0:a1734fe1ec4b | 483 | #define SpiritPktBasicGetBroadcastAddress() SpiritPktCommonGetBroadcastAddress() |
vpcola | 0:a1734fe1ec4b | 484 | |
vpcola | 0:a1734fe1ec4b | 485 | |
vpcola | 0:a1734fe1ec4b | 486 | /** |
vpcola | 0:a1734fe1ec4b | 487 | * @brief Sets the multicast address. When the multicast filtering is on, if the destination address extracted from the received packet is equal to the content of the |
vpcola | 0:a1734fe1ec4b | 488 | * MULTICAST_ADDR register, then the packet is accepted. |
vpcola | 0:a1734fe1ec4b | 489 | * @param cAddress Multicast address. |
vpcola | 0:a1734fe1ec4b | 490 | * This parameter is an uint8_t. |
vpcola | 0:a1734fe1ec4b | 491 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 492 | */ |
vpcola | 0:a1734fe1ec4b | 493 | #define SpiritPktBasicSetMulticastAddress(cAddress) SpiritPktCommonSetMulticastAddress(cAddress) |
vpcola | 0:a1734fe1ec4b | 494 | |
vpcola | 0:a1734fe1ec4b | 495 | |
vpcola | 0:a1734fe1ec4b | 496 | /** |
vpcola | 0:a1734fe1ec4b | 497 | * @brief Returns the multicast address. |
vpcola | 0:a1734fe1ec4b | 498 | * @param None. |
vpcola | 0:a1734fe1ec4b | 499 | * @retval uint8_t Multicast address. |
vpcola | 0:a1734fe1ec4b | 500 | */ |
vpcola | 0:a1734fe1ec4b | 501 | #define SpiritPktBasicGetMulticastAddress() SpiritPktCommonGetMulticastAddress() |
vpcola | 0:a1734fe1ec4b | 502 | |
vpcola | 0:a1734fe1ec4b | 503 | |
vpcola | 0:a1734fe1ec4b | 504 | /** |
vpcola | 0:a1734fe1ec4b | 505 | * @brief Sets the control mask. The 1 bits of the CONTROL_MASK indicate the |
vpcola | 0:a1734fe1ec4b | 506 | * bits to be used in filtering. (All 0s no filtering) |
vpcola | 0:a1734fe1ec4b | 507 | * @param lMask Control mask. |
vpcola | 0:a1734fe1ec4b | 508 | * This parameter is an uint32_t. |
vpcola | 0:a1734fe1ec4b | 509 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 510 | */ |
vpcola | 0:a1734fe1ec4b | 511 | #define SpiritPktBasicSetCtrlMask(lMask) SpiritPktCommonSetCtrlMask(lMask) |
vpcola | 0:a1734fe1ec4b | 512 | |
vpcola | 0:a1734fe1ec4b | 513 | |
vpcola | 0:a1734fe1ec4b | 514 | /** |
vpcola | 0:a1734fe1ec4b | 515 | * @brief Returns the control mask. The 1 bits of the CONTROL_MASK indicate the |
vpcola | 0:a1734fe1ec4b | 516 | * bits to be used in filtering. (All 0s no filtering) |
vpcola | 0:a1734fe1ec4b | 517 | * @param None. |
vpcola | 0:a1734fe1ec4b | 518 | * @retval uint32_t Control mask. |
vpcola | 0:a1734fe1ec4b | 519 | */ |
vpcola | 0:a1734fe1ec4b | 520 | #define SpiritPktBasicGetCtrlMask() SpiritPktCommonGetCtrlMask() |
vpcola | 0:a1734fe1ec4b | 521 | |
vpcola | 0:a1734fe1ec4b | 522 | |
vpcola | 0:a1734fe1ec4b | 523 | /** |
vpcola | 0:a1734fe1ec4b | 524 | * @brief Sets the control field reference. If the bits enabled by the |
vpcola | 0:a1734fe1ec4b | 525 | * CONTROL_MASK match the ones of the control fields extracted from the received packet |
vpcola | 0:a1734fe1ec4b | 526 | * then the packet is accepted. |
vpcola | 0:a1734fe1ec4b | 527 | * @param lReference Control reference. |
vpcola | 0:a1734fe1ec4b | 528 | * This parameter is an uint32_t. |
vpcola | 0:a1734fe1ec4b | 529 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 530 | */ |
vpcola | 0:a1734fe1ec4b | 531 | #define SpiritPktBasicSetCtrlReference(lReference) SpiritPktCommonSetCtrlReference(lReference) |
vpcola | 0:a1734fe1ec4b | 532 | |
vpcola | 0:a1734fe1ec4b | 533 | |
vpcola | 0:a1734fe1ec4b | 534 | /** |
vpcola | 0:a1734fe1ec4b | 535 | * @brief Returns the control field reference. |
vpcola | 0:a1734fe1ec4b | 536 | * @param None. |
vpcola | 0:a1734fe1ec4b | 537 | * @retval uint32_t Control reference. |
vpcola | 0:a1734fe1ec4b | 538 | */ |
vpcola | 0:a1734fe1ec4b | 539 | #define SpiritPktBasicGetCtrlReference() SpiritPktCommonGetCtrlReference() |
vpcola | 0:a1734fe1ec4b | 540 | |
vpcola | 0:a1734fe1ec4b | 541 | |
vpcola | 0:a1734fe1ec4b | 542 | /** |
vpcola | 0:a1734fe1ec4b | 543 | * @brief Sets the TX control field. |
vpcola | 0:a1734fe1ec4b | 544 | * @param lField Tx control field. |
vpcola | 0:a1734fe1ec4b | 545 | * This parameter is an uint32_t. |
vpcola | 0:a1734fe1ec4b | 546 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 547 | */ |
vpcola | 0:a1734fe1ec4b | 548 | #define SpiritPktBasicSetTransmittedCtrlField(lField) SpiritPktCommonSetTransmittedCtrlField(lField) |
vpcola | 0:a1734fe1ec4b | 549 | |
vpcola | 0:a1734fe1ec4b | 550 | |
vpcola | 0:a1734fe1ec4b | 551 | /** |
vpcola | 0:a1734fe1ec4b | 552 | * @brief Returns the TX control field. |
vpcola | 0:a1734fe1ec4b | 553 | * @param None. |
vpcola | 0:a1734fe1ec4b | 554 | * @retval uint32_t Control field of the transmitted packet. |
vpcola | 0:a1734fe1ec4b | 555 | */ |
vpcola | 0:a1734fe1ec4b | 556 | #define SpiritPktBasicGetTransmittedCtrlField() SpiritPktCommonGetTransmittedCtrlField() |
vpcola | 0:a1734fe1ec4b | 557 | |
vpcola | 0:a1734fe1ec4b | 558 | |
vpcola | 0:a1734fe1ec4b | 559 | /** |
vpcola | 0:a1734fe1ec4b | 560 | * @brief If enabled RX packet is accepted if its destination address matches with My address. |
vpcola | 0:a1734fe1ec4b | 561 | * @param xNewState new state for DEST_VS_SOURCE_ADDRESS. |
vpcola | 0:a1734fe1ec4b | 562 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 563 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 564 | */ |
vpcola | 0:a1734fe1ec4b | 565 | #define SpiritPktBasicFilterOnMyAddress(xNewState) SpiritPktCommonFilterOnMyAddress(xNewState) |
vpcola | 0:a1734fe1ec4b | 566 | |
vpcola | 0:a1734fe1ec4b | 567 | |
vpcola | 0:a1734fe1ec4b | 568 | /** |
vpcola | 0:a1734fe1ec4b | 569 | * @brief If enabled RX packet is accepted if its destination address matches with multicast address. |
vpcola | 0:a1734fe1ec4b | 570 | * @param xNewState new state for DEST_VS_MULTICAST_ADDRESS. |
vpcola | 0:a1734fe1ec4b | 571 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 572 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 573 | */ |
vpcola | 0:a1734fe1ec4b | 574 | #define SpiritPktBasicFilterOnMulticastAddress(xNewState) SpiritPktCommonFilterOnMulticastAddress(xNewState) |
vpcola | 0:a1734fe1ec4b | 575 | |
vpcola | 0:a1734fe1ec4b | 576 | |
vpcola | 0:a1734fe1ec4b | 577 | /** |
vpcola | 0:a1734fe1ec4b | 578 | * @brief If enabled RX packet is accepted if its destination address matches with broadcast address. |
vpcola | 0:a1734fe1ec4b | 579 | * @param xNewState new state for DEST_VS_BROADCAST_ADDRESS. |
vpcola | 0:a1734fe1ec4b | 580 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 581 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 582 | */ |
vpcola | 0:a1734fe1ec4b | 583 | #define SpiritPktBasicFilterOnBroadcastAddress(xNewState) SpiritPktCommonFilterOnBroadcastAddress(xNewState) |
vpcola | 0:a1734fe1ec4b | 584 | |
vpcola | 0:a1734fe1ec4b | 585 | |
vpcola | 0:a1734fe1ec4b | 586 | /** |
vpcola | 0:a1734fe1ec4b | 587 | * @brief Returns the enable bit of the my address filtering. |
vpcola | 0:a1734fe1ec4b | 588 | * @param None. |
vpcola | 0:a1734fe1ec4b | 589 | * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 590 | */ |
vpcola | 0:a1734fe1ec4b | 591 | #define SpiritPktBasicGetFilterOnMyAddress() SpiritPktCommonGetFilterOnMyAddress(); |
vpcola | 0:a1734fe1ec4b | 592 | |
vpcola | 0:a1734fe1ec4b | 593 | |
vpcola | 0:a1734fe1ec4b | 594 | /** |
vpcola | 0:a1734fe1ec4b | 595 | * @brief Returns the enable bit of the multicast address filtering. |
vpcola | 0:a1734fe1ec4b | 596 | * @param None. |
vpcola | 0:a1734fe1ec4b | 597 | * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 598 | */ |
vpcola | 0:a1734fe1ec4b | 599 | #define SpiritPktBasicGetFilterOnMulticastAddress() SpiritPktCommonGetFilterOnMulticastAddress(); |
vpcola | 0:a1734fe1ec4b | 600 | |
vpcola | 0:a1734fe1ec4b | 601 | |
vpcola | 0:a1734fe1ec4b | 602 | /** |
vpcola | 0:a1734fe1ec4b | 603 | * @brief Returns the enable bit of the broadcast address filtering. |
vpcola | 0:a1734fe1ec4b | 604 | * @param None. |
vpcola | 0:a1734fe1ec4b | 605 | * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 606 | */ |
vpcola | 0:a1734fe1ec4b | 607 | #define SpiritPktBasicGetFilterOnBroadcastAddress() SpiritPktCommonGetFilterOnBroadcastAddress(); |
vpcola | 0:a1734fe1ec4b | 608 | |
vpcola | 0:a1734fe1ec4b | 609 | |
vpcola | 0:a1734fe1ec4b | 610 | /** |
vpcola | 0:a1734fe1ec4b | 611 | * @brief Returns the destination address of the received packet. |
vpcola | 0:a1734fe1ec4b | 612 | * @param None. |
vpcola | 0:a1734fe1ec4b | 613 | * @retval uint8_t Destination address of the received packet. |
vpcola | 0:a1734fe1ec4b | 614 | */ |
vpcola | 0:a1734fe1ec4b | 615 | #define SpiritPktBasicGetReceivedDestAddress() SpiritPktCommonGetReceivedDestAddress() |
vpcola | 0:a1734fe1ec4b | 616 | |
vpcola | 0:a1734fe1ec4b | 617 | |
vpcola | 0:a1734fe1ec4b | 618 | /** |
vpcola | 0:a1734fe1ec4b | 619 | * @brief Returns the control field of the received packet. |
vpcola | 0:a1734fe1ec4b | 620 | * @param None. |
vpcola | 0:a1734fe1ec4b | 621 | * @retval uint32_t Received control field. |
vpcola | 0:a1734fe1ec4b | 622 | */ |
vpcola | 0:a1734fe1ec4b | 623 | #define SpiritPktBasicGetReceivedCtrlField() SpiritPktCommonGetReceivedCtrlField() |
vpcola | 0:a1734fe1ec4b | 624 | |
vpcola | 0:a1734fe1ec4b | 625 | |
vpcola | 0:a1734fe1ec4b | 626 | /** |
vpcola | 0:a1734fe1ec4b | 627 | * @brief Returns the CRC field of the received packet. |
vpcola | 0:a1734fe1ec4b | 628 | * @param cCrcFieldVect array in which the CRC field has to be stored. |
vpcola | 0:a1734fe1ec4b | 629 | * This parameter is an uint8_t array of 3 elements. |
vpcola | 0:a1734fe1ec4b | 630 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 631 | */ |
vpcola | 0:a1734fe1ec4b | 632 | #define SpiritPktBasicGetReceivedCrcField(cCrcFieldVect) SpiritPktCommonGetReceivedCrcField(cCrcFieldVect) |
vpcola | 0:a1734fe1ec4b | 633 | |
vpcola | 0:a1734fe1ec4b | 634 | |
vpcola | 0:a1734fe1ec4b | 635 | /** |
vpcola | 0:a1734fe1ec4b | 636 | * @brief If enabled RX packet is accepted only if the masked control field matches the |
vpcola | 0:a1734fe1ec4b | 637 | * masked control field reference (CONTROL_MASK & CONTROL_FIELD_REF == CONTROL_MASK & RX_CONTROL_FIELD). |
vpcola | 0:a1734fe1ec4b | 638 | * @param xNewState new state for Control filtering enable bit. |
vpcola | 0:a1734fe1ec4b | 639 | * This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 640 | * @retval None. |
vpcola | 0:a1734fe1ec4b | 641 | * @note This filtering control is enabled by default but the control mask is by default set to 0. |
vpcola | 0:a1734fe1ec4b | 642 | * As a matter of fact the user has to enable the control filtering bit after the packet initialization |
vpcola | 0:a1734fe1ec4b | 643 | * because the PktInit routine disables it. |
vpcola | 0:a1734fe1ec4b | 644 | */ |
vpcola | 0:a1734fe1ec4b | 645 | #define SpiritPktBasicFilterOnControlField(xNewState) SpiritPktCommonFilterOnControlField(xNewState) |
vpcola | 0:a1734fe1ec4b | 646 | |
vpcola | 0:a1734fe1ec4b | 647 | |
vpcola | 0:a1734fe1ec4b | 648 | /** |
vpcola | 0:a1734fe1ec4b | 649 | * @brief Returns the enable bit of the control field filtering. |
vpcola | 0:a1734fe1ec4b | 650 | * @param None. |
vpcola | 0:a1734fe1ec4b | 651 | * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE. |
vpcola | 0:a1734fe1ec4b | 652 | */ |
vpcola | 0:a1734fe1ec4b | 653 | #define SpiritPktBasicGetFilterOnControlField() SpiritPktCommonGetFilterOnControlField(); |
vpcola | 0:a1734fe1ec4b | 654 | |
vpcola | 0:a1734fe1ec4b | 655 | /** |
vpcola | 0:a1734fe1ec4b | 656 | *@} |
vpcola | 0:a1734fe1ec4b | 657 | */ |
vpcola | 0:a1734fe1ec4b | 658 | |
vpcola | 0:a1734fe1ec4b | 659 | |
vpcola | 0:a1734fe1ec4b | 660 | /** |
vpcola | 0:a1734fe1ec4b | 661 | * @defgroup PktBasic_Exported_Functions Pkt Basic Exported Functions |
vpcola | 0:a1734fe1ec4b | 662 | * @{ |
vpcola | 0:a1734fe1ec4b | 663 | */ |
vpcola | 0:a1734fe1ec4b | 664 | |
vpcola | 0:a1734fe1ec4b | 665 | void SpiritPktBasicInit(PktBasicInit* pxPktBasicInit); |
vpcola | 0:a1734fe1ec4b | 666 | void SpiritPktBasicGetInfo(PktBasicInit* pxPktBasicInit); |
vpcola | 0:a1734fe1ec4b | 667 | void SpiritPktBasicAddressesInit(PktBasicAddressesInit* pxPktBasicAddresses); |
vpcola | 0:a1734fe1ec4b | 668 | void SpiritPktBasicGetAddressesInfo(PktBasicAddressesInit* pxPktBasicAddresses); |
vpcola | 0:a1734fe1ec4b | 669 | void SpiritPktBasicSetFormat(void); |
vpcola | 0:a1734fe1ec4b | 670 | void SpiritPktBasicAddressField(SpiritFunctionalState xAddressField); |
vpcola | 0:a1734fe1ec4b | 671 | SpiritFunctionalState SpiritPktBasicGetAddressField(void); |
vpcola | 0:a1734fe1ec4b | 672 | void SpiritPktBasicSetPayloadLength(uint16_t nPayloadLength); |
vpcola | 0:a1734fe1ec4b | 673 | uint16_t SpiritPktBasicGetPayloadLength(void); |
vpcola | 0:a1734fe1ec4b | 674 | uint16_t SpiritPktBasicGetReceivedPktLength(void); |
vpcola | 0:a1734fe1ec4b | 675 | void SpiritPktBasicSetVarLengthWidth(uint16_t nMaxPayloadLength,SpiritFunctionalState xAddressField, BasicControlLength xControlLength); |
vpcola | 0:a1734fe1ec4b | 676 | |
vpcola | 0:a1734fe1ec4b | 677 | /** |
vpcola | 0:a1734fe1ec4b | 678 | *@} |
vpcola | 0:a1734fe1ec4b | 679 | */ |
vpcola | 0:a1734fe1ec4b | 680 | |
vpcola | 0:a1734fe1ec4b | 681 | /** |
vpcola | 0:a1734fe1ec4b | 682 | *@} |
vpcola | 0:a1734fe1ec4b | 683 | */ |
vpcola | 0:a1734fe1ec4b | 684 | |
vpcola | 0:a1734fe1ec4b | 685 | |
vpcola | 0:a1734fe1ec4b | 686 | /** |
vpcola | 0:a1734fe1ec4b | 687 | *@} |
vpcola | 0:a1734fe1ec4b | 688 | */ |
vpcola | 0:a1734fe1ec4b | 689 | |
vpcola | 0:a1734fe1ec4b | 690 | #ifdef __cplusplus |
vpcola | 0:a1734fe1ec4b | 691 | } |
vpcola | 0:a1734fe1ec4b | 692 | #endif |
vpcola | 0:a1734fe1ec4b | 693 | |
vpcola | 0:a1734fe1ec4b | 694 | #endif |
vpcola | 0:a1734fe1ec4b | 695 | |
vpcola | 0:a1734fe1ec4b | 696 | /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ |