⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ztcprimitivehandlersimpleprimitive.c

📁 FREESCALE的基于802.15.4无线通讯原代码
💻 C
字号:
/******************************************************************************
* This module formats the simple primitives which are to be exchanged between
* the test client and BeeStack Layers. Simple primitives are one for which ZTC
* doesn't have to format.  
*
*
* (c) Copyright 2006, Freescale, Inc. All rights reserved.
*
* Freescale Semiconductor Confidential Proprietary
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale Semiconductor Danmark A/S.
*
******************************************************************************/
#if ( gZtcIncluded_d == 1  ) 
#include "EmbeddedTypes.h"
#include "MsgSystem.h"
#include "FunctionLib.h"
#include "ZtcInterface.h"
#include "ZtcQueue.h"
#include "ZtcConfiguration.h"
#include "ZtcPrimitiveHandler.h"

/******************************************************************************
*******************************************************************************
* Private macros
*******************************************************************************
******************************************************************************/
/*  None  */

/******************************************************************************
*******************************************************************************
* Private prototypes
*******************************************************************************
******************************************************************************/
/* None */

/******************************************************************************
*******************************************************************************
* Private type definitions
*******************************************************************************
******************************************************************************/
/*  None  */

/******************************************************************************
*******************************************************************************
* Private memory declarations
*******************************************************************************
******************************************************************************/
/* None */

/******************************************************************************
*******************************************************************************
* Public functions
*******************************************************************************
******************************************************************************/
uint8_t ZTCPrimHandle_StoreSimplePrimInZTCQueue
  (
  const uint8_t msgLength,  /* IN : Length to be copied to the ZTC queue */
  const uint8_t* pMsg       /* IN : Pointer to the memory loaction from where the 
                                    data has to be copied to the ZTC queue */
  ) 
{
  /*Finds out whether sufficient space is available for data in ZTC buffer  */
  if(( ZTCQueue_SpaceAvailableToWriteIntoBuffer ) >= 
      ( gHeaderSize_c + msgLength )) {
    FLib_MemCpy(&aZTCBuffer[ gtZTCBufferTail + gDataIndex_c ],  
      (uint8_t *)pMsg, msgLength);
      
    return msgLength; 
  }
  return gZTCCannotBeQueued_c;  
}

/*****************************************************************************/
void ZTCPrimHandle_SendSimplePrimToSAP
  (
  const ZTCMessage_t* pMsg, /*  IN: Pointer to the data */   
  const uint8_t SAPId,      /*  IN:SapId used by the ZTC,which is derived from
                                   the opcodeGrp   */
  const uint8_t msgLength   /* IN:Length of the primitive */
 )
{
  uint8_t * pMsgToSend;

  pMsgToSend = MSG_Alloc( msgLength );
  if( NULL != pMsgToSend ){
    
    *pMsgToSend = pMsg->opCodeId;
    FLib_MemCpy( pMsgToSend + 1, ((( uint8_t* )pMsg ) + 3 ), msgLength );
    gInjectedTheMessage = TRUE;
    ( void )gaSAPIdToSAPHandlers[ SAPId ]( pMsgToSend );
  }
}

/******************************************************************************
*******************************************************************************
* Private functions
*******************************************************************************
******************************************************************************/
/* None */

/******************************************************************************
*******************************************************************************
* Private Debug stuff
*******************************************************************************
******************************************************************************/
/*  None  */


#endif /* ( gZtcIncluded_d == 1  ) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -