📄 nwk_tx_pool.c
字号:
#include<swsZigbeeNWK_headers.h>
//-------------------------------------------------------------------------------------------------------
// The TX packet pool
extern NWK_TX_INFO nwkTxInfo;
NWK_TX_PACKET pNwkTxPacketPool[NWK_OPT_TX_QUEUE_SIZE];
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// void nwkTxPoolInit(void)
//
// DESCRIPTION:
// Initializes the TX packet pool and the indirect packet queue
//-------------------------------------------------------------------------------------------------------
void nwkTxPoolInit(void) {
UINT8 n ;
for (n=0; n < NWK_OPT_TX_POOL_SIZE; n++) {
pNwkTxPacketPool[n].occupied = FALSE;
pNwkTxPacketPool[n].poolIndex = n;
}
} // mtxpInit
//-------------------------------------------------------------------------------------------------------
// NWK_TX_PACKET* nwkTxPoolReservePacket(void)
//
// DESCRIPTION:
// Reserves a packet in the packet pool
//
// RETURN VALUE:
// MAC_TX_PACKET*
// A pointer to the reserved packet, or NULL if the pool is empty
//-------------------------------------------------------------------------------------------------------
NWK_TX_PACKET* nwkTxPoolReservePacket(void)
{
NWK_TX_PACKET *pPacket;
UINT8 n;
for (n = 0; n < NWK_OPT_TX_POOL_SIZE; n++) {
pPacket = &pNwkTxPacketPool[n];
if (!pPacket->occupied) {
// DISABLE_GLOBAL_INT();
if (!pPacket->occupied) {
pPacket->occupied = TRUE;
// ENABLE_GLOBAL_INT();
return pPacket;
}
// ENABLE_GLOBAL_INT();
}
}
return NULL;
} // mtxpReservePacket
//-------------------------------------------------------------------------------------------------------
// void ntxpReleasePacket(NWK_TX_PACKET* pPacket)
//
// DESCRIPTION:
// Releases a packet back to the TX packet pool
//
// ARGUMENTS:
// NWK_TX_PACKET* pPacket
// A pointer to the packet to be released
//-------------------------------------------------------------------------------------------------------
void nwkTxPoolReleasePacket(NWK_TX_PACKET* pPacket) {
if (nwkTxInfo.nPacket == pPacket)
nwkTxInfo.nPacket = NULL;
pPacket->occupied = FALSE;
} // mtxpReleasePacket
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -