[3652ad35] | 1 | /* coremsg.inl |
---|
| 2 | * |
---|
| 3 | * This include file contains the macro implementation of all |
---|
| 4 | * inlined routines in the Core Message Handler. |
---|
| 5 | * |
---|
[08311cc3] | 6 | * COPYRIGHT (c) 1989-1999. |
---|
[3652ad35] | 7 | * On-Line Applications Research Corporation (OAR). |
---|
| 8 | * |
---|
[98e4ebf5] | 9 | * The license and distribution terms for this file may be |
---|
| 10 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 11 | * http://www.OARcorp.com/rtems/license.html. |
---|
[3652ad35] | 12 | * |
---|
| 13 | * $Id$ |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef __CORE_MESSAGE_QUEUE_inl |
---|
| 17 | #define __CORE_MESSAGE_QUEUE_inl |
---|
| 18 | |
---|
[a50b011f] | 19 | #include <string.h> /* for memcpy */ |
---|
| 20 | |
---|
[3652ad35] | 21 | /*PAGE |
---|
| 22 | * |
---|
| 23 | * _CORE_message_queue_Send |
---|
| 24 | * |
---|
| 25 | */ |
---|
[43b6f75] | 26 | |
---|
[3652ad35] | 27 | #define _CORE_message_queue_Send( _the_message_queue, _buffer, _size, \ |
---|
[53fb837a] | 28 | _id, _api_message_queue_mp_support, _wait, _timeout ) \ |
---|
[3652ad35] | 29 | _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ |
---|
[53fb837a] | 30 | (_id), (_api_message_queue_mp_support), \ |
---|
[43b6f75] | 31 | CORE_MESSAGE_QUEUE_SEND_REQUEST, (_wait), (_timeout) ) |
---|
[3652ad35] | 32 | |
---|
| 33 | /*PAGE |
---|
| 34 | * |
---|
| 35 | * _CORE_message_queue_Urgent |
---|
| 36 | * |
---|
| 37 | */ |
---|
| 38 | |
---|
| 39 | #define _CORE_message_queue_Urgent( _the_message_queue, _buffer, _size, \ |
---|
[53fb837a] | 40 | _id, _api_message_queue_mp_support, _wait, _timeout ) \ |
---|
[3652ad35] | 41 | _CORE_message_queue_Submit( (_the_message_queue), (_buffer), (_size), \ |
---|
[53fb837a] | 42 | (_id), (_api_message_queue_mp_support), \ |
---|
[43b6f75] | 43 | CORE_MESSAGE_QUEUE_URGENT_REQUEST, (_wait), (_timeout) ) |
---|
[3652ad35] | 44 | |
---|
| 45 | /*PAGE |
---|
| 46 | * |
---|
| 47 | * _CORE_message_queue_Copy_buffer |
---|
| 48 | */ |
---|
| 49 | |
---|
| 50 | #define _CORE_message_queue_Copy_buffer( _source, _destination, _size ) \ |
---|
| 51 | memcpy( _destination, _source, _size) |
---|
| 52 | |
---|
| 53 | /*PAGE |
---|
| 54 | * |
---|
| 55 | * _CORE_message_queue_Allocate_message_buffer |
---|
| 56 | * |
---|
| 57 | */ |
---|
| 58 | |
---|
| 59 | #define _CORE_message_queue_Allocate_message_buffer( _the_message_queue ) \ |
---|
| 60 | (CORE_message_queue_Buffer_control *) \ |
---|
| 61 | _Chain_Get( &(_the_message_queue)->Inactive_messages ) |
---|
| 62 | |
---|
| 63 | /*PAGE |
---|
| 64 | * |
---|
| 65 | * _CORE_message_queue_Free_message_buffer |
---|
| 66 | * |
---|
| 67 | */ |
---|
| 68 | |
---|
| 69 | #define _CORE_message_queue_Free_message_buffer( _the_message_queue, _the_message ) \ |
---|
| 70 | _Chain_Append( \ |
---|
| 71 | &(_the_message_queue)->Inactive_messages, \ |
---|
| 72 | &(_the_message)->Node \ |
---|
| 73 | ) |
---|
| 74 | |
---|
| 75 | /*PAGE |
---|
| 76 | * |
---|
| 77 | * _CORE_message_queue_Is_priority |
---|
| 78 | * |
---|
| 79 | */ |
---|
| 80 | |
---|
| 81 | #define _CORE_message_queue_Is_priority( _the_attribute ) \ |
---|
| 82 | ((_the_attribute)->discipline == CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY) |
---|
| 83 | |
---|
| 84 | /*PAGE |
---|
| 85 | * |
---|
| 86 | * _CORE_message_queue_Get_pending_message |
---|
| 87 | * |
---|
| 88 | */ |
---|
| 89 | |
---|
| 90 | #define _CORE_message_queue_Get_pending_message( _the_message_queue ) \ |
---|
| 91 | (CORE_message_queue_Buffer_control *) \ |
---|
| 92 | _Chain_Get_unprotected( &(_the_message_queue)->Pending_messages ) |
---|
| 93 | |
---|
| 94 | /*PAGE |
---|
| 95 | * |
---|
| 96 | * _CORE_message_queue_Append |
---|
| 97 | * |
---|
| 98 | */ |
---|
| 99 | |
---|
| 100 | #define _CORE_message_queue_Append( _the_message_queue, _the_message ) \ |
---|
| 101 | _Chain_Append( &(_the_message_queue)->Pending_messages, \ |
---|
| 102 | &(_the_message)->Node ) |
---|
| 103 | |
---|
| 104 | /*PAGE |
---|
| 105 | * |
---|
| 106 | * _CORE_message_queue_Prepend |
---|
| 107 | * |
---|
| 108 | */ |
---|
| 109 | |
---|
| 110 | #define _CORE_message_queue_Prepend( _the_message_queue, _the_message ) \ |
---|
| 111 | _Chain_Prepend( &(_the_message_queue)->Pending_messages, \ |
---|
| 112 | &(_the_message)->Node ) |
---|
| 113 | |
---|
| 114 | /*PAGE |
---|
| 115 | * |
---|
| 116 | * _CORE_message_queue_Is_null |
---|
| 117 | * |
---|
| 118 | */ |
---|
| 119 | |
---|
| 120 | #define _CORE_message_queue_Is_null( _the_message_queue ) \ |
---|
| 121 | ( (_the_message_queue) == NULL ) |
---|
| 122 | |
---|
[5e9b32b] | 123 | /*PAGE |
---|
| 124 | * |
---|
| 125 | * _CORE_message_queue_Is_notify_enabled |
---|
| 126 | * |
---|
| 127 | */ |
---|
| 128 | |
---|
| 129 | #define _CORE_message_queue_Is_notify_enabled( _the_message_queue ) \ |
---|
| 130 | ( (_the_message_queue)->notify_handler != NULL ) |
---|
| 131 | |
---|
| 132 | /*PAGE |
---|
| 133 | * |
---|
| 134 | * _CORE_message_queue_Set_notify |
---|
| 135 | * |
---|
| 136 | */ |
---|
| 137 | |
---|
| 138 | #define _CORE_message_queue_Set_notify( \ |
---|
| 139 | _the_message_queue, _the_handler, _the_argument ) \ |
---|
| 140 | do { \ |
---|
[c701f197] | 141 | (_the_message_queue)->notify_handler = (_the_handler); \ |
---|
| 142 | (_the_message_queue)->notify_argument = (_the_argument); \ |
---|
[5e9b32b] | 143 | } while ( 0 ) |
---|
| 144 | |
---|
[3652ad35] | 145 | #endif |
---|
| 146 | /* end of include file */ |
---|