📄 mac_scan.h
字号:
/*******************************************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC2420 INTEGRATED 802.15.4 MAC AND PHY *
* *** + + *** Scan Functions *
* *** +++ *** *
* *** *** *
* ************ *
* ********** *
* *
*******************************************************************************************************
* CONFIDENTIAL *
* The use of this file is restricted by the signed MAC software license agreement. *
* *
* Copyright Chipcon AS, 2004 *
*******************************************************************************************************
* This module contains the scan state machine, and transmissin of scan-related packets. *
*******************************************************************************************************
* Compiler: AVR-GCC *
* Target platform: CC2420DB, CC2420 + any ATMEGA MCU *
*******************************************************************************************************
* The revision history is located at the bottom of this file *
*******************************************************************************************************/
#ifndef MAC_SCAN_H
#define MAC_SCAN_H
/*******************************************************************************************************
*******************************************************************************************************
************************** CONSTANTS AND MACROS **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
// A bit-mask containing the valid channels for 2.4 GHz devices (channels 11 to 26)
#define MSC_VALID_CHANNELS 0x07FFF800
// The scan status returned to mlmeScanRequest(...)
typedef enum {
MSC_STATUS_ACTIVE,
MSC_STATUS_FINISHED,
MSC_STATUS_ORPHAN_REALIGNED
} MSC_SCAN_STATUS;
//-------------------------------------------------------------------------------------------------------
/*******************************************************************************************************
*******************************************************************************************************
************************** STATE MACHINES **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
// Scan state machine
// Initial preparations
#define MSC_STATE_INITIALIZE_SCAN 0
#define MSC_STATE_UNREQUEST_INDIRECT 1
// Preparations for each channel
#define MSC_STATE_SET_CHANNEL 2
// Scan states (E = Energy detection, A = Active, O = Orphan, P = Passive)
#define MSC_STATE_E_SAMPLE 3
#define MSC_STATE_A_TX_BEACON_REQUEST 4
#define MSC_STATE_O_TX_ORPHAN_NOTIFICATION 5
#define MSC_STATE_APO_WAIT 6
// Channel complete
#define MSC_STATE_NEXT_CHANNEL 7
// Scan complete
#define MSC_STATE_FINISH 8
//-------------------------------------------------------------------------------------------------------
/*******************************************************************************************************
*******************************************************************************************************
************************** MODULE DATA **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
// Internal module data
typedef struct {
// Scan parameters
BYTE scanType;
DWORD scanChannels;
UINT8 scanDuration;
MAC_SCAN_RESULT *pScanResult;
// Scan status
UINT8 currentChannel;
volatile ZBOOL channelComplete;
volatile MSC_SCAN_STATUS scanStatus;
// Saved variables
UINT8 oldPhyCurrentChannel;
} MAC_SCAN_INFO;
extern MAC_SCAN_INFO mscInfo;
//-------------------------------------------------------------------------------------------------------
/*******************************************************************************************************
*******************************************************************************************************
************************** FUNCTION PROTOTYPES **************************
*******************************************************************************************************
*******************************************************************************************************/
//-------------------------------------------------------------------------------------------------------
// Used by a coordinator to transmit a single beacon in a non-beacon network
ZBOOL mscTransmitBeacon(void);
// Used by a scanning device to transmit a beacon request frame
ZBOOL mscTransmitBeaconRequest(void);
// Scan state machine + channel timeout
void mscScanProcedure(void *scanState);
void mscChannelTimeout(void);
// Searches for a found PAN descriptor in the current result list (used to avoid duplicates)
ZBOOL mscPanDescriptorExists(PAN_DESCRIPTOR *pPanDescriptor);
//Scan init function.
void mscInit(void);
//-------------------------------------------------------------------------------------------------------
#endif
/*******************************************************************************************************
* Revision history:
*
* $Log: mac_scan.h,v $
* Revision 1.5 2004/11/10 09:32:56 thl
* Fixed a number of bugs according to: MAC software check lists.xls
*
* Revision 1.4 2004/08/13 13:04:43 jol
* CC2420 MAC Release v0.7
*
*
*******************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -