📄 macphy.h
字号:
gSeqMemAcRxTimeout_c, // Rx ended with timeout
gSeqMemAcRxPollNoTxData_c,
gSeqMemAcTxPollNoRxData_c,
gSeqMemAcTxChannelBusy_c,// CCA response (for TX too)
gSeqMemAcTxAckMissing_c, // Tx data completed without acknowledge
gSeqMemStatusLastEntry_c // THIS MUST BE THE LAST ENTRY IN THE ENUMERATION
};
typedef uint8_t seqMemStatus_t;
// Must NOT overlap other MEM event opcodes (gMlmeMemScanEdReq_c > gSeqMemStatusLastEntry_c)
enum {
gMlmeMemScanEdReq_c = 180, // The four Scan-related opcodes MUST follow each other
gMlmeMemScanActiveReq_c, // in the following order: energy, active, passive, orphan.
gMlmeMemScanPassiveReq_c,
gMlmeMemScanOrphanReq_c,
gMlmeMemScanAbortReq_c,
gMlmeMemStartReq_c,
gMlmeMemTimerReq_c,
gMlmeMemRxOnWhenIdleChanged_c,
gMlmeMemSyncReq_c,
gMlmeMemRxEnableReq_c,
gMemCmdIdLastEntry // MUST BE THE LAST ENTRY
};
// This is internal MEM events. Add-on to the memSeqStatus_t and gMemEventId_t
// structures.
// Must NOT overlap other MEM event opcodes (gMemIntNoEvent_c > gMemCmdIdLastEntry)
enum {
gMemIntNoEvent_c = 200, // A dummy event used for event buffering.
gSeqMemActionFail_c,
gSeqMemActionFinish_c,
gSeqMemDataInd_c,
gMcpsDirectDataOrPollReq_c,
gMemLwrAbortAll,
gMemLwrTrigDataStateMachine_c,
gMemCtrlDataStateMachineDone_c,
gMemLwrTrigBeaconStateMachine_c,
gMemLwrBeaconStateMachineDone_c,
gMemCtrlAbortAllDone_c,
gMemCtrlEdScanDone_c,
gMemCtrlScanDone_c,
gMemCtrlTimeout_c,
gMemCtrlRxEnableDone_c,
gMemIntLastEntry_c
};
typedef uint8_t memEventId_t;
// Note: This enum contains all possible "timer related" status values. The timer
// is currently only used during association. More status values can be added as
// needed (currently only a single value is used although two are defined!)
enum {
gTimerSuccess_c = 0,
gTimerFailure_c
};
// A header type with the generic information
typedef struct hdrGenericHeaderType_tag {
uint8_t frameControlLsb;
uint8_t frameControlMsb;
uint8_t seqNr;
uint8_t addrFieldsStart;
} hdrGenericHeaderType_t;
typedef uint32_t zbClock24_t;
typedef uint16_t zbClock16_t;
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
// New types and defines block end...
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
#define CHANNELS_SUPPORTED_31_24 (0x07)
#define CHANNELS_SUPPORTED_23_16 (0xFF)
#define CHANNELS_SUPPORTED_15_8 (0xF8)
#define CHANNELS_SUPPORTED_7_0 (0x00)
typedef enum ePhyEnums_tag {
cBusy,
cBusy_Rx,
cBusy_Tx,
cForce_Trx_Off,
cIdle,
cInvalid_Parameter,
cRx_On,
cSuccess,
cTrx_Off,
cTx_On,
cUnsupported_Attribute,
// New enums
cCcaTx,
cCcaCcaTx,
cRxED,
cRxCCA,
cBusy_Wait,
cMaxPhyEnums
} ePhyEnums_t;
#define gMacMinHeaderLengthAck_c (5) /* Smallest packet (ACK) excluding FCS */
#define gMacMinHeaderLength_c (9) /* Smallest packet (ACK) excluding FCS */
/************************************************************************************
*************************************************************************************
* Public prototypes
*************************************************************************************
************************************************************************************/
/************************************************************************************
*************************************************************************************
* Private prototypes
*************************************************************************************
************************************************************************************/
/************************************************************************************
*************************************************************************************
* Private type definitions
*************************************************************************************
************************************************************************************/
/************************************************************************************
*************************************************************************************
* Private macros
*************************************************************************************
************************************************************************************/
/************************************************************************************
*************************************************************************************
* Public memory declarations
*************************************************************************************
************************************************************************************/
extern uint8_t gPhyMacDataRxIndex;
extern uint8_t gPhyMacDataTxIndex;
extern rxPacket_t *gpPhyRxData;
extern uint8_t *gpPhyTxPacket;
// gRxTimeStamp holds the timestamp (16bit of the last received packet)
extern zbClock16_t gRxTimeStamp;
extern zbClock24_t gRxTimeStamp24;
extern bool_t gStopAsyncRx;
extern bool_t gBeaconWithBadSrcDetected;
/************************************************************************************
*************************************************************************************
* Private memory declarations
*************************************************************************************
************************************************************************************/
/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/
// Mac-Phy Interface functions
void PhyPlmeSetCurrentChannelRequest(uint8_t channel);
void PhyPlmeEdRequest(void);
void PhyPlmeCcaRequest(void);
void PhyPlmeWaitRequest(void);
void PhyPlmeRxRequest(void);
void PhyPlmeTxRequest(void);
void PhyPlmeForceTrxOffRequest(void);
void PhyPdDataRequest(txPacket_t *pTxData);
// Phy-Mac Interface functions
void PhyPlmeCcaConfirm(bool_t channelInUse);
void PhyPlmeEdConfirm(uint8_t energyLevel);
void PhyPlmeRxTimeoutIndication(void);
void PhyPlmeSyncLossIndication(void);
void PhyPlmeB2BIndication(void);
void PhyPdDataConfirm(void);
void PhyPdDataIndication(void);
void macRxFilterProcess(uint8_t *macRxIndex);
void ReStartRx(void);
void RxTimeout(void);
void PollForRx(void);
void RestartRxOrTimeout(void);
void DisableEventTimeout(void);
void InitializePhy(void);
void InitializeMac(bool_t resetPib);
void PhySyncSetEventTrigger(uint16_t startTime);
void PhySyncSetEventTimeout(zbClock24_t *pEndTime);
void LowLevelReadClockSync(zbClock24_t *pRetClk);
void LowLevelReadClockASync(zbClock24_t *pRetClk);
extern void (*gIsrFastAction)(void);
extern void (*gIsrPendingFastAction)(void);
extern void (*gIsrAsyncTailFunction)(void);
extern void (*gIsrSuperFastAction)(void);
extern void DummyFastIsr(void);
extern void IrqStreamingRxFirst(void);
extern void IrqAsyncRxFilterEntry(void);
extern void InitRxPointers(void);
extern void InitRxFastAction(void);
bool_t IsCurrentActionExtRx(void);
bool_t IsCurrentActionAutoRx(void);
void SetCorrThresholdNormal(void);
void SetCorrThresholdHigh(void);
/************************************************************************************
*************************************************************************************
* Private functions
*************************************************************************************
************************************************************************************/
/***********************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -