Mistake on this page?
Report an issue in GitHub or email us
Functions
whd_buffer_api.h File Reference

Provides prototypes / declarations for common APSTA functionality. More...

#include "whd.h"
#include "whd_int.h"

Go to the source code of this file.

Functions

whd_result_t whd_host_buffer_get (whd_driver_t whd_driver, whd_buffer_t *buffer, whd_buffer_dir_t direction, uint16_t size, uint32_t wait)
 Allocates a packet buffer. More...
 
whd_result_t whd_buffer_release (whd_driver_t whd_driver, whd_buffer_t buffer, whd_buffer_dir_t direction)
 Releases a packet buffer. More...
 
uint8_t * whd_buffer_get_current_piece_data_pointer (whd_driver_t whd_driver, whd_buffer_t buffer)
 Retrieves the current pointer of a packet buffer. More...
 
uint16_t whd_buffer_get_current_piece_size (whd_driver_t whd_driver, whd_buffer_t buffer)
 Retrieves the size of a packet buffer. More...
 
whd_result_t whd_buffer_set_size (whd_driver_t whd_driver, whd_buffer_t buffer, uint16_t size)
 Sets the current size of a WHD packet. More...
 
whd_result_t whd_buffer_add_remove_at_front (whd_driver_t whd_driver, whd_buffer_t *buffer, int32_t add_remove_amount)
 Moves the current pointer of a packet buffer. More...
 

Detailed Description

Provides prototypes / declarations for common APSTA functionality.

Definition in file whd_buffer_api.h.

Function Documentation

whd_result_t whd_buffer_add_remove_at_front ( whd_driver_t  whd_driver,
whd_buffer_t *  buffer,
int32_t  add_remove_amount 
)

Moves the current pointer of a packet buffer.

Implemented in the port layer interface which is specific to the buffering scheme in use.

Since packet buffers usually need to be created with space at the front for additional headers, this function allows WHD to move the current 'front' location pointer so that it has space to add headers to transmit packets, and so that the network stack does not see the internal WHD headers on received packets.

Parameters
buffer: A pointer to the handle of the current packet buffer for which the current pointer will be moved. On return this may contain a pointer to a newly allocated packet buffer which has been daisy chained to the front of the given one. This would be the case if the given packet buffer didn't have enough space at the front.
add_remove_amount: This is the number of bytes to move the current pointer of the packet buffer - a negative value increases the space for headers at the front of the packet, a positive value decreases the space.
Returns
: WHD_SUCCESS or error code
uint8_t* whd_buffer_get_current_piece_data_pointer ( whd_driver_t  whd_driver,
whd_buffer_t  buffer 
)

Retrieves the current pointer of a packet buffer.

Implemented in the port layer interface which is specific to the buffering scheme in use. Since packet buffers usually need to be created with space at the front for additional headers, this function allows WHD to get the current 'front' location pointer.

Parameters
buffer: The handle of the packet buffer whose pointer is to be retrieved
Returns
: The packet buffer's current pointer.
uint16_t whd_buffer_get_current_piece_size ( whd_driver_t  whd_driver,
whd_buffer_t  buffer 
)

Retrieves the size of a packet buffer.

Implemented in the port layer interface which is specific to the buffering scheme in use. Since packet buffers usually need to be created with space at the front for additional headers, the memory block used to contain a packet buffer will often be larger than the current size of the packet buffer data. This function allows WHD to retrieve the current size of a packet buffer's data.

Parameters
buffer: The handle of the packet buffer whose size is to be retrieved
Returns
: The size of the packet buffer.
whd_result_t whd_buffer_release ( whd_driver_t  whd_driver,
whd_buffer_t  buffer,
whd_buffer_dir_t  direction 
)

Releases a packet buffer.

Implemented in the port layer interface, which will be specific to the buffering scheme in use. This function is used by WHD to indicate that it no longer requires a packet buffer. The buffer can then be released back into a pool for reuse, or the dynamically allocated memory can be freed, according to how the packet was allocated. Returns void since WHD cannot do anything about failures

Parameters
buffer: The handle of the packet buffer to be released
direction: Indicates transmit/receive direction that the packet buffer has been used for. This might be needed if tx/rx pools are separate.
whd_result_t whd_buffer_set_size ( whd_driver_t  whd_driver,
whd_buffer_t  buffer,
uint16_t  size 
)

Sets the current size of a WHD packet.

Implemented in the port layer interface which is specific to the buffering scheme in use. This function sets the current length of a WHD packet buffer

Parameters
buffer: The packet to be modified
size: The new size of the packet buffer
Returns
: WHD_SUCCESS or error code
whd_result_t whd_host_buffer_get ( whd_driver_t  whd_driver,
whd_buffer_t *  buffer,
whd_buffer_dir_t  direction,
uint16_t  size,
uint32_t  wait 
)

Allocates a packet buffer.

Implemented in the port layer interface which is specific to the buffering scheme in use. Attempts to allocate a packet buffer of the size requested. It can do this by allocating a pre-existing packet from a pool, using a static buffer, or by dynamically allocating memory. The method of allocation does not concern WHD, however it must match the way the network stack expects packet buffers to be allocated.

Parameters
buffer: A pointer which receives the allocated packet buffer handle
direction: Indicates transmit/receive direction that the packet buffer is used for. This may be needed if tx/rx pools are separate.
size: The number of bytes to allocate.
wait: Whether to wait for a packet buffer to be available
Returns
: WHD_SUCCESS or error code
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.