A library implementing IEEE 802.15.4 PHY functionality for the MCR20A transceiver. The PHY sublayer provides two services: the PHY data service and the PHY management service interfacing to the PHY sublayer management entity (PLME) service access point (SAP) (known as PLME-SAP). The PHY data service enables the transmission and reception of PHY protocol data units (PSDUs) over the media (radio).

Fork of fsl_phy_mcr20a by Freescale

The Freescale PHY Layer deals with the physical burst which is to be sent and/or received. It performs modulation and demodulation, transmitter and receiver switching, fragmentation, scrambling, interleaving, and error correction coding. The communication to the upper protocol layers is carried out through the Layer 1 Interface.

The PHY Layer is capable of executing the following sequences:

  • I (Idle)
  • R (Receive Sequence conditionally followed by a TxAck)
  • T (Transmit Sequence)
  • C (Standalone CCA)
  • CCCA (Continuous CCA)
  • TR (Transmit/Receive Sequence - transmit unconditionally followed by either an R or RxAck)

In addition to these sequences the PHY Layer also integrates a packet processor which determines whether the packet is MAC-compliant, and if it is, whether it is addressed to the end device. Another feature of the packet processor is Source Address Matching which can be viewed as an extension of packet filtering; however its function is very specific to its intended application (data-polling and indirect queue management by a PAN Coordinator).

Documentation

MCR20A PHY Reference Manual

Committer:
andreikovacs
Date:
Tue Aug 18 12:41:42 2015 +0000
Revision:
0:764779eedf2d
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andreikovacs 0:764779eedf2d 1 /*!
andreikovacs 0:764779eedf2d 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
andreikovacs 0:764779eedf2d 3 * All rights reserved.
andreikovacs 0:764779eedf2d 4 *
andreikovacs 0:764779eedf2d 5 * \file FunctionLib.h
andreikovacs 0:764779eedf2d 6 * This is the Function Lib module header file
andreikovacs 0:764779eedf2d 7 *
andreikovacs 0:764779eedf2d 8 * Redistribution and use in source and binary forms, with or without modification,
andreikovacs 0:764779eedf2d 9 * are permitted provided that the following conditions are met:
andreikovacs 0:764779eedf2d 10 *
andreikovacs 0:764779eedf2d 11 * o Redistributions of source code must retain the above copyright notice, this list
andreikovacs 0:764779eedf2d 12 * of conditions and the following disclaimer.
andreikovacs 0:764779eedf2d 13 *
andreikovacs 0:764779eedf2d 14 * o Redistributions in binary form must reproduce the above copyright notice, this
andreikovacs 0:764779eedf2d 15 * list of conditions and the following disclaimer in the documentation and/or
andreikovacs 0:764779eedf2d 16 * other materials provided with the distribution.
andreikovacs 0:764779eedf2d 17 *
andreikovacs 0:764779eedf2d 18 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
andreikovacs 0:764779eedf2d 19 * contributors may be used to endorse or promote products derived from this
andreikovacs 0:764779eedf2d 20 * software without specific prior written permission.
andreikovacs 0:764779eedf2d 21 *
andreikovacs 0:764779eedf2d 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
andreikovacs 0:764779eedf2d 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
andreikovacs 0:764779eedf2d 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
andreikovacs 0:764779eedf2d 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
andreikovacs 0:764779eedf2d 26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
andreikovacs 0:764779eedf2d 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
andreikovacs 0:764779eedf2d 28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
andreikovacs 0:764779eedf2d 29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
andreikovacs 0:764779eedf2d 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
andreikovacs 0:764779eedf2d 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
andreikovacs 0:764779eedf2d 32 */
andreikovacs 0:764779eedf2d 33
andreikovacs 0:764779eedf2d 34 #ifndef _FUNCTION_LIB_H_
andreikovacs 0:764779eedf2d 35 #define _FUNCTION_LIB_H_
andreikovacs 0:764779eedf2d 36
andreikovacs 0:764779eedf2d 37 #include "EmbeddedTypes.h"
andreikovacs 0:764779eedf2d 38
andreikovacs 0:764779eedf2d 39 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 40 *************************************************************************************
andreikovacs 0:764779eedf2d 41 * Public macros
andreikovacs 0:764779eedf2d 42 *************************************************************************************
andreikovacs 0:764779eedf2d 43 ********************************************************************************** */
andreikovacs 0:764779eedf2d 44
andreikovacs 0:764779eedf2d 45 #ifndef gUseToolchainMemFunc_d
andreikovacs 0:764779eedf2d 46 #define gUseToolchainMemFunc_d 0
andreikovacs 0:764779eedf2d 47 #endif
andreikovacs 0:764779eedf2d 48
andreikovacs 0:764779eedf2d 49 #define FLib_MemSet16 FLib_MemSet
andreikovacs 0:764779eedf2d 50
andreikovacs 0:764779eedf2d 51 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 52 *************************************************************************************
andreikovacs 0:764779eedf2d 53 * Public prototypes
andreikovacs 0:764779eedf2d 54 *************************************************************************************
andreikovacs 0:764779eedf2d 55 ********************************************************************************** */
andreikovacs 0:764779eedf2d 56
andreikovacs 0:764779eedf2d 57 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 58 *************************************************************************************
andreikovacs 0:764779eedf2d 59 * Public type definitions
andreikovacs 0:764779eedf2d 60 *************************************************************************************
andreikovacs 0:764779eedf2d 61 ********************************************************************************** */
andreikovacs 0:764779eedf2d 62
andreikovacs 0:764779eedf2d 63 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 64 *************************************************************************************
andreikovacs 0:764779eedf2d 65 * Public memory declarations
andreikovacs 0:764779eedf2d 66 *************************************************************************************
andreikovacs 0:764779eedf2d 67 ********************************************************************************** */
andreikovacs 0:764779eedf2d 68
andreikovacs 0:764779eedf2d 69 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 70 *************************************************************************************
andreikovacs 0:764779eedf2d 71 * Public functions
andreikovacs 0:764779eedf2d 72 *************************************************************************************
andreikovacs 0:764779eedf2d 73 ********************************************************************************** */
andreikovacs 0:764779eedf2d 74
andreikovacs 0:764779eedf2d 75 #ifdef __cplusplus
andreikovacs 0:764779eedf2d 76 extern "C" {
andreikovacs 0:764779eedf2d 77 #endif
andreikovacs 0:764779eedf2d 78
andreikovacs 0:764779eedf2d 79 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 80 * \brief Copy the content of one memory block to another. The amount of data to copy
andreikovacs 0:764779eedf2d 81 * must be specified in number of bytes.
andreikovacs 0:764779eedf2d 82 *
andreikovacs 0:764779eedf2d 83 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 84 * \param[in] pSrc Pointer to source memory block
andreikovacs 0:764779eedf2d 85 * \param[in] cBytes Number of bytes to copy
andreikovacs 0:764779eedf2d 86 *
andreikovacs 0:764779eedf2d 87 ********************************************************************************** */
andreikovacs 0:764779eedf2d 88 void FLib_MemCpy (void* pDst,
andreikovacs 0:764779eedf2d 89 void* pSrc,
andreikovacs 0:764779eedf2d 90 uint32_t cBytes
andreikovacs 0:764779eedf2d 91 );
andreikovacs 0:764779eedf2d 92
andreikovacs 0:764779eedf2d 93 void FLib_MemCpyAligned32bit (void* to_ptr,
andreikovacs 0:764779eedf2d 94 void* from_ptr,
andreikovacs 0:764779eedf2d 95 register uint32_t number_of_bytes);
andreikovacs 0:764779eedf2d 96
andreikovacs 0:764779eedf2d 97 void FLib_MemCpyDir (void* pBuf1,
andreikovacs 0:764779eedf2d 98 void* pBuf2,
andreikovacs 0:764779eedf2d 99 bool_t dir,
andreikovacs 0:764779eedf2d 100 uint32_t n);
andreikovacs 0:764779eedf2d 101
andreikovacs 0:764779eedf2d 102
andreikovacs 0:764779eedf2d 103 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 104 * \brief Copy bytes. The byte at index i from the source buffer is copied to index
andreikovacs 0:764779eedf2d 105 * ((n-1) - i) in the destination buffer (and vice versa).
andreikovacs 0:764779eedf2d 106 *
andreikovacs 0:764779eedf2d 107 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 108 * \param[in] pSrc Pointer to source memory block
andreikovacs 0:764779eedf2d 109 * \param[in] cBytes Number of bytes to copy
andreikovacs 0:764779eedf2d 110 *
andreikovacs 0:764779eedf2d 111 ********************************************************************************** */
andreikovacs 0:764779eedf2d 112 void FLib_MemCpyReverseOrder (void* pDst,
andreikovacs 0:764779eedf2d 113 void* pSrc,
andreikovacs 0:764779eedf2d 114 uint32_t cBytes
andreikovacs 0:764779eedf2d 115 );
andreikovacs 0:764779eedf2d 116
andreikovacs 0:764779eedf2d 117
andreikovacs 0:764779eedf2d 118 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 119 * \brief Compare two memory blocks. The number of bytes to compare must be specified.
andreikovacs 0:764779eedf2d 120 * If the blocks are equal byte by byte, the function returns TRUE,
andreikovacs 0:764779eedf2d 121 * and FALSE otherwise.
andreikovacs 0:764779eedf2d 122 *
andreikovacs 0:764779eedf2d 123 * \param[in] pData1 First memory block to compare
andreikovacs 0:764779eedf2d 124 * \param[in] pData2 Second memory block to compare
andreikovacs 0:764779eedf2d 125 * \param[in] cBytes Number of bytes to compare
andreikovacs 0:764779eedf2d 126 *
andreikovacs 0:764779eedf2d 127 * \return TRUE if memory areas are equal. FALSE othwerwise.
andreikovacs 0:764779eedf2d 128 *
andreikovacs 0:764779eedf2d 129 ********************************************************************************** */
andreikovacs 0:764779eedf2d 130 bool_t FLib_MemCmp (void* pData1,
andreikovacs 0:764779eedf2d 131 void* pData2,
andreikovacs 0:764779eedf2d 132 uint32_t cBytes
andreikovacs 0:764779eedf2d 133 );
andreikovacs 0:764779eedf2d 134
andreikovacs 0:764779eedf2d 135
andreikovacs 0:764779eedf2d 136 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 137 * \brief Reset bytes in a memory block to a certain value. The value, and the number
andreikovacs 0:764779eedf2d 138 * of bytes to be set, are supplied as arguments.
andreikovacs 0:764779eedf2d 139 *
andreikovacs 0:764779eedf2d 140 * \param[in] pData Pointer to memory block to reset
andreikovacs 0:764779eedf2d 141 * \param[in] value Value that memory block will be set to
andreikovacs 0:764779eedf2d 142 * \param[in] cBytes Number of bytes to set
andreikovacs 0:764779eedf2d 143 *
andreikovacs 0:764779eedf2d 144 ********************************************************************************** */
andreikovacs 0:764779eedf2d 145 void FLib_MemSet (void* pData,
andreikovacs 0:764779eedf2d 146 uint8_t value,
andreikovacs 0:764779eedf2d 147 uint32_t cBytes
andreikovacs 0:764779eedf2d 148 );
andreikovacs 0:764779eedf2d 149
andreikovacs 0:764779eedf2d 150
andreikovacs 0:764779eedf2d 151 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 152 * \brief Copy bytes, possibly into the same overlapping memory as it is taken from
andreikovacs 0:764779eedf2d 153 *
andreikovacs 0:764779eedf2d 154 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 155 * \param[in] pSrc Pointer to source memory block
andreikovacs 0:764779eedf2d 156 * \param[in] cBytes Number of bytes to copy
andreikovacs 0:764779eedf2d 157 *
andreikovacs 0:764779eedf2d 158 ********************************************************************************** */
andreikovacs 0:764779eedf2d 159 void FLib_MemInPlaceCpy (void* pDst,
andreikovacs 0:764779eedf2d 160 void* pSrc,
andreikovacs 0:764779eedf2d 161 uint32_t cBytes
andreikovacs 0:764779eedf2d 162 );
andreikovacs 0:764779eedf2d 163
andreikovacs 0:764779eedf2d 164
andreikovacs 0:764779eedf2d 165 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 166 * \brief Copies a 16bit value to an unaligned a memory block.
andreikovacs 0:764779eedf2d 167 *
andreikovacs 0:764779eedf2d 168 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 169 * \param[in] val16 The 16-bit value to be copied
andreikovacs 0:764779eedf2d 170 *
andreikovacs 0:764779eedf2d 171 ********************************************************************************** */
andreikovacs 0:764779eedf2d 172 void FLib_MemCopy16Unaligned (void* pDst,
andreikovacs 0:764779eedf2d 173 uint16_t val16
andreikovacs 0:764779eedf2d 174 );
andreikovacs 0:764779eedf2d 175
andreikovacs 0:764779eedf2d 176
andreikovacs 0:764779eedf2d 177 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 178 * \brief Copies a 32bit value to an unaligned a memory block.
andreikovacs 0:764779eedf2d 179 *
andreikovacs 0:764779eedf2d 180 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 181 * \param[in] val32 The 32-bit value to be copied
andreikovacs 0:764779eedf2d 182 *
andreikovacs 0:764779eedf2d 183 ********************************************************************************** */
andreikovacs 0:764779eedf2d 184 void FLib_MemCopy32Unaligned (void* pDst,
andreikovacs 0:764779eedf2d 185 uint32_t val32
andreikovacs 0:764779eedf2d 186 );
andreikovacs 0:764779eedf2d 187
andreikovacs 0:764779eedf2d 188
andreikovacs 0:764779eedf2d 189 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 190 * \brief Copies a 64bit value to an unaligned a memory block.
andreikovacs 0:764779eedf2d 191 *
andreikovacs 0:764779eedf2d 192 * \param[out] pDst Pointer to destination memory block
andreikovacs 0:764779eedf2d 193 * \param[in] val64 The 64-bit value to be copied
andreikovacs 0:764779eedf2d 194 *
andreikovacs 0:764779eedf2d 195 ********************************************************************************** */
andreikovacs 0:764779eedf2d 196 void FLib_MemCopy64Unaligned (void* pDst,
andreikovacs 0:764779eedf2d 197 uint64_t val64
andreikovacs 0:764779eedf2d 198 );
andreikovacs 0:764779eedf2d 199
andreikovacs 0:764779eedf2d 200
andreikovacs 0:764779eedf2d 201 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 202 * \brief Add an offset to a pointer.
andreikovacs 0:764779eedf2d 203 *
andreikovacs 0:764779eedf2d 204 * \param[out] pPtr Pointer to the pointer to be updated
andreikovacs 0:764779eedf2d 205 * \param[in] offset The offset(in bytes) to be added
andreikovacs 0:764779eedf2d 206 *
andreikovacs 0:764779eedf2d 207 ********************************************************************************** */
andreikovacs 0:764779eedf2d 208 void FLib_AddOffsetToPointer (void** pPtr,
andreikovacs 0:764779eedf2d 209 uint32_t offset);
andreikovacs 0:764779eedf2d 210
andreikovacs 0:764779eedf2d 211 #define FLib_AddOffsetToPtr(pPtr,offset) FLib_AddOffsetToPointer((void**)(pPtr),(offset))
andreikovacs 0:764779eedf2d 212
andreikovacs 0:764779eedf2d 213
andreikovacs 0:764779eedf2d 214 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 215 * \brief This function returns the length of a NULL terminated string.
andreikovacs 0:764779eedf2d 216 *
andreikovacs 0:764779eedf2d 217 * \param[in] str A NULL terminated string
andreikovacs 0:764779eedf2d 218 *
andreikovacs 0:764779eedf2d 219 * \return the size of string in bytes
andreikovacs 0:764779eedf2d 220 *
andreikovacs 0:764779eedf2d 221 ********************************************************************************** */
andreikovacs 0:764779eedf2d 222 uint32_t FLib_StrLen(char *str);
andreikovacs 0:764779eedf2d 223
andreikovacs 0:764779eedf2d 224
andreikovacs 0:764779eedf2d 225 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 226 * \brief Compare two bytes.
andreikovacs 0:764779eedf2d 227 *
andreikovacs 0:764779eedf2d 228 * \param[in] c1 first byte to compare
andreikovacs 0:764779eedf2d 229 * \param[in] c2 second byte to compare
andreikovacs 0:764779eedf2d 230 *
andreikovacs 0:764779eedf2d 231 * \return TRUE if the two bytes are equal, and FALSE otherwise.
andreikovacs 0:764779eedf2d 232 *
andreikovacs 0:764779eedf2d 233 ********************************************************************************** */
andreikovacs 0:764779eedf2d 234 #define FLib_Cmp2Bytes(c1, c2) (*((uint16_t*) (c1)) == *((uint16_t*) (c2)))
andreikovacs 0:764779eedf2d 235
andreikovacs 0:764779eedf2d 236
andreikovacs 0:764779eedf2d 237 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 238 * \brief Returns the maximum value of arguments a and b.
andreikovacs 0:764779eedf2d 239 *
andreikovacs 0:764779eedf2d 240 * \return The maximum value of arguments a and b
andreikovacs 0:764779eedf2d 241 *
andreikovacs 0:764779eedf2d 242 * \remarks
andreikovacs 0:764779eedf2d 243 * The primitive should must be implemented as a macro, as it should be possible to
andreikovacs 0:764779eedf2d 244 * evaluate the result on compile time if the arguments are constants.
andreikovacs 0:764779eedf2d 245 *
andreikovacs 0:764779eedf2d 246 ********************************************************************************** */
andreikovacs 0:764779eedf2d 247 #define FLib_GetMax(a,b) (((a) > (b)) ? (a) : (b))
andreikovacs 0:764779eedf2d 248
andreikovacs 0:764779eedf2d 249
andreikovacs 0:764779eedf2d 250 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 251 * \brief Returns the minimum value of arguments a and b.
andreikovacs 0:764779eedf2d 252 *
andreikovacs 0:764779eedf2d 253 * \return The minimum value of arguments a and b
andreikovacs 0:764779eedf2d 254 *
andreikovacs 0:764779eedf2d 255 * \remarks
andreikovacs 0:764779eedf2d 256 * The primitive should must be implemented as a macro, as it should be possible to
andreikovacs 0:764779eedf2d 257 * evaluate the result on compile time if the arguments are constants.
andreikovacs 0:764779eedf2d 258 *
andreikovacs 0:764779eedf2d 259 ********************************************************************************** */
andreikovacs 0:764779eedf2d 260 #define FLib_GetMin(a,b) (((a) < (b)) ? (a) : (b))
andreikovacs 0:764779eedf2d 261
andreikovacs 0:764779eedf2d 262 #ifdef __cplusplus
andreikovacs 0:764779eedf2d 263 }
andreikovacs 0:764779eedf2d 264 #endif
andreikovacs 0:764779eedf2d 265
andreikovacs 0:764779eedf2d 266 #endif /* _FUNCTION_LIB_H_ */