The Freescale MCR20A Simple Media Access Controller (MCR20A SMAC) is a simple ANSI C based codebase available as sample source code. The MCR20A SMAC is used for developing proprietary RF transceiver applications using Freescale’s MCR20A 2.4 GHz transceiver 

Fork of fsl_smac by Freescale

The MCR20A SMAC is a small codebase that provides simple communication and test applications based on drivers, (802.15.4 compliant) PHY, and framework utilities available as source code. This environment is useful for hardware and RF debug, hardware standards certification, and developing proprietary applications. The MCR20A SMAC is provided as part of the Example Application Demos available for MCR20A and also as a standalone set of files.

SMAC features include:

  • Compact footprint.
  • Very low power, proprietary, bidirectional RF communication link.
  • The MCR20A radio allows packet filtering by hardware by checking the preamble and the synchronization word, which reduces software overhead and memory footprint.
  • Broadcast communication.
  • Unicast communication — MCR20A SMAC includes a Node Address 16-bit field. This allows SMAC to perform unicast transmissions. To change the address of a node, modify this constant: gNodeAddress_c inside the SMAC_Config.h file, or call SMACSetShortSrcAddress(uint16_t nwShortAddress). The address is set to 0xBEAD by default. Some of the Demo Applications allow the user to change this address at runtime.
  • Change of current PAN. The SMAC packet uses a short 802.15.4 compliant header with a hard-coded configuration for frame control which allows the user to switch between PANs. The PAN address has also 16 bits (gDefaultPanID_c). This address can be modified by changing the default value from SMAC_Config.h file or by calling SMACSetPanID(uint16_t nwShortPanID.
  • There are no blocking functions within the MCR20A SMAC.
  • Easy-to-use sample applications included.
  • Light-weight, custom LBT algorithm.
  • Light-weight, custom, AA mechanism which is transparent to the user after enabling the feature.
  • Encryption using Advanced Encryption Standard in Cipher Block Chaining mode with configurable initial vector and key.
  • Configurable number of retries and backoff interval.
  • Inter-layer communication using SAPs.
  • The MCR20A SMAC also filters packets that have correct addressing information (pass address filtering) but are not in the expected format (short addressing, no security, data frame).

Documentation

SMAC Reference Manual

Committer:
andreikovacs
Date:
Tue Aug 18 12:48:33 2015 +0000
Revision:
0:401ba973869e
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andreikovacs 0:401ba973869e 1 /**************************************************************************************************
andreikovacs 0:401ba973869e 2 * SMAC implementation.
andreikovacs 0:401ba973869e 3 *
andreikovacs 0:401ba973869e 4 * Freescale Semiconductor Inc.
andreikovacs 0:401ba973869e 5 * (c) Copyright 2004-2010 Freescale Semiconductor, Inc.
andreikovacs 0:401ba973869e 6 * ALL RIGHTS RESERVED.
andreikovacs 0:401ba973869e 7 *
andreikovacs 0:401ba973869e 8 ***************************************************************************************************
andreikovacs 0:401ba973869e 9 *
andreikovacs 0:401ba973869e 10 * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
andreikovacs 0:401ba973869e 11 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
andreikovacs 0:401ba973869e 12 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
andreikovacs 0:401ba973869e 13 * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
andreikovacs 0:401ba973869e 14 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
andreikovacs 0:401ba973869e 15 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
andreikovacs 0:401ba973869e 16 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
andreikovacs 0:401ba973869e 17 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
andreikovacs 0:401ba973869e 18 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
andreikovacs 0:401ba973869e 19 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
andreikovacs 0:401ba973869e 20 * THE POSSIBILITY OF SUCH DAMAGE.
andreikovacs 0:401ba973869e 21 *
andreikovacs 0:401ba973869e 22 ***********************************************************************************************//*!
andreikovacs 0:401ba973869e 23 **************************************************************************************************/
andreikovacs 0:401ba973869e 24
andreikovacs 0:401ba973869e 25 #ifndef SMAC_H_
andreikovacs 0:401ba973869e 26 #define SMAC_H_
andreikovacs 0:401ba973869e 27
andreikovacs 0:401ba973869e 28 /************************************************************************************
andreikovacs 0:401ba973869e 29 *************************************************************************************
andreikovacs 0:401ba973869e 30 * Includes
andreikovacs 0:401ba973869e 31 *************************************************************************************
andreikovacs 0:401ba973869e 32 ************************************************************************************/
andreikovacs 0:401ba973869e 33
andreikovacs 0:401ba973869e 34 #include "SMAC_Interface.h"
andreikovacs 0:401ba973869e 35 #include "Phy.h"
andreikovacs 0:401ba973869e 36 #include "PhyInterface.h"
andreikovacs 0:401ba973869e 37 //#include "TimersManager.h"
andreikovacs 0:401ba973869e 38 #include "RNG_Interface.h"
andreikovacs 0:401ba973869e 39
andreikovacs 0:401ba973869e 40 #if defined (gPHY_802_15_4g_d)
andreikovacs 0:401ba973869e 41 #include "PhyPib.h"
andreikovacs 0:401ba973869e 42 #include "PhyExtended.h"
andreikovacs 0:401ba973869e 43 #include "PhyTime.h"
andreikovacs 0:401ba973869e 44 #endif
andreikovacs 0:401ba973869e 45 /************************************************************************************
andreikovacs 0:401ba973869e 46 *************************************************************************************
andreikovacs 0:401ba973869e 47 * Private Prototypes
andreikovacs 0:401ba973869e 48 *************************************************************************************
andreikovacs 0:401ba973869e 49 ************************************************************************************/
andreikovacs 0:401ba973869e 50 void SmacSetRxTimeout(smacTime_t timeoutSymbols);
andreikovacs 0:401ba973869e 51
andreikovacs 0:401ba973869e 52 #if defined (gPHY_802_15_4g_d)
andreikovacs 0:401ba973869e 53
andreikovacs 0:401ba973869e 54 #define smacPreambleSizeOf16_c (16)
andreikovacs 0:401ba973869e 55 #define smacPreambleSizeOf3_c (3)
andreikovacs 0:401ba973869e 56
andreikovacs 0:401ba973869e 57 #endif
andreikovacs 0:401ba973869e 58 /*smacParametersValidation_d:
andreikovacs 0:401ba973869e 59 TRUE : SMAC primitives validate their incoming parameters.
andreikovacs 0:401ba973869e 60 FALSE: SMAC primitives do their stuff without validating their incoming
andreikovacs 0:401ba973869e 61 parameters
andreikovacs 0:401ba973869e 62 *Note: Setting this as FALSE will compile a smaller foot print SMAC.
andreikovacs 0:401ba973869e 63 */
andreikovacs 0:401ba973869e 64 #define smacParametersValidation_d TRUE
andreikovacs 0:401ba973869e 65
andreikovacs 0:401ba973869e 66 /*smacInitializationValidation_d:
andreikovacs 0:401ba973869e 67 TRUE : SMAC primitives validate whether SMAC is initialized or not.
andreikovacs 0:401ba973869e 68 FALSE: SMAC primitives don't care about SMAC's initialization.
andreikovacs 0:401ba973869e 69 *Note: Setting this as FALSE will compile a smaller foot print SMAC.
andreikovacs 0:401ba973869e 70 */
andreikovacs 0:401ba973869e 71 #define smacInitializationValidation_d TRUE
andreikovacs 0:401ba973869e 72
andreikovacs 0:401ba973869e 73 #define FRAME_CTRL_ACK_FIELD_SET (1 << 5)
andreikovacs 0:401ba973869e 74 /************************************************************************************
andreikovacs 0:401ba973869e 75 *************************************************************************************
andreikovacs 0:401ba973869e 76 * Module Type definitions
andreikovacs 0:401ba973869e 77 *************************************************************************************
andreikovacs 0:401ba973869e 78 ************************************************************************************/
andreikovacs 0:401ba973869e 79 typedef enum smacStates_tag {
andreikovacs 0:401ba973869e 80 mSmacStateIdle_c,
andreikovacs 0:401ba973869e 81 mSmacStateTransmitting_c,
andreikovacs 0:401ba973869e 82 mSmacStateReceiving_c,
andreikovacs 0:401ba973869e 83 mSmacStateScanningChannels_c,
andreikovacs 0:401ba973869e 84 mSmacStatePerformingCca_c,
andreikovacs 0:401ba973869e 85 mSmacStatePerformingEd_c,
andreikovacs 0:401ba973869e 86 mSmacStatePerformingTest_c,
andreikovacs 0:401ba973869e 87 mSmacStateHibernate_c,
andreikovacs 0:401ba973869e 88 mSmacStateDoze_c
andreikovacs 0:401ba973869e 89 } smacStates_t;
andreikovacs 0:401ba973869e 90
andreikovacs 0:401ba973869e 91 typedef union prssPacketPtr_tag
andreikovacs 0:401ba973869e 92 {
andreikovacs 0:401ba973869e 93 uint8_t* smacScanResultsPointer;
andreikovacs 0:401ba973869e 94 rxPacket_t *smacRxPacketPointer;
andreikovacs 0:401ba973869e 95 pdDataReq_t *smacTxPacketPointer;
andreikovacs 0:401ba973869e 96 }prssPacketPtr_t;
andreikovacs 0:401ba973869e 97
andreikovacs 0:401ba973869e 98 /***********************************************************************************
andreikovacs 0:401ba973869e 99 * Phy to SMAC SAP prototype
andreikovacs 0:401ba973869e 100 ************************************************************************************/
andreikovacs 0:401ba973869e 101 typedef phyStatus_t ( * PD_SMAC_SapHandler_t)(pdDataToMacMessage_t * pMsg, instanceId_t instanceId);
andreikovacs 0:401ba973869e 102
andreikovacs 0:401ba973869e 103 typedef phyStatus_t ( * PLME_SMAC_SapHandler_t)(plmeToMacMessage_t * pMsg, instanceId_t instanceId);
andreikovacs 0:401ba973869e 104
andreikovacs 0:401ba973869e 105 /***********************************************************************************
andreikovacs 0:401ba973869e 106 * SMAC to App SAP handlers
andreikovacs 0:401ba973869e 107 ************************************************************************************/
andreikovacs 0:401ba973869e 108 static SMAC_APP_MCPS_SapHandler_t gSMAC_APP_MCPS_SapHandler;
andreikovacs 0:401ba973869e 109 static SMAC_APP_MLME_SapHandler_t gSMAC_APP_MLME_SapHandler;
andreikovacs 0:401ba973869e 110 /************************************************************************************
andreikovacs 0:401ba973869e 111 *************************************************************************************
andreikovacs 0:401ba973869e 112 * Private definitions
andreikovacs 0:401ba973869e 113 *************************************************************************************
andreikovacs 0:401ba973869e 114 ************************************************************************************/
andreikovacs 0:401ba973869e 115
andreikovacs 0:401ba973869e 116 #define smacInstance 0
andreikovacs 0:401ba973869e 117
andreikovacs 0:401ba973869e 118 #endif /* SMAC_H_ */