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

📄 mac_indirect_queue.h

📁 ucos在NEC平台下的移植
💻 H
字号:
/*******************************************************************************************************
 *                                                                                                     *
 *        **********                                                                                   *
 *       ************                                                                                  *
 *      ***        ***                                                                                 *
 *      ***   +++   ***                                                                                *
 *      ***   + +   ***                                                                                *
 *      ***   +                         CHIPCON CC2420 INTEGRATED 802.15.4 MAC AND PHY                 *
 *      ***   + +   ***                        Indirect Packet Queue + Related                         *
 *      ***   +++   ***                                                                                *
 *      ***        ***                                                                                 *
 *       ************                                                                                  *
 *        **********                                                                                   *
 *                                                                                                     *
 *******************************************************************************************************
 * CONFIDENTIAL                                                                                        *
 * The use of this file is restricted by the signed MAC software license agreement.                    *
 *                                                                                                     *
 * Copyright Chipcon AS, 2004                                                                          *
 *******************************************************************************************************
 * This module contains functions related to the indirect packet queue (on coordinators), including    *
 * queue management, transmission initiation, expiration, and other functions.                         *
 *******************************************************************************************************
 * Compiler: AVR-GCC                                                                                   *
 * Target platform: CC2420DB, CC2420 + any ATMEGA MCU                                                  *
 *******************************************************************************************************
 * The revision history is located at the bottom of this file                                          *
 *******************************************************************************************************/
#ifndef MACINDIRECTQUEUE_H
#define MACINDIRECTQUEUE_H




/*******************************************************************************************************
 *******************************************************************************************************
 **************************               CONSTANTS AND MACROS                **************************
 *******************************************************************************************************
 *******************************************************************************************************/


//-------------------------------------------------------------------------------------------------------
// MAC_TX_PACKET.timeToLive is set to MIQ_PACKET_PURGED to indicate that a packet was purged (callbacks
#define MIQ_PACKET_PURGED -1

// Packet queue termination
#define NO_PACKET 0xFF
//-------------------------------------------------------------------------------------------------------




/*******************************************************************************************************
 *******************************************************************************************************
 **************************                  STATE MACHINES                   **************************
 *******************************************************************************************************
 *******************************************************************************************************/


//-------------------------------------------------------------------------------------------------------
// miqAddIndirectPacket
#define MIQ_STATE_FIND_FIRST_PACKET_FROM_NODE  0
#define MIQ_STATE_INSERT_INTO_QUEUE            1

// miqRemoveIndirectPacket
#define MIQ_STATE_REMOVE_PACKET                0
#define MIQ_STATE_MOVE_FIRST_PACKET_FLAG       1

// miqExpireIndirectPacketsTask
#define MIQ_STATE_FIND_EXPIRED_PACKET          0
#define MIQ_STATE_REMOVE_EXPIRED_PACKET        1
//-------------------------------------------------------------------------------------------------------




/*******************************************************************************************************
 *******************************************************************************************************
 **************************                   MODULE DATA                     **************************
 *******************************************************************************************************
 *******************************************************************************************************/

#if MAC_OPT_FFD
//-------------------------------------------------------------------------------------------------------
// Internal module data
typedef struct {
    
    // Indexes of the first and the last packet in the indirect queue
    UINT8 firstIndirectPacket;
    UINT8 lastIndirectPacket;
    
    // The number of requested indirect packets (to tell whether or not to continue looping the 
    // miqTransmitRequestedPackets(...) task.
    UINT8 requestedCounter;
    
} MAC_INDIRECT_QUEUE_INFO;
extern MAC_INDIRECT_QUEUE_INFO miqInfo;
//-------------------------------------------------------------------------------------------------------
#endif // MAC_OPT_FFD




/*******************************************************************************************************
 *******************************************************************************************************
 **************************               FUNCTION PROTOTYPES                 **************************
 *******************************************************************************************************
 *******************************************************************************************************/


//-------------------------------------------------------------------------------------------------------
// Queue initialization
void miqInit(void);

// Queue management
void miqAddIndirectPacket(void *pTask);
void miqRemoveIndirectPacket(MAC_TASK_INFO *pTask);

// Transmission of requested packets
ZBOOL miqFindAndRequestIndirectPacket(ADDRESS *pDestAddr, ZBOOL isExtAddr);
MAC_TX_PACKET *miqFindIndirectPacket(ADDRESS *pDestAddr, ZBOOL isExtAddr);
void miqSetRequested(MAC_TX_PACKET *pPacket, ZBOOL requested);
void miqUnrequestAll(void);
void miqTransmitRequestedPackets(MAC_TASK_INFO *pTask);

// Expiration of old or purged packets
void miqExpireIndirectPacketsTask(MAC_TASK_INFO *pTask);
void miqDecrTimeToLive(void);

// Transmission of the empty data packet, which is sent when there is no data for a polling device
ZBOOL miqTransmitNoDataPacket(ADDRESS *pDestAddr, ZBOOL isExtAddr);


//-------------------------------------------------------------------------------------------------------


#endif




/*******************************************************************************************************
 * Revision history:
 *
 * $Log: mac_indirect_queue.h,v $
 * Revision 1.6  2004/12/07 09:48:01  thl
 * Fixed potential coruption of memmory when max payload is recived.
 *
 * Revision 1.5  2004/08/13 13:04:43  jol
 * CC2420 MAC Release v0.7
 *
 *
 *******************************************************************************************************/

⌨️ 快捷键说明

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