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

📄 ztcprimitivehandlercomplexprimsyncprim.c

📁 freescale的基于802.15.4的无线通讯例程
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
* This module formats the complex synchronous primitives which are to be 
* exchanged between the test client and BeeStack Layers. Complex primitives are
* one for which ZTC has to format.Here formatting means ZTC has to put the
* messages in proper way so that BeeStack can understand when test client sends
* and vice-versa 
*
*
* (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"
#if gBeeStackIncluded_d == 1  
#include "BeeStackConfiguration.h"
#endif
#include "NwkMacInterface.h"
#include "ZtcInterface.h"
#include "ZtcConfiguration.h"
#include "ZtcQueue.h"
#include "ZtcPrimitiveHandler.h"
#include "ZtcPrimitiveHandlerComplexPrimitive.h"
#include "ZtcPrimitiveHandlerComplexPrimWithOnePtr.h"
#include "ZtcPrimitiveHandlerComplexPrimWithTableList.h"
#include "ZtcPrimitiveHandlerComplexPrimSyncPrim.h"
#include "ZtcPrimitiveHandlerComplexPrimUtilitySupport.h"
#include "ZtcPrimitiveHandlerOtherComplexPrimitive.h"
#include "ZtcFilter.h"

/*  If sync primitive handling capability is enabled then only this part of
   code will be enabled */
#if gZTC_SyncPrimitiveHandlingCapability_d == 1
/******************************************************************************
*******************************************************************************
* Private macros
*******************************************************************************
******************************************************************************/
#define ZTCPrimHandle_OffsetBtwnSyncConfAndSyncReq 					 \
  gMLMEGetConfId_c - gMLMEGetReqId_c  

#define mNIBLengthPosition_c      0x01 
#define mNIBGetLengthPosition_c   0x02
#define mMaxSyncPrimitiveLength_c 44

#define mOpCodeGrpIdForMlmeGetConf_c      0x5
#define mOpCodeGrpIdForNlmeGetConf_c			0x4D
#define mOpCodeGrpIdForApsmeGetConf_c			0x9
#define mOpCodeGrpIdForMlmeSetConf_c			0x0D
#define mOpCodeGrpIdForNlmeSetConf_c			0x4E
#define mOpCodeGrpIdForApsmeSetConf_c			0xA
#define mOpCodeGrpIdForApsmeBindConf_c		0x7
#define mOpCodeGrpIdForApsmeUnbindConf_c  0x8
#define mOpCodeGrpIdForMlmeResetConf_c		0x9
#define mOpCodeGrpIdForNlmeResetConf_c    0x4A          

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

/*****************************************************************************
* Copies the data from pSrc to the pDest meory location depending on the sync
* primitive message ID passed and depending on the direction mentioned in the
* fromSAP.
*
* Interface assumptions:
*   None
*
* The routine limitations.
*   None
*
* Return value:
*   Returns the length of data it wrote into memory locatrion pointed by pDst 
*
* Effects on global data.
*   None
*
* Source of algorithm used.
*   None
*
* Revison history:
*   date    Author   Comments
*   ------  ------   --------
*   240306  LS,      Updated
*****************************************************************************/ 

static uint8_t ZTCPrimHandle_CopyForSyncPrim
  ( 
  uint8_t* pDest,       /* IN: Pointer to the memory location to write data */   
  const uint8_t* pSrc, /* IN: Pointer to the memory location to get the 
    information */ 
  uint8_t msgId      /*  IN: Message ID of the sync primitive used in ZTC */
  );
/******************************************************************************
*******************************************************************************
* Private type definitions
*******************************************************************************
******************************************************************************/

/* The below type definition will be used for primitives which are synchronous.
The opcode group and the opcode group ID used for sending confirmation to the 
test client will be stored as an look up table using this type definition. */

typedef struct ZTCHeaderDetailForSyncPrim_tag {
  uint8_t opCodeGrp;
  uint8_t opCodeGrpId;  
}ZTCHeaderDetailForSyncPrim_t;


enum  {
  gMAC_PIBOffset_c = gMPibRole_c,
#if gBeeStackIncluded_d == 1 
  gAPS_IBOffset_c  = gAPibAddressMap_c,
  gNwk_IBOffset_c  = gNwkSequenceNumber_c, 
#endif  
};

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

/*  Table to get the length of MAC layer IB */
static const uint8_t  maMAClengthForGetSetPrimitive[] = {
  1,  /*  gMPibRole_c */
  1,  /*  gMPibLogicalChannel_c */
  3,  /*  gMPibTreemodeStartTime_c*/
  1,  /*  gMPibPanIdConflictDetection_c */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  0, 0, 0, 0, 0, 0, 0, 0,				/* Padded with zero for proper indexing */
  1,  /*  gMPibAckWaitDuration_c  */ 
  1,  /*  gMPibAssociationPermit_c  */
  1,  /*  gMPibAutoRequest_c  */
  1,  /*  gMPibBattLifeExt_c  */
  1,  /*  gMPibBattLifeExtPeriods_c */
  6,  /*  gMPibBeaconPayload_c*/
  1,  /*  gMPibBeaconPayloadLength_c*/
  1,  /*  gMPibBeaconOrder_c*/
  3,  /*  gMPibBeaconTxTime_c */
  1,  /*  gMPibBsn_c  */
  8,  /*  gMPibCoordExtendedAddress_c */
  2,  /*  gMPibCoordShortAddress_c  */
  1,  /*  gMPibDsn_c  */
  1,  /*  gMPibGtsPermit_c  */
  1,  /*  gMPibMaxCsmaBackoffs_c  */
  1,  /*  gMPibMinBe_c  */
  2,  /*  gMPibPanId_c  */
  1,  /*  gMPibPromiscuousMode_c  */
  1,  /*  gMPibRxOnWhenIdle_c */
  2,  /*  gMPibShortAddress_c */
  1,  /*  gMPibSuperFrameOrder_c  */
  2,  /*  gMPibTransactionPersistenceTime_c */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  0, 0, 0, 0, 0, 0, 						/* Padded with zero for proper indexing */
  44, /*  gMPibAclEntryDescriptorSet_c  */
  1,  /*  gMPibAclEntryDescriptorSetSize_c  */
  1,  /*  gMPibDefaultSecurity_c  */
  1,  /*  gMPibDefaultSecurityMaterialLength_c  */
  16, /*  gMPibDefaultSecurityMaterial_c  */
  1,  /*  gMPibDefaultSecuritySuite_c */
  1,  /*  gMPibSecurityMode_c */
  1,  /*  gMPibAclEntryCurrent_c  */
  8,  /*  gMPibAclEntryExtAddress_c */
  2,  /*  gMPibAclEntryShortAddress_c */
  2,  /*  gMPibAclEntryPanId_c  */
  1,  /*  gMPibAclEntrySecurityMaterialLength_c */
  44, /*  gMPibAclEntrySecurityMaterial_c */
  1   /*  gMPibAclEntrySecuritySuite_c  */
};
#if gBeeStackIncluded_d == 1 
/*  Table to get the length of APS layer IB */
static const uint8_t  maAPSlengthForGetSetPrimitive[] = { 
  sizeof( addressMap_t ),    /* gAPibAddressMap_c */
  sizeof( apsmeBindReq_t ),  /* gAPibBindingTable_c */
  sizeof( uint8_t ), 				 /* gAPibAddressMapCurrent_c */
  sizeof( uint8_t ), 			   /* gAPibBindingTableCurrent_c */
  0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  0, 0, 0, 0, 0, 0, 0, 0, 0, /* Padded with zero for proper indexing */
  sizeof( apsDeviceKeyPairDetails_t ),/* gAPibDeviceKeyPairSet_c */
  gIEEEAddressLength_c, 		 /* gAPibTrustCenterAddress_c */
  sizeof( uint16_t ), 			 /* gAPibSecurityTimeOutPeriod_c */
  sizeof( uint8_t ) 				 /* gAPibDeviceKeyPairCurrent_c */
};
  
/*  Table to get the length to be copied for sync primitives  */
static const uint8_t maLengthtoBeCopiedForSyncPrim[] = {
  sizeof( mlmeGetReq_t )      - sizeof( uint8_t * ),  
  sizeof( nlmeGetReq_t )      - sizeof( uint8_t * ),
  sizeof( apsmeGetReq_t )     - sizeof( uint8_t * ),
  sizeof( mlmeSetReq_t )      - sizeof( uint8_t * ),
  sizeof( nlmeSetReq_t )      - sizeof( uint8_t )  ,
  sizeof( apsmeSetReq_t )     - sizeof( uint8_t * ),
  sizeof( apsmeBindReq_t ),
  sizeof( apsmeUnbindReq_t ),
  sizeof( mlmeResetReq_t ),
  0, 0, 0, /* Padded with zero for proper indexing */
  sizeof( mlmeGetReq_t )      - sizeof( uint8_t * ),  
  sizeof( nlmeGetReq_t )      - sizeof( uint8_t * ),
  sizeof( apsmeGetReq_t )     - sizeof( uint8_t * ),
  sizeof( mlmeSetReq_t )      - sizeof( uint8_t * ),
  sizeof( nlmeSetReq_t )      - sizeof( uint8_t * ),
  sizeof( apsmeSetReq_t )     - sizeof( uint8_t * ),
  sizeof( apsmeBindReq_t ),
  sizeof( apsmeUnbindReq_t ),
  0, 0, /* Padded with zero for proper indexing */
  0 
};

/*  This Table gives OpcodeGrp and OpcodeGrpId for sync primitives */
static const ZTCHeaderDetailForSyncPrim_t maZTCHeaderDetailForSyncPrimConf[] ={ 
  { gOpCodeGrpForMLMEToNwkSAP_c,  mOpCodeGrpIdForMlmeGetConf_c },
  { gOpCodeGrpForNLMEToZDO_SAP_c, mOpCodeGrpIdForNlmeGetConf_c },
  { gOpCodeGrpForAPSMEToZDO_SAP_c,mOpCodeGrpIdForApsmeGetConf_c },
  { gOpCodeGrpForMLMEToNwkSAP_c,  mOpCodeGrpIdForMlmeSetConf_c },
  { gOpCodeGrpForNLMEToZDO_SAP_c, mOpCodeGrpIdForNlmeSetConf_c },
  { gOpCodeGrpForAPSMEToZDO_SAP_c,mOpCodeGrpIdForApsmeSetConf_c },
  { gOpCodeGrpForAPSMEToZDO_SAP_c,mOpCodeGrpIdForApsmeBindConf_c },
  { gOpCodeGrpForAPSMEToZDO_SAP_c,mOpCodeGrpIdForApsmeUnbindConf_c},
  { gOpCodeGrpForMLMEToNwkSAP_c,  mOpCodeGrpIdForMlmeResetConf_c },
  { gOpCodeGrpForNLMEToZDO_SAP_c, mOpCodeGrpIdForNlmeResetConf_c }
};

 /* Function pointer to Sap handlers  */
static const pfToSAPHandler_t maSyncMsgIdToSapHandler[] = {

⌨️ 快捷键说明

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