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

📄 ztcinterface.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
📖 第 1 页 / 共 3 页
字号:
    gFilterSetValueForUserDescriptorSetReq_c  |
    gFilterSetValueForUserDescriptorSetConf_c,
    
  gDefaultZDPSecDetailCmdSet1_c =
    gFilterSetValueForZdpApsmeEstablishKeyReq_c   | 
    gFilterSetValueForZdpApsmeEstablishKeyResp_c  |   
    gFilterSetValueForZdpApsmeTransportKeyReq_c   | 
    gFilterSetValueForZdpApsmeUpdateDeviceReq_c   | 
    gFilterSetValueForZdpApsmeRemoveDeviceReq_c   |
    gFilterSetValueForZdpApsmeRequestKeyReq_c     |
    gFilterSetValueForZdpApsmeSwitchKeyReq_c, 
    
  gDefaultZDPSecDetailCmdSet2_c =
    gFilterSetValueForZdpApsmeEstablishKeyConf_c  | 
    gFilterSetValueForZdpApsmeEstablishKeyInd_c   | 
    gFilterSetValueForZdpApsmeTransportKeyInd_c   |
    gFilterSetValueForZdpApsmeUpdateDeviceInd_c   |
    gFilterSetValueForZdpApsmeRemoveDeviceInd_c   |
    gFilterSetValueForZdpApsmeRequestKeyInd_c     |
    gFilterSetValueForZdpApsmeSwitchKeyInd_c, 
    
  gDefaultZDPNwkDetailCmdSet1_c =
    gFilterSetValueForZdpNlmeNwkDiscoveryReq_c  | 
    gFilterSetValueForZdpNlmeNwkDiscoveryConf_c | 
    gFilterSetValueForZdpNlmePermitJoiningReq_c     |
    gFilterSetValueForZdpNlmePermitJoiningConf_c    |
    gFilterSetValueForZdpNlmeDirectJoinReq_c        |
    gFilterSetValueForZdpNlmeDirectJoinConf_c       |
    gFilterSetValueForZdpNlmeSyncReq_c              |
    gFilterSetValueForZdpNlmeSyncConf_c,  
    
  gDefaultZDPNwkDetailCmdSet2_c = 
    gFilterSetValueForZdpNlmeSyncInd_c  

};


/* SAP Id used in ZTC */
enum{
  gNwkMCPS_SAPHandlerId_c,
  gMCPSNwkSAPHandlerId_c,
  gNwkMLME_SAPHandlerId_c,
  gMLMENwkSAPHandlerId_c, 
  gNwkASP_SAPHandlerId_c,
  gASPNwkSAPHandlerId_c,
  gAPS_NLDE_SAPHandlerId_c, 
  gNLDE_APS_SAPHandlerId_c,
  gZDO_NLME_SAPHandlerId_c,
  gNLME_ZDO_SAPHandlerId_c,
  gAF_APSDE_SAPHandlerId_c, 
  gAPSDE_AF_SAPHandlerId_c,
  gAppAFDE_SAPHandlerId_c,
  gAFDEAppSAPHandlerId_c,
  gZDO_APSME_SAPHandlerId_c,
  gAPSME_ZDO_SAPHandlerId_c,
  gAppZDP_SAPHandlerId_c,
  gZDPAppSAPHandlerId_c
};

/*  Opcode group for SapIds which are used to send the data from
ZTC to Test client */
enum  {
  gOpCodeGrpForMLMEToNwkSAP_c     = 0x84,
  gOpCodeGrpForNwkToMLME_SAP_c    = 0x85,
  gOpCodeGrpForMCPSToNwkSAP_c     = 0x86,
  gOpCodeGrpForNwkToMCPS_SAP_c	  = 0x87,
  gOpCodeGrpForASPToNwkSAP_c      = 0x94,
  gOpCodeGrpForNwkToASP_SAP_c     = 0x95,
  gOpCodeGrpForZDOToNLME_SAP_c    = 0x96,
  gOpCodeGrpForNLMEToZDO_SAP_c    = 0x97,
  gOpCodeGrpForAPSMEToZDO_SAP_c   = 0x98,
  gOpCodeGrpForZDOToAPSME_SAP_c   = 0x99,
  gOpCodeGrpForAPSToNLDE_SAP_c    = 0x9A,
  gOpCodeGrpForNLDEToAPD_SAP_c    = 0x9B,
  gOpCodeGrpForAFToAPSDE_SAP_c    = 0x9C,
  gOpCodeGrpForAPSDEToAF_SAP_c    = 0x9D,
  gOpCodeGrpForAFDEToAppSAP_c     = 0x9E,
  gOpCodeGrpForAppToAF_SAP_c      = 0x9F,
  gOpCodeGrpForZDPToAppSAP_c      = 0xA0,
  gOpCodeGrpForAppToZDP_SAP_c     = 0xA2,
  gOpCodeGrpForZTCReq_c           = 0xA3,
  gOpCodeGrpForZTCConf_c				  = 0xA4
};

/* Events used in BeeStack. These event values has to be changed if they are 
changed in the BeeStack */
enum{
  gMACEventNwkMCPSMsgQueuedEvent_c  = 1 << 1,
  gMCPSToNwkEvent_c                 = 1 << 1,
  gMACEventNwkMLMEMsgQueuedEvent_c  = 1 << 0, 
  gMLMEToNwkEvent_c                 = 1 << 2,
  gMACEventMemASPMsgQueuedEvent_c   = 1 << 3,
  /* ASP to NWK */ 
  gAPSToNLDEEvent_c                 = 1 << 0,
  gNLDEToAPSEvent_c                 = 1 << 1,
  gZDOToNLMEEvent_c                 = 1 << 3,
  gNLMEToZDOEvent_c                 = 1 << 1,
  gAFToAPSDEEvent_c                 = 1 << 0,
  gAPSDEToAFEvent_c                 = 1 << 0,
  gAppToAFEvent_c                   = 1 << 1,
  /* AF to APP */
  gZDOToAPSMEEvent_c                = 1 << 2,
  gAPSMEToZDOEvent_c                = 1 << 0,
  gAPPToZDPEvent_c                  = 1 << 2
  /* ZDP to APP */ 
};

/* OpcodeIDs to configure ZTC */
enum
{
  gModeConfigure_c, 
  gFilterConfigure_c,
  gGetSAPMode_c,
  gGetFilterSettings_c,
  gSendSAPCalledEvent_c
};

/* Event sent to the ZTC Task */
enum{
  gDataFromTestClientToZTCEvent_c = 1 << 0,
 	gDataFromZTCToTestClientEvent_c = 1 << 1	
};



/*****************************************************************************
* This macro is called from SCI1_rx_ISR and SCI2_rx_ISR ISR when data is
* received in SCI1D or SCI2D 
*
* Interface assumptions:
* None
*
* The routine limitations
* None
*
* Return value:
* None
*
* Effects on global data
* None
*
* Source of algorithm used.
* None
*
* Revison history:
*
* date   Author   Comments
* ----- ------   --------
* 240306 LS,      Updated
*****************************************************************************/
#define SendEventToZTC()  \
   TS_SendEvent( gZTCTaskId, gDataFromTestClientToZTCEvent_c ) 


/*****************************************************************************
* This macro is used to register the call back fucntion which will be called
* when ZTC receives a message from test client for application. If the opcode
* group is not that of the opcode group of BeeStack or ZTC, the message is
* sent to the application.
*
* Interface assumptions:
*       None
*
* The routine limitations
*       None
*
* Return value:
*       None
*
* Effects on global data
*       None
*
* Source of algorithm used.
*       None
*
* Revison history:
*
* date   Author   Comments
* ----- ------   --------
* 270406 SP,      Updated
*****************************************************************************/

#define ZTC_RegisterAppInterfaceToTestClient( pfPointer ) \
  gpfTestClientToApplicationFuncPtr = pfPointer 
/******************************************************************************
*******************************************************************************
* Public prototypes
*******************************************************************************
******************************************************************************/
/* None */

/******************************************************************************
*******************************************************************************
* Public type definitions
*******************************************************************************
******************************************************************************/

/* ZTC message */
typedef struct ZTCMessage_tag {
  uint8_t opCode;
  uint8_t opCodeId;
  uint8_t length;
  uint8_t data[1]; /* Place holder, can hold maximum of 128 - 3 = 125 bytes */ 
}ZTCMessage_t;

/* Is used to clear the event after Dequeing the msg in Hook mode  */
typedef struct mTsTcb_tag {                 /* The Task Control Block 
                                                Structure(TCB) */
  void (*pftaskEntryPoint)(event_t events); /* Function pointer  */
	event_t taskEvent;                        /* Event of the task */
}mTsTcb_t;

/* Function pointer to call App function, to send the message received
from ZTC */
typedef void (*gpfTestClientToApplication_t)( ZTCMessage_t* pMsg );   


/******************************************************************************
*******************************************************************************
* Public memory declarations
*******************************************************************************
******************************************************************************/
#if gBeeStackIncluded_d == 1 
extern anchor_t mMcpsNwkInputQueue;   /* MCPS_NWK_SapHandler */
extern anchor_t mMlmeNwkInputQueue;   /* MLME_NWK_SapHandler */
extern anchor_t mApsNldeInputQueue;   /* ASP_APP_SapHandler  */ 
extern anchor_t mApsNldeInputQueue;   /* APS_NLDE_SapHandler */
extern anchor_t gNldeQueue;           /* NLDE_APS_SapHandler */
extern anchor_t mZdoNlmeInputQueue;   /* ZDO_NLME_SapHandler */
extern anchor_t mNlmeZdoInputQueue;   /* NLME_ZDO_SapHandler */
extern anchor_t gApsdeQueue;          /* AF_APSDE_SapHandler */
extern anchor_t gApsToAfdeQ;          /* APSDE_AF_SapHandler */
#if ( gResCapability_d == 1 ) || ( gComCapability_d == 1 )
  extern anchor_t mApsmeZdoInputQueue;  /* APSME_ZDO_SapHandler */
  extern anchor_t mApsmeQueue;          /* ZDO_APSME_SapHandler */
#endif
extern anchor_t   mAppZdpInputQueue;  /* APP_ZDP_SapHandler */
#endif
extern mTsTcb_t aTaskArray [gHighestTaskID_c + 1 ];/*Array of TCBs */

/* Function pointer to store the call back fucntion of APP to handle message
received from Test Client */
extern gpfTestClientToApplication_t gpfTestClientToApplicationFuncPtr;
/******************************************************************************
*******************************************************************************
* Public functions
*******************************************************************************
******************************************************************************/

/*****************************************************************************
* This monitors the primitive sent to the task. If this primitive has to be
* hooked or monitored then it queues the event in the ZTC.
*
* Interface assumptions:
*       None
*
* The routine limitations.
*       None
*
* Return value:
*       None 
*
* Effects on global data.
*       None
*
* Source of algorithm used.
*       None
*
* Revison history:
*
* date   Author   Comments
* ------ ------   --------
* 240306 LS,      Updated
*****************************************************************************/
void ZTC_TaskEventMonitor
  (
  const uint8_t  SAPId,  /*  IN: SAP Id used in ZTC  */
  uint8_t* pMsg,         /*  IN/OUT: pointer to message  */ 
  const uint8_t  status  /*  IN: status returned from the SAP handler */
  );

/*****************************************************************************
* This is the main task of ZTC. Depending on the event, it will sends the
* message either up (to test client) or handles the message if the message if 
* of  ZTC configuration or it sends down (to the BeeStack).
*
* Interface assumptions:
*       None
*
* The routine limitations.
*       None
*
* Return value:
*       None
*
* Effects on global data.
*       None
*
* Source of algorithm used.
*       None
*
* Revison history:
*
* date   Author   Comments
* ------ ------   --------
* 240306 LS,      Updated
*****************************************************************************/
void ZTC_Main
  (
  uint16_t events /* IN:Events set for the ZTC task */
  );

/*****************************************************************************
* This function formates the data according to the ZTC protocol and sends an
* event ZTC task to send the frame from ZTC to Test client.
*
* Interface assumptions:
*       None
*
* The routine limitations.
*       None
*
* Return value:
*       Status
*
* Effects on global data.
*       None
*
* Source of algorithm used.
*       None
*
* Revison history:
*
* date   Author   Comments
* ------ ------   --------
* 240306 LS,      Updated
*****************************************************************************/
uint8_t ZTCQueue_QueueToTestClient
  ( 
  const uint8_t *const pData, /*  IN:Pointer to message */  
  const uint8_t  opCodeGrp,		/*  IN:Opcode group to send msg to Test client  */  
  const uint8_t  opCodeGrpId, /*  IN:Opcode to recognose the config attribute */
  const uint8_t  lengthOfData /*  IN:Length of data */ 
  );



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

⌨️ 快捷键说明

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