<< Previous | Next >>

OSQPostOpt

INT8U OSQPostOpt( OS_EVENT * pevent, void * msg, INT8U opt );

Description

This function sends a message to a queue. This call has been added to reduce code size since it can replace both OSQPost() and OSQPostFront(). Also, this function adds the capability to broadcast a message to all tasks waiting on the message queue.

NOTE Interrupts can be disabled for a long time if you do a "broadcast." In fact, the interrupt disable time is proportional to the number of tasks waiting on the queue.

Parameters

pevent
Pointer to message queue's event control block.

msg
Pointer to the message to send. A null pointer must not be sent.

opt
Determines the type of POST performed:

  • OS_POST_OPT_NONE - POST to a single waiting task (Identical to OSQPost())

  • OS_POST_OPT_BROADCAST - POST to ALL tasks that are waiting on the queue

  • OS_POST_OPT_FRONT - POST as LIFO (Simulates OSQPostFront())

The last 2 flags may be combined:

  • OS_POST_OPT_FRONT + OS_POST_OPT_BROADCAST - is identical to OSQPostFront() except that it will broadcast msg to all waiting tasks.

Return value

OS_NO_ERR
The call was successful and the message was sent.

OS_Q_FULL
The queue is full, cannot accept any more messages.

OS_ERR_EVENT_TYPE
A pointer to a queue was not passed.

OS_ERR_PEVENT_NULL
If pevent is a null pointer.

OS_ERR_POST_NULL_PTR
Attempting to post a null pointer.

Library

OS_Q.C (Prior to DC 8:UCOS2.LIB)


Dynamic C Functions << Previous | Next >> rabbit.com