Microchip® Advanced Software Framework

nwkFrame.c File Reference

Frame buffers management implementation.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "sysConfig.h"
#include "nwk.h"
#include "nwkFrame.h"

Enumerations

enum  { NWK_FRAME_STATE_FREE = 0x00 }
 

Functions

NwkFrame_tnwkFrameAlloc (void)
 Allocates an empty frame from the buffer pool. More...
 
void nwkFrameCommandInit (NwkFrame_t *frame)
 Sets default parameters for the the command frame. More...
 
void nwkFrameFree (NwkFrame_t *frame)
 Frees a frame and returns it to the buffer pool. More...
 
void nwkFrameInit (void)
 Initializes the Frame module. More...
 
NwkFrame_tnwkFrameNext (NwkFrame_t *frame)
 Cycles through the allocated frames starting from the specified frame. More...
 

Variables

static NwkFrame_t nwkFrameFrames [NWK_BUFFERS_AMOUNT]
 

anonymous enum
Enumerator
NWK_FRAME_STATE_FREE 

NwkFrame_t* nwkFrameAlloc ( void  )
void nwkFrameCommandInit ( NwkFrame_t frame)
void nwkFrameFree ( NwkFrame_t frame)

Frees a frame and returns it to the buffer pool.

Parameters
[in]framePointer to the frame to be freed

References NwkIb_t::lock, NWK_FRAME_STATE_FREE, nwkIb, and NwkFrame_t::state.

Referenced by nwkDataReqTxConf(), nwkRouteFrame(), nwkRxTaskHandler(), and nwkTxTaskHandler().

void nwkFrameInit ( void  )

Initializes the Frame module.

References NWK_BUFFERS_AMOUNT, NWK_FRAME_STATE_FREE, and NwkFrame_t::state.

Referenced by NWK_Init().

NwkFrame_t* nwkFrameNext ( NwkFrame_t frame)

Cycles through the allocated frames starting from the specified frame.

Parameters
[in]framePointer to the current frame or NULL for the first frame
Returns
Next allocated frame or NULL if there are no more frames

References NWK_DataReq_t::frame, NWK_BUFFERS_AMOUNT, NWK_FRAME_STATE_FREE, nwkFrameFrames, and NwkFrame_t::state.

Referenced by nwkRouteDiscoveryDone(), nwkRxTaskHandler(), nwkSecurityTaskHandler(), nwkTxAckReceived(), nwkTxAckWaitTimerHandler(), nwkTxDelayTimerHandler(), and nwkTxTaskHandler().

NwkFrame_t nwkFrameFrames[NWK_BUFFERS_AMOUNT]
static

Referenced by nwkFrameNext().