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

📄 mac_tx_pool.h

📁 zigbee location examples
💻 H
字号:
/*******************************************************************************************************
 *                                                                                                     *
 *        **********                                                                                   *
 *       ************                                                                                  *
 *      ***        ***                                                                                 *
 *      ***   +++   ***                                                                                *
 *      ***   + +   ***                                                                                *
 *      ***   +                         CHIPCON CC2430 INTEGRATED 802.15.4 MAC AND PHY                 *
 *      ***   + +   ***                                RX Packet Pool                                  *
 *      ***   +++   ***                                                                                *
 *      ***        ***                                                                                 *
 *       ************                                                                                  *
 *        **********                                                                                   *
 *                                                                                                     *
 *******************************************************************************************************
 * CONFIDENTIAL                                                                                        *
 * The use of this file is restricted by the signed MAC software license agreement.                    *
 *                                                                                                     *
 * Copyright Chipcon AS, 2005                                                                          *
 *******************************************************************************************************
 * This module contains the TX packet pool, which manages a table of MAC_TX_PACKET structures to be    *
 * used with the TX engine.                                                                            *
 *******************************************************************************************************/
#ifndef MAC_TX_POOL_H
#define MAC_TX_POOL_H




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


//-------------------------------------------------------------------------------------------------------
// The maximum length of the packet header
#define MTX_MAX_HEADER_LENGTH 23

// The maximum length of the security field (TBD)
#define MTX_MAX_SECURITY_LENGTH 5

// The length of the frame check sequence
#define MAC_FCS_LENGTH 2
//-------------------------------------------------------------------------------------------------------




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


//-------------------------------------------------------------------------------------------------------
// Packet TX structure
typedef struct {
    volatile BOOL occupied;

    // Transmission buffer
    UINT8 headerLength;
    UINT8 length;
    BYTE pHeader[MTX_MAX_HEADER_LENGTH]; // Frame control field (2) | Sequence number (1) | Addressing fields (0 to 20)
    BYTE pPayload[aMaxMACFrameSize];

    // Various packet parameters
    BYTE type;                  // FT_BEACON, FT_DATA or FT_MAC_COMMAND
    BYTE txOptions;
    BYTE msduHandle;
    BYTE commandType;
    BOOL toCoord;
    UINT8 duration;             // Backoff periods including ACK and IFS
    BYTE txMode;
    BOOL slotted;               // Set automatically by the TX engine

    // For indirect packets
    BOOL purgeRequest;
    UINT16 timeToLive;           // This variable is signed because "time to live" becomes -1 when purged

    BOOL requested;
    BOOL transmissionStarted;   // This flag indicates that the transmission has been started and that the packet cannot be removed
    UINT8 nextPacket;
    UINT8 prevPacket;
    BOOL isFirstPacket;         // Is this the first packet in the queue for this node?
    UINT8 poolIndex;

    // The number of retries left (must be placed here because of indirect packets)
    UINT8 retriesLeft;
    BYTE securitySuite;
#if MAC_OPT_SECURITY
    // Security material, if used
    SECURITY_MATERIAL *pSecurityMaterial;
    MSEC_SETUP_INFO securitySetup;
#endif

} MAC_TX_PACKET;
extern MAC_TX_PACKET pMtxPacketPool[MAC_OPT_TX_POOL_SIZE];
//-------------------------------------------------------------------------------------------------------




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


//-------------------------------------------------------------------------------------------------------
// Initializes the packet pool
ROOT void mtxpInit(void);

// Reserve/release
ROOT MAC_TX_PACKET  * mtxpReservePacket(void);
ROOT void mtxpReleasePacket(MAC_TX_PACKET   *pPacket);
//-------------------------------------------------------------------------------------------------------


#endif

⌨️ 快捷键说明

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