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
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.h
- Committer:
- andreikovacs
- Date:
- 2015-08-18
- Revision:
- 0:401ba973869e
File content as of revision 0:401ba973869e:
/************************************************************************************************** * SMAC implementation. * * Freescale Semiconductor Inc. * (c) Copyright 2004-2010 Freescale Semiconductor, Inc. * ALL RIGHTS RESERVED. * *************************************************************************************************** * * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * ***********************************************************************************************//*! **************************************************************************************************/ #ifndef SMAC_H_ #define SMAC_H_ /************************************************************************************ ************************************************************************************* * Includes ************************************************************************************* ************************************************************************************/ #include "SMAC_Interface.h" #include "Phy.h" #include "PhyInterface.h" //#include "TimersManager.h" #include "RNG_Interface.h" #if defined (gPHY_802_15_4g_d) #include "PhyPib.h" #include "PhyExtended.h" #include "PhyTime.h" #endif /************************************************************************************ ************************************************************************************* * Private Prototypes ************************************************************************************* ************************************************************************************/ void SmacSetRxTimeout(smacTime_t timeoutSymbols); #if defined (gPHY_802_15_4g_d) #define smacPreambleSizeOf16_c (16) #define smacPreambleSizeOf3_c (3) #endif /*smacParametersValidation_d: TRUE : SMAC primitives validate their incoming parameters. FALSE: SMAC primitives do their stuff without validating their incoming parameters *Note: Setting this as FALSE will compile a smaller foot print SMAC. */ #define smacParametersValidation_d TRUE /*smacInitializationValidation_d: TRUE : SMAC primitives validate whether SMAC is initialized or not. FALSE: SMAC primitives don't care about SMAC's initialization. *Note: Setting this as FALSE will compile a smaller foot print SMAC. */ #define smacInitializationValidation_d TRUE #define FRAME_CTRL_ACK_FIELD_SET (1 << 5) /************************************************************************************ ************************************************************************************* * Module Type definitions ************************************************************************************* ************************************************************************************/ typedef enum smacStates_tag { mSmacStateIdle_c, mSmacStateTransmitting_c, mSmacStateReceiving_c, mSmacStateScanningChannels_c, mSmacStatePerformingCca_c, mSmacStatePerformingEd_c, mSmacStatePerformingTest_c, mSmacStateHibernate_c, mSmacStateDoze_c } smacStates_t; typedef union prssPacketPtr_tag { uint8_t* smacScanResultsPointer; rxPacket_t *smacRxPacketPointer; pdDataReq_t *smacTxPacketPointer; }prssPacketPtr_t; /*********************************************************************************** * Phy to SMAC SAP prototype ************************************************************************************/ typedef phyStatus_t ( * PD_SMAC_SapHandler_t)(pdDataToMacMessage_t * pMsg, instanceId_t instanceId); typedef phyStatus_t ( * PLME_SMAC_SapHandler_t)(plmeToMacMessage_t * pMsg, instanceId_t instanceId); /*********************************************************************************** * SMAC to App SAP handlers ************************************************************************************/ static SMAC_APP_MCPS_SapHandler_t gSMAC_APP_MCPS_SapHandler; static SMAC_APP_MLME_SapHandler_t gSMAC_APP_MLME_SapHandler; /************************************************************************************ ************************************************************************************* * Private definitions ************************************************************************************* ************************************************************************************/ #define smacInstance 0 #endif /* SMAC_H_ */