Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Queue Management

Queue Management: provides services for creating and maintaining the queues.

Data Structures

struct  queue_tag
 Queue structure. More...
 
struct  search_t
 Structure to search for a buffer to be removed from a queue. More...
 

Typedefs

typedef struct queue_tag queue_t
 Queue structure. More...
 

Functions

void qmm_queue_append (queue_t *q, buffer_t *buf)
 Appends a buffer into the queue. More...
 
void qmm_queue_flush (queue_t *q)
 Internal function for flushing a specific queue. More...
 
__PACK__RST_DATA__ void qmm_queue_init (queue_t *q)
 Initializes the queue. More...
 
buffer_tqmm_queue_read (queue_t *q, search_t *search)
 Reads a buffer from queue. More...
 
buffer_tqmm_queue_remove (queue_t *q, search_t *search)
 Removes a buffer from queue. More...
 

Variables

uint8_t(* search_t::criteria_func )(void *buf, void *handle)
 Pointer to search criteria function. More...
 
void * search_t::handle
 Handle to callbck parameter. More...
 
buffer_tqueue_tag::head
 Pointer to head of queue. More...
 
uint8_t queue_tag::size
 Number of buffers present in the current queue. More...
 
buffer_tqueue_tag::tail
 Pointer to tail of queue. More...
 

typedef struct queue_tag queue_t

Queue structure.

This structur defines the queue structure. The application should declare the queue of type queue_t and call qmm_queue_init before invoking any other functionality of qmm.

void qmm_queue_append ( queue_t q,
buffer_t buf 
)

Appends a buffer into the queue.

This function appends a buffer into the queue.

Parameters
qQueue into which buffer should be appended
bufPointer to the buffer that should be appended into the queue. Note that this pointer should be same as the pointer returned by bmm_buffer_alloc.

References Assert, ENTER_CRITICAL_REGION, queue_tag::head, LEAVE_CRITICAL_REGION, MAC_SUCCESS, buffer_t::next, QUEUE_FULL, queue_tag::size, and queue_tag::tail.

Referenced by bmm_buffer_free(), bmm_buffer_init(), and handle_received_frame_irq().

void qmm_queue_flush ( queue_t q)

Internal function for flushing a specific queue.

Parameters
qQueue to be flushed

References bmm_buffer_free(), qmm_queue_remove(), and queue_tag::size.

__PACK__RST_DATA__ void qmm_queue_init ( queue_t q)

Initializes the queue.

This function initializes the queue. Note that this function should be called before invoking any other functionality of QMM.

Parameters
qThe queue which should be initialized.

References queue_tag::head, queue_tag::size, and queue_tag::tail.

Referenced by bmm_buffer_init(), and tal_init().

buffer_t* qmm_queue_read ( queue_t q,
search_t search 
)

Reads a buffer from queue.

This function reads either the first buffer if search is NULL or buffer matching the given criteria from queue.

Parameters
qThe queue from which buffer should be read.
searchIf this parameter is NULL first buffer in the queue will be read. Otherwise buffer matching the criteria will be read
Returns
Pointer to the buffer header which is to be read, NULL if the buffer is not available

References queue_read_or_remove(), and READ_MODE.

buffer_t* qmm_queue_remove ( queue_t q,
search_t search 
)

Removes a buffer from queue.

This function removes a buffer from queue

Parameters
qQueue from which buffer should be removed
searchSearch criteria. If this parameter is NULL, first buffer in the queue will be removed. Otherwise buffer matching the criteria will be removed.
Returns
Pointer to the buffer header, if the buffer is successfully removed, NULL otherwise.

References queue_read_or_remove(), and REMOVE_MODE.

Referenced by bmm_buffer_alloc(), qmm_queue_flush(), tal_reset(), and tal_task().

uint8_t(* search_t::criteria_func)(void *buf, void *handle)

Pointer to search criteria function.

Referenced by queue_read_or_remove().

void* search_t::handle

Handle to callbck parameter.

Referenced by queue_read_or_remove().

buffer_t* queue_tag::head

Pointer to head of queue.

Referenced by qmm_queue_append(), qmm_queue_init(), and queue_read_or_remove().

uint8_t queue_tag::size

Number of buffers present in the current queue.

Referenced by qmm_queue_append(), qmm_queue_flush(), qmm_queue_init(), queue_read_or_remove(), tal_reset(), and tal_task().

buffer_t* queue_tag::tail

Pointer to tail of queue.

Referenced by qmm_queue_append(), qmm_queue_init(), and queue_read_or_remove().