MotorWare f2806x Module API Documentation
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
QUEUE

Modules

 Module overview
 

Data Structures

struct  _EVENT_ArgList_
 Defines the event argument list. More...
 
struct  _EVENT_Obj_
 Defines the event queue object. More...
 
struct  _QUEUE_Obj_
 Defines the queue object structure. More...
 

Macros

#define EVENT_MAX_NUM_ARGS   4
 Defines the maximum number of event arguments. More...
 
#define QUEUE_MAX_NUM_EVENTS   8
 Defines the maximum number of events per queue Note: must be a power of 2. More...
 

Typedefs

typedef void(* EVENT_Fxn) ()
 Defines the event function prototype. More...
 
typedef struct _EVENT_ArgList_ EVENT_ArgList
 Defines the event argument list. More...
 
typedef struct _EVENT_Obj_ EVENT_Obj
 Defines the event queue object. More...
 
typedef struct _EVENT_Obj_EVENT_Handle
 Defines the EVENT handle. More...
 
typedef struct _QUEUE_Obj_ QUEUE_Obj
 Defines the queue object structure. More...
 
typedef struct _QUEUE_Obj_QUEUE_Handle
 Defines the queue handle. More...
 

Enumerations

enum  QUEUE_Status_e { QUEUE_STATUS_FIRST_EVENT_TAKEN =0, QUEUE_STATUS_LAST_EVENT_TAKEN }
 Defines the queue status messages. More...
 

Functions

static bool QUEUE_isEvent (QUEUE_Handle handle)
 Checks if there is an event available in the queue. More...
 
static bool QUEUE_isIdle (QUEUE_Handle handle)
 Checks if the specified queue is idle. More...
 
QUEUE_Handle QUEUE_init (void *pMemory, const size_t numBytes)
 Initializes the queue. More...
 
void QUEUE_listen (QUEUE_Handle handle)
 Puts the calling process in a listen state. It loops until. More...
 
static status QUEUE_postEventFirst (QUEUE_Handle handle, const EVENT_Fxn eventFxn, const EVENT_ArgList *pArgList, const uint_least8_t numArgs)
 Posts an event to the beginning of the specified queue. More...
 
static status QUEUE_postEventLast (QUEUE_Handle handle, const EVENT_Fxn eventFxn, const EVENT_ArgList *pArgList, const uint_least8_t numArgs)
 Posts an event to the end of the specified queue. More...
 
static void QUEUE_removeFirstEvent (QUEUE_Handle handle)
 Removed the first event from the specified queue. More...
 
static void QUEUE_removeLastEvent (QUEUE_Handle handle)
 Removed the last event from the specified queue. More...
 
static void QUEUE_executeEvent (QUEUE_Handle handle)
 Checks the specified event queue for an event. If there is an event,. More...
 

Variables

uint32_t gEventIndex
 The event index. More...
 
EVENT_Obj gEvents [QUEUE_MAX_NUM_EVENTS]
 The array of events. More...
 

Detailed Description


Data Structure Documentation

struct _EVENT_ArgList_

Defines the event argument list.

Definition at line 91 of file queue.h.

Data Fields
void * arg[EVENT_MAX_NUM_ARGS] an array of the pointers to the event arguments
struct _EVENT_Obj_

Defines the event queue object.

Definition at line 99 of file queue.h.

Data Fields
EVENT_ArgList argList the event function argument list
EVENT_Fxn eventFxn the event function that will be called
struct _EVENT_Obj_ * nextEvent the next event in the queue
uint_least8_t numArgs the number of event arguments
struct _EVENT_Obj_ * prevEvent the previous event in the queue
uint_least8_t queueNumber the queue number
bool taken a flag to indicate if event is taken
struct _QUEUE_Obj_

Defines the queue object structure.

Definition at line 118 of file queue.h.

Data Fields
EVENT_Handle firstEvent the first event in the queue
EVENT_Handle lastEvent the last event in the queue

Macro Definition Documentation

#define EVENT_MAX_NUM_ARGS   4

Defines the maximum number of event arguments.

Definition at line 73 of file queue.h.

Referenced by QUEUE_postEventFirst(), and QUEUE_postEventLast().

#define QUEUE_MAX_NUM_EVENTS   8

Defines the maximum number of events per queue Note: must be a power of 2.

Definition at line 78 of file queue.h.

Referenced by QUEUE_postEventFirst(), and QUEUE_postEventLast().

Typedef Documentation

Defines the event argument list.

typedef void(* EVENT_Fxn) ()

Defines the event function prototype.

Definition at line 86 of file queue.h.

typedef struct _EVENT_Obj_* EVENT_Handle

Defines the EVENT handle.

Definition at line 113 of file queue.h.

typedef struct _EVENT_Obj_ EVENT_Obj

Defines the event queue object.

typedef struct _QUEUE_Obj_* QUEUE_Handle

Defines the queue handle.

Definition at line 136 of file queue.h.

typedef struct _QUEUE_Obj_ QUEUE_Obj

Defines the queue object structure.

Enumeration Type Documentation

Defines the queue status messages.

Enumerator
QUEUE_STATUS_FIRST_EVENT_TAKEN 

the first event taken message

QUEUE_STATUS_LAST_EVENT_TAKEN 

the last event taken message

Definition at line 127 of file queue.h.

Function Documentation

static void QUEUE_executeEvent ( QUEUE_Handle  handle)
inlinestatic

Checks the specified event queue for an event. If there is an event,.

Parameters
[in]handleThe queue handle

Definition at line 364 of file queue.h.

References _EVENT_ArgList_::arg, _EVENT_Obj_::argList, _EVENT_Obj_::eventFxn, _QUEUE_Obj_::firstEvent, _EVENT_Obj_::numArgs, and QUEUE_removeFirstEvent().

Referenced by QUEUE_listen().

QUEUE_Handle QUEUE_init ( void *  pMemory,
const size_t  numBytes 
)

Initializes the queue.

Parameters
[in]pMemoryA pointer to the memory for the queue object
[in]numBytesThe number of bytes allocated for the queue object, bytes
Returns
The queue (QUEUE) object handle

Definition at line 60 of file queue.c.

References _QUEUE_Obj_::firstEvent, gEventIndex, and _QUEUE_Obj_::lastEvent.

static bool QUEUE_isEvent ( QUEUE_Handle  handle)
inlinestatic

Checks if there is an event available in the queue.

Parameters
[in]handleThe queue handle

Definition at line 158 of file queue.h.

References _QUEUE_Obj_::firstEvent.

static bool QUEUE_isIdle ( QUEUE_Handle  handle)
inlinestatic

Checks if the specified queue is idle.

Parameters
[in]handleThe queue handle

Definition at line 168 of file queue.h.

References _QUEUE_Obj_::firstEvent.

Referenced by QUEUE_listen().

void QUEUE_listen ( QUEUE_Handle  handle)

Puts the calling process in a listen state. It loops until.

Parameters
[in]handleThe queue handle

Definition at line 91 of file queue.c.

References QUEUE_executeEvent(), and QUEUE_isIdle().

static status QUEUE_postEventFirst ( QUEUE_Handle  handle,
const EVENT_Fxn  eventFxn,
const EVENT_ArgList pArgList,
const uint_least8_t  numArgs 
)
inlinestatic

Posts an event to the beginning of the specified queue.

Parameters
[in]handleThe queue handle
[in]eventFxnThe event function that will be called
[in]*pArgListThe pointer to the event argument list
[in]numArgsThe number of arguments

Definition at line 194 of file queue.h.

References _EVENT_ArgList_::arg, _EVENT_Obj_::argList, ERROR, EVENT_MAX_NUM_ARGS, _EVENT_Obj_::eventFxn, _QUEUE_Obj_::firstEvent, gEventIndex, _EVENT_Obj_::nextEvent, _EVENT_Obj_::numArgs, OK, _EVENT_Obj_::prevEvent, QUEUE_MAX_NUM_EVENTS, QUEUE_STATUS_FIRST_EVENT_TAKEN, and _EVENT_Obj_::taken.

static status QUEUE_postEventLast ( QUEUE_Handle  handle,
const EVENT_Fxn  eventFxn,
const EVENT_ArgList pArgList,
const uint_least8_t  numArgs 
)
inlinestatic

Posts an event to the end of the specified queue.

Parameters
[in]handleThe queue handle
[in]eventFxnThe event function that will be called
[in]*pArgListThe pointer to the event argument list
[in]numArgsThe number of event arguments

Definition at line 247 of file queue.h.

References _EVENT_ArgList_::arg, _EVENT_Obj_::argList, ERROR, EVENT_MAX_NUM_ARGS, _EVENT_Obj_::eventFxn, gEventIndex, _QUEUE_Obj_::lastEvent, _EVENT_Obj_::nextEvent, _EVENT_Obj_::numArgs, OK, _EVENT_Obj_::prevEvent, QUEUE_MAX_NUM_EVENTS, QUEUE_STATUS_LAST_EVENT_TAKEN, and _EVENT_Obj_::taken.

static void QUEUE_removeFirstEvent ( QUEUE_Handle  handle)
inlinestatic

Removed the first event from the specified queue.

Parameters
[in]handleThe queue handle

Definition at line 298 of file queue.h.

References _QUEUE_Obj_::firstEvent, _EVENT_Obj_::nextEvent, _EVENT_Obj_::prevEvent, and _EVENT_Obj_::taken.

Referenced by QUEUE_executeEvent().

static void QUEUE_removeLastEvent ( QUEUE_Handle  handle)
inlinestatic

Removed the last event from the specified queue.

Parameters
[in]handleThe queue handle

Definition at line 331 of file queue.h.

References _QUEUE_Obj_::lastEvent, _EVENT_Obj_::nextEvent, _EVENT_Obj_::prevEvent, and _EVENT_Obj_::taken.

Variable Documentation

uint32_t gEventIndex

The event index.

Definition at line 52 of file queue.c.

Referenced by QUEUE_init(), QUEUE_postEventFirst(), and QUEUE_postEventLast().

The array of events.

Definition at line 54 of file queue.c.