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 MemManager.h
andreikovacs 0:764779eedf2d 6 * This is the header file for the Memory Manager interface.
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 _MEM_MANAGER_H_
andreikovacs 0:764779eedf2d 35 #define _MEM_MANAGER_H_
andreikovacs 0:764779eedf2d 36
andreikovacs 0:764779eedf2d 37 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 38 *************************************************************************************
andreikovacs 0:764779eedf2d 39 * Include
andreikovacs 0:764779eedf2d 40 *************************************************************************************
andreikovacs 0:764779eedf2d 41 ********************************************************************************** */
andreikovacs 0:764779eedf2d 42 #include "EmbeddedTypes.h"
andreikovacs 0:764779eedf2d 43 #include "GenericList.h"
andreikovacs 0:764779eedf2d 44 #include "MemManagerConfig.h"
andreikovacs 0:764779eedf2d 45
andreikovacs 0:764779eedf2d 46
andreikovacs 0:764779eedf2d 47 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 48 *************************************************************************************
andreikovacs 0:764779eedf2d 49 * Public macros
andreikovacs 0:764779eedf2d 50 *************************************************************************************
andreikovacs 0:764779eedf2d 51 ********************************************************************************** */
andreikovacs 0:764779eedf2d 52 /*Defines pools by block size and number of blocks. Must be alligned to 4 bytes.*/
andreikovacs 0:764779eedf2d 53 #ifndef PoolsDetails_c
andreikovacs 0:764779eedf2d 54 #define PoolsDetails_c \
andreikovacs 0:764779eedf2d 55 _block_size_ 64 _number_of_blocks_ 8 _eol_ \
andreikovacs 0:764779eedf2d 56 _block_size_ 128 _number_of_blocks_ 2 _eol_ \
andreikovacs 0:764779eedf2d 57 _block_size_ 256 _number_of_blocks_ 6 _eol_
andreikovacs 0:764779eedf2d 58 #endif
andreikovacs 0:764779eedf2d 59
andreikovacs 0:764779eedf2d 60
andreikovacs 0:764779eedf2d 61 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 62 *************************************************************************************
andreikovacs 0:764779eedf2d 63 * Private type definitions
andreikovacs 0:764779eedf2d 64 *************************************************************************************
andreikovacs 0:764779eedf2d 65 ********************************************************************************** */
andreikovacs 0:764779eedf2d 66 /*Defines statuses used in MEM_BufferAlloc and MEM_BufferFree*/
andreikovacs 0:764779eedf2d 67 typedef enum
andreikovacs 0:764779eedf2d 68 {
andreikovacs 0:764779eedf2d 69 MEM_SUCCESS_c = 0, /* No error occurred */
andreikovacs 0:764779eedf2d 70 MEM_INIT_ERROR_c, /* Memory initialization error */
andreikovacs 0:764779eedf2d 71 MEM_ALLOC_ERROR_c, /* Memory allocation error */
andreikovacs 0:764779eedf2d 72 MEM_FREE_ERROR_c, /* Memory free error */
andreikovacs 0:764779eedf2d 73 MEM_UNKNOWN_ERROR_c /* something bad has happened... */
andreikovacs 0:764779eedf2d 74 }memStatus_t;
andreikovacs 0:764779eedf2d 75
andreikovacs 0:764779eedf2d 76
andreikovacs 0:764779eedf2d 77 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 78 *************************************************************************************
andreikovacs 0:764779eedf2d 79 * Public prototypes
andreikovacs 0:764779eedf2d 80 *************************************************************************************
andreikovacs 0:764779eedf2d 81 ********************************************************************************** */
andreikovacs 0:764779eedf2d 82 #ifdef __cplusplus
andreikovacs 0:764779eedf2d 83 extern "C" {
andreikovacs 0:764779eedf2d 84 #endif
andreikovacs 0:764779eedf2d 85 /*Initialises the Memory Manager.*/
andreikovacs 0:764779eedf2d 86 memStatus_t MEM_Init(void);
andreikovacs 0:764779eedf2d 87 /*Returns the number of available blocks that fit the given size.*/
andreikovacs 0:764779eedf2d 88 uint32_t MEM_GetAvailableBlocks(uint32_t size);
andreikovacs 0:764779eedf2d 89 /*Frees the givem buffer.*/
andreikovacs 0:764779eedf2d 90 memStatus_t MEM_BufferFree(void* buffer);
andreikovacs 0:764779eedf2d 91 /*Returns the allocated buffer of the given size.*/
andreikovacs 0:764779eedf2d 92 void* MEM_BufferAlloc(uint32_t numBytes);
andreikovacs 0:764779eedf2d 93 /*Returns the size of a given buffer*/
andreikovacs 0:764779eedf2d 94 uint16_t MEM_BufferGetSize(void* buffer);
andreikovacs 0:764779eedf2d 95 /*Performs a write-read-verify test accross all pools*/
andreikovacs 0:764779eedf2d 96 uint32_t MEM_WriteReadTest(void);
andreikovacs 0:764779eedf2d 97 #ifdef __cplusplus
andreikovacs 0:764779eedf2d 98 }//extern "C"
andreikovacs 0:764779eedf2d 99 #endif
andreikovacs 0:764779eedf2d 100
andreikovacs 0:764779eedf2d 101 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 102 *************************************************************************************
andreikovacs 0:764779eedf2d 103 * Private macros
andreikovacs 0:764779eedf2d 104 *************************************************************************************
andreikovacs 0:764779eedf2d 105 ********************************************************************************** */
andreikovacs 0:764779eedf2d 106 #if defined(MEM_TRACKING) && defined(DEBUG_ASSERT)
andreikovacs 0:764779eedf2d 107 #define MEM_ASSERT(condition) if(!(condition))while(1);
andreikovacs 0:764779eedf2d 108 #else
andreikovacs 0:764779eedf2d 109 #define MEM_ASSERT(condition) (void)(condition);
andreikovacs 0:764779eedf2d 110 #endif
andreikovacs 0:764779eedf2d 111
andreikovacs 0:764779eedf2d 112
andreikovacs 0:764779eedf2d 113 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 114 *************************************************************************************
andreikovacs 0:764779eedf2d 115 * Private type definitions
andreikovacs 0:764779eedf2d 116 *************************************************************************************
andreikovacs 0:764779eedf2d 117 ********************************************************************************** */
andreikovacs 0:764779eedf2d 118
andreikovacs 0:764779eedf2d 119 #ifdef MEM_STATISTICS
andreikovacs 0:764779eedf2d 120 /*Statistics structure definition. Used by pools.*/
andreikovacs 0:764779eedf2d 121 typedef struct poolStat_tag
andreikovacs 0:764779eedf2d 122 {
andreikovacs 0:764779eedf2d 123 uint16_t numBlocks;
andreikovacs 0:764779eedf2d 124 uint16_t allocatedBlocks;
andreikovacs 0:764779eedf2d 125 uint16_t allocatedBlocksPeak;
andreikovacs 0:764779eedf2d 126 uint16_t allocationFailures;
andreikovacs 0:764779eedf2d 127 uint16_t freeFailures;
andreikovacs 0:764779eedf2d 128 #ifdef MEM_TRACKING
andreikovacs 0:764779eedf2d 129 uint16_t poolFragmentWaste;
andreikovacs 0:764779eedf2d 130 uint16_t poolFragmentWastePeak;
andreikovacs 0:764779eedf2d 131 #endif /*MEM_TRACKING*/
andreikovacs 0:764779eedf2d 132 } poolStat_t;
andreikovacs 0:764779eedf2d 133 #endif /*MEM_STATISTICS*/
andreikovacs 0:764779eedf2d 134
andreikovacs 0:764779eedf2d 135 #ifdef MEM_TRACKING
andreikovacs 0:764779eedf2d 136 /*Definition for alloc indicators. Used in buffer tracking.*/
andreikovacs 0:764779eedf2d 137 typedef enum
andreikovacs 0:764779eedf2d 138 {
andreikovacs 0:764779eedf2d 139 MEM_TRACKING_FREE_c = 0,
andreikovacs 0:764779eedf2d 140 MEM_TRACKING_ALLOC_c,
andreikovacs 0:764779eedf2d 141 }memTrackingStatus_t;
andreikovacs 0:764779eedf2d 142
andreikovacs 0:764779eedf2d 143 /*Tracking structure definition.*/
andreikovacs 0:764779eedf2d 144 typedef struct BlockTracking_tag
andreikovacs 0:764779eedf2d 145 {
andreikovacs 0:764779eedf2d 146 void *blockAddr; /*Addr of Msg, not that this pointer is
andreikovacs 0:764779eedf2d 147 4 byte bigger than the addr in the pool
andreikovacs 0:764779eedf2d 148 has the header of the msg is 4 bytes */
andreikovacs 0:764779eedf2d 149 uint16_t blockSize; /*Size of block in bytes.*/
andreikovacs 0:764779eedf2d 150 uint16_t fragmentWaste; /*Size requested by allocator.*/
andreikovacs 0:764779eedf2d 151 void *allocAddr; /*Return address of last Alloc made */
andreikovacs 0:764779eedf2d 152 void *freeAddr; /*Return address of last Free made */
andreikovacs 0:764779eedf2d 153 uint16_t allocCounter; /*No of time this msg has been allocated */
andreikovacs 0:764779eedf2d 154 uint16_t freeCounter; /*No of time this msg has been freed */
andreikovacs 0:764779eedf2d 155 memTrackingStatus_t allocStatus; /*1 if currently allocated, 0 if currently free */
andreikovacs 0:764779eedf2d 156 // uint8_t padding;
andreikovacs 0:764779eedf2d 157 }blockTracking_t;
andreikovacs 0:764779eedf2d 158 #endif /*MEM_TRACKING*/
andreikovacs 0:764779eedf2d 159
andreikovacs 0:764779eedf2d 160 /*Header description for buffers.*/
andreikovacs 0:764779eedf2d 161 typedef struct listHeader_tag
andreikovacs 0:764779eedf2d 162 {
andreikovacs 0:764779eedf2d 163 listElement_t link;
andreikovacs 0:764779eedf2d 164 struct pools_tag *pParentPool;
andreikovacs 0:764779eedf2d 165 }listHeader_t;
andreikovacs 0:764779eedf2d 166
andreikovacs 0:764779eedf2d 167 /*Buffer pools. Used by most functions*/
andreikovacs 0:764779eedf2d 168 typedef struct pools_tag
andreikovacs 0:764779eedf2d 169 {
andreikovacs 0:764779eedf2d 170 list_t anchor; /* MUST be first element in pools_t struct */
andreikovacs 0:764779eedf2d 171 uint16_t nextBlockSize;
andreikovacs 0:764779eedf2d 172 uint16_t blockSize;
andreikovacs 0:764779eedf2d 173 #ifdef MEM_STATISTICS
andreikovacs 0:764779eedf2d 174 poolStat_t poolStatistics;
andreikovacs 0:764779eedf2d 175 uint8_t padding[2];
andreikovacs 0:764779eedf2d 176 #endif /*MEM_STATISTICS*/
andreikovacs 0:764779eedf2d 177 }pools_t;
andreikovacs 0:764779eedf2d 178
andreikovacs 0:764779eedf2d 179 /*Buffer pool description. Used by MM_Init() for creating the buffer pools. */
andreikovacs 0:764779eedf2d 180 typedef struct poolInfo_tag
andreikovacs 0:764779eedf2d 181 {
andreikovacs 0:764779eedf2d 182 uint16_t blockSize;
andreikovacs 0:764779eedf2d 183 uint16_t poolSize;
andreikovacs 0:764779eedf2d 184 /* uint8_t padding[2]; */
andreikovacs 0:764779eedf2d 185 }poolInfo_t;
andreikovacs 0:764779eedf2d 186
andreikovacs 0:764779eedf2d 187 /*! *********************************************************************************
andreikovacs 0:764779eedf2d 188 *************************************************************************************
andreikovacs 0:764779eedf2d 189 * Private prototypes
andreikovacs 0:764779eedf2d 190 *************************************************************************************
andreikovacs 0:764779eedf2d 191 ********************************************************************************** */
andreikovacs 0:764779eedf2d 192
andreikovacs 0:764779eedf2d 193 #ifdef MEM_TRACKING
andreikovacs 0:764779eedf2d 194 uint8_t MEM_Track(listHeader_t *block, memTrackingStatus_t alloc, uint32_t address, uint16_t requestedSize);
andreikovacs 0:764779eedf2d 195 uint8_t MEM_BufferCheck(uint8_t *p, uint32_t size);
andreikovacs 0:764779eedf2d 196 #endif /*MEM_TRACKING*/
andreikovacs 0:764779eedf2d 197
andreikovacs 0:764779eedf2d 198 #endif /* _MEM_MANAGER_H_ */