00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _RTEMS_SCORE_COREMSG_H
00020 #define _RTEMS_SCORE_COREMSG_H
00021
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #include <limits.h>
00035 #include <rtems/score/thread.h>
00036 #include <rtems/score/threadq.h>
00037 #include <rtems/score/priority.h>
00038 #include <rtems/score/watchdog.h>
00039
00046 typedef void ( *CORE_message_queue_API_mp_support_callout )(
00047 Thread_Control *,
00048 Objects_Id
00049 );
00050
00060 typedef struct {
00062 size_t size;
00064 uint32_t buffer[1];
00065 } CORE_message_queue_Buffer;
00066
00073 typedef struct {
00075 Chain_Node Node;
00077 int priority;
00079 CORE_message_queue_Buffer Contents;
00080 } CORE_message_queue_Buffer_control;
00081
00088 typedef enum {
00090 CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO,
00092 CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY
00093 } CORE_message_queue_Disciplines;
00094
00101 #define CORE_MESSAGE_QUEUE_SEND_REQUEST INT_MAX
00102
00109 #define CORE_MESSAGE_QUEUE_URGENT_REQUEST INT_MIN
00110
00121 typedef int CORE_message_queue_Submit_types;
00122
00129 typedef enum {
00131 CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
00133 CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
00135 CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
00137 CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
00139 CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
00143 CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
00147 CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
00149 CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT
00150 } CORE_message_queue_Status;
00151
00157 #define CORE_MESSAGE_QUEUE_STATUS_LAST CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT
00158
00165 typedef struct {
00167 CORE_message_queue_Disciplines discipline;
00168 } CORE_message_queue_Attributes;
00169
00177 typedef void (*CORE_message_queue_Notify_Handler)( void * );
00178
00185 typedef struct {
00189 Thread_queue_Control Wait_queue;
00193 CORE_message_queue_Attributes Attributes;
00197 uint32_t maximum_pending_messages;
00200 uint32_t number_of_pending_messages;
00204 uint32_t maximum_message_size;
00208 Chain_Control Pending_messages;
00213 CORE_message_queue_Buffer *message_buffers;
00217 CORE_message_queue_Notify_Handler notify_handler;
00219 void *notify_argument;
00223 Chain_Control Inactive_messages;
00224 } CORE_message_queue_Control;
00225
00243 boolean _CORE_message_queue_Initialize(
00244 CORE_message_queue_Control *the_message_queue,
00245 CORE_message_queue_Attributes *the_message_queue_attributes,
00246 uint32_t maximum_pending_messages,
00247 uint32_t maximum_message_size
00248 );
00249
00262 void _CORE_message_queue_Close(
00263 CORE_message_queue_Control *the_message_queue,
00264 Thread_queue_Flush_callout remote_extract_callout,
00265 uint32_t status
00266 );
00267
00278 uint32_t _CORE_message_queue_Flush(
00279 CORE_message_queue_Control *the_message_queue
00280 );
00281
00292 uint32_t _CORE_message_queue_Flush_support(
00293 CORE_message_queue_Control *the_message_queue
00294 );
00295
00305 void _CORE_message_queue_Flush_waiting_threads(
00306 CORE_message_queue_Control *the_message_queue
00307 );
00308
00327 CORE_message_queue_Status _CORE_message_queue_Broadcast(
00328 CORE_message_queue_Control *the_message_queue,
00329 void *buffer,
00330 size_t size,
00331 Objects_Id id,
00332 CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
00333 uint32_t *count
00334 );
00335
00361 CORE_message_queue_Status _CORE_message_queue_Submit(
00362 CORE_message_queue_Control *the_message_queue,
00363 void *buffer,
00364 size_t size,
00365 Objects_Id id,
00366 CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
00367 CORE_message_queue_Submit_types submit_type,
00368 boolean wait,
00369 Watchdog_Interval timeout
00370 );
00371
00395 void _CORE_message_queue_Seize(
00396 CORE_message_queue_Control *the_message_queue,
00397 Objects_Id id,
00398 void *buffer,
00399 size_t *size,
00400 boolean wait,
00401 Watchdog_Interval timeout
00402 );
00403
00414 void _CORE_message_queue_Insert_message(
00415 CORE_message_queue_Control *the_message_queue,
00416 CORE_message_queue_Buffer_control *the_message,
00417 CORE_message_queue_Submit_types submit_type
00418 );
00419
00420 #ifndef __RTEMS_APPLICATION__
00421 #include <rtems/score/coremsg.inl>
00422 #endif
00423
00424 #ifdef __cplusplus
00425 }
00426 #endif
00427
00430 #endif
00431