Fork of my original MQTTGateway

Dependencies:   mbed-http

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SPIRIT_PktBasic.h Source File

SPIRIT_PktBasic.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003  * @file    SPIRIT_PktBasic.h
00004   * @author  VMA division - AMS
00005   * @version 3.2.2
00006   * @date    08-July-2015
00007  * @brief   Configuration and management of SPIRIT Basic packets.
00008   * 
00009  * @details
00010  *
00011  * This module can be used to manage the configuration of Spirit Basic
00012  * packets.
00013  * The user can obtain a packet configuration filling the structure
00014  * <i>@ref PktBasicInit</i>, defining in it some general parameters
00015  * for the Spirit Basic packet format.
00016  * Another structure the user can fill is <i>@ref PktBasicAddressesInit</i>
00017  * to define the addresses which will be used during the communication.
00018  * Moreover, functions to set the payload length and the destination address
00019  * are provided.
00020  *
00021  * <b>Example:</b>
00022  * @code
00023  *
00024  * PktBasicInit basicInit={
00025  *   PKT_PREAMBLE_LENGTH_08BYTES,       // preamble length in bytes
00026  *   PKT_SYNC_LENGTH_4BYTES,            // sync word length in bytes
00027  *   0x1A2635A8,                        // sync word
00028  *   PKT_LENGTH_VAR,                    // variable or fixed payload length
00029  *   7,                                 // length field width in bits (used only for variable length)
00030  *   PKT_NO_CRC,                        // CRC mode
00031  *   PKT_CONTROL_LENGTH_0BYTES,         // control field length
00032  *   S_ENABLE,                          // address field
00033  *   S_DISABLE,                         // FEC
00034  *   S_ENABLE                           // whitening
00035  * };
00036  *
00037  * PktBasicAddressesInit addressInit={
00038  *   S_ENABLE,                          // enable/disable filtering on my address
00039  *   0x34,                              // my address (address of the current node)
00040  *   S_DISABLE,                         // enable/disable filtering on multicast address
00041  *   0xEE,                              // multicast address
00042  *   S_DISABLE,                         // enable/disable filtering on broadcast address
00043  *   0xFF                               // broadcast address
00044  * };
00045  *
00046  * ...
00047  *
00048  * SpiritPktBasicInit(&basicInit);
00049  * SpiritPktBasicAddressesInit(&addressInit);
00050  *
00051  * ...
00052  *
00053  * SpiritPktBasicSetPayloadLength(20);
00054  * SpiritPktBasicSetDestinationAddress(0x44);
00055  *
00056  * ...
00057  *
00058  * @endcode
00059  *
00060  * The module provides some other functions that can be used to modify
00061  * or read only some configuration parameters.
00062  *
00063  *
00064   * @attention
00065   *
00066   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
00067   *
00068   * Redistribution and use in source and binary forms, with or without modification,
00069   * are permitted provided that the following conditions are met:
00070   *   1. Redistributions of source code must retain the above copyright notice,
00071   *      this list of conditions and the following disclaimer.
00072   *   2. Redistributions in binary form must reproduce the above copyright notice,
00073   *      this list of conditions and the following disclaimer in the documentation
00074   *      and/or other materials provided with the distribution.
00075   *   3. Neither the name of STMicroelectronics nor the names of its contributors
00076   *      may be used to endorse or promote products derived from this software
00077   *      without specific prior written permission.
00078   *
00079   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00080   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00081   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00082   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00083   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00084   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00085   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00086   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00087   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00088   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00089  *
00090   ******************************************************************************
00091  */
00092 
00093 /* Define to prevent recursive inclusion -------------------------------------*/
00094 #ifndef __SPIRIT_PKT_BASIC_H
00095 #define __SPIRIT_PKT_BASIC_H
00096 
00097 /* Includes ------------------------------------------------------------------*/
00098 
00099 #include "SPIRIT_Regs.h"
00100 #include "SPIRIT_Types.h"
00101 #include "SPIRIT_PktCommon.h"
00102 
00103 #ifdef __cplusplus
00104  extern "C" {
00105 #endif
00106 
00107 
00108 
00109 /**
00110  * @addtogroup SPIRIT_Libraries
00111  * @{
00112  */
00113 
00114 
00115 /**
00116  * @defgroup SPIRIT_PktBasic    Pkt Basic
00117  * @brief Configuration and management of SPIRIT Basic packets.
00118  * @details See the file <i>@ref SPIRIT_PktBasic.h</i> for more details.
00119  * @{
00120  */
00121 
00122 /**
00123  * @defgroup PktBasic_Exported_Types    Pkt Basic Exported Types
00124  * @{
00125  */
00126 
00127 
00128 /**
00129  * @brief  Preamble length in bytes enumeration.
00130  */
00131 typedef PktPreambleLength                  BasicPreambleLength;
00132 
00133 #define IS_BASIC_PREAMBLE_LENGTH           IS_PKT_PREAMBLE_LENGTH
00134 
00135 /**
00136  * @brief  Sync length in bytes enumeration.
00137  */
00138 typedef PktSyncLength                      BasicSyncLength;
00139 
00140 #define IS_BASIC_SYNC_LENGTH               IS_PKT_SYNC_LENGTH
00141 
00142 
00143 
00144 /**
00145  * @brief  CRC length in bytes enumeration.
00146  */
00147 typedef PktCrcMode                         BasicCrcMode;
00148 
00149 #define IS_BASIC_CRC_MODE                  IS_PKT_CRC_MODE
00150 
00151 
00152 /**
00153  * @brief  Fixed or variable payload length enumeration.
00154  */
00155 typedef PktFixVarLength                    BasicFixVarLength;
00156 
00157 #define IS_BASIC_FIX_VAR_LENGTH            IS_PKT_FIX_VAR_LENGTH
00158 
00159 /**
00160  * @brief  Control length in bytes enumeration.
00161  */
00162 typedef PktControlLength                   BasicControlLength;
00163 
00164 #define IS_BASIC_CONTROL_LENGTH            IS_PKT_CONTROL_LENGTH
00165 
00166 /**
00167  * @brief  Sync words enumeration.
00168  */
00169 typedef PktSyncX                           BasicSyncX;
00170 
00171 #define IS_BASIC_SYNCx                     IS_PKT_SYNCx
00172 
00173 
00174 /**
00175  * @brief  SPIRIT Basic Packet Init structure definition. This structure allows users to set the main options
00176  *         for the Basic packet.
00177  */
00178 typedef struct
00179 {
00180 
00181   BasicPreambleLength           xPreambleLength;        /*!< Specifies the preamble length.
00182                                                              This parameter can be any value of @ref BasicPreambleLength */
00183   BasicSyncLength               xSyncLength;            /*!< Specifies the sync word length. The 32bit word passed (lSyncWords) will be stored in the SYNCx registers from the MSb
00184                                                              until the number of bytes in xSyncLength has been stored.
00185                                                              This parameter can be any value of @ref BasicSyncLength */
00186   uint32_t                      lSyncWords;             /*!< Specifies the sync words.
00187                                                              This parameter is a uint32_t word with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4| */
00188   BasicFixVarLength             xFixVarLength;          /*!< Specifies if a fixed length of packet has to be used.
00189                                                              This parameter can be any value of @ref BasicFixVarLength */
00190   uint8_t                       cPktLengthWidth;        /*!< Specifies the size of the length of packet in bits. This field is useful only if
00191                                                              the field xFixVarLength is set to BASIC_LENGTH_VAR. For Basic packets the length width
00192                                                              is log2( max payload length + control length (0 to 4) + address length (0 or 1)).
00193                                                              This parameter is an uint8_t */
00194   BasicCrcMode                  xCrcMode;               /*!< Specifies the CRC word length of packet.
00195                                                              This parameter can be any value of @ref BasicCrcMode */
00196   BasicControlLength            xControlLength;         /*!< Specifies the length of a control field to be sent.
00197                                                              This parameter can be any value of @ref BasicControlLength */
00198   SpiritFunctionalState         xAddressField;          /*!< Specifies if the destination address has to be sent.
00199                                                              This parameter can be S_ENABLE or S_DISABLE */
00200   SpiritFunctionalState         xFec;                   /*!< Specifies if FEC has to be enabled.
00201                                                              This parameter can be S_ENABLE or S_DISABLE */
00202   SpiritFunctionalState         xDataWhitening;         /*!< Specifies if data whitening has to be enabled.
00203                                                              This parameter can be S_ENABLE or S_DISABLE */
00204 }PktBasicInit;
00205 
00206 
00207 /**
00208  * @brief  SPIRIT Basic Packet address structure definition. This structure allows users to specify
00209  *         the node/multicast/broadcast addresses and the correspondent filtering options.
00210  */
00211 typedef struct
00212 {
00213 
00214   SpiritFunctionalState         xFilterOnMyAddress;             /*!< If set RX packet is accepted if its destination address matches with cMyAddress.
00215                                                                      This parameter can be S_ENABLE or S_DISABLE */
00216   uint8_t                       cMyAddress;                     /*!< Specifies the TX packet source address (address of this node).
00217                                                                      This parameter is an uint8_t */
00218   SpiritFunctionalState         xFilterOnMulticastAddress;      /*!< If set RX packet is accepted if its destination address matches with cMulticastAddress.
00219                                                                      This parameter can be S_ENABLE or S_DISABLE */
00220   uint8_t                       cMulticastAddress;              /*!< Specifies the Multicast group address for this node.
00221                                                                      This parameter is an uint8_t */
00222   SpiritFunctionalState         xFilterOnBroadcastAddress;      /*!< If set RX packet is accepted if its destination address matches with cBroadcastAddress.
00223                                                                      This parameter can be S_ENABLE or S_DISABLE */
00224   uint8_t                       cBroadcastAddress;              /*!< Specifies the Broadcast address for this node.
00225                                                                      This parameter is an uint8_t */
00226 }PktBasicAddressesInit;
00227 
00228 /**
00229  *@}
00230  */
00231 
00232 
00233 /**
00234  * @defgroup PktBasic_Exported_Constants        Pkt Basic Exported Constants
00235  * @{
00236  */
00237 
00238 #define IS_BASIC_LENGTH_WIDTH_BITS                      IS_PKT_LENGTH_WIDTH_BITS
00239 
00240 
00241 /**
00242  *@}
00243  */
00244 
00245 
00246 /**
00247  * @defgroup PktBasic_Exported_Macros   Pkt Basic Exported Macros
00248  * @{
00249  */
00250 
00251 /**
00252  * @brief  Macro used to compute per lower part of the packet length
00253  *         for Spirit Basic packets, to write in the PCKTLEN0 register.
00254  * @param  nLength Length of the packet payload.
00255  *         This parameter is an uint16_t.
00256  * @retval None.
00257  */
00258 #define BASIC_BUILD_PCKTLEN0(nLength)                                            BUILD_PCKTLEN0(nLength)
00259 
00260 
00261 /**
00262  * @brief  Macro used to compute per upper part of the packet length
00263  *         for Spirit Basic packets, to write the PCKTLEN1 register.
00264  * @param  nLengthLength of the packet payload.
00265  *         This parameter is an uint16_t.
00266  * @retval None.
00267  */
00268 #define BASIC_BUILD_PCKTLEN1(nLength)                                            BUILD_PCKTLEN1(nLength)
00269 
00270 /**
00271  * @brief  Sets the CONTROL field length for SPIRIT Basic packets.
00272  * @param  xControlLength length of CONTROL field in bytes.
00273  *         This parameter can be any value of @ref PktControlLength.
00274  * @retval None.
00275  */
00276 #define SpiritPktBasicSetControlLength(xControlLength)                  SpiritPktCommonSetControlLength(xControlLength)
00277 
00278 
00279 /**
00280  * @brief  Returns the CONTROL field length for SPIRIT Basic packets.
00281  * @param  None.
00282  * @retval uint8_t Control field length.
00283  */
00284 #define SpiritPktBasicGetControlLength()                                SpiritPktCommonGetControlLength()
00285 
00286 
00287 /**
00288  * @brief  Sets the PREAMBLE field length for SPIRIT Basic packets.
00289  * @param  xPreambleLength length of PREAMBLE field in bytes.
00290  *         This parameter can be any value of @ref BasicPreambleLength.
00291  * @retval None.
00292  */
00293 #define SpiritPktBasicSetPreambleLength(xPreambleLength)                SpiritPktCommonSetPreambleLength((PktPreambleLength)xPreambleLength)
00294 
00295 
00296 /**
00297  * @brief  Returns the PREAMBLE field length mode for SPIRIT Basic packets.
00298  * @param  None.
00299  * @retval uint8_t Preamble field length in bytes.
00300  */
00301 #define SpiritPktBasicGetPreambleLength()                               SpiritPktCommonGetPreambleLength()
00302 
00303 
00304 /**
00305  * @brief  Sets the SYNC field length for SPIRIT Basic packets.
00306  * @param  xSyncLength length of SYNC field in bytes.
00307  *         This parameter can be any value of @ref BasicSyncLength.
00308  * @retval None.
00309  */
00310 #define SpiritPktBasicSetSyncLength(xSyncLength)                         SpiritPktCommonSetSyncLength((PktSyncLength)xSyncLength)
00311 
00312 
00313 /**
00314  * @brief  Returns the SYNC field length for SPIRIT Basic packets.
00315  * @param  None.
00316  * @retval uint8_t SYNC field length in bytes.
00317  */
00318 #define SpiritPktBasicGetSyncLength()                                   SpiritPktCommonGetSyncLength()
00319 
00320 
00321 /**
00322  * @brief  Sets fixed or variable payload length mode for SPIRIT packets.
00323  * @param  xFixVarLength variable or fixed length.
00324  *         BASIC_FIXED_LENGTH_VAR -> variable (the length is extracted from the received packet).
00325  *         BASIC_FIXED_LENGTH_FIX -> fix (the length is set by PCKTLEN0 and PCKTLEN1).
00326  * @retval None.
00327  */
00328 #define SpiritPktBasicSetFixVarLength(xFixVarLength)                    SpiritPktCommonSetFixVarLength((PktFixVarLength)xFixVarLength)
00329 
00330 
00331 /**
00332  * @brief  Enables or Disables the CRC filtering.
00333  * @param  xNewState new state for CRC_CHECK.
00334  *         This parameter can be S_ENABLE or S_DISABLE.
00335  * @retval None.
00336  */
00337 #define SpiritPktBasicFilterOnCrc(xNewState)                            SpiritPktCommonFilterOnCrc(xNewState)
00338 
00339 
00340 /**
00341  * @brief  Returns the CRC filtering bit.
00342  * @param  None.
00343  * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
00344  */
00345 #define SpiritPktBasicGetFilterOnCrc()                                  SpiritPktCommonGetFilterOnCrc()
00346 
00347 
00348 /**
00349  * @brief  Sets the CRC mode for SPIRIT Basic packets.
00350  * @param  xCrcMode CRC mode.
00351  *         This parameter can be any value of @ref BasicCrcMode.
00352  * @retval None.
00353  */
00354 #define SpiritPktBasicSetCrcMode(xCrcMode)                              SpiritPktCommonSetCrcMode((PktCrcMode)xCrcMode)
00355 
00356 
00357 /**
00358  * @brief  Returns the CRC mode for SPIRIT Basic packets.
00359  * @param  None.
00360  * @retval BasicCrcMode Crc mode.
00361  */
00362 #define SpiritPktBasicGetCrcMode()                                      (BasicCrcMode)SpiritPktCommonGetCrcMode()
00363 
00364 
00365 /**
00366  * @brief  Enables or Disables WHITENING for SPIRIT packets.
00367  * @param  xNewState new state for WHITENING mode.
00368  *         This parameter can be S_ENABLE or S_DISABLE.
00369  * @retval None.
00370  */
00371 #define SpiritPktBasicWhitening(xNewState)                               SpiritPktCommonWhitening(xNewState)
00372 
00373 
00374 /**
00375  * @brief  Enables or Disables FEC for SPIRIT Basic packets.
00376  * @param  xNewState new state for FEC mode.
00377  *         This parameter can be S_ENABLE or S_DISABLE.
00378  * @retval None.
00379  */
00380 #define SpiritPktBasicFec(xNewState)                                     SpiritPktCommonFec(xNewState)
00381 
00382 
00383 /**
00384  * @brief  Sets a specific SYNC word for SPIRIT Basic packets.
00385  * @param  xSyncX SYNC word number to be set.
00386  *         This parameter can be any value of @ref BasicSyncX.
00387  * @param  cSyncWord SYNC word.
00388  *         This parameter is an uint8_t.
00389  * @retval None.
00390  */
00391 #define SpiritPktBasicSetSyncxWord(xSyncX, cSyncWord)                   SpiritPktCommonSetSyncxWord((PktSyncX)xSyncX, cSyncWord)
00392 
00393 
00394 /**
00395  * @brief  Returns a specific SYNC words for SPIRIT Basic packets.
00396  * @param  xSyncX SYNC word number to be get.
00397  *         This parameter can be any value of @ref BasicSyncX.
00398  * @retval uint8_t Sync word x.
00399  */
00400 #define SpiritPktBasicGetSyncxWord(xSyncX)                              SpiritPktCommonGetSyncxWord(xSyncX)
00401 
00402 
00403 /**
00404  * @brief  Sets multiple SYNC words for SPIRIT Basic packets.
00405  * @param  lSyncWords SYNC words to be set with format: 0x|SYNC1|SYNC2|SYNC3|SYNC4|.
00406  *         This parameter is a uint32_t.
00407  * @param  xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb
00408  *         until the number of bytes in xSyncLength has been stored.
00409  *         This parameter is a @ref BasicSyncLength.
00410  * @retval None.
00411  */
00412 #define SpiritPktBasicSetSyncWords(lSyncWords, xSyncLength)              SpiritPktCommonSetSyncWords(lSyncWords, (PktSyncLength)xSyncLength)
00413 
00414 
00415 /**
00416  * @brief  Returns multiple SYNC words for SPIRIT Basic packets.
00417  * @param  xSyncLength SYNC length in bytes. The 32bit word passed will be stored in the SYNCx registers from the MSb
00418  *         until the number of bytes in xSyncLength has been stored.
00419  *         This parameter is a pointer to @ref BasicSyncLength.
00420  * @retval uint32_t Sync words. The format of the read 32 bit word is 0x|SYNC1|SYNC2|SYNC3|SYNC4|.
00421  */
00422 #define SpiritPktBasicGetSyncWords(xSyncLength)                         SpiritPktCommonGetSyncWords((PktSyncLength)xSyncLength)
00423 
00424 
00425 /**
00426  * @brief  Returns the SPIRIT variable length width (in number of bits).
00427  * @param  None.
00428  * @retval Variable length width in bits.
00429  */
00430 #define SpiritPktBasicGetVarLengthWidth()                               SpiritPktCommonGetVarLengthWidth()
00431 
00432 
00433 /**
00434  * @brief  Sets the destination address for the Tx packet.
00435  * @param  cAddress destination address.
00436  *         This parameter is an uint8_t.
00437  * @retval None.
00438  */
00439 #define SpiritPktBasicSetDestinationAddress(cAddress)                   SpiritPktCommonSetDestinationAddress(cAddress)
00440 
00441 
00442 /**
00443  * @brief  Returns the settled destination address.
00444  * @param  None.
00445  * @retval uint8_t Transmitted destination address.
00446  */
00447 #define SpiritPktBasicGetTransmittedDestAddress()                       SpiritPktCommonGetTransmittedDestAddress()
00448 
00449 
00450 /**
00451  * @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
00452  *         my address, then the packet is accepted (this is the address of the node).
00453  * @param  cAddress Address of the present node.
00454  *         This parameter is an uint8_t.
00455  * @retval None.
00456  */
00457 #define SpiritPktBasicSetMyAddress(cAddress)                            SpiritPktCommonSetMyAddress(cAddress)
00458 
00459 
00460 /**
00461  * @brief  Returns the address of the present node.
00462  * @param  None.
00463  * @retval uint8_t My address (address of this node).
00464  */
00465 #define SpiritPktBasicGetMyAddress()                                    SpiritPktCommonGetMyAddress()
00466 
00467 
00468 /**
00469  * @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
00470  *         BROADCAST_ADDR register, then the packet is accepted.
00471  * @param  cAddress Broadcast address.
00472  *         This parameter is an uint8_t.
00473  * @retval None.
00474  */
00475 #define SpiritPktBasicSetBroadcastAddress(cAddress)                     SpiritPktCommonSetBroadcastAddress(cAddress)
00476 
00477 
00478 /**
00479  * @brief  Returns the broadcast address.
00480  * @param  None.
00481  * @retval uint8_t Broadcast address.
00482  */
00483 #define SpiritPktBasicGetBroadcastAddress()                             SpiritPktCommonGetBroadcastAddress()
00484 
00485 
00486 /**
00487  * @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
00488  *         MULTICAST_ADDR register, then the packet is accepted.
00489  * @param  cAddress Multicast address.
00490  *         This parameter is an uint8_t.
00491  * @retval None.
00492  */
00493 #define SpiritPktBasicSetMulticastAddress(cAddress)                     SpiritPktCommonSetMulticastAddress(cAddress)
00494 
00495 
00496 /**
00497  * @brief  Returns the multicast address.
00498  * @param  None.
00499  * @retval uint8_t Multicast address.
00500  */
00501 #define SpiritPktBasicGetMulticastAddress()                             SpiritPktCommonGetMulticastAddress()
00502 
00503 
00504 /**
00505  * @brief  Sets the control mask. The 1 bits of the CONTROL_MASK indicate the
00506  *         bits to be used in filtering. (All 0s no filtering)
00507  * @param  lMask Control mask.
00508  *         This parameter is an uint32_t.
00509  * @retval None.
00510  */
00511 #define SpiritPktBasicSetCtrlMask(lMask)                                SpiritPktCommonSetCtrlMask(lMask)
00512 
00513 
00514 /**
00515  * @brief  Returns the control mask. The 1 bits of the CONTROL_MASK indicate the
00516  *         bits to be used in filtering. (All 0s no filtering)
00517  * @param  None.
00518  * @retval uint32_t Control mask.
00519  */
00520 #define SpiritPktBasicGetCtrlMask()                                     SpiritPktCommonGetCtrlMask()
00521 
00522 
00523 /**
00524  * @brief  Sets the control field reference. If the bits enabled by the
00525  *         CONTROL_MASK match the ones of the control fields extracted from the received packet
00526  *         then the packet is accepted.
00527  * @param  lReference Control reference.
00528  *         This parameter is an uint32_t.
00529  * @retval None.
00530  */
00531 #define SpiritPktBasicSetCtrlReference(lReference)                      SpiritPktCommonSetCtrlReference(lReference)
00532 
00533 
00534 /**
00535  * @brief  Returns the control field reference.
00536  * @param  None.
00537  * @retval uint32_t Control reference.
00538  */
00539 #define SpiritPktBasicGetCtrlReference()                                SpiritPktCommonGetCtrlReference()
00540 
00541 
00542 /**
00543  * @brief  Sets the TX control field.
00544  * @param  lField Tx control field.
00545  *         This parameter is an uint32_t.
00546  * @retval None.
00547  */
00548 #define SpiritPktBasicSetTransmittedCtrlField(lField)                   SpiritPktCommonSetTransmittedCtrlField(lField)
00549 
00550 
00551 /**
00552  * @brief  Returns the TX control field.
00553  * @param  None.
00554  * @retval uint32_t Control field of the transmitted packet.
00555  */
00556 #define SpiritPktBasicGetTransmittedCtrlField()                         SpiritPktCommonGetTransmittedCtrlField()
00557 
00558 
00559 /**
00560  * @brief  If enabled RX packet is accepted if its destination address matches with My address.
00561  * @param  xNewState new state for DEST_VS_SOURCE_ADDRESS.
00562  *         This parameter can be S_ENABLE or S_DISABLE.
00563  * @retval None.
00564  */
00565 #define SpiritPktBasicFilterOnMyAddress(xNewState)                      SpiritPktCommonFilterOnMyAddress(xNewState)
00566 
00567 
00568 /**
00569  * @brief  If enabled RX packet is accepted if its destination address matches with multicast address.
00570  * @param  xNewState new state for DEST_VS_MULTICAST_ADDRESS.
00571  *         This parameter can be S_ENABLE or S_DISABLE.
00572  * @retval None.
00573  */
00574 #define SpiritPktBasicFilterOnMulticastAddress(xNewState)               SpiritPktCommonFilterOnMulticastAddress(xNewState)
00575 
00576 
00577 /**
00578  * @brief  If enabled RX packet is accepted if its destination address matches with broadcast address.
00579  * @param  xNewState new state for DEST_VS_BROADCAST_ADDRESS.
00580  *         This parameter can be S_ENABLE or S_DISABLE.
00581  * @retval None.
00582  */
00583 #define SpiritPktBasicFilterOnBroadcastAddress(xNewState)               SpiritPktCommonFilterOnBroadcastAddress(xNewState)
00584 
00585 
00586 /**
00587  * @brief  Returns the enable bit of the my address filtering.
00588  * @param  None.
00589  * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
00590  */
00591 #define SpiritPktBasicGetFilterOnMyAddress()                            SpiritPktCommonGetFilterOnMyAddress();
00592 
00593 
00594 /**
00595  * @brief  Returns the enable bit of the multicast address filtering.
00596  * @param  None.
00597  * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
00598  */
00599 #define SpiritPktBasicGetFilterOnMulticastAddress()                     SpiritPktCommonGetFilterOnMulticastAddress();
00600 
00601 
00602 /**
00603  * @brief  Returns the enable bit of the broadcast address filtering.
00604  * @param  None.
00605  * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
00606  */
00607 #define SpiritPktBasicGetFilterOnBroadcastAddress()                     SpiritPktCommonGetFilterOnBroadcastAddress();
00608 
00609 
00610 /**
00611  * @brief  Returns the destination address of the received packet.
00612  * @param  None.
00613  * @retval uint8_t Destination address of the received packet.
00614  */
00615 #define SpiritPktBasicGetReceivedDestAddress()                          SpiritPktCommonGetReceivedDestAddress()
00616 
00617 
00618 /**
00619  * @brief  Returns the control field of the received packet.
00620  * @param  None.
00621  * @retval uint32_t Received control field.
00622  */
00623 #define SpiritPktBasicGetReceivedCtrlField()                            SpiritPktCommonGetReceivedCtrlField()
00624 
00625 
00626 /**
00627  * @brief  Returns the CRC field of the received packet.
00628  * @param  cCrcFieldVect array in which the CRC field has to be stored.
00629  *         This parameter is an uint8_t array of 3 elements.
00630  * @retval None.
00631  */
00632 #define SpiritPktBasicGetReceivedCrcField(cCrcFieldVect)                SpiritPktCommonGetReceivedCrcField(cCrcFieldVect)
00633 
00634 
00635 /**
00636  * @brief  If enabled RX packet is accepted only if the masked control field matches the
00637  *         masked control field reference (CONTROL_MASK & CONTROL_FIELD_REF == CONTROL_MASK & RX_CONTROL_FIELD).
00638  * @param  xNewState new state for Control filtering enable bit.
00639  *         This parameter can be S_ENABLE or S_DISABLE.
00640  * @retval None.
00641  * @note   This filtering control is enabled by default but the control mask is by default set to 0.
00642  *         As a matter of fact the user has to enable the control filtering bit after the packet initialization
00643  *         because the PktInit routine disables it.
00644  */
00645 #define SpiritPktBasicFilterOnControlField(xNewState)                           SpiritPktCommonFilterOnControlField(xNewState)
00646 
00647 
00648 /**
00649  * @brief  Returns the enable bit of the control field filtering.
00650  * @param  None.
00651  * @retval SpiritFunctionalState This parameter can be S_ENABLE or S_DISABLE.
00652  */
00653 #define SpiritPktBasicGetFilterOnControlField()                                 SpiritPktCommonGetFilterOnControlField();
00654 
00655 /**
00656  *@}
00657  */
00658 
00659 
00660 /**
00661  * @defgroup PktBasic_Exported_Functions        Pkt Basic Exported Functions
00662  * @{
00663  */
00664 
00665 void SpiritPktBasicInit(PktBasicInit* pxPktBasicInit);
00666 void SpiritPktBasicGetInfo(PktBasicInit* pxPktBasicInit);
00667 void SpiritPktBasicAddressesInit(PktBasicAddressesInit* pxPktBasicAddresses);
00668 void SpiritPktBasicGetAddressesInfo(PktBasicAddressesInit* pxPktBasicAddresses);
00669 void SpiritPktBasicSetFormat(void);
00670 void SpiritPktBasicAddressField(SpiritFunctionalState xAddressField);
00671 SpiritFunctionalState SpiritPktBasicGetAddressField(void);
00672 void SpiritPktBasicSetPayloadLength(uint16_t nPayloadLength);
00673 uint16_t SpiritPktBasicGetPayloadLength(void);
00674 uint16_t SpiritPktBasicGetReceivedPktLength(void);
00675 void SpiritPktBasicSetVarLengthWidth(uint16_t nMaxPayloadLength,SpiritFunctionalState xAddressField, BasicControlLength xControlLength);
00676 
00677 /**
00678  *@}
00679  */
00680 
00681 /**
00682  *@}
00683  */
00684 
00685 
00686 /**
00687  *@}
00688  */
00689 
00690 #ifdef __cplusplus
00691 }
00692 #endif
00693 
00694 #endif
00695 
00696 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/