FreeRTOS C-Addons  1.1.0
C-Addon functionality to FreeRTOS
Macros | Typedefs | Functions
workqueue.h File Reference
#include "FreeRTOS.h"
#include "semphr.h"
Include dependency graph for workqueue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEFAULT_WORK_QUEUE_STACK_SIZE   (configMINIMAL_STACK_SIZE * 2)
 
#define DEFAULT_WORK_QUEUE_PRIORITY   (tskIDLE_PRIORITY + 1)
 
#define CreateWorkQueue()
 

Typedefs

typedef void(* WorkItem_t) (void *UserData)
 
typedef void * WorkQueue_t
 

Functions

WorkQueue_t CreateWorkQueueEx (const char *const Name, uint16_t StackSize, UBaseType_t Priority)
 
void DestroyWorkQueue (WorkQueue_t WorkQueue)
 
int QueueWorkItem (WorkQueue_t WorkQueue, WorkItem_t WorkItem, void *UserData)
 

Macro Definition Documentation

◆ CreateWorkQueue

#define CreateWorkQueue ( )
Value:
#define DEFAULT_WORK_QUEUE_STACK_SIZE
Definition: workqueue.h:64
#define DEFAULT_WORK_QUEUE_PRIORITY
Definition: workqueue.h:70
WorkQueue_t CreateWorkQueueEx(const char *const Name, uint16_t StackSize, UBaseType_t Priority)
Definition: workqueue.c:255

Create a WorkQueue using the defaults.

Returns
A handle, or NULL on error.

Definition at line 91 of file workqueue.h.

◆ DEFAULT_WORK_QUEUE_PRIORITY

#define DEFAULT_WORK_QUEUE_PRIORITY   (tskIDLE_PRIORITY + 1)

Default task priority of the Worker Task.

Definition at line 70 of file workqueue.h.

◆ DEFAULT_WORK_QUEUE_STACK_SIZE

#define DEFAULT_WORK_QUEUE_STACK_SIZE   (configMINIMAL_STACK_SIZE * 2)

Default stack size of the Worker Task.

Definition at line 64 of file workqueue.h.

Typedef Documentation

◆ WorkItem_t

typedef void(* WorkItem_t) (void *UserData)

All your work items are actually functions that take a void * parameter.

Definition at line 52 of file workqueue.h.

◆ WorkQueue_t

typedef void* WorkQueue_t

Handle for the actual work queue.

Definition at line 58 of file workqueue.h.

Function Documentation

◆ CreateWorkQueueEx()

WorkQueue_t CreateWorkQueueEx ( const char *const  Name,
uint16_t  StackSize,
UBaseType_t  Priority 
)

Create a WorkQueue, specifying all options.

Parameters
NameThe name of the worker thread.
StackSizeThe size of the worker thread stack, in words.
PriorityThe priority of the worker thread.
Returns
A handle, or NULL on error.

Definition at line 255 of file workqueue.c.

◆ DestroyWorkQueue()

void DestroyWorkQueue ( WorkQueue_t  WorkQueue)

Destroy a WorkQueue, if allowed.

Parameters
WorkQueueThe work queue.

Lock

Flag we are all done.

Signal the Worker thead.

Unlock

Definition at line 312 of file workqueue.c.

◆ QueueWorkItem()

int QueueWorkItem ( WorkQueue_t  WorkQueue,
WorkItem_t  WorkItem,
void *  UserData 
)

Add an item of work onto the queue.

Parameters
WorkQueueThe work queue.
WorkItemThe function you want called.
UserDataA value passed back to you.
Returns
pdPASS on success, pdFAIL on error.

Lock the queue

Put the work item on the queue.

Wake the Worker thread up.

Unlock the queue

Definition at line 344 of file workqueue.c.