RTEMS: Message Queues

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Functions
Message Queues
API » Classic

## Files
file | message.h
| Classic Message Queue Manager API.
file | messagedata.h
| Classic Message Queue Manager API.
file | msg.c
| Classic Message Queue Information with Zero Objects.
file | msgqbroadcast.c
| RTEMS Broadcast Message Queue.
file | msgqcreate.c
| RTEMS Create Message Queue.
file | msgqdelete.c
| RTEMS Delete Message Queue.
file | msgqflush.c
| rtems_message_queue_flush
file | msgqgetnumberpending.c
| RTEMS Message Queue Get Number Pending.
file | msgqident.c
| RTEMS Message Queue Name to Id.
file | msgqreceive.c
| RTEMS Message Queue Receive.
file | msgqsend.c
| rtems_message_queue_send
file | msgqurgent.c
| RTEMS Urgent Message Queue.

## Functions
rtems_status_code | rtems_message_queue_create (rtems_name name, uint32_t count, size_t max_message_size, rtems_attribute attribute_set, rtems_id *id)
| RTEMS Create Message Queue.
rtems_status_code | rtems_message_queue_ident (rtems_name name, uint32_t node, rtems_id *id)
| RTEMS Message Queue Name to Id.
rtems_status_code | rtems_message_queue_delete (rtems_id id)
| RTEMS Delete Message Queue.
rtems_status_code | rtems_message_queue_send (rtems_id id, const void *buffer, size_t size)
| Sends a message to the message queue.
rtems_status_code | rtems_message_queue_urgent (rtems_id id, const void *buffer, size_t size)
| RTEMS Urgent Message Queue.
rtems_status_code | rtems_message_queue_broadcast (rtems_id id, const void *buffer, size_t size, uint32_t *count)
| RTEMS Broadcast Message Queue.
rtems_status_code | rtems_message_queue_receive (rtems_id id, void *buffer, size_t *size, rtems_option option_set, rtems_interval timeout)
| Receives a message from the message queue.
rtems_status_code | rtems_message_queue_flush (rtems_id id, uint32_t *count)
| rtems_message_queue_flush
rtems_status_code | rtems_message_queue_get_number_pending (rtems_id id, uint32_t *count)
| RTEMS Message Queue Get Number Pending.

## Detailed Description

This encapsulates functionality related to the Classic API Message Queue Manager.

## Function Documentation

## ◆ rtems_message_queue_broadcast()

rtems_status_code rtems_message_queue_broadcast | ( | rtems_id | id,
|  | const void * | buffer,
|  | size_t | size,
|  | uint32_t * | count
| ) |  |

RTEMS Broadcast Message Queue.

This routine implements the rtems_message_queue_broadcast directive. This directive sends the message buffer to all of the tasks blocked waiting for a message on the message queue indicated by ID. If no tasks are waiting, then the message buffer will not be queued.

Parameters

  [in] | id | is the pointer to message queue
  [in] | buffer | is the pointer to message buffer
  [in] | size | is the size of message to broadcast
  [in] | count | pointer to area to store number of threads made ready

Return values

  RTEMS_SUCCESSFUL | if successful or error code if unsuccessful and *count filled in with number of threads made ready

## ◆ rtems_message_queue_create()

rtems_status_code rtems_message_queue_create | ( | rtems_name | name,
|  | uint32_t | count,
|  | size_t | max_message_size,
|  | rtems_attribute | attribute_set,
|  | rtems_id * | id
| ) |  |

RTEMS Create Message Queue.

This routine implements the rtems_message_queue_create directive. The message queue will have the name. If the attribute_set indicates that the message queue is to be limited in the number of messages that can be outstanding, then count indicates the maximum number of messages that will be held. It returns the id of the created message queue in id.

Parameters

  [in] | name | is the user defined queue name
  [in] | count | is the maximum message and reserved buffer count
  [in] | max_message_size | is the maximum size of each message
  [in] | attribute_set | is the process method
  [in] | id | is the pointer to queue

Return values

  This | method returns RTEMS_SUCCESSFUL if there was not an error. Otherwise, a status code is returned indicating the source of the error. If successful, the id will be filled in with the queue id.

## ◆ rtems_message_queue_delete()

rtems_status_code rtems_message_queue_delete | ( | rtems_id | id | ) |

RTEMS Delete Message Queue.

This routine implements the rtems_message_queue_delete directive. The message queue indicated by ID is deleted.

Parameters

  [in] | id | is the queue id

Return values

  RTEMS_SUCCESSFUL | if successful or error code if unsuccessful

## ◆ rtems_message_queue_flush()

rtems_status_code rtems_message_queue_flush | ( | rtems_id | id,
|  | uint32_t * | count
| ) |  |

rtems_message_queue_flush

This routine implements the rtems_message_queue_flush directive. This directive takes all outstanding messages for the message queue indicated by ID and returns them to the inactive message chain. The number of messages flushed is returned in COUNT.

Message Queue Manager

## ◆ rtems_message_queue_get_number_pending()

rtems_status_code rtems_message_queue_get_number_pending | ( | rtems_id | id,
|  | uint32_t * | count
| ) |  |

RTEMS Message Queue Get Number Pending.

Message Queue Manager

This routine implements the rtems_message_queue_get_number_pending directive. This directive returns the number of pending messages for the message queue indicated by ID chain. The number of messages pending is returned in COUNT.

## ◆ rtems_message_queue_ident()

rtems_status_code rtems_message_queue_ident | ( | rtems_name | name,
|  | uint32_t | node,
|  | rtems_id * | id
| ) |  |

RTEMS Message Queue Name to Id.

This routine implements the rtems_message_queue_ident directive. This directive returns the message queue ID associated with NAME. If more than one message queue is named name, then the message queue to which the ID belongs is arbitrary. node indicates the extent of the search for the ID of the message queue named name. The search can be limited to a particular node or allowed to encompass all nodes.

Parameters

  [in] | name | is the user defined message queue name
  [in] | node | is the node(s) to be searched
  [in] | id | is the pointer to message queue id

Return values

  RTEMS_SUCCESSFUL | if successful or error code if unsuccessful and *id filled with the message queue id

## ◆ rtems_message_queue_receive()

rtems_status_code rtems_message_queue_receive | ( | rtems_id | id,
|  | void * | buffer,
|  | size_t * | size,
|  | rtems_option | option_set,
|  | rtems_interval | timeout
| ) |  |

Receives a message from the message queue.

This directive is invoked when the calling task wishes to receive a message from the message queue indicated by ID. The received message is to be placed in the buffer. If no messages are outstanding and the option set indicates that the task is willing to block, then the task will be blocked until a message arrives or until, optionally, timeout clock ticks have passed.

Parameters

  | id | The message queue ID.
  [out] | buffer | The buffer for the message content. The buffer must be large enough to store maximum size messages of this message queue.
  [out] | size | The size of the message.
  | option_set | The option set, e.g. RTEMS_NO_WAIT or RTEMS_WAIT.
  | timeout | The number of ticks to wait if the RTEMS_WAIT is set. Use RTEMS_NO_TIMEOUT to wait indefinitely.

Return values

  RTEMS_SUCCESSFUL | Successful operation.
  RTEMS_INVALID_ID | Invalid message queue ID.
  RTEMS_INVALID_ADDRESS | The message buffer pointer or the message size pointer is `NULL`.
  RTEMS_TIMEOUT | A timeout occurred and no message was received.

## ◆ rtems_message_queue_send()

rtems_status_code rtems_message_queue_send | ( | rtems_id | id,
|  | const void * | buffer,
|  | size_t | size
| ) |  |

Sends a message to the message queue.

This directive sends the message buffer to the message queue indicated by ID. If one or more tasks is blocked waiting to receive a message from this message queue, then one will receive the message. The task selected to receive the message is based on the task queue discipline algorithm in use by this particular message queue. If no tasks are waiting, then the message buffer will be placed at the rear of the chain of pending messages for this message queue.

Parameters

  id | The message queue ID.
  buffer | The message content buffer.
  size | The size of the message.

Return values

  RTEMS_SUCCESSFUL | Successful operation.
  RTEMS_INVALID_ID | Invalid message queue ID.
  RTEMS_INVALID_ADDRESS | The message buffer pointer is `NULL`.
  RTEMS_INVALID_SIZE | The message size is larger than the maximum message size of the message queue.
  RTEMS_TOO_MANY | The new message would exceed the message queue limit for pending messages.

## ◆ rtems_message_queue_urgent()

rtems_status_code rtems_message_queue_urgent | ( | rtems_id | id,
|  | const void * | buffer,
|  | size_t | size
| ) |  |

RTEMS Urgent Message Queue.

This routine implements the rtems_message_queue_urgent directive. This directive has the same behavior as rtems_message_queue_send except that if no tasks are waiting, the message buffer will be placed at the FRONT of the chain of pending messages rather than at the REAR.

Parameters

  [in] | id | is the pointer to message queue
  [in] | buffer | is the pointer to message buffer
  [in] | size | is the size of message to send urgently

Return values

  RTEMS_SUCCESSFUL | if successful or error code if unsuccessful