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

📄 appaspinterface.h

📁 freescale的基于802.15.4的无线通讯例程
💻 H
字号:
/************************************************************************************
* This header file is provided as part of the interface to the Freescale 802.15.4
* MAC and PHY layer.
*
* The file covers the interface to the Application Support Package (ASP).
*
* Author(s): JEHOL1, BPPED1
*
* (c) Copyright 2005, Freescale, Inc.  All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* 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.
*
************************************************************************************/

#ifndef _APP_ASP_INTERFACE_H_
#define _APP_ASP_INTERFACE_H_

/************************************************************************************
*************************************************************************************
* Includes
*************************************************************************************
************************************************************************************/

#include "EmbeddedTypes.h"
#include "FunctionalityDefines.h"

/************************************************************************************
*************************************************************************************
* Public types
*************************************************************************************
************************************************************************************/


  // Valid values for aspSetNotifyReq_t->notifications.
enum {
  gAspNotifyNone_c,         // No notifications about beacon state
  gAspNotifyIdle_c,         // Notify about remaining time in Idle portion of CAP
  gAspNotifyInactive_c,     // Notify about remaining time in inactive portion of superframe
  gAspNotifyIdleInactive_c, // Notify about remaining time in Idle portion of CAP, and inactive portion of superframe
  gAspNotifyLastEntry_c     // Don't use! 
};

  // Valid values for aspTelecTestReq_t->mode
enum {
  gTestForceIdle_c=0  ,
  gTestPulseTxPrbs9_c,
  gTestContinuousRx_c,
  gTestContinuousTxMod_c,
  gTestContinuousTxNoMod_c
};

  // GetMacState status codes
enum {
  gAspMacStateIdle_c = 0,
  gAspMacStateBusy_c,
  gAspMacStateNotEmpty_c
};


//-----------------------------------------------------------------------------------
//     Messages from ASP to application
//-----------------------------------------------------------------------------------
enum {
  gAspErrorCfm_c,       
  gAspAppWakeInd_c,
  gAspAppIdleInd_c,
  gAspAppInactiveInd_c,
  gAspAppEventInd_c,
  gAspMaxPrimitives_c
};


  // Type: gAspAppWakeInd_c
typedef struct appWakeInd_tag {
  uint8_t status;
} appWakeInd_t;

  // Type: gAspAppIdleInd_c
typedef struct appIdleInd_tag {
  uint8_t timeRemaining[3];
} appIdleInd_t;

  // Type: gAspAppInactiveInd_c
typedef struct appInactiveInd_tag {
  uint8_t timeRemaining[3];
} appInactiveInd_t;

  // Type: gAspAppEventInd_c
typedef struct appEventInd_tag {
  uint8_t dummy; // This primitive has no parameters.
} appEventInd_t;


  // Type: gAspErrorCnf_c
typedef struct appErrorCfm_tag {
  uint8_t  status;
} appErrorCfm_t;


  // ASP to application message
typedef struct aspToAppMsg_tag {
  uint8_t msgType;
  union {
    appErrorCfm_t           appErrorCfm;
    appWakeInd_t            appWakeInd;
    appIdleInd_t            appIdleInd;
    appInactiveInd_t        appInactiveInd;
    appEventInd_t           appEventInd;
  } msgData;
} aspToAppMsg_t;


/************************************************************************************
*************************************************************************************
* Public prototypes
*************************************************************************************
************************************************************************************/

/************************************************************************************
* Requests the current value of the transceiver internal event timer.
*   
* Interface assumptions:
*   time - pointer to a  zbClock24_t variable, where the time value will be stored 
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   170204    JEHOL1    Created
*   180706    r04471    Modified for direct APP to ASP call instead communication with messages
* 
************************************************************************************/
void    Asp_GetTimeReq(zbClock24_t *time);

/************************************************************************************
* Get basic state of the MAC. The caller can use this information to determine
* if it is safe to go into one of the deep sleep modes! It checks for the following:
* The MEM, SEQ, and MLME state machines must be in idle state. Otherwise return "busy"
* The queues must be empty. Otherwise return "not empty"
* Otherwise just return "idle".
*   
* Interface assumptions:
*   None
*   
* Return value:
*   one of the three values
*     gAspMacStateBusy_c;
*    gAspMacStateNotEmpty_c;
*    gAspMacStateIdle_c;
*
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   170204    JEHOL1    Created
*   180706    r04471    Modified for direct APP to ASP call instead communication with messages
* 
************************************************************************************/
uint8_t Asp_GetMacStateReq(void);

/************************************************************************************
* Wake-up the transceiver from Doze/Hibernate mode. The ATTNBi pin of the transceiver must be wired to
* a MCU port pin for this primitive to function. Otherwise, it has no effect. The AttEnable, and AttDisable
* macros must be defined in Target.h. The former must set the MCU port pin to logic high, and the latter
* must set it to logic low. If the two macros are modified e.g. due to changes in the PCB layout, the PHY
* should be modified also.
*   
* Interface assumptions:
*   None
*   
* Return value:
*   None
* 
* Revision history:
*   date      Author    Comments
*   ------    ------    --------
*   170204    JEHOL1    Created
*   180706    r04471    Modified for direct APP to ASP call instead communication with messages
* 
************************************************************************************/
void    Asp_WakeReq(void);

#if gAspPowerSaveCapability_d
 
 /************************************************************************************
  * Shut down the transceiver for a given amount of time in symbols. The CLKO output pin will stop providing
  * a clock signal to the CPU if clko_en is 0 (FALSE). The CLKO output pin will continue to provide a clock 
  * signal if clko_en is 1 (TRUE). The dozeDuration parameter is the maximum time in number of symbols
  * that the transceiver will be in doze mode. The transceiver can be woken up prematurely from doze mode by
  *  a signal on the ATTNBi pin. CLKO is automatically started again when transceiver leaves doze mode.
    *   
  * Interface assumptions:
  *   dozeDuration
  *   clko_en
    *   
  * Return value:
  *   None
  * 
  * Revision history:
  *   date      Author    Comments
  *   ------    ------    --------
  *   170204    JEHOL1    Created
  *   180706    r04471    Modified for direct APP to ASP call instead communication with messages
  * 
  ************************************************************************************/
  uint8_t Asp_DozeReq(zbClock24_t *dozeDuration, uint8_t clko_en);

  /************************************************************************************
  * Automatically shut down the transceiver during idle periods. The CLKO output pin will stop providing a
  * clock signal to the CPU if clko_en is 0 (FALSE). The CLKO output pin will continue to provide a clock
  * signal if clko_en is 1 (TRUE). The autoDozeInterval parameter is a suggested period in symbols in
  * which the transceiver will be in doze mode. This interval may be overridden if doze mode is interrupted by
  * an external signal (ATTNBi pin). If the enableWakeIndication parameter is TRUE then an
  * ASP-WAKE.Indication is sent to the APP layer each time the doze interval expires. The indication can be
  * used by the APP layer to do processing. In order to enable auto doze the autoEnable parameter must be
  * TRUE. Auto doze can be disabled by sending another ASP-AUTODOZE.Request with the autoEnable
  * parameter set to FALSE. It is recommended to use the ASP-WAKE. Indication for simple processing
  * during auto doze since it will occur frequently (if enabled) and the auto doze feature is blocked during the
  * processing of the indication in the ASP_APP SAP..
  *   
  * Interface assumptions:
  *   dozeDuration
  *   clko_en
  *   
  * Return value:
  *   Standard error code
  * 
  * Revision history:
  *   date      Author    Comments
  *   ------    ------    --------
  *   170204    JEHOL1    Created
  *   180706    r04471    Modified for direct APP to ASP call instead communication with messages
  * 
  ************************************************************************************/
  void Asp_AutoDozeReq(bool_t  autoEnable, bool_t  enableWakeIndication, zbClock24_t *autoDozeInterval, uint8_t clko_en);

  /************************************************************************************
  * The hibernate request shuts down the transceiver. The CLKO output pin will stop providing a clock signal
  * to the CPU. Only a signal on the ATTNBi pin of the transceiver or a power loss can bring the transceiver out
  * of hibernate mode. CLKO is automatically started again when transceiver leaves hibernate mode. The
  * hibernate mode is not adequate for beaconed operation. Doze mode should be used instead when
  * transceiver timers are required.
  *   
  * Interface assumptions:
  *   None
  *   
  * Return value:
  *   Standard error code
  * 
  * Revision history:
  *   date      Author    Comments
  *   ------    ------    --------
  *   170204    JEHOL1    Created
  *   180706    r04471    Modified for direct APP to ASP call instead communication with messages
  * 
  ************************************************************************************/
  uint8_t Asp_HibernateReq(void);

  /************************************************************************************
  * Set the default minimum doze time. If the MAC cannot doze for at least the minimum doze time, then it
  * will not enter doze mode. E.g. if the doze request is issued 3ms before the end of a beacon period the MAC
  * will not enter doze mode since the default minimum doze time is 4ms. However, if the minimum doze time
  * is changed to 2ms, then the MAC will doze for 2ms, and wake up 1ms before the next beacon assuming
  * the same timing in both examples.
  *   
  * Interface assumptions:
  *   minDozeTime
  *   
  * Return value:
  *   None
  * 
  * Revision history:
  *   date      Author    Comments
  *   ------    ------    --------
  *   170204    JEHOL1    Created
  *   180706    r04471    Modified for direct APP to ASP call instead communication with messages
  * 
  ************************************************************************************/
  void Asp_SetMinDozeTimeReq(zbClock24_t *minDozeTime);

  /************************************************************************************
  * The acoma request shuts down the transceiver. The CLKO output pin will stop providing a clock signal to
  * the CPU if clko_en is 0 (FALSE). The CLKO output pin will continue to provide a clock signal if clko_en
  * is 1 (TRUE). Only a signal on the ATTNBi pin of the transceiver or a power loss can bring the transceiver
  * out of acoma mode. CLKO is automatically started again when transceiver leaves acoma mode. The
  * acoma mode is not suited for beaconed operation. Doze mode should be used instead when transceiver
  * timers are required.
  * The main difference between acoma mode and hibernate mode is that CLKO can be generated during
  * acoma mode 

⌨️ 快捷键说明

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