Atmel Software Framework

nwkFrame.h File Reference

Frame buffers management interface.

Copyright (C) 2014-2015 Atmel Corporation. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software may only be redistributed and used in connection with an Atmel microcontroller product.

THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <stdint.h>
#include "compiler.h"

Data Structures

struct  NwkFrame_t
 
struct  NwkFrameHeader_t
 
struct  NwkFrameMulticastHeader_t
 

Macros

#define NWK_FRAME_MAX_PAYLOAD_SIZE   127
 

Typedefs

typedef struct NwkFrame_t NwkFrame_t
 
typedef struct NwkFrameHeader_t NwkFrameHeader_t
 
typedef struct
NwkFrameMulticastHeader_t 
NwkFrameMulticastHeader_t
 

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...
 
static uint8_t nwkFramePayloadSize (NwkFrame_t *frame)
 

#define NWK_FRAME_MAX_PAYLOAD_SIZE   127

typedef struct NwkFrame_t NwkFrame_t

NwkFrame_t* nwkFrameAlloc ( void  )

Allocates an empty frame from the buffer pool.

Returns
Pointer to the frame or NULL if there are no free frames

References NwkFrame_t::data, NwkIb_t::lock, NWK_BUFFERS_AMOUNT, NWK_FRAME_STATE_FREE, nwkIb, NwkFrame_t::payload, NwkFrame_t::size, and state.

Referenced by nwkDataReqSendFrame(), nwkRxSendAck(), nwkTxBroadcastFrame(), and PHY_DataInd().

void nwkFrameCommandInit ( NwkFrame_t frame)

Sets default parameters for the the command frame.

Parameters
[in]framePointer to the command frame

References NwkIb_t::addr, NwkFrame_t::header, NWK_SUCCESS_STATUS, NwkFrameHeader_t::nwkFcf, nwkIb, NwkFrameHeader_t::nwkSeq, NwkIb_t::nwkSeqNum, NwkFrameHeader_t::nwkSrcAddr, NwkFrameHeader_t::security, and NwkFrame_t::tx.

Referenced by nwkRxSendAck().

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(), 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 nwkRxTaskHandler(), nwkTxAckReceived(), nwkTxAckWaitTimerHandler(), nwkTxDelayTimerHandler(), and nwkTxTaskHandler().

static uint8_t nwkFramePayloadSize ( NwkFrame_t frame)
inlinestatic

Referenced by nwkRxIndicateFrame().