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

📄 mac_tx_pool.h

📁 ucos在NEC平台下的移植
💻 H
字号:
#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 ZBOOL 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;
    //union {
    //    BYTE msduHandle;
    //    BYTE commandType;
   // }DATA_OR_COMMAND;

    BYTE msduHandle;
    BYTE commandType;
  
   
    ZBOOL toCoord;
    UINT8 duration;             // Backoff periods including ACK and IFS
    BYTE txMode;
    ZBOOL slotted;               // Set automatically by the TX engine

    // For indirect packets
    ZBOOL purgeRequest;
    UINT16 timeToLive;           // This variable is signed because "time to live" becomes -1 when purged
    ZBOOL requested;
    ZBOOL transmissionStarted;   // This flag indicates that the transmission has been started and that the packet cannot be removed
    UINT8 nextPacket;
    UINT8 prevPacket;
    ZBOOL 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;
#if MAC_OPT_SECURITY
    // Security material, if used
    BYTE securitySuite;
    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
void mtxpInit(void);

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


#endif




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

⌨️ 快捷键说明

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