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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SMAC_Interface.h Source File

SMAC_Interface.h

00001 /**************************************************************************************************
00002 * SMAC Interface header file
00003 * 
00004 * Freescale Semiconductor Inc.
00005 * (c) Copyright 2004-2014 Freescale Semiconductor, Inc.
00006 * ALL RIGHTS RESERVED.
00007 *
00008 ***************************************************************************************************
00009 *
00010 * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR 
00011 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
00012 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  
00013 * IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
00014 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
00015 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00016 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
00017 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
00018 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
00019 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
00020 * THE POSSIBILITY OF SUCH DAMAGE.
00021 *
00022 ***********************************************************************************************//*!
00023 **************************************************************************************************/
00024 
00025 #ifndef SMAC_INTERFACE_H_
00026 #define SMAC_INTERFACE_H_
00027 
00028 /************************************************************************************
00029 *************************************************************************************
00030 * Includes
00031 *************************************************************************************
00032 ************************************************************************************/
00033 #include "EmbeddedTypes.h"   
00034 #include "PhyTypes.h"
00035 /************************************************************************************
00036 *************************************************************************************
00037 * Interface macro definitions 
00038 *************************************************************************************
00039 ************************************************************************************/
00040 
00041 #define gSmacHeaderBytes_c         ( sizeof(smacHeader_t) )
00042 #define gMaxSmacSDULength_c        (gMaxPHYPacketSize_c -(sizeof(smacHeader_t) + 2) )
00043 #define gMinSmacSDULength_c        (0)
00044 
00045 #define gBroadcastAddress_c        (0xFFFF)
00046 #define gSmacDefaultFrameCtrl          (0x8841)
00047 #define gSmacDefaultSeqNo              (0xAB)
00048 /************************************************************************************
00049 *************************************************************************************
00050 * Public memory declarations
00051 *************************************************************************************
00052 ************************************************************************************/
00053 // extern bool_t smacStandalone;          
00054 extern uint8_t gTotalChannels;
00055 
00056 /************************************************************************************
00057 *************************************************************************************
00058 * Interface Type definitions
00059 *************************************************************************************
00060 ************************************************************************************/
00061 
00062 typedef enum smacMessageDefs_tag 
00063 {
00064   gMcpsDataReq_c,
00065   gMcpsDataCnf_c,
00066   gMcpsDataInd_c,
00067   
00068   gMcpsIndQueueInsertReq_c,
00069   gMcpsIndQueueInsertCnf_c,
00070   gMcpsIndQueueRemoveReq_c,
00071   
00072   gMlmeCcaReq_c,
00073   gMlmeCcaCnf_c,
00074   
00075   gMlmeEdReq_c,
00076   gMlmeEdCnf_c,
00077   
00078   gMlmeSetTRxStateReq_c,
00079   gMlmeSetTRxStateCnf_c,
00080   
00081   gMlmeSetReq_c,
00082   gMlmeSetCnf_c,
00083   
00084   gMlmeGetReq_c,
00085   gMlmeGetCnf_c,
00086   
00087   gMlmeTimeoutInd_c,
00088   
00089   gMlme_StartEventInd_c,
00090   gMlme_SyncLossInd_c,
00091   gMlme_RxSfdDetectInd_c,
00092   gMlme_FilterFailInd_c,
00093   gMlme_UnexpectedRadioResetInd_c,
00094 }smacMessageDefs_t;
00095 
00096 typedef uint64_t smacTime_t;
00097 
00098 typedef struct smacPdu_tag
00099 {
00100   uint8_t smacPdu[1];
00101 }smacPdu_t;
00102 
00103 typedef PACKED_STRUCT smacHeader_tag
00104 {
00105   uint16_t frameControl;
00106   uint8_t seqNo;
00107   uint16_t       panId;
00108   uint16_t       destAddr;
00109   uint16_t       srcAddr;
00110 }smacHeader_t;
00111 
00112 typedef struct txPacket_tag
00113 {
00114   uint8_t u8DataLength;
00115   smacHeader_t smacHeader;
00116   smacPdu_t smacPdu;
00117 }txPacket_t;
00118 
00119 typedef struct txContextConfig_tag
00120 {
00121   bool_t ccaBeforeTx;
00122   bool_t autoAck;
00123   uint8_t retryCountCCAFail;
00124   uint8_t retryCountAckFail;
00125 }txContextConfig_t;
00126 
00127 typedef enum rxStatus_tag
00128 {
00129   rxInitStatus,
00130   rxProcessingReceptionStatus_c,
00131   rxSuccessStatus_c, 
00132   rxTimeOutStatus_c,
00133   rxAbortedStatus_c,
00134   rxMaxStatus_c
00135 } rxStatus_t;
00136 
00137 typedef struct rxPacket_tag
00138 {
00139   uint8_t    u8MaxDataLength;
00140   rxStatus_t rxStatus;
00141   uint8_t    u8DataLength;
00142   smacHeader_t smacHeader;
00143   smacPdu_t  smacPdu;
00144 }rxPacket_t;
00145 
00146 typedef enum txStatus_tag
00147 {
00148   txSuccessStatus_c, 
00149   txFailureStatus_c,
00150   txMaxStatus_c
00151 } txStatus_t;
00152 
00153 typedef enum smacErrors_tag
00154 {
00155   gErrorNoError_c = 0,
00156   gErrorBusy_c,
00157   gErrorChannelBusy_c,
00158   gErrorNoAck_c,
00159   gErrorOutOfRange_c,
00160   gErrorNoResourcesAvailable_c,
00161   gErrorNoValidCondition_c,
00162   gErrorCorrupted_c,
00163   gErrorMaxError_c
00164 } smacErrors_t;
00165 
00166 #if defined (gPHY_802_15_4g_d)
00167 
00168 typedef enum smacRFModes_tag
00169 {
00170   gRFMode1_c = gPhyMode1_c,
00171   gRFMode2_c = gPhyMode2_c,
00172   gRFMode3_c = gPhyMode3_c,
00173   gRFMode4_c = gPhyMode4_c,
00174   gRFMode5_c = gPhyMode1ARIB_c, /*ARIB mode 1*/
00175   gRFMode6_c = gPhyMode2ARIB_c, /*ARIB mode 2*/
00176   gRFMaxMode_c
00177 } smacRFModes_t;
00178 
00179 typedef enum smacFrequencyBands_tag
00180 {
00181   gSMAC_863_870MHz_c = gFreq863__870MHz_c, /* 863-870   (Europe) */ 
00182   gSMAC_902_928MHz_c = gFreq902__928MHz_c, /* 902-928   (US)     */ 
00183   gSMAC_920_928MHz_c = gFreq920__928MHz_c, /* 920-928 (Japan)    */
00184   gSMAC_169_400__169_475MHz_c = gFreq169_400__169_475MHz_c /* 169-475 */
00185 }smacFrequencyBands_t;
00186 
00187 #endif
00188 typedef struct smacPacket_tag
00189 {
00190   uint8_t u8SyncWordSize;
00191   uint8_t *u8SyncWordValue;
00192   uint16_t u16PreambleLength;
00193 }smacPacket_t;
00194 
00195 typedef enum scanModes_tag 
00196 { 
00197   gScanModeCCA_c = 0, 
00198   gScanModeED_c,
00199   gMaxScanMode_c 
00200 } scanModes_t;
00201 
00202 #if defined (gPHY_802_15_4g_d)
00203 
00204 typedef struct packetConfig_tag
00205 {   
00206   uint16_t u16PreambleSize;
00207   uint8_t u8SyncWordSize;
00208   uint8_t *pu8SyncWord;
00209 } packetConfig_t;
00210 
00211 #endif
00212 
00213 /*@CMA, Connectivity Test_Start*/
00214 typedef enum channels_tag
00215 {
00216 #include "SMAC_Channels.h "
00217 } channels_t;
00218 
00219 typedef enum smacTestMode_tag  
00220 {
00221   gTestModeForceIdle_c = 0,
00222   gTestModeContinuousTxModulated_c,
00223   gTestModeContinuousTxUnmodulated_c,
00224   gTestModePRBS9_c,
00225   gTestModeContinuousRxBER_c,
00226   gMaxTestMode_c
00227 } smacTestMode_t;
00228 
00229 typedef  struct smacDataCnf_tag
00230 {
00231   smacErrors_t         status;
00232 } smacDataCnf_t;
00233 
00234 typedef  struct smacDataInd_tag
00235 {
00236   //phyTimeTimestamp_t      timeStamp;
00237   uint8_t                 ppduLinkQuality;
00238   uint8_t                 u8LastRxRssi;
00239   rxPacket_t *            pRxPacket;
00240 } smacDataInd_t;
00241 
00242 typedef  struct smacEdReq_tag
00243 {
00244   channels_t               scanChannel;
00245   smacTime_t               startTime;  // absolute
00246 } smacEdReq_t;
00247 
00248 typedef  struct smacCcaReq_tag
00249 {
00250   scanModes_t             ccaType;
00251 } smacCcaReq_t;
00252 
00253 typedef  struct smacCcaCnf_tag
00254 {
00255   smacErrors_t       status;
00256 } smacCcaCnf_t;
00257 
00258 typedef  struct smacEdCnf_tag
00259 {
00260   smacErrors_t            status;
00261   uint8_t                 energyLevel;
00262   uint8_t                 energyLeveldB;
00263   channels_t              scannedChannel;
00264 } smacEdCnf_t;
00265 
00266 typedef  struct smacToAppMlmeMessage_tag
00267 {
00268   smacMessageDefs_t          msgType;
00269   uint8_t                    appInstanceId;
00270   union
00271   {
00272     smacCcaCnf_t       ccaCnf;
00273     smacEdCnf_t             edCnf;
00274   }msgData;
00275 } smacToAppMlmeMessage_t;
00276 
00277 typedef  struct smacToAppDataMessage_tag
00278 {
00279   smacMessageDefs_t            msgType;
00280   uint8_t                    appInstanceId;
00281   union
00282   {
00283     smacDataCnf_t             dataCnf;
00284     smacDataInd_t             dataInd;
00285   }msgData;
00286 } smacToAppDataMessage_t;
00287 
00288 typedef smacErrors_t ( * SMAC_APP_MCPS_SapHandler_t)(smacToAppDataMessage_t * pMsg, instanceId_t instanceId);
00289 
00290 typedef smacErrors_t ( * SMAC_APP_MLME_SapHandler_t)(smacToAppMlmeMessage_t * pMsg, instanceId_t instanceId);
00291 
00292 /************************************************************************************
00293 *************************************************************************************
00294 * External Prototypes
00295 *************************************************************************************
00296 ************************************************************************************/
00297 extern void InitSmac(void);
00298 
00299 /***********************************************************************************
00300 * Smac_RegisterSapHandlers
00301 * This function registers the data and management components callbacks to the application
00302 * After calling this function and providing two function pointers, SMAC will call 
00303 * one of these two, for each async request, based on request type (data or management)
00304 *
00305 * Interface assumptions:
00306 *   The SMAC and radio driver have been initialized and are ready to be used. 
00307 *
00308 * Return value:  
00309 *   None
00310 ************************************************************************************/
00311 extern void Smac_RegisterSapHandlers(SMAC_APP_MCPS_SapHandler_t pSMAC_APP_MCPS_SapHandler,
00312                                      SMAC_APP_MLME_SapHandler_t pSMAC_APP_MLME_SapHandler,
00313                                      instanceId_t smacInstanceId);
00314 
00315 /***********************************************************************************
00316 * App to Smac SAP HANDLERS
00317 ************************************************************************************/
00318 //smacErrors_t AppToSmac_Data_SapHandler(AppToSmacDataMessage_t* pMsg, uint8_t MACInstance);
00319 //smacErrors_t AppToSmac_Mlme_SapHandler(AppToSmacMlmeMessage_t* pMsg, uint8_t MACInstance);
00320 /***********************************************************************************/
00321 
00322 /******************************** SMAC Data primitives *****************************/
00323 /***********************************************************************************/
00324 
00325 /************************************************************************************
00326 * MCPSDataRequest
00327 * 
00328 * This data primitive is used to send an over the air packet. This is an asyncronous 
00329 * function,  it means it ask SMAC to transmit one OTA packet,  but when the function 
00330 * returns it is not sent already.
00331 *
00332 * Interface assumptions:
00333 *   The SMAC and radio driver have been initialized and are ready to be used. 
00334 *
00335 * Return value:  
00336 *   gErrorNoError_c: Everything is ok and the transmission will be performed.
00337 *   gErrorOutOfRange_c: One of the members in the pTxMessage structure is out of 
00338 *                      range (no valid bufer size or data buffer pointer is NULL)
00339 *   gErrorNoResourcesAvailable_c: the radio is performing another action.
00340 *   gErrorNoValidCondition_c: The SMAC has not been initialized 
00341 *
00342 ************************************************************************************/
00343 extern smacErrors_t MCPSDataRequest(txPacket_t *psTxPacket);
00344 
00345 
00346 /************************************************************************************
00347 * MLMEConfigureTxContext
00348 * 
00349 * This management primitive sets up the transmission conditions used by MCPSDataRequest
00350 *
00351 * Interface assumptions:
00352 *   SMAC is initialized 
00353 *
00354 * Return value:  
00355 *   gErrorNoError_c: Everything is set accordingly.
00356 *   gErrorOutOfRange_c: More than gMaxRetriesAllowed_c are required
00357 *   gErrorNoValidCondition_c: Retries are required but neither Ack nor CCA are requested 
00358 *
00359 ************************************************************************************/
00360 extern smacErrors_t MLMEConfigureTxContext(txContextConfig_t* pTxConfig);
00361 /************************************************************************************
00362 * MLMERXEnableRequest
00363 * 
00364 * Function used to place the radio into receive mode
00365 * 
00366 * Interface assumptions:
00367 *   The SMAC and radio driver have been initialized and are ready to be used.
00368 *    
00369 * Arguments:
00370 * 
00371 *        rxPacket_t *gsRxPacket: Pointer to the structure where the reception results will be stored.
00372 *        smacTime_t stTimeout: 64-bit timeout value, absolute time in symbols
00373 *        
00374 *  Return Value:
00375 *       gErrorNoError_c: Everything is ok and the reception will be performed.
00376 *       gErrorOutOfRange_c: One of the members in the pRxMessage structure is out of range (no valid bufer size or data buffer pointer is NULL).
00377 *       gErrorBusy_c: the radio is performing another action.
00378 *       gErrorNoValidCondition_c: The SMAC has not been initialized.
00379 *************************************************************************************/
00380 extern smacErrors_t MLMERXEnableRequest(rxPacket_t *gsRxPacket, smacTime_t stTimeout);
00381 
00382 
00383 /************************************************************************************
00384 * MLMERXDisableRequest
00385 * 
00386 * Returns the radio to idle mode from receive mode.
00387 * 
00388 *   Interface assumptions:
00389 *   The SMAC and radio driver have been initialized and are ready to be used.
00390 * 
00391 *   Arguments: 
00392 *   None 
00393 *   
00394 *   Return Value:
00395 *      gErrorNoValidCondition_c If the Radio is not in Rx state.
00396 *      gErrorNoError_c When the message was aborted or disabled.
00397 *************************************************************************************/
00398 extern smacErrors_t MLMERXDisableRequest(void);
00399 
00400 /************************************************************************************
00401 * MLMELinkQuality
00402 * 
00403 *  This function returns an integer value that is the link quality from the last received 
00404 *  packet of the form: dBm = (-Link Quality/2).
00405 * 
00406 *   Interface assumptions:
00407 *   The SMAC and radio driver have been initialized and are ready to be used.
00408 * 
00409 *   Arguments: 
00410 *   None 
00411 *   
00412 *   Return Value:
00413 *   uint8_t: 8 bit value representing the link quality value in dBm.
00414 *   Returns the result in smacLastDataRxParams.linkQuality.
00415 *************************************************************************************/
00416 extern uint8_t  MLMELinkQuality(void);
00417 
00418 /************************************************************************************
00419 * MLMESetInterPacketRxDelay
00420 * 
00421 * This sets the inter packet delay for the packet handler 
00422 * 
00423 *  Interface assumptions:
00424 *   The SMAC and radio driver have been initialized and are ready to be used.
00425 * 
00426 *  Arguments: 
00427 *   uint8_t u8InterPacketRxDelay: interpacket delay in ms
00428 *   
00429 *  Return Value:
00430 *      gErrorNoValidCondition_c If the Radio is not in Rx state.
00431 *      gErrorNoError_c When the message was aborted or disabled.
00432 *
00433 *************************************************************************************/
00434 #if defined(gPHY_802_15_4g_d)
00435 extern smacErrors_t MLMESetInterPacketRxDelay(uint8_t u8InterPacketRxDelay);
00436 #endif
00437 
00438 /***********************************************************************************/
00439 /******************************** SMAC Radio primitives ****************************/
00440 /***********************************************************************************/
00441 
00442 /************************************************************************************
00443 * MLMESetChannelRequest
00444 *
00445 * This sets the frequency on which the radio will transmit or receive on.
00446 * 
00447 *  Interface assumptions:
00448 *   The SMAC and radio driver have been initialized and are ready to be used.
00449 * 
00450 *  Arguments: 
00451 *    channels_t newChannel: channel to be set
00452 *   
00453 *  Return Value:
00454 *   gErrorNoError_c: The channel set has been performed
00455 *   gErrorOutOfRange_c : channel requested is not valid
00456 *   gErrorBusy_c: when SMAC is busy in other radio activity as transmitting or receiving data. Or performing a channel scan.
00457 *************************************************************************************/
00458 extern smacErrors_t MLMESetChannelRequest (channels_t newChannel);
00459 
00460 #ifdef gIncludeCalibrationOption
00461 /************************************************************************************
00462 * MLMESetAdditionalRFOffset
00463 *
00464 * This sets the frequency offset in respect to the current channel. Used for calibration.
00465 * 
00466 *  Interface assumptions:
00467 *   The SMAC and radio driver have been initialized and are ready to be used.
00468 * 
00469 *  Arguments: 
00470 *    uint32_t additionalRFOffset: offset used in frequency Calculation
00471 *   
00472 *  Return Value:
00473 *   gErrorNoError_c: The PIB is set
00474 *   gErrorNoValidCondition_c: SMAC is not initialized
00475 *************************************************************************************/
00476 extern smacErrors_t MLMESetAdditionalRFOffset (uint32_t additionalRFOffset);
00477 
00478 /************************************************************************************
00479 * MLMEGetAdditionalRFOffset
00480 *
00481 * This gets the frequency offset in respect to the current channel. Used for calibration.
00482 * 
00483 *  Interface assumptions:
00484 *   The SMAC and radio driver have been initialized and are ready to be used.
00485 * 
00486 *  Arguments: 
00487 *    None
00488 *   
00489 *  Return Value:
00490 *   calibration offset
00491 *************************************************************************************/
00492 extern uint32_t MLMEGetAdditionalRFOffset( void );
00493 
00494 #endif
00495 /************************************************************************************
00496 * MLMEGetChannelRequest
00497 * 
00498 * This function returns the current channel, if an error is detected it returns gChannelOutOfRange_c.
00499 * 
00500 *  Interface assumptions:
00501 *   The SMAC and radio driver have been initialized and are ready to be used.
00502 * 
00503 *  Arguments: 
00504 *   None 
00505 *   
00506 *  Return Value:
00507 *  channels_t (uint8_t): The current RF channel.
00508 *  gChannelOutOfRange_c: If current channel could not be detected
00509 *************************************************************************************/
00510 extern channels_t MLMEGetChannelRequest(void);
00511 
00512 
00513 /************************************************************************************
00514 * MLMERssi
00515 *
00516 * This call starts an energy detect (ED) cycle and returns the energy value (-power/2) 
00517 * via the returned argument. For example, if the Energy Detect returns 80 then the 
00518 * interpreted value is -80/2 or -40 dBm
00519 * 
00520 *  Interface assumptions:
00521 *   The SMAC and radio driver have been initialized and are ready to be used.
00522 * 
00523 *  Arguments: 
00524 *   None 
00525 *   
00526 *  Return Value:
00527 *  uint8_t: An unsigned 8-bit value representing the energy on the current channel.
00528 *************************************************************************************/
00529 #if defined(gPHY_802_15_4g_d)
00530 extern uint8_t MLMERssi(void);
00531 #endif
00532 
00533 /************************************************************************************
00534 * MLMESetCCADuration
00535 *
00536 * This call sets the amount of time necessary to perform CCA or ED
00537 *  Interface assumptions:
00538 *   The SMAC and radio driver have been initialized and are ready to be used.
00539 * 
00540 *  Arguments: 
00541 *   uint64_t usCCADuration: duration in microseconds
00542 *   
00543 *  Return Value:
00544 *  gErrorNoError_c in case of success, error code otherwise.
00545 *************************************************************************************/
00546 #if defined(gPHY_802_15_4g_d)
00547 extern smacErrors_t MLMESetCCADuration(uint64_t usCCADuration );
00548 #endif
00549 /************************************************************************************
00550 * MLMEPacketConfig
00551 *
00552 * This function sets the following parameters for OTA packets in radio�s registers:
00553 * Preamble size, synchronization word size, and synchronization word value.
00554 * 
00555 *  Interface assumptions:
00556 *   The SMAC and radio driver have been initialized and are ready to be used.
00557 * 
00558 *  Arguments: 
00559 *   packetConfig_t *pPacketCfg
00560 *   
00561 *  Return Value:
00562 *  gErrorBusy_c: when SMAC is busy in other radio activity as transmitting or receiving data. 
00563 *  Or performing a channel scan.
00564 *  gErrorNoError_c: the packet has been configured 
00565 *************************************************************************************/
00566 #if defined(gPHY_802_15_4g_d)
00567 extern smacErrors_t MLMEPacketConfig(packetConfig_t *pPacketCfg);
00568 #endif
00569 /************************************************************************************
00570 * MLMERadioInit
00571 * 
00572 * This function initializes the Radio parameters.
00573 * 
00574 *  Interface assumptions:
00575 *   None
00576 * 
00577 *  Arguments: 
00578 *   None 
00579 *   
00580 *  Return Value:
00581 *  gErrorNoError_c: the Radio initialization has been done successfully
00582 *************************************************************************************/
00583 #if defined(gPHY_802_15_4g_d)
00584 extern smacErrors_t MLMERadioInit(void);
00585 #endif
00586 /************************************************************************************
00587 * MLMEPhySoftReset
00588 *
00589 * This function performs a software reset on the radio, PHY and SMAC state machines.
00590 * 
00591 *  Interface assumptions:
00592 *   None
00593 * 
00594 *  Arguments: 
00595 *   None 
00596 *   
00597 *  Return Value:
00598 *  gErrorNoError_c: If the action is performed.
00599 *************************************************************************************/
00600 #ifdef __cplusplus
00601 extern "C" {
00602 #endif
00603 smacErrors_t MLMEPhySoftReset(void);
00604 
00605 #ifdef __cplusplus
00606 } //extern "C" 
00607 #endif
00608 
00609 /************************************************************************************
00610 * MLMEPAOutputAdjust
00611 *
00612 *
00613 *************************************************************************************/
00614 extern smacErrors_t MLMEPAOutputAdjust(uint8_t u8PaValue);
00615 
00616 /************************************************************************************
00617 * MLMESetPreambleLength
00618 *
00619 *
00620 *************************************************************************************/
00621 #if defined(gPHY_802_15_4g_d)
00622 extern smacErrors_t MLMESetPreambleLength(uint16_t u16preambleLength);
00623 #endif
00624 /************************************************************************************
00625 * MLMESetSyncWordValue
00626 *
00627 *
00628 *************************************************************************************/
00629 #if defined(gPHY_802_15_4g_d)
00630 extern smacErrors_t MLMESetSyncWordValue(uint8_t *u8syncWordValue);
00631 #endif
00632 /************************************************************************************
00633 * MLMESetSyncWordSize
00634 *
00635 *
00636 *************************************************************************************/
00637 #if defined(gPHY_802_15_4g_d)
00638 extern smacErrors_t MLMESetSyncWordSize(uint8_t u8syncWordSize);
00639 #endif
00640 /************************************************************************************
00641 * MLMESetFreqBand
00642 * 
00643 *  
00644 *
00645 ************************************************************************************/
00646 #if defined(gPHY_802_15_4g_d)
00647 extern smacErrors_t MLMESetFreqBand(smacFrequencyBands_t freqBand, smacRFModes_t phyMode);
00648 #endif
00649 /************************************************************************************
00650 * MLMESetPhyMode
00651 * 
00652 *  
00653 *
00654 ************************************************************************************/
00655 #if defined(gPHY_802_15_4g_d)
00656 extern smacErrors_t MLMESetPhyMode(smacRFModes_t phyMode);
00657 #endif
00658 /***********************************************************************************/
00659 /***************************** SMAC Management primitives **************************/
00660 /***********************************************************************************/
00661 
00662 /************************************************************************************
00663 * MLMEScanRequest
00664 *
00665 *  This function scans the channel passed as parameter using CCA or ED mode
00666 *  returns the RSSI in that channel.
00667 * 
00668 *  Interface assumptions:
00669 *   The SMAC and radio driver have been initialized and are ready to be used.
00670 * 
00671 *  Arguments: 
00672 *   channels_t u8ChannelToScan: channel to scan 
00673 *  uint8_t *u8ChannelScanResult: to return the RSSI value 
00674 *   
00675 *  Return Value:
00676 *   gErrorNoError_c:  If the action was performed correctly.
00677 *   gErrorBusy_c:     If SMAC is busy. 
00678 *************************************************************************************/
00679 extern smacErrors_t MLMEScanRequest(channels_t u8ChannelToScan);
00680 
00681 /*@CMA, Conn Test Added*/
00682 /************************************************************************************
00683 * MLMECcaRequest
00684 * 
00685 * This  function  performs Clear Channel Assessment on the active channel  
00686 * 
00687 * Return value:
00688 * gErrorNoError_c: SMAC will perform Cca 
00689 * gErrorBusy_c:    SMAC is busy
00690 ************************************************************************************/
00691 extern smacErrors_t MLMECcaRequest(void);
00692 
00693 /************************************************************************************
00694 * MLMETXDisableRequest
00695 * 
00696 * Returns the radio to idle mode from Tx mode.
00697 *
00698 ************************************************************************************/
00699 extern void MLMETXDisableRequest(void);
00700 
00701 /***********************************************************************************
00702 ******************************** SMAC MCU primitives *******************************
00703 ***********************************************************************************/
00704 
00705 /************************************************************************************
00706 *SMAC auxiliary functions
00707 *************************************************************************************/
00708 
00709 /************************************************************************************
00710 *SMACFillHeader
00711 *This is a replacement for the u8DestAddress in the txPacket_t structure
00712 *To set the destination address simply call this function with a pointer to 
00713 *txPacket->smacHeader and a uint16_t variable resembling the address.
00714 *Also, to change the default source address and panID, modify gDefaultPanID_c and
00715 *gNodeAddress_c from SMAC_Config.h or call SMACSetShortSrcAddress and SMACSetPanID.
00716 *************************************************************************************/
00717 extern void SMACFillHeader(smacHeader_t* pSmacHeader, uint16_t destAddr);
00718 
00719 /***********************************************************************************/
00720 extern smacErrors_t SMACSetShortSrcAddress(uint16_t nwShortAddress);
00721 
00722 /***********************************************************************************/
00723 extern smacErrors_t SMACSetPanID(uint16_t nwShortPanID);
00724 
00725 /***********************************************************************************/
00726 
00727 
00728 
00729 #endif /* SMAC_INTERFACE_H_ */