Changeset 3a4ae6c in rtems for cpukit/rtems
- Timestamp:
- 09/11/95 19:35:39 (28 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- ced11f99
- Parents:
- 5072b07
- Location:
- cpukit/rtems
- Files:
-
- 1 added
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/rtems/include/rtems.h
r5072b07 r3a4ae6c 25 25 26 26 #include <rtems/system.h> 27 #include <rtems/types.h> 27 #include <rtems/rtems/status.h> 28 #include <rtems/rtems/types.h> 28 29 30 #include <rtems/config.h> 29 31 #include <rtems/init.h> 30 #include <rtems/ tasks.h>31 #include <rtems/ intr.h>32 #include <rtems/ clock.h>32 #include <rtems/rtems/tasks.h> 33 #include <rtems/rtems/intr.h> 34 #include <rtems/rtems/clock.h> 33 35 #include <rtems/extension.h> 34 #include <rtems/ timer.h>35 #include <rtems/ sem.h>36 #include <rtems/ message.h>37 #include <rtems/ event.h>38 #include <rtems/ signal.h>39 #include <rtems/ event.h>40 #include <rtems/ part.h>41 #include <rtems/r egion.h>42 #include <rtems/ dpmem.h>36 #include <rtems/rtems/timer.h> 37 #include <rtems/rtems/sem.h> 38 #include <rtems/rtems/message.h> 39 #include <rtems/rtems/event.h> 40 #include <rtems/rtems/signal.h> 41 #include <rtems/rtems/event.h> 42 #include <rtems/rtems/part.h> 43 #include <rtems/rtems/region.h> 44 #include <rtems/rtems/dpmem.h> 43 45 #include <rtems/io.h> 44 46 #include <rtems/fatal.h> 45 #include <rtems/r atemon.h>46 #include <rtems/ mp.h>47 #include <rtems/rtems/ratemon.h> 48 #include <rtems/rtems/mp.h> 47 49 48 #include <rtems/support.h> 50 #include <rtems/rtems/support.h> 51 #include <rtems/sysstate.h> 49 52 50 53 #define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP 54 55 /* 56 * The following define the constants which may be used in name searches. 57 */ 58 59 #define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES 60 #define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES 61 #define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE 62 #define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I 63 64 /* 65 * Parameters and return id's for _Objects_Get_next 66 */ 67 68 #define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX 69 #define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX 70 71 #define RTEMS_OBJECT_ID_INITIAL(node) OBJECTS_ID_INITIAL(node) 72 #define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL 73 74 /* 75 * The following constant defines the minimum stack size which every 76 * thread must exceed. 77 */ 78 79 #define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE 80 81 /* 82 * Constant for indefinite wait. (actually an illegal interval) 83 */ 84 85 #define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT 86 87 /* 88 * An MPCI must support packets of at least this size. 89 */ 90 91 #define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE 92 93 /* 94 * The following constant defines the number of unsigned32's 95 * in a packet which must be converted to native format in a 96 * heterogeneous system. In packets longer than 97 * MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data 98 * may a user message buffer which is not automatically endian swapped. 99 */ 100 101 #define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION 102 51 103 52 104 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/asr.h
r5072b07 r3a4ae6c 23 23 #endif 24 24 25 #include <rtems/ modes.h>25 #include <rtems/rtems/modes.h> 26 26 27 27 /* … … 55 55 56 56 typedef struct { 57 boolean is_enabled; /* are ASRs enabled currently? */ 57 58 rtems_asr_entry handler; /* address of RTEMS_ASR */ 58 59 Modes_Control mode_set; /* RTEMS_ASR mode */ … … 168 169 ); 169 170 170 #include <rtems/ asr.inl>171 #include <rtems/rtems/asr.inl> 171 172 172 173 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/attr.h
r5072b07 r3a4ae6c 44 44 #define RTEMS_NO_INHERIT_PRIORITY 0x00000000 45 45 #define RTEMS_INHERIT_PRIORITY 0x00000020 46 47 #define RTEMS_NO_PRIORITY_CEILING 0x00000000 48 #define RTEMS_PRIORITY_CEILING 0x00000040 46 49 47 50 #if ( CPU_HARDWARE_FP == TRUE ) … … 178 181 ); 179 182 180 #include <rtems/attr.inl> 183 /* 184 * _Attributes_Is_priority_ceiling 185 * 186 * DESCRIPTION: 187 * 188 * This function returns TRUE if the priority ceiling attribute 189 * is enabled in the attribute_set and FALSE otherwise. 190 */ 191 192 STATIC INLINE boolean _Attributes_Is_priority_ceiling( 193 rtems_attribute attribute_set 194 ); 195 196 197 #include <rtems/rtems/attr.inl> 181 198 182 199 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/clock.h
r5072b07 r3a4ae6c 30 30 #endif 31 31 32 #include <rtems/tod.h> 32 #include <rtems/core/tod.h> 33 #include <rtems/rtems/types.h> 33 34 34 35 /* -
cpukit/rtems/include/rtems/rtems/dpmem.h
r5072b07 r3a4ae6c 33 33 #endif 34 34 35 #include <rtems.h> 36 #include <rtems/object.h> 35 #include <rtems/core/object.h> 37 36 38 37 /* … … 202 201 ); 203 202 204 #include <rtems/ dpmem.inl>203 #include <rtems/rtems/dpmem.inl> 205 204 206 205 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/event.h
r5072b07 r3a4ae6c 29 29 #endif 30 30 31 #include <rtems/object.h> 32 #include <rtems/options.h> 33 #include <rtems/thread.h> 34 #include <rtems/watchdog.h> 35 #include <rtems/eventset.h> 31 #include <rtems/core/object.h> 32 #include <rtems/rtems/types.h> 33 #include <rtems/rtems/options.h> 34 #include <rtems/core/thread.h> 35 #include <rtems/core/watchdog.h> 36 #include <rtems/rtems/eventset.h> 36 37 37 38 /* … … 105 106 106 107 void _Event_Seize ( 107 rtems_event_set event_in, 108 rtems_option option_set, 109 rtems_interval ticks 108 rtems_event_set event_in, 109 rtems_option option_set, 110 rtems_interval ticks, 111 rtems_event_set *event_out 110 112 ); 111 113 … … 148 150 EXTERN boolean _Event_Sync; /* event manager sync flag */ 149 151 150 #include <rtems/ event.inl>151 #include <rtems/ eventmp.h>152 #include <rtems/rtems/eventmp.h> 153 #include <rtems/rtems/event.inl> 152 154 153 155 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/eventmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ event.h>25 #include <rtems/ mppkt.h>26 #include <rtems/ object.h>27 #include <rtems/ thread.h>28 #include <rtems/ watchdog.h>24 #include <rtems/rtems/event.h> 25 #include <rtems/core/mppkt.h> 26 #include <rtems/core/object.h> 27 #include <rtems/core/thread.h> 28 #include <rtems/core/watchdog.h> 29 29 30 30 /* -
cpukit/rtems/include/rtems/rtems/eventset.h
r5072b07 r3a4ae6c 133 133 ); 134 134 135 #include <rtems/ eventset.inl>135 #include <rtems/rtems/eventset.inl> 136 136 137 137 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/intr.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ isr.h>24 #include <rtems/core/isr.h> 25 25 26 26 /* … … 29 29 30 30 typedef ISR_Level rtems_interrupt_level; 31 32 /* 33 * The following type defines the control block used to manage 34 * the vectors. 35 */ 36 37 typedef ISR_Vector_number rtems_vector_number; 38 39 /* 40 * Return type for ISR Handler 41 */ 42 43 typedef void rtems_isr; 44 45 /* 46 * Pointer to an ISR Handler 47 */ 48 49 typedef rtems_isr ( *rtems_isr_entry )( 50 rtems_vector_number 51 ); 31 52 32 53 /* -
cpukit/rtems/include/rtems/rtems/message.h
r5072b07 r3a4ae6c 35 35 #endif 36 36 37 #include <rtems/types.h> 38 #include <rtems/chain.h> 39 #include <rtems/object.h> 40 #include <rtems/threadq.h> 37 #include <rtems/rtems/types.h> 38 #include <rtems/core/chain.h> 39 #include <rtems/core/object.h> 40 #include <rtems/rtems/attr.h> 41 #include <rtems/core/threadq.h> 41 42 42 43 /* … … 469 470 ); 470 471 471 #include <rtems/ message.inl>472 #include <rtems/ msgmp.h>472 #include <rtems/rtems/message.inl> 473 #include <rtems/rtems/msgmp.h> 473 474 474 475 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/modes.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ isr.h>24 #include <rtems/core/isr.h> 25 25 26 26 /* … … 174 174 ); 175 175 176 #include <rtems/ modes.inl>176 #include <rtems/rtems/modes.inl> 177 177 178 178 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/mp.h
r5072b07 r3a4ae6c 46 46 void rtems_multiprocessing_announce ( void ); 47 47 48 /*49 *50 * _Multiprocessing_Receive_server51 *52 * DESCRIPTION:53 *54 * This routine is a server thread which processes remote requests55 * from other nodes.56 */57 58 Thread _Multiprocessing_Receive_server (59 Thread_Argument ignored60 );61 62 48 #ifdef __cplusplus 63 49 } -
cpukit/rtems/include/rtems/rtems/msgmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ message.h>25 #include <rtems/ mppkt.h>26 #include <rtems/ object.h>27 #include <rtems/ options.h>28 #include <rtems/ thread.h>29 #include <rtems/ watchdog.h>24 #include <rtems/rtems/message.h> 25 #include <rtems/core/mppkt.h> 26 #include <rtems/core/object.h> 27 #include <rtems/rtems/options.h> 28 #include <rtems/core/thread.h> 29 #include <rtems/core/watchdog.h> 30 30 31 31 /* … … 98 98 unsigned32 *size_p, 99 99 rtems_option option_set, 100 rtems_intervaltimeout100 Watchdog_Interval timeout 101 101 ); 102 102 -
cpukit/rtems/include/rtems/rtems/options.h
r5072b07 r3a4ae6c 70 70 ); 71 71 72 #include <rtems/ options.inl>72 #include <rtems/rtems/options.inl> 73 73 74 74 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/part.h
r5072b07 r3a4ae6c 32 32 #endif 33 33 34 #include <rtems .h>35 #include <rtems/ address.h>36 #include <rtems/ attr.h>37 #include <rtems/ object.h>34 #include <rtems/core/address.h> 35 #include <rtems/core/object.h> 36 #include <rtems/rtems/attr.h> 37 #include <rtems/rtems/types.h> 38 38 39 39 /* … … 281 281 ); 282 282 283 #include <rtems/ part.inl>284 #include <rtems/ partmp.h>283 #include <rtems/rtems/part.inl> 284 #include <rtems/rtems/partmp.h> 285 285 286 286 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/partmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/mppkt.h> 25 #include <rtems/object.h> 26 #include <rtems/options.h> 27 #include <rtems/part.h> 28 #include <rtems/thread.h> 24 #include <rtems/core/mppkt.h> 25 #include <rtems/core/object.h> 26 #include <rtems/rtems/options.h> 27 #include <rtems/core/thread.h> 28 29 #include <rtems/rtems/part.h> 29 30 30 31 /* -
cpukit/rtems/include/rtems/rtems/ratemon.h
r5072b07 r3a4ae6c 30 30 #endif 31 31 32 #include <rtems.h> 33 #include <rtems/object.h> 34 #include <rtems/thread.h> 35 #include <rtems/watchdog.h> 32 #include <rtems/core/object.h> 33 #include <rtems/core/thread.h> 34 #include <rtems/core/watchdog.h> 36 35 37 36 /* … … 51 50 */ 52 51 53 #define RTEMS_PERIOD_STATUS RTEMS_NO_TIMEOUT52 #define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT 54 53 55 54 /* … … 149 148 150 149 rtems_status_code rtems_rate_monotonic_period( 151 Objects_Id 152 rtems_interval length150 Objects_Id id, 151 rtems_interval length 153 152 ); 154 153 … … 277 276 ); 278 277 279 #include <rtems/r atemon.inl>278 #include <rtems/rtems/ratemon.inl> 280 279 281 280 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/region.h
r5072b07 r3a4ae6c 31 31 #endif 32 32 33 #include <rtems.h> 34 #include <rtems/object.h> 35 #include <rtems/threadq.h> 36 #include <rtems/heap.h> 33 #include <rtems/core/object.h> 34 #include <rtems/core/threadq.h> 35 #include <rtems/core/heap.h> 37 36 #include <rtems/debug.h> 37 #include <rtems/rtems/attr.h> 38 #include <rtems/rtems/types.h> 38 39 39 40 /* … … 159 160 Objects_Id id, 160 161 unsigned32 size, 161 rtems_option option_set,162 rtems_interval timeout,162 rtems_option option_set, 163 rtems_interval timeout, 163 164 void **segment 164 165 ); … … 279 280 ); 280 281 281 #include <rtems/r egion.inl>282 #include <rtems/r egionmp.h>282 #include <rtems/rtems/region.inl> 283 #include <rtems/rtems/regionmp.h> 283 284 284 285 /* -
cpukit/rtems/include/rtems/rtems/regionmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/mppkt.h> 25 #include <rtems/object.h> 26 #include <rtems/options.h> 27 #include <rtems/region.h> 28 #include <rtems/thread.h> 24 #include <rtems/core/mppkt.h> 25 #include <rtems/core/object.h> 26 #include <rtems/core/thread.h> 27 28 #include <rtems/rtems/options.h> 29 #include <rtems/rtems/region.h> 29 30 30 31 /* … … 88 89 void *segment, 89 90 unsigned32 size, 90 rtems_option option_set,91 rtems_interval timeout91 rtems_option option_set, 92 rtems_interval timeout 92 93 ); 93 94 -
cpukit/rtems/include/rtems/rtems/sem.h
r5072b07 r3a4ae6c 32 32 #endif 33 33 34 #include <rtems.h> 35 #include <rtems/attr.h> 36 #include <rtems/object.h> 37 #include <rtems/threadq.h> 34 #include <rtems/rtems/types.h> 35 #include <rtems/rtems/support.h> 36 #include <rtems/rtems/tasks.h> 37 #include <rtems/rtems/attr.h> 38 #include <rtems/core/coremutex.h> 39 #include <rtems/core/object.h> 40 #include <rtems/core/coresem.h> 41 #include <rtems/core/threadq.h> 38 42 39 43 /* … … 42 46 43 47 typedef struct { 44 Objects_Control Object; 45 Thread_queue_Control Wait_queue; 46 rtems_attribute attribute_set; 47 unsigned32 count; 48 unsigned32 nest_count; 49 Thread_Control *holder; 50 Objects_Id holder_id; 48 Objects_Control Object; 49 rtems_attribute attribute_set; 50 union { 51 CORE_mutex_Control mutex; 52 CORE_semaphore_Control semaphore; 53 } Core_control; 51 54 } Semaphore_Control; 52 55 … … 83 86 84 87 rtems_status_code rtems_semaphore_create( 85 rtems_name 86 unsigned32 87 rtems_attribute 88 rtems_task_priority 89 Objects_Id*id88 rtems_name name, 89 unsigned32 count, 90 rtems_attribute attribute_set, 91 rtems_task_priority priority_ceiling, 92 rtems_id *id 90 93 ); 91 94 … … 107 110 rtems_name name, 108 111 unsigned32 node, 109 Objects_Id*id112 rtems_id *id 110 113 ); 111 114 … … 120 123 121 124 rtems_status_code rtems_semaphore_delete( 122 Objects_Idid125 rtems_id id 123 126 ); 124 127 … … 138 141 139 142 rtems_status_code rtems_semaphore_obtain( 140 Objects_Idid,141 unsigned32 143 rtems_id id, 144 unsigned32 option_set, 142 145 rtems_interval timeout 143 146 ); … … 156 159 157 160 rtems_status_code rtems_semaphore_release( 158 Objects_Idid161 rtems_id id 159 162 ); 160 163 … … 214 217 215 218 STATIC INLINE Semaphore_Control *_Semaphore_Get ( 216 Objects_Idid,219 rtems_id id, 217 220 Objects_Locations *location 218 221 ); … … 230 233 ); 231 234 232 #include <rtems/sem.inl> 233 #include <rtems/semmp.h> 235 /* 236 * _Semaphore_Translate_core_mutex_return_code 237 * 238 * DESCRIPTION: 239 * 240 * This function returns a RTEMS status code based on the mutex 241 * status code specified. 242 */ 243 244 rtems_status_code _Semaphore_Translate_core_mutex_return_code ( 245 unsigned32 the_mutex_status 246 ); 247 248 /* 249 * _Semaphore_Translate_core_semaphore_return_code 250 * 251 * DESCRIPTION: 252 * 253 * This function returns a RTEMS status code based on the semaphore 254 * status code specified. 255 */ 256 257 rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( 258 unsigned32 the_mutex_status 259 ); 260 261 /*PAGE 262 * 263 * _Semaphore_Core_mutex_mp_support 264 * 265 * DESCRIPTION: 266 * 267 * This function processes the global actions necessary for remote 268 * accesses to a global semaphore based on a core mutex. This function 269 * is called by the core. 270 */ 271 272 void _Semaphore_Core_mutex_mp_support ( 273 Thread_Control *the_thread, 274 rtems_id id 275 ); 276 277 /*PAGE 278 * 279 * _Semaphore_Core_mp_support 280 * 281 * DESCRIPTION: 282 * 283 * This function processes the global actions necessary for remote 284 * accesses to a global semaphore based on a core semaphore. This function 285 * is called by the core. 286 */ 287 288 void _Semaphore_Core_semaphore_mp_support ( 289 Thread_Control *the_thread, 290 rtems_id id 291 ); 292 293 #include <rtems/rtems/sem.inl> 294 #include <rtems/rtems/semmp.h> 234 295 235 296 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/semmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ mppkt.h>25 #include <rtems/ object.h>26 #include <rtems/ options.h>27 #include <rtems/ sem.h>28 #include <rtems/ thread.h>29 #include <rtems/ watchdog.h>24 #include <rtems/core/mppkt.h> 25 #include <rtems/core/object.h> 26 #include <rtems/rtems/options.h> 27 #include <rtems/rtems/sem.h> 28 #include <rtems/core/thread.h> 29 #include <rtems/core/watchdog.h> 30 30 31 31 /* … … 85 85 Semaphore_MP_Remote_operations operation, 86 86 Objects_Id semaphore_id, 87 rtems_option option_set,88 rtems_interval timeout87 rtems_option option_set, 88 rtems_interval timeout 89 89 ); 90 90 -
cpukit/rtems/include/rtems/rtems/signal.h
r5072b07 r3a4ae6c 28 28 #endif 29 29 30 #include <rtems/asr.h> 31 #include <rtems/modes.h> 32 #include <rtems/object.h> 33 #include <rtems/status.h> 34 #include <rtems/types.h> 30 #include <rtems/rtems/asr.h> 31 #include <rtems/rtems/modes.h> 32 #include <rtems/core/object.h> 33 #include <rtems/rtems/status.h> 34 #include <rtems/rtems/types.h> 35 36 /* 37 * _Signal_Manager_initialization 38 * 39 * DESCRIPTION: 40 * 41 * This routine performs the initialization necessary for this manager. 42 */ 43 44 void _Signal_Manager_initialization( void ); 35 45 36 46 /* … … 64 74 ); 65 75 66 #include <rtems/ signalmp.h>76 #include <rtems/rtems/signalmp.h> 67 77 68 78 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/signalmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ asr.h>25 #include <rtems/ mppkt.h>26 #include <rtems/ object.h>27 #include <rtems/ thread.h>28 #include <rtems/ watchdog.h>24 #include <rtems/rtems/asr.h> 25 #include <rtems/core/mppkt.h> 26 #include <rtems/core/object.h> 27 #include <rtems/core/thread.h> 28 #include <rtems/core/watchdog.h> 29 29 30 30 /* -
cpukit/rtems/include/rtems/rtems/status.h
r5072b07 r3a4ae6c 53 53 RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */ 54 54 RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */ 55 RTEMS_PROXY_BLOCKING = 26, /* internal multiprocessing only */ 56 RTEMS_NO_MEMORY = 27 /* could not get enough memory */ 55 RTEMS_NO_MEMORY = 26 /* could not get enough memory */ 57 56 } rtems_status_code; 58 57 59 58 #define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL 60 59 #define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY 60 61 extern rtems_status_code _Status_Object_name_errors_to_status[]; 62 63 #ifdef INIT 64 rtems_status_code _Status_Object_name_errors_to_status[] = { 65 RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */ 66 RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */ 67 RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */ 68 }; 69 #endif 61 70 62 71 /* … … 87 96 ); 88 97 89 /* 90 * _Status_Is_proxy_blocking 91 * 92 * DESCRIPTION: 93 * 94 * This function returns TRUE if the status code is equal to the 95 * status which indicates that a proxy is blocking, and FALSE otherwise. 96 */ 97 98 STATIC INLINE boolean _Status_Is_proxy_blocking ( 99 rtems_status_code code 100 ); 101 102 #include <rtems/status.inl> 98 #include <rtems/rtems/status.inl> 103 99 104 100 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/support.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ types.h>24 #include <rtems/rtems/types.h> 25 25 26 26 /* … … 71 71 ); 72 72 73 #include <rtems/support.inl> 73 /* 74 * rtems_get_class 75 * 76 * DESCRIPTION: 77 * 78 * This function returns the class portion of the ID. 79 * 80 */ 81 82 #define rtems_get_class( _id ) \ 83 _Objects_Get_class( _id ) 84 85 /* 86 * rtems_get_node 87 * 88 * DESCRIPTION: 89 * 90 * This function returns the node portion of the ID. 91 * 92 */ 93 94 #define rtems_get_node( _id ) \ 95 _Objects_Get_node( _id ) 96 97 /* 98 * rtems_get_index 99 * 100 * DESCRIPTION: 101 * 102 * This function returns the index portion of the ID. 103 * 104 */ 105 106 #define rtems_get_index( _id ) \ 107 _Objects_Get_index( _id ) 108 109 /* 110 * Time related 111 */ 112 113 #define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \ 114 TOD_MILLISECONDS_TO_MICROSECONDS(_ms) 115 #define RTEMS_MILLISECONDS_TO_TICKS(_ms) \ 116 TOD_MILLISECONDS_TO_TICKS(_ms) 117 118 #include <rtems/rtems/support.inl> 74 119 75 120 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/taskmp.h
r5072b07 r3a4ae6c 22 22 #endif 23 23 24 #include <rtems/ mppkt.h>25 #include <rtems/ object.h>26 #include <rtems/ options.h>27 #include <rtems/ priority.h>28 #include <rtems/ tasks.h>29 #include <rtems/ thread.h>24 #include <rtems/core/mppkt.h> 25 #include <rtems/core/object.h> 26 #include <rtems/rtems/options.h> 27 #include <rtems/core/priority.h> 28 #include <rtems/rtems/tasks.h> 29 #include <rtems/core/thread.h> 30 30 31 31 /* -
cpukit/rtems/include/rtems/rtems/tasks.h
r5072b07 r3a4ae6c 39 39 #endif 40 40 41 #include <rtems.h> 42 #include <rtems/message.h> 43 #include <rtems/object.h> 44 #include <rtems/part.h> 45 #include <rtems/region.h> 46 #include <rtems/sem.h> 47 #include <rtems/states.h> 48 #include <rtems/thread.h> 49 #include <rtems/threadq.h> 50 #include <rtems/types.h> 41 #include <rtems/core/object.h> 42 #include <rtems/core/states.h> 43 #include <rtems/core/thread.h> 44 #include <rtems/rtems/types.h> 45 #include <rtems/rtems/eventset.h> 46 #include <rtems/rtems/asr.h> 47 #include <rtems/rtems/attr.h> 51 48 52 49 /* … … 61 58 */ 62 59 63 #define RTEMS_YIELD_PROCESSOR RTEMS_NO_TIMEOUT 60 #define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT 61 62 /* 63 * Define the type for an RTEMS API task priority. 64 */ 65 66 typedef Priority_Control rtems_task_priority; 67 68 #define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY 69 70 #define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1) 71 #define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM 72 73 /* 74 * The following constant is passed to rtems_task_set_priority when the 75 * caller wants to obtain the current priority. 76 */ 77 78 #define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM 79 80 /* 81 * Notepads constants (indices into notepad array) 82 */ 83 84 #define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */ 85 #define RTEMS_NOTEPAD_0 0 /* notepad location 0 */ 86 #define RTEMS_NOTEPAD_1 1 /* notepad location 1 */ 87 #define RTEMS_NOTEPAD_2 2 /* notepad location 2 */ 88 #define RTEMS_NOTEPAD_3 3 /* notepad location 3 */ 89 #define RTEMS_NOTEPAD_4 4 /* notepad location 4 */ 90 #define RTEMS_NOTEPAD_5 5 /* notepad location 5 */ 91 #define RTEMS_NOTEPAD_6 6 /* notepad location 6 */ 92 #define RTEMS_NOTEPAD_7 7 /* notepad location 7 */ 93 #define RTEMS_NOTEPAD_8 8 /* notepad location 8 */ 94 #define RTEMS_NOTEPAD_9 9 /* notepad location 9 */ 95 #define RTEMS_NOTEPAD_10 10 /* notepad location 10 */ 96 #define RTEMS_NOTEPAD_11 11 /* notepad location 11 */ 97 #define RTEMS_NOTEPAD_12 12 /* notepad location 12 */ 98 #define RTEMS_NOTEPAD_13 13 /* notepad location 13 */ 99 #define RTEMS_NOTEPAD_14 14 /* notepad location 14 */ 100 #define RTEMS_NOTEPAD_15 15 /* notepad location 15 */ 101 #define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */ 102 103 #define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1) 104 105 /* 106 * External API name for Thread_Control 107 */ 108 109 typedef Thread_Control rtems_tcb; 110 111 /* 112 * The following defines the "return type" of an RTEMS task. 113 */ 114 115 typedef void rtems_task; 116 117 /* 118 * The following defines the argument to an RTEMS task. 119 */ 120 121 typedef unsigned32 rtems_task_argument; 122 123 /* 124 * The following defines the type for the entry point of an RTEMS task. 125 */ 126 127 typedef rtems_task ( *rtems_task_entry )( 128 rtems_task_argument 129 ); 130 131 /* 132 * The following records define the Initialization Tasks Table. 133 * Each entry contains the information required by RTEMS to 134 * create and start a user task automatically at executive 135 * initialization time. 136 */ 137 138 typedef struct { 139 rtems_name name; /* task name */ 140 unsigned32 stack_size; /* task stack size */ 141 rtems_task_priority initial_priority; /* task priority */ 142 rtems_attribute attribute_set; /* task attributes */ 143 rtems_task_entry entry_point; /* task entry point */ 144 rtems_mode mode_set; /* task initial mode */ 145 unsigned32 argument; /* task argument */ 146 } rtems_initialization_tasks_table; 147 148 /* 149 * This is the API specific information required by each thread for 150 * the RTEMS API to function correctly. 151 */ 152 153 154 typedef struct { 155 unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ]; 156 rtems_event_set pending_events; 157 rtems_event_set event_condition; 158 ASR_Information Signal; 159 } RTEMS_API_Control; 64 160 65 161 /* … … 71 167 72 168 /* 169 * These are used to manage the user initialization tasks. 170 */ 171 172 EXTERN rtems_initialization_tasks_table *_RTEMS_tasks_User_initialization_tasks; 173 EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks; 174 175 /* 73 176 * _RTEMS_tasks_Manager_initialization 74 177 * … … 79 182 80 183 void _RTEMS_tasks_Manager_initialization( 81 unsigned32 maximum_tasks 184 unsigned32 maximum_tasks, 185 unsigned32 number_of_initialization_tasks, 186 rtems_initialization_tasks_table *user_tasks 82 187 ); 83 188 … … 285 390 286 391 rtems_status_code rtems_task_wake_after( 287 rtems_interval ticks392 rtems_interval ticks 288 393 ); 289 394 … … 314 419 315 420 /* 316 * _RTEMS_tasks_Cancel_wait 317 * 318 * DESCRIPTION: 319 * 320 * This routine unblocks the_thread and cancels any timers 321 * which the_thread has active. 322 */ 323 324 STATIC INLINE void _RTEMS_tasks_Cancel_wait( 325 Thread_Control *the_thread 326 ); 327 328 /* 329 * _RTEMS_Tasks_Priority_to_Core 421 * _RTEMS_tasks_Priority_to_Core 330 422 * 331 423 * DESCRIPTION: … … 334 426 */ 335 427 336 STATIC INLINE Priority_Control _RTEMS_ Tasks_Priority_to_Core(428 STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( 337 429 rtems_task_priority priority 338 430 ); 339 431 340 #include <rtems/tasks.inl> 341 #include <rtems/taskmp.h> 432 /*PAGE 433 * 434 * _RTEMS_tasks_Initialize_user_tasks 435 * 436 * This routine creates and starts all configured user 437 * initialzation threads. 438 * 439 * Input parameters: NONE 440 * 441 * Output parameters: NONE 442 */ 443 444 void _RTEMS_tasks_Initialize_user_tasks( void ); 445 446 /*PAGE 447 * 448 * _RTEMS_tasks_Priority_is_valid 449 * 450 */ 451 452 STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( 453 rtems_task_priority the_priority 454 ); 455 456 #include <rtems/rtems/tasks.inl> 457 #include <rtems/rtems/taskmp.h> 342 458 343 459 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/timer.h
r5072b07 r3a4ae6c 34 34 #endif 35 35 36 #include <rtems.h> 37 #include <rtems/object.h> 38 #include <rtems/tod.h> 39 #include <rtems/watchdog.h> 36 #include <rtems/core/object.h> 37 #include <rtems/core/tod.h> 38 #include <rtems/core/watchdog.h> 40 39 41 40 /* … … 51 50 52 51 /* 53 * The following defines the type of a Timer Service Routine. 54 */ 55 56 typedef rtems_timer_service_routine_entry Timer_Service; 52 * The following types define a pointer to a timer service routine. 53 */ 54 55 typedef void rtems_timer_service_routine; 56 57 typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( 58 rtems_id, 59 void * 60 ); 57 61 58 62 /* … … 154 158 155 159 rtems_status_code rtems_timer_fire_after( 156 Objects_Id id,157 rtems_interval ticks,158 Timer_Serviceroutine,159 void *user_data160 Objects_Id id, 161 rtems_interval ticks, 162 rtems_timer_service_routine_entry routine, 163 void *user_data 160 164 ); 161 165 … … 171 175 172 176 rtems_status_code rtems_timer_fire_when( 173 Objects_Id id,174 rtems_time_of_day *wall_time,175 Timer_Serviceroutine,176 void *user_data177 Objects_Id id, 178 rtems_time_of_day *wall_time, 179 rtems_timer_service_routine_entry routine, 180 void *user_data 177 181 ); 178 182 … … 284 288 ); 285 289 286 #include <rtems/ timer.inl>290 #include <rtems/rtems/timer.inl> 287 291 288 292 #ifdef __cplusplus -
cpukit/rtems/include/rtems/rtems/types.h
r5072b07 r3a4ae6c 21 21 #endif 22 22 23 #include <rtems/object.h> 24 #include <rtems/priority.h> 25 #include <rtems/modes.h> 23 #include <rtems/core/object.h> 24 #include <rtems/core/priority.h> 25 #include <rtems/rtems/modes.h> 26 #include <rtems/core/mpci.h> 27 #include <rtems/core/mppkt.h> 26 28 27 29 /* … … 52 54 53 55 /* 54 * Define the type for an RTEMS API task priority.56 * Time related 55 57 */ 56 58 57 typedef Priority_Control rtems_task_priority; 59 typedef Watchdog_Interval rtems_interval; 60 typedef TOD_Control rtems_time_of_day; 58 61 59 #define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY60 62 /* 61 63 * Define the type for an RTEMS API task mode. … … 63 65 64 66 typedef Modes_Control rtems_mode; 67 68 /* 69 * MPCI related entries 70 */ 71 72 typedef MP_packet_Classes rtems_mp_packet_classes; 73 typedef MP_packet_Prefix rtems_packet_prefix; 74 75 typedef MPCI_initialization_entry rtems_mpci_initialization_entry; 76 typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry; 77 typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry; 78 typedef MPCI_send_entry rtems_mpci_send_packet_entry; 79 typedef MPCI_receive_entry rtems_mpci_receive_packet_entry; 80 81 typedef MPCI_Entry rtems_mpci_entry; 82 83 typedef MPCI_Control rtems_mpci_table; 65 84 66 85 #ifdef __cplusplus -
cpukit/rtems/inline/rtems/rtems/asr.inl
r5072b07 r3a4ae6c 18 18 #define __INLINE_ASR_inl 19 19 20 #include <rtems/ isr.h>20 #include <rtems/core/isr.h> 21 21 22 22 /*PAGE … … 30 30 ) 31 31 { 32 information->is_enabled = TRUE; 32 33 information->handler = NULL; 33 34 information->mode_set = RTEMS_DEFAULT_MODES; … … 48 49 { 49 50 rtems_signal_set _signals; 50 ISR_Level 51 ISR_Level _level; 51 52 52 53 _ISR_Disable( _level ); -
cpukit/rtems/inline/rtems/rtems/attr.inl
r5072b07 r3a4ae6c 109 109 } 110 110 111 /*PAGE 112 * 113 * _Attributes_Is_priority_ceiling 114 * 115 */ 116 117 STATIC INLINE boolean _Attributes_Is_priority_ceiling( 118 rtems_attribute attribute_set 119 ) 120 { 121 return ( attribute_set & RTEMS_PRIORITY_CEILING ); 122 } 123 111 124 #endif 112 125 /* end of include file */ -
cpukit/rtems/inline/rtems/rtems/event.inl
r5072b07 r3a4ae6c 25 25 { 26 26 _Event_Sync = FALSE; 27 28 /* 29 * Register the MP Process Packet routine. 30 */ 31 32 _MPCI_Register_packet_processor( MP_PACKET_EVENT, _Event_MP_Process_packet ); 27 33 } 28 34 -
cpukit/rtems/inline/rtems/rtems/message.inl
r5072b07 r3a4ae6c 18 18 #define __MESSAGE_QUEUE_inl 19 19 20 #include <rtems/ wkspace.h>20 #include <rtems/core/wkspace.h> 21 21 22 22 /*PAGE -
cpukit/rtems/inline/rtems/rtems/modes.inl
r5072b07 r3a4ae6c 54 54 ) 55 55 { 56 return ( mode_set & RTEMS_ASR_MASK );56 return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR; 57 57 } 58 58 … … 67 67 ) 68 68 { 69 return ( ( mode_set & RTEMS_PREEMPT_MASK ) == RTEMS_PREEMPT );69 return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT; 70 70 } 71 71 … … 80 80 ) 81 81 { 82 return ((mode_set & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == 83 (RTEMS_TIMESLICE|RTEMS_PREEMPT) ); 82 return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; 84 83 } 85 84 -
cpukit/rtems/inline/rtems/rtems/status.inl
r5072b07 r3a4ae6c 45 45 } 46 46 47 /*48 * _Status_Is_proxy_blocking49 *50 */51 52 STATIC INLINE boolean _Status_Is_proxy_blocking (53 rtems_status_code code54 )55 {56 return (code == RTEMS_PROXY_BLOCKING);57 }58 59 47 #endif 60 48 /* end of include file */ -
cpukit/rtems/inline/rtems/rtems/tasks.inl
r5072b07 r3a4ae6c 17 17 #ifndef __RTEMS_TASKS_inl 18 18 #define __RTEMS_TASKS_inl 19 20 #include <rtems/msgmp.h>21 #include <rtems/partmp.h>22 #include <rtems/regionmp.h>23 #include <rtems/semmp.h>24 19 25 20 /*PAGE … … 52 47 /*PAGE 53 48 * 54 * _RTEMS_tasks_Cancel_wait 55 * 56 */ 57 58 STATIC INLINE void _RTEMS_tasks_Cancel_wait( 59 Thread_Control *the_thread 60 ) 61 { 62 States_Control state; 63 States_Control remote_state; 64 65 state = the_thread->current_state; 66 67 /* XXX do this with the object class */ 68 if ( _States_Is_waiting_on_thread_queue( state ) ) { 69 if ( _States_Is_waiting_for_rpc_reply( state ) && 70 _States_Is_locally_blocked( state ) ) { 71 remote_state = _States_Clear( 72 STATES_WAITING_FOR_RPC_REPLY | STATES_TRANSIENT, 73 state 74 ); 75 76 switch ( remote_state ) { 77 78 case STATES_WAITING_FOR_BUFFER: 79 _Partition_MP_Send_extract_proxy( the_thread ); 80 break; 81 case STATES_WAITING_FOR_SEGMENT: 82 _Region_MP_Send_extract_proxy( the_thread ); 83 break; 84 case STATES_WAITING_FOR_SEMAPHORE: 85 _Semaphore_MP_Send_extract_proxy( the_thread ); 86 break; 87 case STATES_WAITING_FOR_MESSAGE: 88 _Message_queue_MP_Send_extract_proxy( the_thread ); 89 break; 90 } 91 } 92 _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); 93 } 94 else if ( _Watchdog_Is_active( &the_thread->Timer ) ) 95 (void) _Watchdog_Remove( &the_thread->Timer ); 96 } 97 98 /*PAGE 99 * 100 * _RTEMS_Tasks_Priority_to_Core 49 * _RTEMS_tasks_Priority_to_Core 101 50 */ 102 51 103 STATIC INLINE Priority_Control _RTEMS_ Tasks_Priority_to_Core(52 STATIC INLINE Priority_Control _RTEMS_tasks_Priority_to_Core( 104 53 rtems_task_priority priority 105 54 ) … … 108 57 } 109 58 59 /*PAGE 60 * 61 * _RTEMS_tasks_Priority_is_valid 62 * 63 */ 64 65 STATIC INLINE boolean _RTEMS_tasks_Priority_is_valid ( 66 rtems_task_priority the_priority 67 ) 68 { 69 return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) && 70 ( the_priority <= RTEMS_MAXIMUM_PRIORITY ) ); 71 } 72 110 73 #endif 111 74 /* end of include file */ -
cpukit/rtems/macros/rtems/rtems/asr.inl
r5072b07 r3a4ae6c 18 18 #define __INLINE_ASR_h 19 19 20 #include <rtems/ isr.h>20 #include <rtems/core/isr.h> 21 21 22 22 /*PAGE … … 28 28 #define _ASR_Initialize( _information ) \ 29 29 { \ 30 (_information)->is_enabled = TRUE; \ 30 31 (_information)->handler = NULL; \ 31 32 (_information)->mode_set = RTEMS_DEFAULT_MODES; \ -
cpukit/rtems/macros/rtems/rtems/attr.inl
r5072b07 r3a4ae6c 79 79 ( (_attribute_set) & RTEMS_INHERIT_PRIORITY ) 80 80 81 /*PAGE 82 * 83 * _Attributes_Is_priority_ceiling 84 * 85 */ 86 87 #define _Attributes_Is_priority_ceiling( _attribute_set ) \ 88 ( (_attribute_set) & RTEMS_PRIORITY_CEILING ) 89 81 90 #endif 82 91 /* end of include file */ -
cpukit/rtems/macros/rtems/rtems/event.inl
r5072b07 r3a4ae6c 23 23 24 24 #define _Event_Manager_initialization() \ 25 _Event_Sync = FALSE 25 do { \ 26 \ 27 _Event_Sync = FALSE; \ 28 \ 29 /* \ 30 * Register the MP Process Packet routine. \ 31 */ \ 32 \ 33 _MPCI_Register_packet_processor( \ 34 MP_PACKET_EVENT, \ 35 _Event_MP_Process_packet \ 36 ); \ 37 } while ( 0 ) 26 38 27 39 #endif -
cpukit/rtems/macros/rtems/rtems/modes.inl
r5072b07 r3a4ae6c 42 42 43 43 #define _Modes_Is_asr_disabled( _mode_set ) \ 44 ( (_mode_set) & RTEMS_ASR_MASK)44 (((_mode_set) & RTEMS_ASR_MASK) == RTEMS_NO_ASR) 45 45 46 46 /*PAGE … … 60 60 61 61 #define _Modes_Is_timeslice( _mode_set ) \ 62 (((_mode_set) & (RTEMS_TIMESLICE_MASK|RTEMS_PREEMPT_MASK)) == \ 63 (RTEMS_TIMESLICE|RTEMS_PREEMPT) ) 62 (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE) 64 63 65 64 /*PAGE -
cpukit/rtems/macros/rtems/rtems/status.inl
r5072b07 r3a4ae6c 36 36 ((_code1) == (_code2)) 37 37 38 /*39 * _Status_Is_proxy_blocking40 *41 */42 43 #define _Status_Is_proxy_blocking( _code ) \44 ( (_code) == RTEMS_PROXY_BLOCKING )45 46 38 #endif 47 39 /* end of include file */ -
cpukit/rtems/macros/rtems/rtems/tasks.inl
r5072b07 r3a4ae6c 17 17 #ifndef __RTEMS_TASKS_inl 18 18 #define __RTEMS_TASKS_inl 19 20 #include <rtems/msgmp.h>21 #include <rtems/partmp.h>22 #include <rtems/regionmp.h>23 #include <rtems/semmp.h>24 19 25 20 /*PAGE … … 43 38 /*PAGE 44 39 * 45 * _RTEMS_tasks_Cancel_wait 46 * 40 * _RTEMS_tasks_Priority_to_Core 47 41 */ 48 49 #define _RTEMS_tasks_Cancel_wait( _the_thread ) \ 50 { \ 51 States_Control _state; \ 52 States_Control _remote_state; \ 53 \ 54 _state = (_the_thread)->current_state; \ 55 \ 56 if ( _States_Is_waiting_on_thread_queue( _state ) ) { \ 57 if ( _States_Is_waiting_for_rpc_reply( _state ) && \ 58 _States_Is_locally_blocked( _state ) ) { \ 59 _remote_state = _States_Clear( \ 60 STATES_WAITING_FOR_RPC_REPLY + STATES_TRANSIENT, \ 61 _state \ 62 ); \ 63 \ 64 switch ( _remote_state ) { \ 65 \ 66 case STATES_WAITING_FOR_BUFFER: \ 67 _Partition_MP_Send_extract_proxy( (_the_thread) ); \ 68 break; \ 69 case STATES_WAITING_FOR_SEGMENT: \ 70 _Region_MP_Send_extract_proxy( (_the_thread) ); \ 71 break; \ 72 case STATES_WAITING_FOR_SEMAPHORE: \ 73 _Semaphore_MP_Send_extract_proxy( (_the_thread) ); \ 74 break; \ 75 case STATES_WAITING_FOR_MESSAGE: \ 76 _Message_queue_MP_Send_extract_proxy( (_the_thread) ); \ 77 break; \ 78 } \ 79 } \ 80 _Thread_queue_Extract( (_the_thread)->Wait.queue, (_the_thread) ); \ 81 } \ 82 else if ( _Watchdog_Is_active( &(_the_thread)->Timer ) ) \ 83 (void) _Watchdog_Remove( &(_the_thread)->Timer ); \ 84 } 42 43 #define _RTEMS_tasks_Priority_to_Core( _priority ) \ 44 ((Priority_Control) (_priority)) 85 45 86 46 /*PAGE 87 47 * 88 * _RTEMS_Tasks_Priority_to_Core 48 * _RTEMS_tasks_Priority_is_valid 49 * 89 50 */ 90 51 91 #define _RTEMS_Tasks_Priority_to_Core( _priority ) \ 92 ((Priority_Control) (_priority)) 52 #define _RTEMS_tasks_Priority_is_valid( _the_priority ) \ 53 ( ((_the_priority) >= RTEMS_MINIMUM_PRIORITY) && \ 54 ((_the_priority) <= RTEMS_MAXIMUM_PRIORITY) ) 55 93 56 94 57 #endif -
cpukit/rtems/src/dpmem.c
r5072b07 r3a4ae6c 14 14 15 15 #include <rtems/system.h> 16 #include <rtems/support.h> 17 #include <rtems/address.h> 18 #include <rtems/dpmem.h> 19 #include <rtems/object.h> 20 #include <rtems/thread.h> 16 #include <rtems/rtems/status.h> 17 #include <rtems/rtems/support.h> 18 #include <rtems/core/address.h> 19 #include <rtems/rtems/dpmem.h> 20 #include <rtems/core/object.h> 21 #include <rtems/core/thread.h> 22 #include <rtems/rtems/dpmem.h> 21 23 22 24 /*PAGE … … 79 81 80 82 if ( !rtems_is_name_valid( name) ) 81 return ( RTEMS_INVALID_NAME );83 return RTEMS_INVALID_NAME; 82 84 83 85 if ( !_Addresses_Is_aligned( internal_start ) || 84 86 !_Addresses_Is_aligned( external_start ) ) 85 return ( RTEMS_INVALID_ADDRESS );87 return RTEMS_INVALID_ADDRESS; 86 88 87 89 _Thread_Disable_dispatch(); /* to prevent deletion */ … … 91 93 if ( !the_port ) { 92 94 _Thread_Enable_dispatch(); 93 return ( RTEMS_TOO_MANY );95 return RTEMS_TOO_MANY; 94 96 } 95 97 … … 106 108 *id = the_port->Object.id; 107 109 _Thread_Enable_dispatch(); 108 return ( RTEMS_SUCCESSFUL );110 return RTEMS_SUCCESSFUL; 109 111 } 110 112 … … 131 133 ) 132 134 { 133 return(134 _Objects_Name_to_id( 135 &_Dual_ported_memory_Information,136 &name,137 RTEMS_SEARCH_ALL_NODES,138 id139 )135 Objects_Name_to_id_errors status; 136 137 status = _Objects_Name_to_id( 138 &_Dual_ported_memory_Information, 139 &name, 140 OBJECTS_SEARCH_ALL_NODES, 141 id 140 142 ); 143 144 return _Status_Object_name_errors_to_status[ status ]; 141 145 } 142 146 … … 166 170 switch ( location ) { 167 171 case OBJECTS_ERROR: 168 return ( RTEMS_INVALID_ID );172 return RTEMS_INVALID_ID; 169 173 case OBJECTS_REMOTE: /* this error cannot be returned */ 170 return ( RTEMS_INTERNAL_ERROR );174 return RTEMS_INTERNAL_ERROR; 171 175 case OBJECTS_LOCAL: 172 176 _Objects_Close( &_Dual_ported_memory_Information, &the_port->Object ); 173 177 _Dual_ported_memory_Free( the_port ); 174 178 _Thread_Enable_dispatch(); 175 return ( RTEMS_SUCCESSFUL );176 } 177 178 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */179 return RTEMS_SUCCESSFUL; 180 } 181 182 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 179 183 } 180 184 … … 211 215 switch ( location ) { 212 216 case OBJECTS_ERROR: 213 return ( RTEMS_INVALID_ID );217 return RTEMS_INVALID_ID; 214 218 case OBJECTS_REMOTE: /* this error cannot be returned */ 215 return ( RTEMS_INTERNAL_ERROR );219 return RTEMS_INTERNAL_ERROR; 216 220 case OBJECTS_LOCAL: 217 221 ending = _Addresses_Subtract( internal, the_port->internal_base ); … … 222 226 ending ); 223 227 _Thread_Enable_dispatch(); 224 return ( RTEMS_SUCCESSFUL );225 } 226 227 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */228 return RTEMS_SUCCESSFUL; 229 } 230 231 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 228 232 } 229 233 … … 260 264 switch ( location ) { 261 265 case OBJECTS_ERROR: 262 return ( RTEMS_INVALID_ID );266 return RTEMS_INVALID_ID; 263 267 case OBJECTS_REMOTE: /* this error cannot be returned */ 264 return ( RTEMS_INTERNAL_ERROR );268 return RTEMS_INTERNAL_ERROR; 265 269 case OBJECTS_LOCAL: 266 270 ending = _Addresses_Subtract( external, the_port->external_base ); … … 271 275 ending ); 272 276 _Thread_Enable_dispatch(); 273 return ( RTEMS_SUCCESSFUL );274 } 275 276 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */277 } 277 return RTEMS_SUCCESSFUL; 278 } 279 280 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 281 } -
cpukit/rtems/src/event.c
r5072b07 r3a4ae6c 14 14 15 15 #include <rtems/system.h> 16 #include <rtems/event.h> 17 #include <rtems/isr.h> 18 #include <rtems/object.h> 19 #include <rtems/options.h> 20 #include <rtems/states.h> 21 #include <rtems/thread.h> 16 #include <rtems/rtems/status.h> 17 #include <rtems/rtems/event.h> 18 #include <rtems/core/isr.h> 19 #include <rtems/core/object.h> 20 #include <rtems/rtems/options.h> 21 #include <rtems/core/states.h> 22 #include <rtems/core/thread.h> 23 #include <rtems/rtems/tasks.h> 22 24 23 25 /*PAGE … … 43 45 register Thread_Control *the_thread; 44 46 Objects_Locations location; 47 RTEMS_API_Control *api; 45 48 46 49 the_thread = _Thread_Get( id, &location ); 47 50 switch ( location ) { 48 51 case OBJECTS_ERROR: 49 return ( RTEMS_INVALID_ID );52 return RTEMS_INVALID_ID; 50 53 case OBJECTS_REMOTE: 51 54 return( … … 57 60 ); 58 61 case OBJECTS_LOCAL: 59 _Event_sets_Post( event_in, &the_thread->RTEMS_API->pending_events ); 62 api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; 63 _Event_sets_Post( event_in, &api->pending_events ); 60 64 _Event_Surrender( the_thread ); 61 65 _Thread_Enable_dispatch(); 62 return ( RTEMS_SUCCESSFUL );66 return RTEMS_SUCCESSFUL; 63 67 } 64 68 65 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */69 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 66 70 } 67 71 … … 91 95 ) 92 96 { 97 RTEMS_API_Control *api; 98 99 api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; 100 93 101 if ( _Event_sets_Is_empty( event_in ) ) { 94 *event_out = _Thread_Executing->RTEMS_API->pending_events;95 return ( RTEMS_SUCCESSFUL );102 *event_out = api->pending_events; 103 return RTEMS_SUCCESSFUL; 96 104 } 97 105 98 106 _Thread_Disable_dispatch(); 99 _Event_Seize( event_in, option_set, ticks );107 _Event_Seize( event_in, option_set, ticks, event_out ); 100 108 _Thread_Enable_dispatch(); 101 *event_out = _Thread_Executing->RTEMS_API->events_out;102 109 return( _Thread_Executing->Wait.return_code ); 103 110 } -
cpukit/rtems/src/eventmp.c
r5072b07 r3a4ae6c 14 14 15 15 #include <rtems/system.h> 16 #include <rtems/event.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/states.h> 22 #include <rtems/thread.h> 16 #include <rtems/rtems/status.h> 17 #include <rtems/rtems/event.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/core/states.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/rtems/support.h> 23 25 24 26 /*PAGE … … 50 52 51 53 the_packet = _Event_MP_Get_packet(); 52 the_packet->Prefix.the_class = RTEMS_MP_PACKET_EVENT;54 the_packet->Prefix.the_class = MP_PACKET_EVENT; 53 55 the_packet->Prefix.length = sizeof ( Event_MP_Packet ); 54 56 the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet ); -
cpukit/rtems/src/intr.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/isr.h> 18 #include <rtems/stack.h> 19 #include <rtems/intr.h> 20 #include <rtems/wkspace.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/isr.h> 19 #include <rtems/rtems/intr.h> 21 20 22 21 /* _Interrupt_Manager_initialization … … 31 30 void _Interrupt_Manager_initialization( void ) 32 31 { 33 #if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )34 35 if ( _CPU_Table.interrupt_stack_size < RTEMS_MINIMUM_STACK_SIZE )36 rtems_fatal_error_occurred( RTEMS_INVALID_SIZE );37 38 _CPU_Interrupt_stack_low =39 _Workspace_Allocate_or_fatal_error( _CPU_Table.interrupt_stack_size );40 41 _CPU_Interrupt_stack_high = _Addresses_Add_offset(42 _CPU_Interrupt_stack_low,43 _CPU_Table.interrupt_stack_size44 );45 46 #endif47 48 #if ( CPU_HAS_HARDWARE_INTERRUPT_STACK == TRUE )49 _CPU_Install_interrupt_stack();50 #endif51 52 32 } 53 33 … … 74 54 { 75 55 if ( !_ISR_Is_vector_number_valid( vector ) ) 76 return ( RTEMS_INVALID_NUMBER );56 return RTEMS_INVALID_NUMBER; 77 57 78 58 if ( !_ISR_Is_valid_user_handler( new_isr_handler ) ) 79 return ( RTEMS_INVALID_ADDRESS );59 return RTEMS_INVALID_ADDRESS; 80 60 81 61 _ISR_Install_vector( 82 62 vector, (proc_ptr)new_isr_handler, (proc_ptr *)old_isr_handler ); 83 63 84 return ( RTEMS_SUCCESSFUL );64 return RTEMS_SUCCESSFUL; 85 65 } -
cpukit/rtems/src/mp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/config.h> 18 #include <rtems/cpu.h> 19 #include <rtems/event.h> 20 #include <rtems/fatal.h> 21 #include <rtems/intthrd.h> 22 #include <rtems/message.h> 23 #include <rtems/mp.h> 24 #include <rtems/mpci.h> 25 #include <rtems/mppkt.h> 26 #include <rtems/part.h> 27 #include <rtems/sem.h> 28 #include <rtems/signal.h> 29 #include <rtems/states.h> 30 #include <rtems/tasks.h> 31 #include <rtems/thread.h> 32 #include <rtems/threadq.h> 33 #include <rtems/watchdog.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/mp.h> 19 #include <rtems/core/mpci.h> 34 20 35 21 /*PAGE … … 41 27 void _Multiprocessing_Manager_initialization ( void ) 42 28 { 43 if ( _Configuration_MP_table->node < 1 ||44 _Configuration_MP_table->node > _Configuration_MP_table->maximum_nodes )45 rtems_fatal_error_occurred( RTEMS_INVALID_NODE );46 47 _Internal_threads_Set_MP_receive_server( _Multiprocessing_Receive_server );48 29 } 49 30 … … 56 37 void rtems_multiprocessing_announce ( void ) 57 38 { 58 _Thread_Disable_dispatch(); 59 _Event_sets_Post( 60 RTEMS_EVENT_0, 61 &_Internal_threads_System_initialization_thread->RTEMS_API->pending_events 62 ); 63 _Event_Surrender( _Internal_threads_System_initialization_thread ); 64 _Thread_Enable_dispatch(); 65 } 66 67 /*PAGE 68 * 69 * _Multiprocessing_Receive_server 70 * 71 */ 72 73 typedef void (*packet_processor)( rtems_packet_prefix * ); 74 75 packet_processor _Multiprocessor_Packet_processors[] = { 76 _Internal_threads_MP_Process_packet, /* RTEMS_MP_PACKET_INTERNAL_THREADS */ 77 _RTEMS_tasks_MP_Process_packet, /* RTEMS_MP_PACKET_TASKS */ 78 _Message_queue_MP_Process_packet, /* RTEMS_MP_PACKET_MESSAGE_QUEUE */ 79 _Semaphore_MP_Process_packet, /* RTEMS_MP_PACKET_SEMAPHORE */ 80 _Partition_MP_Process_packet, /* RTEMS_MP_PACKET_PARTITION */ 81 0, /* RTEMS_MP_PACKET_REGION */ 82 _Event_MP_Process_packet, /* RTEMS_MP_PACKET_EVENT */ 83 _Signal_MP_Process_packet /* RTEMS_MP_PACKET_SIGNAL */ 84 }; 85 86 Thread _Multiprocessing_Receive_server ( 87 Thread_Argument ignored 88 ) 89 { 90 91 rtems_packet_prefix *the_packet; 92 packet_processor the_function; 93 94 for ( ; ; ) { 95 96 _Thread_Disable_dispatch(); 97 _Event_Seize( RTEMS_EVENT_0, RTEMS_DEFAULT_OPTIONS, RTEMS_NO_TIMEOUT ); 98 _Thread_Enable_dispatch(); 99 100 for ( ; ; ) { 101 the_packet = _MPCI_Receive_packet(); 102 103 if ( !the_packet ) 104 break; 105 106 _Thread_Executing->receive_packet = the_packet; 107 108 if ( !_Mp_packet_Is_valid_packet_class ( the_packet->the_class ) ) 109 break; 110 111 the_function = _Multiprocessor_Packet_processors[ the_packet->the_class ]; 112 113 if ( !the_function ) 114 break; 115 116 (*the_function)( the_packet ); 117 } 118 } 39 _MPCI_Announce(); 119 40 } 120 41 -
cpukit/rtems/src/msg.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/attr.h> 18 #include <rtems/chain.h> 19 #include <rtems/config.h> 20 #include <rtems/isr.h> 21 #include <rtems/message.h> 22 #include <rtems/object.h> 23 #include <rtems/options.h> 24 #include <rtems/states.h> 25 #include <rtems/support.h> 26 #include <rtems/thread.h> 27 #include <rtems/wkspace.h> 28 #include <rtems/mpci.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/attr.h> 19 #include <rtems/core/chain.h> 20 #include <rtems/core/isr.h> 21 #include <rtems/rtems/message.h> 22 #include <rtems/core/object.h> 23 #include <rtems/rtems/options.h> 24 #include <rtems/core/states.h> 25 #include <rtems/rtems/support.h> 26 #include <rtems/core/thread.h> 27 #include <rtems/core/wkspace.h> 28 #include <rtems/core/mpci.h> 29 #include <rtems/sysstate.h> 29 30 30 31 /*PAGE … … 55 56 FALSE 56 57 ); 58 59 /* 60 * Register the MP Process Packet routine. 61 */ 62 63 _MPCI_Register_packet_processor( 64 MP_PACKET_MESSAGE_QUEUE, 65 _Message_queue_MP_Process_packet 66 ); 67 57 68 } 58 69 … … 73 84 unsigned32 allocated_message_size; 74 85 75 mq = \86 mq = 76 87 (Message_queue_Control *)_Objects_Allocate(&_Message_queue_Information); 77 88 … … 145 156 146 157 if ( !rtems_is_name_valid( name ) ) 147 return ( RTEMS_INVALID_NAME );148 149 if ( _Attributes_Is_global( attribute_set ) && 150 !_ Configuration_Is_multiprocessing())151 return ( RTEMS_MP_NOT_CONFIGURED );158 return RTEMS_INVALID_NAME; 159 160 if ( _Attributes_Is_global( attribute_set ) && 161 !_System_state_Is_multiprocessing ) 162 return RTEMS_MP_NOT_CONFIGURED; 152 163 153 164 if (count == 0) … … 165 176 166 177 if ( _Attributes_Is_global( attribute_set ) && 167 _Configuration_MPCI_table && 168 (_Configuration_MPCI_table->maximum_packet_size < max_message_size)) 178 (_MPCI_table->maximum_packet_size < max_message_size)) 169 179 { 170 180 return RTEMS_INVALID_SIZE; … … 178 188 if ( !the_message_queue ) { 179 189 _Thread_Enable_dispatch(); 180 return ( RTEMS_TOO_MANY );190 return RTEMS_TOO_MANY; 181 191 } 182 192 … … 202 212 THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, 203 213 STATES_WAITING_FOR_MESSAGE, 204 _Message_queue_MP_Send_extract_proxy 214 _Message_queue_MP_Send_extract_proxy, 215 RTEMS_TIMEOUT 205 216 ); 206 217 … … 222 233 223 234 _Thread_Enable_dispatch(); 224 return ( RTEMS_SUCCESSFUL );235 return RTEMS_SUCCESSFUL; 225 236 } 226 237 … … 249 260 ) 250 261 { 251 return _Objects_Name_to_id( 262 Objects_Name_to_id_errors status; 263 264 status = _Objects_Name_to_id( 252 265 &_Message_queue_Information, 253 266 &name, … … 255 268 id 256 269 ); 270 271 return _Status_Object_name_errors_to_status[ status ]; 257 272 } 258 273 … … 282 297 switch ( location ) { 283 298 case OBJECTS_ERROR: 284 return ( RTEMS_INVALID_ID );299 return RTEMS_INVALID_ID; 285 300 case OBJECTS_REMOTE: 286 301 _Thread_Dispatch(); 287 return ( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );302 return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; 288 303 case OBJECTS_LOCAL: 289 304 _Objects_Close( &_Message_queue_Information, … … 295 310 _Thread_queue_Flush( 296 311 &the_message_queue->Wait_queue, 297 _Message_queue_MP_Send_object_was_deleted 312 _Message_queue_MP_Send_object_was_deleted, 313 RTEMS_OBJECT_WAS_DELETED 298 314 ); 299 315 … … 315 331 316 332 _Thread_Enable_dispatch(); 317 return ( RTEMS_SUCCESSFUL );318 } 319 320 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */333 return RTEMS_SUCCESSFUL; 334 } 335 336 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 321 337 } 322 338 … … 404 420 switch ( location ) { 405 421 case OBJECTS_ERROR: 406 return ( RTEMS_INVALID_ID );422 return RTEMS_INVALID_ID; 407 423 case OBJECTS_REMOTE: 408 424 _Thread_Executing->Wait.return_argument = count; … … 437 453 constrained_size); 438 454 439 * waitp->Extra.message_size_p = constrained_size;455 *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size; 440 456 441 457 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { … … 451 467 _Thread_Enable_dispatch(); 452 468 *count = number_broadcasted; 453 return ( RTEMS_SUCCESSFUL );469 return RTEMS_SUCCESSFUL; 454 470 } 455 471 … … 492 508 493 509 case OBJECTS_ERROR: 494 return ( RTEMS_INVALID_ID );510 return RTEMS_INVALID_ID; 495 511 496 512 case OBJECTS_REMOTE: 497 _Thread_Executing->Wait.return_argument = buffer;498 499 513 return _Message_queue_MP_Send_request_packet( 500 514 MESSAGE_QUEUE_MP_RECEIVE_REQUEST, … … 518 532 } 519 533 520 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */534 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 521 535 } 522 536 … … 550 564 switch ( location ) { 551 565 case OBJECTS_ERROR: 552 return ( RTEMS_INVALID_ID );566 return RTEMS_INVALID_ID; 553 567 case OBJECTS_REMOTE: 554 568 _Thread_Executing->Wait.return_argument = count; … … 570 584 *count = 0; 571 585 _Thread_Enable_dispatch(); 572 return ( RTEMS_SUCCESSFUL );573 } 574 575 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */586 return RTEMS_SUCCESSFUL; 587 } 588 589 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 576 590 } 577 591 … … 634 648 executing->Wait.queue = &the_message_queue->Wait_queue; 635 649 executing->Wait.id = the_message_queue->Object.id; 636 executing->Wait.option _set= option_set;637 executing->Wait.return_argument = ( unsigned32*)buffer;638 executing->Wait. Extra.message_size_p =size_p;650 executing->Wait.option = option_set; 651 executing->Wait.return_argument = (void *)buffer; 652 executing->Wait.return_argument_1 = (void *)size_p; 639 653 _ISR_Enable( level ); 640 654 return FALSE; … … 725 739 { 726 740 case OBJECTS_ERROR: 727 return ( RTEMS_INVALID_ID );741 return RTEMS_INVALID_ID; 728 742 729 743 case OBJECTS_REMOTE: … … 771 785 size 772 786 ); 773 * the_thread->Wait.Extra.message_size_p= size;787 *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = size; 774 788 775 789 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { … … 784 798 } 785 799 _Thread_Enable_dispatch(); 786 return ( RTEMS_SUCCESSFUL );800 return RTEMS_SUCCESSFUL; 787 801 } 788 802 … … 795 809 the_message_queue->maximum_pending_messages ) { 796 810 _Thread_Enable_dispatch(); 797 return ( RTEMS_TOO_MANY );811 return RTEMS_TOO_MANY; 798 812 } 799 813 … … 801 815 if ( the_message == 0) { 802 816 _Thread_Enable_dispatch(); 803 return ( RTEMS_UNSATISFIED );817 return RTEMS_UNSATISFIED; 804 818 } 805 819 … … 819 833 820 834 _Thread_Enable_dispatch(); 821 return ( RTEMS_SUCCESSFUL );835 return RTEMS_SUCCESSFUL; 822 836 823 837 default: -
cpukit/rtems/src/msgmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/message.h> 18 #include <rtems/mpci.h> 19 #include <rtems/msgmp.h> 20 #include <rtems/object.h> 21 #include <rtems/options.h> 22 #include <rtems/thread.h> 23 #include <rtems/watchdog.h> 24 #include <rtems/config.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/message.h> 19 #include <rtems/core/mpci.h> 20 #include <rtems/rtems/msgmp.h> 21 #include <rtems/core/object.h> 22 #include <rtems/rtems/options.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/core/watchdog.h> 25 #include <rtems/rtems/support.h> 25 26 26 27 /*PAGE … … 47 48 48 49 the_packet = _Message_queue_MP_Get_packet(); 49 the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE;50 the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; 50 51 the_packet->Prefix.length = sizeof ( Message_queue_MP_Packet ); 51 52 the_packet->Prefix.to_convert = sizeof ( Message_queue_MP_Packet ); … … 103 104 104 105 the_packet = _Message_queue_MP_Get_packet(); 105 the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE;106 the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; 106 107 the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); 107 108 if ( size_p ) 108 the_packet->Prefix.length += *size_p;109 the_packet->Prefix.length += *size_p; 109 110 the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); 110 111 … … 115 116 */ 116 117 117 if (the_packet->Prefix.length > 118 _Configuration_MPCI_table->maximum_packet_size) 119 { 118 if (the_packet->Prefix.length > _MPCI_table->maximum_packet_size) { 120 119 _Thread_Enable_dispatch(); 121 120 return RTEMS_INVALID_SIZE; … … 133 132 */ 134 133 135 if (buffer) 136 { 134 if (buffer) { 137 135 the_packet->Buffer.size = *size_p; 138 136 _Message_queue_Copy_buffer(buffer, … … 149 147 150 148 the_packet = _Message_queue_MP_Get_packet(); 151 the_packet->Prefix.the_class = RTEMS_MP_PACKET_MESSAGE_QUEUE;149 the_packet->Prefix.the_class = MP_PACKET_MESSAGE_QUEUE; 152 150 the_packet->Prefix.length = sizeof(Message_queue_MP_Packet); 153 151 the_packet->Prefix.to_convert = sizeof(Message_queue_MP_Packet); … … 161 159 the_packet->size = 0; /* just in case of an error */ 162 160 163 _Thread_Executing->Wait.return_argument 164 _Thread_Executing->Wait. Extra.message_size_p= size_p;161 _Thread_Executing->Wait.return_argument = (unsigned32 *)buffer; 162 _Thread_Executing->Wait.return_argument_1 = size_p; 165 163 166 164 return _MPCI_Send_request_packet(rtems_get_node(message_queue_id), … … 297 295 ); 298 296 299 if ( ! _ Status_Is_proxy_blocking( the_packet->Prefix.return_code ) )297 if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) ) 300 298 _Message_queue_MP_Send_response_packet( 301 299 MESSAGE_QUEUE_MP_RECEIVE_RESPONSE, … … 310 308 311 309 if (the_packet->Prefix.return_code == RTEMS_SUCCESSFUL) { 312 *the_thread->Wait.Extra.message_size_p = the_packet->size; 310 *(rtems_unsigned32 *)the_thread->Wait.return_argument_1 = 311 the_packet->size; 313 312 314 313 _Message_queue_Copy_buffer( -
cpukit/rtems/src/part.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/support.h> 18 #include <rtems/address.h> 19 #include <rtems/config.h> 20 #include <rtems/object.h> 21 #include <rtems/part.h> 22 #include <rtems/thread.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/support.h> 19 #include <rtems/core/address.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/part.h> 22 #include <rtems/core/thread.h> 23 #include <rtems/sysstate.h> 23 24 24 25 /*PAGE … … 50 51 ); 51 52 53 /* 54 * Register the MP Process Packet routine. 55 */ 56 57 _MPCI_Register_packet_processor( 58 MP_PACKET_PARTITION, 59 _Partition_MP_Process_packet 60 ); 61 52 62 } 53 63 … … 85 95 86 96 if ( !rtems_is_name_valid( name ) ) 87 return ( RTEMS_INVALID_NAME );97 return RTEMS_INVALID_NAME; 88 98 89 99 if ( length == 0 || buffer_size == 0 || length < buffer_size || 90 100 !_Partition_Is_buffer_size_aligned( buffer_size ) ) 91 return ( RTEMS_INVALID_SIZE );101 return RTEMS_INVALID_SIZE; 92 102 93 103 if ( !_Addresses_Is_aligned( starting_address ) ) 94 return ( RTEMS_INVALID_ADDRESS );95 96 if ( _Attributes_Is_global( attribute_set ) && 97 !_ Configuration_Is_multiprocessing())98 return ( RTEMS_MP_NOT_CONFIGURED );104 return RTEMS_INVALID_ADDRESS; 105 106 if ( _Attributes_Is_global( attribute_set ) && 107 !_System_state_Is_multiprocessing ) 108 return RTEMS_MP_NOT_CONFIGURED; 99 109 100 110 _Thread_Disable_dispatch(); /* prevents deletion */ … … 104 114 if ( !the_partition ) { 105 115 _Thread_Enable_dispatch(); 106 return ( RTEMS_TOO_MANY );116 return RTEMS_TOO_MANY; 107 117 } 108 118 … … 112 122 _Partition_Free( the_partition ); 113 123 _Thread_Enable_dispatch(); 114 return ( RTEMS_TOO_MANY );124 return RTEMS_TOO_MANY; 115 125 } 116 126 the_partition->starting_address = starting_address; … … 135 145 136 146 _Thread_Enable_dispatch(); 137 return ( RTEMS_SUCCESSFUL );147 return RTEMS_SUCCESSFUL; 138 148 } 139 149 … … 162 172 ) 163 173 { 164 return _Objects_Name_to_id( &_Partition_Information, &name, node, id ); 174 Objects_Name_to_id_errors status; 175 176 status = _Objects_Name_to_id( &_Partition_Information, &name, node, id ); 177 178 return _Status_Object_name_errors_to_status[ status ]; 165 179 } 166 180 … … 191 205 switch ( location ) { 192 206 case OBJECTS_ERROR: 193 return ( RTEMS_INVALID_ID );207 return RTEMS_INVALID_ID; 194 208 case OBJECTS_REMOTE: 195 209 _Thread_Dispatch(); 196 return ( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );210 return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; 197 211 case OBJECTS_LOCAL: 198 212 if ( the_partition->number_of_used_blocks == 0 ) { … … 215 229 216 230 _Thread_Enable_dispatch(); 217 return ( RTEMS_SUCCESSFUL );231 return RTEMS_SUCCESSFUL; 218 232 } 219 233 _Thread_Enable_dispatch(); 220 return ( RTEMS_RESOURCE_IN_USE );221 } 222 223 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */234 return RTEMS_RESOURCE_IN_USE; 235 } 236 237 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 224 238 } 225 239 … … 252 266 switch ( location ) { 253 267 case OBJECTS_ERROR: 254 return ( RTEMS_INVALID_ID );268 return RTEMS_INVALID_ID; 255 269 case OBJECTS_REMOTE: 256 270 _Thread_Executing->Wait.return_argument = buffer; … … 268 282 _Thread_Enable_dispatch(); 269 283 *buffer = the_buffer; 270 return ( RTEMS_SUCCESSFUL );284 return RTEMS_SUCCESSFUL; 271 285 } 272 286 _Thread_Enable_dispatch(); 273 return ( RTEMS_UNSATISFIED );274 } 275 276 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */287 return RTEMS_UNSATISFIED; 288 } 289 290 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 277 291 } 278 292 … … 304 318 switch ( location ) { 305 319 case OBJECTS_ERROR: 306 return ( RTEMS_INVALID_ID );320 return RTEMS_INVALID_ID; 307 321 case OBJECTS_REMOTE: 308 322 return( … … 318 332 the_partition->number_of_used_blocks -= 1; 319 333 _Thread_Enable_dispatch(); 320 return ( RTEMS_SUCCESSFUL );334 return RTEMS_SUCCESSFUL; 321 335 } 322 336 _Thread_Enable_dispatch(); 323 return ( RTEMS_INVALID_ADDRESS );324 } 325 326 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */327 } 337 return RTEMS_INVALID_ADDRESS; 338 } 339 340 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 341 } -
cpukit/rtems/src/partmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/part.h> 22 #include <rtems/thread.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/rtems/part.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/rtems/support.h> 23 25 24 26 /*PAGE … … 45 47 46 48 the_packet = _Partition_MP_Get_packet(); 47 the_packet->Prefix.the_class = RTEMS_MP_PACKET_PARTITION;49 the_packet->Prefix.the_class = MP_PACKET_PARTITION; 48 50 the_packet->Prefix.length = sizeof ( Partition_MP_Packet ); 49 51 the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet ); … … 89 91 90 92 the_packet = _Partition_MP_Get_packet(); 91 the_packet->Prefix.the_class = RTEMS_MP_PACKET_PARTITION;93 the_packet->Prefix.the_class = MP_PACKET_PARTITION; 92 94 the_packet->Prefix.length = sizeof ( Partition_MP_Packet ); 93 95 the_packet->Prefix.to_convert = sizeof ( Partition_MP_Packet ); -
cpukit/rtems/src/ratemon.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/support.h> 18 #include <rtems/isr.h> 19 #include <rtems/object.h> 20 #include <rtems/ratemon.h> 21 #include <rtems/thread.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/support.h> 19 #include <rtems/core/isr.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/ratemon.h> 22 #include <rtems/core/thread.h> 22 23 23 24 /*PAGE … … 78 79 79 80 if ( !rtems_is_name_valid( name ) ) 80 return ( RTEMS_INVALID_NAME );81 return RTEMS_INVALID_NAME; 81 82 82 83 _Thread_Disable_dispatch(); /* to prevent deletion */ … … 86 87 if ( !the_period ) { 87 88 _Thread_Enable_dispatch(); 88 return ( RTEMS_TOO_MANY );89 return RTEMS_TOO_MANY; 89 90 } 90 91 … … 96 97 *id = the_period->Object.id; 97 98 _Thread_Enable_dispatch(); 98 return ( RTEMS_SUCCESSFUL );99 return RTEMS_SUCCESSFUL; 99 100 } 100 101 … … 121 122 ) 122 123 { 123 return _Objects_Name_to_id( 124 Objects_Name_to_id_errors status; 125 126 status = _Objects_Name_to_id( 124 127 &_Rate_monotonic_Information, 125 128 &name, 126 RTEMS_SEARCH_LOCAL_NODE,129 OBJECTS_SEARCH_LOCAL_NODE, 127 130 id 128 131 ); 132 133 return _Status_Object_name_errors_to_status[ status ]; 129 134 } 130 135 … … 153 158 switch ( location ) { 154 159 case OBJECTS_ERROR: 155 return ( RTEMS_INVALID_ID );156 case OBJECTS_REMOTE: /* should never return this */157 return ( RTEMS_INTERNAL_ERROR );160 return RTEMS_INVALID_ID; 161 case OBJECTS_REMOTE: 162 return RTEMS_INTERNAL_ERROR; /* should never return this */ 158 163 case OBJECTS_LOCAL: 159 164 if ( !_Thread_Is_executing( the_period->owner ) ) { 160 165 _Thread_Enable_dispatch(); 161 return ( RTEMS_NOT_OWNER_OF_RESOURCE );166 return RTEMS_NOT_OWNER_OF_RESOURCE; 162 167 } 163 168 (void) _Watchdog_Remove( &the_period->Timer ); 164 169 the_period->state = RATE_MONOTONIC_INACTIVE; 165 170 _Thread_Enable_dispatch(); 166 return ( RTEMS_SUCCESSFUL );167 } 168 169 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */171 return RTEMS_SUCCESSFUL; 172 } 173 174 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 170 175 } 171 176 … … 194 199 switch ( location ) { 195 200 case OBJECTS_ERROR: 196 return ( RTEMS_INVALID_ID );201 return RTEMS_INVALID_ID; 197 202 case OBJECTS_REMOTE: /* should never return this */ 198 return ( RTEMS_INTERNAL_ERROR );203 return RTEMS_INTERNAL_ERROR; 199 204 case OBJECTS_LOCAL: 200 205 _Objects_Close( &_Rate_monotonic_Information, &the_period->Object ); … … 203 208 _Rate_monotonic_Free( the_period ); 204 209 _Thread_Enable_dispatch(); 205 return ( RTEMS_SUCCESSFUL );206 } 207 208 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */210 return RTEMS_SUCCESSFUL; 211 } 212 213 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 209 214 } 210 215 … … 226 231 rtems_status_code rtems_rate_monotonic_period( 227 232 Objects_Id id, 228 rtems_interval length233 rtems_interval length 229 234 ) 230 235 { 231 236 Rate_monotonic_Control *the_period; 232 237 Objects_Locations location; 233 rtems_status_code 238 rtems_status_code return_value; 234 239 235 240 the_period = _Rate_monotonic_Get( id, &location ); 236 241 switch ( location ) { 237 242 case OBJECTS_ERROR: 238 return ( RTEMS_INVALID_ID );243 return RTEMS_INVALID_ID; 239 244 case OBJECTS_REMOTE: /* should never return this */ 240 return ( RTEMS_INTERNAL_ERROR );245 return RTEMS_INTERNAL_ERROR; 241 246 case OBJECTS_LOCAL: 242 247 if ( !_Thread_Is_executing( the_period->owner ) ) { 243 248 _Thread_Enable_dispatch(); 244 return ( RTEMS_NOT_OWNER_OF_RESOURCE );249 return RTEMS_NOT_OWNER_OF_RESOURCE; 245 250 } 246 251 … … 276 281 &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW ); 277 282 _Thread_Enable_dispatch(); 278 return ( RTEMS_SUCCESSFUL );283 return RTEMS_SUCCESSFUL; 279 284 280 285 case RATE_MONOTONIC_ACTIVE: … … 283 288 if ( _Rate_monotonic_Set_state( the_period ) ) { 284 289 _Thread_Enable_dispatch(); 285 return ( RTEMS_SUCCESSFUL );290 return RTEMS_SUCCESSFUL; 286 291 } 287 292 /* has expired -- fall into next case */ … … 291 296 &the_period->Timer, length, WATCHDOG_ACTIVATE_NOW ); 292 297 _Thread_Enable_dispatch(); 293 return ( RTEMS_TIMEOUT );298 return RTEMS_TIMEOUT; 294 299 } 295 300 } 296 301 297 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */302 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 298 303 } 299 304 -
cpukit/rtems/src/region.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/ support.h>18 #include <rtems/ config.h>19 #include <rtems/ object.h>20 #include <rtems/ options.h>21 #include <rtems/r egion.h>22 #include <rtems/ states.h>23 #include <rtems/ thread.h>17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/support.h> 19 #include <rtems/core/object.h> 20 #include <rtems/rtems/options.h> 21 #include <rtems/rtems/region.h> 22 #include <rtems/core/states.h> 23 #include <rtems/core/thread.h> 24 24 25 25 /*PAGE … … 49 49 FALSE 50 50 ); 51 52 /* 53 * Register the MP Process Packet routine. 54 */ 55 56 _MPCI_Register_packet_processor( 57 MP_PACKET_REGION, 58 0 /* XXX _Region_MP_Process_packet */ 59 ); 60 51 61 } 52 62 … … 84 94 85 95 if ( !rtems_is_name_valid( name ) ) 86 return ( RTEMS_INVALID_NAME );96 return RTEMS_INVALID_NAME; 87 97 88 98 if ( !_Addresses_Is_aligned( starting_address ) ) 89 return ( RTEMS_INVALID_ADDRESS );99 return RTEMS_INVALID_ADDRESS; 90 100 91 101 _Thread_Disable_dispatch(); /* to prevent deletion */ … … 95 105 if ( !the_region ) { 96 106 _Thread_Enable_dispatch(); 97 return ( RTEMS_TOO_MANY );107 return RTEMS_TOO_MANY; 98 108 } 99 109 … … 104 114 _Region_Free( the_region ); 105 115 _Thread_Enable_dispatch(); 106 return ( RTEMS_INVALID_SIZE );116 return RTEMS_INVALID_SIZE; 107 117 } 108 118 … … 119 129 THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, 120 130 STATES_WAITING_FOR_SEGMENT, 121 _Region_MP_Send_extract_proxy 131 _Region_MP_Send_extract_proxy, 132 RTEMS_TIMEOUT 122 133 ); 123 134 … … 126 137 *id = the_region->Object.id; 127 138 _Thread_Enable_dispatch(); 128 return ( RTEMS_SUCCESSFUL );139 return RTEMS_SUCCESSFUL; 129 140 } 130 141 … … 151 162 ) 152 163 { 153 return _Objects_Name_to_id( 154 &_Region_Information, 155 &name, 156 RTEMS_SEARCH_LOCAL_NODE, 157 id 158 ); 164 Objects_Name_to_id_errors status; 165 166 status = _Objects_Name_to_id( 167 &_Region_Information, 168 &name, 169 OBJECTS_SEARCH_LOCAL_NODE, 170 id 171 ); 172 173 return _Status_Object_name_errors_to_status[ status ]; 159 174 } 160 175 … … 185 200 switch ( location ) { 186 201 case OBJECTS_ERROR: 187 return ( RTEMS_INVALID_ID );202 return RTEMS_INVALID_ID; 188 203 case OBJECTS_REMOTE: /* this error cannot be returned */ 189 return ( RTEMS_INTERNAL_ERROR );204 return RTEMS_INTERNAL_ERROR; 190 205 case OBJECTS_LOCAL: 191 206 _Region_Debug_Walk( the_region, 5 ); … … 194 209 _Region_Free( the_region ); 195 210 _Thread_Enable_dispatch(); 196 return ( RTEMS_SUCCESSFUL );211 return RTEMS_SUCCESSFUL; 197 212 } 198 213 _Thread_Enable_dispatch(); 199 return ( RTEMS_RESOURCE_IN_USE );200 } 201 202 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */214 return RTEMS_RESOURCE_IN_USE; 215 } 216 217 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 203 218 } 204 219 … … 237 252 switch ( location ) { 238 253 case OBJECTS_ERROR: 239 return ( RTEMS_INVALID_ID );254 return RTEMS_INVALID_ID; 240 255 case OBJECTS_REMOTE: /* this error cannot be returned */ 241 return ( RTEMS_INTERNAL_ERROR );256 return RTEMS_INTERNAL_ERROR; 242 257 case OBJECTS_LOCAL: 243 258 … … 265 280 } 266 281 267 return ( RTEMS_INTERNAL_ERROR );282 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 268 283 } 269 284 … … 290 305 Objects_Id id, 291 306 unsigned32 size, 292 rtems_option option_set,293 rtems_interval timeout,307 rtems_option option_set, 308 rtems_interval timeout, 294 309 void **segment 295 310 ) … … 301 316 302 317 if ( size == 0 ) 303 return ( RTEMS_INVALID_SIZE );318 return RTEMS_INVALID_SIZE; 304 319 305 320 executing = _Thread_Executing; … … 307 322 switch ( location ) { 308 323 case OBJECTS_ERROR: 309 return ( RTEMS_INVALID_ID );324 return RTEMS_INVALID_ID; 310 325 case OBJECTS_REMOTE: /* this error cannot be returned */ 311 return ( RTEMS_INTERNAL_ERROR );326 return RTEMS_INTERNAL_ERROR; 312 327 case OBJECTS_LOCAL: 313 328 if ( size > the_region->maximum_segment_size ) { 314 329 _Thread_Enable_dispatch(); 315 return ( RTEMS_INVALID_SIZE );330 return RTEMS_INVALID_SIZE; 316 331 } 317 332 … … 326 341 _Thread_Enable_dispatch(); 327 342 *segment = the_segment; 328 return ( RTEMS_SUCCESSFUL );343 return RTEMS_SUCCESSFUL; 329 344 } 330 345 331 346 if ( _Options_Is_no_wait( option_set ) ) { 332 347 _Thread_Enable_dispatch(); 333 return ( RTEMS_UNSATISFIED );334 } 335 336 executing->Wait.queue 337 executing->Wait.id 338 executing->Wait. Extra.segment_size= size;339 executing->Wait.return_argument 348 return RTEMS_UNSATISFIED; 349 } 350 351 executing->Wait.queue = &the_region->Wait_queue; 352 executing->Wait.id = id; 353 executing->Wait.count = size; 354 executing->Wait.return_argument = (unsigned32 *) segment; 340 355 341 356 the_region->Wait_queue.sync = TRUE; … … 347 362 } 348 363 349 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */364 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 350 365 } 351 366 /*PAGE … … 380 395 switch ( location ) { 381 396 case OBJECTS_ERROR: 382 return ( RTEMS_INVALID_ID );397 return RTEMS_INVALID_ID; 383 398 case OBJECTS_REMOTE: /* this error cannot be returned */ 384 return ( RTEMS_INTERNAL_ERROR );399 return RTEMS_INTERNAL_ERROR; 385 400 case OBJECTS_LOCAL: 386 401 387 402 if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) { 388 403 _Thread_Enable_dispatch(); 389 return ( RTEMS_SUCCESSFUL );404 return RTEMS_SUCCESSFUL; 390 405 } 391 406 _Thread_Enable_dispatch(); 392 return ( RTEMS_INVALID_ADDRESS );393 } 394 395 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */407 return RTEMS_INVALID_ADDRESS; 408 } 409 410 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 396 411 } 397 412 … … 425 440 switch ( location ) { 426 441 case OBJECTS_ERROR: 427 return ( RTEMS_INVALID_ID );442 return RTEMS_INVALID_ID; 428 443 case OBJECTS_REMOTE: /* this error cannot be returned */ 429 return ( RTEMS_INTERNAL_ERROR );444 return RTEMS_INTERNAL_ERROR; 430 445 case OBJECTS_LOCAL: 431 446 … … 438 453 if ( !status ) { 439 454 _Thread_Enable_dispatch(); 440 return ( RTEMS_INVALID_ADDRESS );455 return RTEMS_INVALID_ADDRESS; 441 456 } 442 457 … … 449 464 450 465 the_segment = _Region_Allocate_segment( 451 the_region, the_thread->Wait.Extra.segment_size ); 466 the_region, 467 the_thread->Wait.count 468 ); 452 469 453 470 if ( the_segment == NULL ) … … 461 478 462 479 _Thread_Enable_dispatch(); 463 return ( RTEMS_SUCCESSFUL );464 } 465 466 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */467 } 480 return RTEMS_SUCCESSFUL; 481 } 482 483 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 484 } -
cpukit/rtems/src/regionmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/region.h> 22 #include <rtems/thread.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/rtems/region.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/rtems/support.h> 23 25 24 26 /*PAGE … … 45 47 46 48 the_packet = _Region_MP_Get_packet(); 47 the_packet->Prefix.the_class = RTEMS_MP_PACKET_REGION;49 the_packet->Prefix.the_class = MP_PACKET_REGION; 48 50 the_packet->Prefix.length = sizeof ( Region_MP_Packet ); 49 51 the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); … … 80 82 void *segment, 81 83 unsigned32 size, 82 rtems_option option_set,83 rtems_interval timeout84 rtems_option option_set, 85 rtems_interval timeout 84 86 ) 85 87 { … … 92 94 93 95 the_packet = _Region_MP_Get_packet(); 94 the_packet->Prefix.the_class = RTEMS_MP_PACKET_REGION;96 the_packet->Prefix.the_class = MP_PACKET_REGION; 95 97 the_packet->Prefix.length = sizeof ( Region_MP_Packet ); 96 98 the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); -
cpukit/rtems/src/rtclock.c
r5072b07 r3a4ae6c 14 14 15 15 #include <rtems/system.h> 16 #include <rtems/ clock.h>17 #include <rtems/ config.h>18 #include <rtems/ isr.h>19 #include <rtems/ thread.h>20 #include <rtems/ tod.h>21 #include <rtems/ watchdog.h>16 #include <rtems/rtems/status.h> 17 #include <rtems/rtems/clock.h> 18 #include <rtems/core/isr.h> 19 #include <rtems/core/thread.h> 20 #include <rtems/core/tod.h> 21 #include <rtems/core/watchdog.h> 22 22 23 23 /*PAGE … … 50 50 case RTEMS_CLOCK_GET_TOD: 51 51 if ( !_TOD_Is_set() ) 52 return ( RTEMS_NOT_DEFINED );52 return RTEMS_NOT_DEFINED; 53 53 54 54 *(rtems_time_of_day *)time_buffer = _TOD_Current; 55 return ( RTEMS_SUCCESSFUL );55 return RTEMS_SUCCESSFUL; 56 56 57 57 case RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH: 58 58 if ( !_TOD_Is_set() ) 59 return ( RTEMS_NOT_DEFINED );59 return RTEMS_NOT_DEFINED; 60 60 61 61 *(rtems_interval *)time_buffer = _TOD_Seconds_since_epoch; 62 return ( RTEMS_SUCCESSFUL );62 return RTEMS_SUCCESSFUL; 63 63 64 64 case RTEMS_CLOCK_GET_TICKS_SINCE_BOOT: 65 65 *(rtems_interval *)time_buffer = _TOD_Ticks_since_boot; 66 return ( RTEMS_SUCCESSFUL );66 return RTEMS_SUCCESSFUL; 67 67 68 68 case RTEMS_CLOCK_GET_TICKS_PER_SECOND: 69 69 *(rtems_interval *)time_buffer = _TOD_Ticks_per_second; 70 return ( RTEMS_SUCCESSFUL );70 return RTEMS_SUCCESSFUL; 71 71 72 72 case RTEMS_CLOCK_GET_TIME_VALUE: 73 73 if ( !_TOD_Is_set() ) 74 return ( RTEMS_NOT_DEFINED );74 return RTEMS_NOT_DEFINED; 75 75 76 76 _ISR_Disable( level ); … … 80 80 _ISR_Enable( level ); 81 81 82 tmp *= _ Configuration_Table->microseconds_per_tick;82 tmp *= _TOD_Microseconds_per_tick; 83 83 ((rtems_clock_time_value *)time_buffer)->microseconds = tmp; 84 84 85 return ( RTEMS_SUCCESSFUL );85 return RTEMS_SUCCESSFUL; 86 86 } 87 87 88 return ( RTEMS_SUCCESSFUL ); /* should never get here */88 return RTEMS_INTERNAL_ERROR; /* should never get here */ 89 89 90 90 } … … 108 108 ) 109 109 { 110 rtems_status_code local_result; 111 rtems_interval seconds; 110 rtems_interval seconds; 112 111 113 local_result = _TOD_Validate( time_buffer ); 114 if ( rtems_is_status_successful( local_result ) ) { 112 if ( _TOD_Validate( time_buffer ) ) { 115 113 seconds = _TOD_To_seconds( time_buffer ); 116 114 _Thread_Disable_dispatch(); 117 115 _TOD_Set( time_buffer, seconds ); 118 116 _Thread_Enable_dispatch(); 119 117 return RTEMS_SUCCESSFUL; 120 118 } 121 return ( local_result );119 return RTEMS_INVALID_CLOCK; 122 120 } 123 121 … … 150 148 _Thread_Dispatch(); 151 149 152 return ( RTEMS_SUCCESSFUL );150 return RTEMS_SUCCESSFUL; 153 151 } -
cpukit/rtems/src/rtemstimer.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/support.h> 18 #include <rtems/object.h> 19 #include <rtems/thread.h> 20 #include <rtems/timer.h> 21 #include <rtems/tod.h> 22 #include <rtems/watchdog.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/support.h> 19 #include <rtems/core/object.h> 20 #include <rtems/core/thread.h> 21 #include <rtems/rtems/timer.h> 22 #include <rtems/core/tod.h> 23 #include <rtems/core/watchdog.h> 23 24 24 25 /*PAGE … … 74 75 75 76 if ( !rtems_is_name_valid( name ) ) 76 return ( RTEMS_INVALID_NAME );77 return RTEMS_INVALID_NAME; 77 78 78 79 _Thread_Disable_dispatch(); /* to prevent deletion */ … … 82 83 if ( !the_timer ) { 83 84 _Thread_Enable_dispatch(); 84 return ( RTEMS_TOO_MANY );85 return RTEMS_TOO_MANY; 85 86 } 86 87 … … 91 92 *id = the_timer->Object.id; 92 93 _Thread_Enable_dispatch(); 93 return ( RTEMS_SUCCESSFUL );94 return RTEMS_SUCCESSFUL; 94 95 } 95 96 … … 116 117 ) 117 118 { 118 return _Objects_Name_to_id( 119 Objects_Name_to_id_errors status; 120 121 status = _Objects_Name_to_id( 119 122 &_Timer_Information, 120 123 &name, 121 RTEMS_SEARCH_LOCAL_NODE,124 OBJECTS_SEARCH_LOCAL_NODE, 122 125 id 123 126 ); 127 128 return _Status_Object_name_errors_to_status[ status ]; 124 129 } 125 130 … … 148 153 switch ( location ) { 149 154 case OBJECTS_ERROR: 150 return ( RTEMS_INVALID_ID );151 case OBJECTS_REMOTE: /* should never return this */ 152 return ( RTEMS_INTERNAL_ERROR );155 return RTEMS_INVALID_ID; 156 case OBJECTS_REMOTE: /* should never return this */ 157 return RTEMS_INTERNAL_ERROR; 153 158 case OBJECTS_LOCAL: 154 159 if ( !_Timer_Is_dormant_class( the_timer->the_class ) ) 155 160 (void) _Watchdog_Remove( &the_timer->Ticker ); 156 161 _Thread_Enable_dispatch(); 157 return ( RTEMS_SUCCESSFUL );158 } 159 160 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */162 return RTEMS_SUCCESSFUL; 163 } 164 165 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 161 166 } 162 167 … … 185 190 switch ( location ) { 186 191 case OBJECTS_ERROR: 187 return ( RTEMS_INVALID_ID );188 case OBJECTS_REMOTE: /* should never return this */ 189 return ( RTEMS_INTERNAL_ERROR );192 return RTEMS_INVALID_ID; 193 case OBJECTS_REMOTE: /* should never return this */ 194 return RTEMS_INTERNAL_ERROR; 190 195 case OBJECTS_LOCAL: 191 196 _Objects_Close( &_Timer_Information, &the_timer->Object ); … … 193 198 _Timer_Free( the_timer ); 194 199 _Thread_Enable_dispatch(); 195 return ( RTEMS_SUCCESSFUL );196 } 197 198 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */200 return RTEMS_SUCCESSFUL; 201 } 202 203 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 199 204 } 200 205 … … 216 221 217 222 rtems_status_code rtems_timer_fire_after( 218 Objects_Id id,219 rtems_interval ticks,220 Timer_Serviceroutine,221 void *user_data223 Objects_Id id, 224 rtems_interval ticks, 225 rtems_timer_service_routine_entry routine, 226 void *user_data 222 227 ) 223 228 { … … 226 231 227 232 if ( ticks == 0 ) 228 return ( RTEMS_INVALID_NUMBER );229 230 the_timer = _Timer_Get( id, &location ); 231 switch ( location ) { 232 case OBJECTS_ERROR: 233 return ( RTEMS_INVALID_ID );234 case OBJECTS_REMOTE: /* should never return this */ 235 return ( RTEMS_INTERNAL_ERROR );233 return RTEMS_INVALID_NUMBER; 234 235 the_timer = _Timer_Get( id, &location ); 236 switch ( location ) { 237 case OBJECTS_ERROR: 238 return RTEMS_INVALID_ID; 239 case OBJECTS_REMOTE: /* should never return this */ 240 return RTEMS_INTERNAL_ERROR; 236 241 case OBJECTS_LOCAL: 237 242 (void) _Watchdog_Remove( &the_timer->Ticker ); … … 241 246 ticks, WATCHDOG_ACTIVATE_NOW ); 242 247 _Thread_Enable_dispatch(); 243 return ( RTEMS_SUCCESSFUL );244 } 245 246 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */248 return RTEMS_SUCCESSFUL; 249 } 250 251 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 247 252 } 248 253 … … 264 269 265 270 rtems_status_code rtems_timer_fire_when( 266 Objects_Id id, 267 rtems_time_of_day *wall_time, 268 Timer_Service routine, 269 void *user_data 270 ) 271 { 272 Timer_Control *the_timer; 273 Objects_Locations location; 274 rtems_status_code validate_status; 271 Objects_Id id, 272 rtems_time_of_day *wall_time, 273 rtems_timer_service_routine_entry routine, 274 void *user_data 275 ) 276 { 277 Timer_Control *the_timer; 278 Objects_Locations location; 275 279 rtems_interval seconds; 276 280 277 281 if ( !_TOD_Is_set() ) 278 return( RTEMS_NOT_DEFINED ); 279 280 validate_status = _TOD_Validate( wall_time ); 281 if ( !rtems_is_status_successful( validate_status ) ) 282 return( validate_status ); 282 return RTEMS_NOT_DEFINED; 283 284 if ( !_TOD_Validate( wall_time ) ) 285 return RTEMS_INVALID_CLOCK; 283 286 284 287 seconds = _TOD_To_seconds( wall_time ); 285 288 if ( seconds <= _TOD_Seconds_since_epoch ) 286 return ( RTEMS_INVALID_CLOCK );287 288 the_timer = _Timer_Get( id, &location ); 289 switch ( location ) { 290 case OBJECTS_ERROR: 291 return ( RTEMS_INVALID_ID );292 case OBJECTS_REMOTE: /* should never return this */ 293 return ( RTEMS_INTERNAL_ERROR );289 return RTEMS_INVALID_CLOCK; 290 291 the_timer = _Timer_Get( id, &location ); 292 switch ( location ) { 293 case OBJECTS_ERROR: 294 return RTEMS_INVALID_ID; 295 case OBJECTS_REMOTE: /* should never return this */ 296 return RTEMS_INTERNAL_ERROR; 294 297 case OBJECTS_LOCAL: 295 298 (void) _Watchdog_Remove( &the_timer->Ticker ); … … 299 302 seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW ); 300 303 _Thread_Enable_dispatch(); 301 return ( RTEMS_SUCCESSFUL );302 } 303 304 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */304 return RTEMS_SUCCESSFUL; 305 } 306 307 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 305 308 } 306 309 … … 329 332 switch ( location ) { 330 333 case OBJECTS_ERROR: 331 return ( RTEMS_INVALID_ID );332 case OBJECTS_REMOTE: /* should never return this */ 333 return ( RTEMS_INTERNAL_ERROR );334 return RTEMS_INVALID_ID; 335 case OBJECTS_REMOTE: /* should never return this */ 336 return RTEMS_INTERNAL_ERROR; 334 337 case OBJECTS_LOCAL: 335 338 if ( _Timer_Is_interval_class( the_timer->the_class ) ) { 336 339 _Watchdog_Reset( &the_timer->Ticker ); 337 340 _Thread_Enable_dispatch(); 338 return ( RTEMS_SUCCESSFUL );341 return RTEMS_SUCCESSFUL; 339 342 } 340 343 _Thread_Enable_dispatch(); 341 return ( RTEMS_NOT_DEFINED );342 } 343 344 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */345 } 344 return RTEMS_NOT_DEFINED; 345 } 346 347 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 348 } -
cpukit/rtems/src/sem.c
r5072b07 r3a4ae6c 28 28 29 29 #include <rtems/system.h> 30 #include <rtems/support.h> 31 #include <rtems/attr.h> 32 #include <rtems/config.h> 33 #include <rtems/isr.h> 34 #include <rtems/object.h> 35 #include <rtems/options.h> 36 #include <rtems/sem.h> 37 #include <rtems/states.h> 38 #include <rtems/thread.h> 39 #include <rtems/threadq.h> 40 #include <rtems/mpci.h> 30 #include <rtems/rtems/status.h> 31 #include <rtems/rtems/support.h> 32 #include <rtems/rtems/attr.h> 33 #include <rtems/core/isr.h> 34 #include <rtems/core/object.h> 35 #include <rtems/rtems/options.h> 36 #include <rtems/rtems/sem.h> 37 #include <rtems/core/coremutex.h> 38 #include <rtems/core/coresem.h> 39 #include <rtems/core/states.h> 40 #include <rtems/core/thread.h> 41 #include <rtems/core/threadq.h> 42 #include <rtems/core/mpci.h> 43 #include <rtems/sysstate.h> 44 45 #include <rtems/core/interr.h> 41 46 42 47 /*PAGE … … 66 71 FALSE 67 72 ); 73 74 /* 75 * Register the MP Process Packet routine. 76 */ 77 78 _MPCI_Register_packet_processor( 79 MP_PACKET_SEMAPHORE, 80 _Semaphore_MP_Process_packet 81 ); 82 68 83 } 69 84 … … 76 91 * 77 92 * Input parameters: 78 * name - user defined semaphore name 79 * count - initial count of semaphore 80 * attribute_set - semaphore attributes 81 * id - pointer to semaphore id 93 * name - user defined semaphore name 94 * count - initial count of semaphore 95 * attribute_set - semaphore attributes 96 * priority_ceiling - semaphore's ceiling priority 97 * id - pointer to semaphore id 82 98 * 83 99 * Output parameters: … … 88 104 89 105 rtems_status_code rtems_semaphore_create( 90 rtems_name 91 unsigned32 92 rtems_attribute 93 rtems_task_priority 94 Objects_Id 106 rtems_name name, 107 unsigned32 count, 108 rtems_attribute attribute_set, 109 rtems_task_priority priority_ceiling, 110 Objects_Id *id 95 111 ) 96 112 { 97 113 register Semaphore_Control *the_semaphore; 114 CORE_mutex_Attributes the_mutex_attributes; 115 CORE_semaphore_Attributes the_semaphore_attributes; 116 unsigned32 lock; 98 117 99 118 if ( !rtems_is_name_valid( name ) ) … … 102 121 if ( _Attributes_Is_global( attribute_set ) ) { 103 122 104 if ( !_ Configuration_Is_multiprocessing())123 if ( !_System_state_Is_multiprocessing ) 105 124 return( RTEMS_MP_NOT_CONFIGURED ); 106 125 … … 129 148 130 149 if ( _Attributes_Is_global( attribute_set ) && 131 ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name,150 ! ( _Objects_MP_Allocate_and_open( &_Semaphore_Information, name, 132 151 the_semaphore->Object.id, FALSE ) ) ) { 133 152 _Semaphore_Free( the_semaphore ); … … 137 156 138 157 the_semaphore->attribute_set = attribute_set; 139 the_semaphore->count = count; 140 141 if ( _Attributes_Is_binary_semaphore( attribute_set ) && count == 0 ) { 142 the_semaphore->nest_count = 1; 143 the_semaphore->holder = _Thread_Executing; 144 the_semaphore->holder_id = _Thread_Executing->Object.id; 145 _Thread_Executing->resource_count++; 146 } else { 147 the_semaphore->nest_count = 0; 148 the_semaphore->holder = NULL; 149 the_semaphore->holder_id = 0; 150 } 151 152 _Thread_queue_Initialize( 153 &the_semaphore->Wait_queue, 154 OBJECTS_RTEMS_SEMAPHORES, 155 _Attributes_Is_priority( attribute_set ) ? 156 THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO, 157 STATES_WAITING_FOR_SEMAPHORE, 158 _Semaphore_MP_Send_extract_proxy 159 ); 158 159 if ( _Attributes_Is_binary_semaphore( attribute_set ) ) { 160 if ( _Attributes_Is_inherit_priority( attribute_set ) ) 161 the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; 162 else if (_Attributes_Is_priority_ceiling( attribute_set ) ) 163 the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; 164 else if (_Attributes_Is_priority( attribute_set ) ) 165 the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY; 166 else 167 the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO; 168 169 the_mutex_attributes.allow_nesting = TRUE; 170 171 /* Add priority ceiling code here ????? */ 172 173 if ( count == 1 ) 174 lock = CORE_MUTEX_UNLOCKED; 175 else 176 lock = CORE_MUTEX_LOCKED; 177 178 _CORE_mutex_Initialize( 179 &the_semaphore->Core_control.mutex, 180 OBJECTS_RTEMS_SEMAPHORES, 181 &the_mutex_attributes, 182 lock, 183 _Semaphore_MP_Send_extract_proxy 184 ); 185 } 186 else { 187 if ( _Attributes_Is_priority( attribute_set ) ) 188 the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY; 189 else 190 the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; 191 192 _CORE_semaphore_Initialize( 193 &the_semaphore->Core_control.semaphore, 194 OBJECTS_RTEMS_SEMAPHORES, 195 &the_semaphore_attributes, 196 count, 197 _Semaphore_MP_Send_extract_proxy 198 ); 199 } 160 200 161 201 _Objects_Open( &_Semaphore_Information, &the_semaphore->Object, &name ); … … 193 233 194 234 rtems_status_code rtems_semaphore_ident( 195 rtems_name name, 196 unsigned32 node, 197 Objects_Id *id 198 ) 199 { 200 return( _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ) ); 235 rtems_name name, 236 unsigned32 node, 237 Objects_Id *id 238 ) 239 { 240 Objects_Name_to_id_errors status; 241 242 status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ); 243 244 return _Status_Object_name_errors_to_status[ status ]; 201 245 } 202 246 … … 232 276 return( RTEMS_ILLEGAL_ON_REMOTE_OBJECT ); 233 277 case OBJECTS_LOCAL: 234 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) && 235 ( the_semaphore->count == 0 ) ) { 236 _Thread_Enable_dispatch(); 237 return( RTEMS_RESOURCE_IN_USE ); 278 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set) ) { 279 if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) { 280 _Thread_Enable_dispatch(); 281 return( RTEMS_RESOURCE_IN_USE ); 282 } 283 else 284 _CORE_mutex_Flush( 285 &the_semaphore->Core_control.mutex, 286 _Semaphore_MP_Send_object_was_deleted, 287 CORE_MUTEX_WAS_DELETED 288 ); 238 289 } 290 else 291 _CORE_semaphore_Flush( 292 &the_semaphore->Core_control.semaphore, 293 _Semaphore_MP_Send_object_was_deleted, 294 CORE_SEMAPHORE_WAS_DELETED 295 ); 239 296 240 297 _Objects_Close( &_Semaphore_Information, &the_semaphore->Object ); 241 242 _Thread_queue_Flush(243 &the_semaphore->Wait_queue,244 _Semaphore_MP_Send_object_was_deleted245 );246 298 247 299 _Semaphore_Free( the_semaphore ); … … 282 334 283 335 rtems_status_code rtems_semaphore_obtain( 284 Objects_Id 285 unsigned32 286 rtems_interval timeout336 Objects_Id id, 337 unsigned32 option_set, 338 rtems_interval timeout 287 339 ) 288 340 { 289 341 register Semaphore_Control *the_semaphore; 290 342 Objects_Locations location; 343 boolean wait; 291 344 292 345 the_semaphore = _Semaphore_Get( id, &location ); … … 302 355 ); 303 356 case OBJECTS_LOCAL: 304 if ( !_Semaphore_Seize( the_semaphore, option_set ) ) { 305 if ( _Attributes_Is_inherit_priority( the_semaphore->attribute_set ) && 306 the_semaphore->holder->current_priority > 307 _Thread_Executing->current_priority ) { 308 _Thread_Change_priority( 309 the_semaphore->holder, _Thread_Executing->current_priority ); 310 } 311 _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); 357 if ( _Options_Is_no_wait( option_set ) ) 358 wait = FALSE; 359 else 360 wait = TRUE; 361 362 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { 363 _CORE_mutex_Seize( 364 &the_semaphore->Core_control.mutex, 365 id, 366 wait, 367 timeout 368 ); 369 _Thread_Enable_dispatch(); 370 return( _Semaphore_Translate_core_mutex_return_code( 371 _Thread_Executing->Wait.return_code ) ); 372 } else { 373 _CORE_semaphore_Seize( 374 &the_semaphore->Core_control.semaphore, 375 id, 376 wait, 377 timeout 378 ); 379 _Thread_Enable_dispatch(); 380 return( _Semaphore_Translate_core_semaphore_return_code( 381 _Thread_Executing->Wait.return_code ) ); 312 382 } 313 _Thread_Enable_dispatch();314 return( _Thread_Executing->Wait.return_code );315 383 } 316 384 … … 338 406 register Semaphore_Control *the_semaphore; 339 407 Objects_Locations location; 340 Thread_Control *the_thread; 408 CORE_mutex_Status mutex_status; 409 CORE_semaphore_Status semaphore_status; 341 410 342 411 the_semaphore = _Semaphore_Get( id, &location ); … … 354 423 ); 355 424 case OBJECTS_LOCAL: 356 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set)) { 357 358 if ( !_Objects_Are_ids_equal( 359 _Thread_Executing->Object.id, the_semaphore->holder_id ) ) { 360 _Thread_Enable_dispatch(); 361 return( RTEMS_NOT_OWNER_OF_RESOURCE ); 362 } 363 364 the_semaphore->nest_count--; 365 366 if ( the_semaphore->nest_count != 0 ) { 367 _Thread_Enable_dispatch(); 368 return( RTEMS_SUCCESSFUL ); 369 } 370 371 _Thread_Executing->resource_count--; 372 the_semaphore->holder = NULL; 373 the_semaphore->holder_id = 0; 374 375 /* 376 * Whether or not someone is waiting for the semaphore, an 377 * inherited priority must be lowered if this is the last 378 * semaphore (i.e. resource) this task has. 379 */ 380 381 if ( _Attributes_Is_inherit_priority(the_semaphore->attribute_set) && 382 _Thread_Executing->resource_count == 0 && 383 _Thread_Executing->real_priority != 384 _Thread_Executing->current_priority ) { 385 _Thread_Change_priority( 386 _Thread_Executing, _Thread_Executing->real_priority ); 387 } 388 425 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { 426 mutex_status = _CORE_mutex_Surrender( 427 &the_semaphore->Core_control.mutex, 428 id, 429 _Semaphore_Core_mutex_mp_support 430 ); 431 _Thread_Enable_dispatch(); 432 return( _Semaphore_Translate_core_mutex_return_code( mutex_status ) ); 389 433 } 390 391 if ( (the_thread = _Thread_queue_Dequeue(&the_semaphore->Wait_queue)) ) { 392 393 if ( !_Objects_Is_local_id( the_thread->Object.id ) ) { 394 the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; 395 396 if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) { 397 the_semaphore->holder = NULL; 398 the_semaphore->holder_id = the_thread->Object.id; 399 the_semaphore->nest_count = 1; 400 } 401 402 _Semaphore_MP_Send_response_packet( 403 SEMAPHORE_MP_OBTAIN_RESPONSE, 404 id, 405 the_thread 406 ); 407 } else { 408 409 if ( _Attributes_Is_binary_semaphore(the_semaphore->attribute_set) ) { 410 the_semaphore->holder = the_thread; 411 the_semaphore->holder_id = the_thread->Object.id; 412 the_thread->resource_count++; 413 the_semaphore->nest_count = 1; 414 } 415 416 /* 417 * No special action for priority inheritance because the_thread 418 * is guaranteed to be the highest priority thread waiting for 419 * the semaphore. 420 */ 421 } 422 } else 423 the_semaphore->count += 1; 424 425 _Thread_Enable_dispatch(); 434 else 435 semaphore_status = _CORE_semaphore_Surrender( 436 &the_semaphore->Core_control.semaphore, 437 id, 438 _Semaphore_Core_semaphore_mp_support 439 ); 440 _Thread_Enable_dispatch(); 441 return( 442 _Semaphore_Translate_core_semaphore_return_code( semaphore_status ) ); 443 } 444 445 return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ 446 } 447 448 /*PAGE 449 * 450 * _Semaphore_Translate_core_mutex_return_code 451 * 452 * Input parameters: 453 * the_mutex_status - mutex status code to translate 454 * 455 * Output parameters: 456 * rtems status code - translated RTEMS status code 457 * 458 */ 459 460 rtems_status_code _Semaphore_Translate_core_mutex_return_code ( 461 unsigned32 the_mutex_status 462 ) 463 { 464 switch ( the_mutex_status ) { 465 case CORE_MUTEX_STATUS_SUCCESSFUL: 426 466 return( RTEMS_SUCCESSFUL ); 427 } 428 467 case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT: 468 return( RTEMS_UNSATISFIED ); 469 case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED: 470 return( RTEMS_INTERNAL_ERROR ); 471 case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE: 472 return( RTEMS_NOT_OWNER_OF_RESOURCE ); 473 case CORE_MUTEX_WAS_DELETED: 474 return( RTEMS_OBJECT_WAS_DELETED ); 475 case CORE_MUTEX_TIMEOUT: 476 return( RTEMS_TIMEOUT ); 477 case THREAD_STATUS_PROXY_BLOCKING: 478 return( THREAD_STATUS_PROXY_BLOCKING ); 479 } 480 _Internal_error_Occurred( 481 INTERNAL_ERROR_RTEMS_API, 482 TRUE, 483 the_mutex_status 484 ); 429 485 return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ 430 486 } … … 432 488 /*PAGE 433 489 * 434 * _Semaphore_Seize 435 * 436 * This routine attempts to allocate a semaphore to the calling thread. 437 * 438 * Input parameters: 439 * the_semaphore - pointer to semaphore control block 440 * option_set - acquire semaphore options 441 * 442 * Output parameters: 443 * TRUE - if semaphore allocated 444 * FALSE - if semaphore NOT allocated 445 * 446 * INTERRUPT LATENCY: 447 * available 448 * wait 449 */ 450 451 boolean _Semaphore_Seize( 452 Semaphore_Control *the_semaphore, 453 rtems_option option_set 454 ) 455 { 456 Thread_Control *executing; 457 ISR_Level level; 458 459 executing = _Thread_Executing; 460 executing->Wait.return_code = RTEMS_SUCCESSFUL; 461 _ISR_Disable( level ); 462 if ( the_semaphore->count != 0 ) { 463 the_semaphore->count -= 1; 464 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { 465 the_semaphore->holder = executing; 466 the_semaphore->holder_id = executing->Object.id; 467 the_semaphore->nest_count = 1; 468 executing->resource_count++; 469 } 470 _ISR_Enable( level ); 471 return( TRUE ); 472 } 473 474 if ( _Options_Is_no_wait( option_set ) ) { 475 _ISR_Enable( level ); 476 executing->Wait.return_code = RTEMS_UNSATISFIED; 477 return( TRUE ); 478 } 479 480 if ( _Attributes_Is_binary_semaphore( the_semaphore->attribute_set ) ) { 481 if ( _Objects_Are_ids_equal( 482 _Thread_Executing->Object.id, the_semaphore->holder_id ) ) { 483 the_semaphore->nest_count++; 484 _ISR_Enable( level ); 485 return( TRUE ); 486 } 487 } 488 489 the_semaphore->Wait_queue.sync = TRUE; 490 executing->Wait.queue = &the_semaphore->Wait_queue; 491 executing->Wait.id = the_semaphore->Object.id; 492 executing->Wait.option_set = option_set; 493 _ISR_Enable( level ); 494 return( FALSE ); 495 } 490 * _Semaphore_Translate_core_semaphore_return_code 491 * 492 * Input parameters: 493 * the_semaphore_status - semaphore status code to translate 494 * 495 * Output parameters: 496 * rtems status code - translated RTEMS status code 497 * 498 */ 499 500 rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( 501 unsigned32 the_semaphore_status 502 ) 503 { 504 switch ( the_semaphore_status ) { 505 case CORE_SEMAPHORE_STATUS_SUCCESSFUL: 506 return( RTEMS_SUCCESSFUL ); 507 case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: 508 return( RTEMS_UNSATISFIED ); 509 case CORE_SEMAPHORE_WAS_DELETED: 510 return( RTEMS_OBJECT_WAS_DELETED ); 511 case CORE_SEMAPHORE_TIMEOUT: 512 return( RTEMS_TIMEOUT ); 513 case THREAD_STATUS_PROXY_BLOCKING: 514 return( THREAD_STATUS_PROXY_BLOCKING ); 515 } 516 _Internal_error_Occurred( 517 INTERNAL_ERROR_RTEMS_API, 518 TRUE, 519 the_semaphore_status 520 ); 521 return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ 522 return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */ 523 } 524 525 /*PAGE 526 * 527 * _Semaphore_Core_mutex_mp_support 528 * 529 * Input parameters: 530 * the_thread - the remote thread the semaphore was surrendered to 531 * id - id of the surrendered semaphore 532 * 533 * Output parameters: NONE 534 */ 535 536 void _Semaphore_Core_mutex_mp_support ( 537 Thread_Control *the_thread, 538 Objects_Id id 539 ) 540 { 541 the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; 542 543 _Semaphore_MP_Send_response_packet( 544 SEMAPHORE_MP_OBTAIN_RESPONSE, 545 id, 546 the_thread 547 ); 548 } 549 550 551 /*PAGE 552 * 553 * _Semaphore_Core_semaphore_mp_support 554 * 555 * Input parameters: 556 * the_thread - the remote thread the semaphore was surrendered to 557 * id - id of the surrendered semaphore 558 * 559 * Output parameters: NONE 560 */ 561 562 void _Semaphore_Core_semaphore_mp_support ( 563 Thread_Control *the_thread, 564 Objects_Id id 565 ) 566 { 567 the_thread->receive_packet->return_code = RTEMS_SUCCESSFUL; 568 569 _Semaphore_MP_Send_response_packet( 570 SEMAPHORE_MP_OBTAIN_RESPONSE, 571 id, 572 the_thread 573 ); 574 } -
cpukit/rtems/src/semmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/sem.h> 22 #include <rtems/thread.h> 23 #include <rtems/watchdog.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/rtems/sem.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/core/watchdog.h> 25 #include <rtems/rtems/support.h> 24 26 25 27 /*PAGE … … 46 48 47 49 the_packet = _Semaphore_MP_Get_packet(); 48 the_packet->Prefix.the_class = RTEMS_MP_PACKET_SEMAPHORE;50 the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE; 49 51 the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet ); 50 52 the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet ); … … 79 81 Semaphore_MP_Remote_operations operation, 80 82 Objects_Id semaphore_id, 81 rtems_option option_set,82 rtems_interval timeout83 rtems_option option_set, 84 rtems_interval timeout 83 85 ) 84 86 { … … 91 93 92 94 the_packet = _Semaphore_MP_Get_packet(); 93 the_packet->Prefix.the_class = RTEMS_MP_PACKET_SEMAPHORE;95 the_packet->Prefix.the_class = MP_PACKET_SEMAPHORE; 94 96 the_packet->Prefix.length = sizeof ( Semaphore_MP_Packet ); 95 97 the_packet->Prefix.to_convert = sizeof ( Semaphore_MP_Packet ); … … 223 225 ); 224 226 225 if ( ! _ Status_Is_proxy_blocking( the_packet->Prefix.return_code ) )227 if ( ! _Thread_Is_proxy_blocking( the_packet->Prefix.return_code ) ) 226 228 _Semaphore_MP_Send_response_packet( 227 229 SEMAPHORE_MP_OBTAIN_RESPONSE, -
cpukit/rtems/src/signal.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/asr.h> 18 #include <rtems/isr.h> 19 #include <rtems/modes.h> 20 #include <rtems/signal.h> 21 #include <rtems/thread.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/asr.h> 19 #include <rtems/core/isr.h> 20 #include <rtems/rtems/modes.h> 21 #include <rtems/rtems/signal.h> 22 #include <rtems/core/thread.h> 23 #include <rtems/rtems/tasks.h> 22 24 25 /*PAGE 26 * 27 * _Signal_Manager_initialization 28 * 29 * This routine initializes all signal manager related data structures. 30 * 31 * Input parameters: NONE 32 * 33 * Output parameters: NONE 34 */ 35 36 void _Signal_Manager_initialization( void ) 37 { 38 /* 39 * Register the MP Process Packet routine. 40 */ 41 42 _MPCI_Register_packet_processor( 43 MP_PACKET_SIGNAL, 44 _Signal_MP_Process_packet 45 ); 46 } 47 23 48 /*PAGE 24 49 * … … 42 67 ) 43 68 { 44 Thread_Control *executing; 69 Thread_Control *executing; 70 RTEMS_API_Control *api; 71 ASR_Information *asr; 45 72 46 73 /* XXX normalize mode */ 47 74 executing = _Thread_Executing; 75 api = executing->API_Extensions[ THREAD_API_RTEMS ]; 76 asr = &api->Signal; 77 48 78 _Thread_Disable_dispatch(); /* cannot reschedule while */ 49 79 /* the thread is inconsistent */ 50 80 51 81 if ( !_ASR_Is_null_handler( asr_handler ) ) { 52 executing->RTEMS_API->Signal.mode_set = mode_set;53 executing->RTEMS_API->Signal.handler= asr_handler;82 asr->mode_set = mode_set; 83 asr->handler = asr_handler; 54 84 } 55 85 else 56 _ASR_Initialize( &executing->RTEMS_API->Signal);86 _ASR_Initialize( asr ); 57 87 _Thread_Enable_dispatch(); 58 return ( RTEMS_SUCCESSFUL );88 return RTEMS_SUCCESSFUL; 59 89 } 60 90 … … 81 111 register Thread_Control *the_thread; 82 112 Objects_Locations location; 113 RTEMS_API_Control *api; 114 ASR_Information *asr; 83 115 84 116 the_thread = _Thread_Get( id, &location ); 85 117 switch ( location ) { 86 118 case OBJECTS_ERROR: 87 return ( RTEMS_INVALID_ID );119 return RTEMS_INVALID_ID; 88 120 case OBJECTS_REMOTE: 89 121 return _Signal_MP_Send_request_packet( … … 93 125 ); 94 126 case OBJECTS_LOCAL: 95 if ( ! _ASR_Is_null_handler( the_thread->RTEMS_API->Signal.handler ) ) { 96 if ( _Modes_Is_asr_disabled( the_thread->current_modes ) ) 97 _ASR_Post_signals( 98 signal_set, &the_thread->RTEMS_API->Signal.signals_pending ); 99 else { 100 _ASR_Post_signals( 101 signal_set, &the_thread->RTEMS_API->Signal.signals_posted ); 127 api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; 128 asr = &api->Signal; 129 130 if ( ! _ASR_Is_null_handler( asr->handler ) ) { 131 if ( asr->is_enabled ) { 132 _ASR_Post_signals( signal_set, &asr->signals_posted ); 102 133 if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) ) 103 134 _ISR_Signals_to_thread_executing = TRUE; 135 } else { 136 _ASR_Post_signals( signal_set, &asr->signals_pending ); 104 137 } 105 138 _Thread_Enable_dispatch(); 106 return ( RTEMS_SUCCESSFUL );139 return RTEMS_SUCCESSFUL; 107 140 } 108 141 _Thread_Enable_dispatch(); 109 return ( RTEMS_NOT_DEFINED );142 return RTEMS_NOT_DEFINED; 110 143 } 111 144 112 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */145 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 113 146 } -
cpukit/rtems/src/signalmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/signal.h> 22 #include <rtems/states.h> 23 #include <rtems/thread.h> 24 #include <rtems/watchdog.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/rtems/signal.h> 23 #include <rtems/core/states.h> 24 #include <rtems/core/thread.h> 25 #include <rtems/core/watchdog.h> 26 #include <rtems/rtems/support.h> 25 27 26 28 /*PAGE … … 52 54 53 55 the_packet = _Signal_MP_Get_packet(); 54 the_packet->Prefix.the_class = RTEMS_MP_PACKET_SIGNAL;56 the_packet->Prefix.the_class = MP_PACKET_SIGNAL; 55 57 the_packet->Prefix.length = sizeof ( Signal_MP_Packet ); 56 58 the_packet->Prefix.to_convert = sizeof ( Signal_MP_Packet ); -
cpukit/rtems/src/taskmp.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/mpci.h> 18 #include <rtems/mppkt.h> 19 #include <rtems/object.h> 20 #include <rtems/options.h> 21 #include <rtems/tasks.h> 22 #include <rtems/thread.h> 23 #include <rtems/watchdog.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/core/mpci.h> 19 #include <rtems/core/mppkt.h> 20 #include <rtems/core/object.h> 21 #include <rtems/rtems/options.h> 22 #include <rtems/rtems/tasks.h> 23 #include <rtems/core/thread.h> 24 #include <rtems/core/watchdog.h> 25 #include <rtems/rtems/support.h> 24 26 25 27 /*PAGE … … 43 45 44 46 the_packet = _RTEMS_tasks_MP_Get_packet(); 45 the_packet->Prefix.the_class = RTEMS_MP_PACKET_TASKS;47 the_packet->Prefix.the_class = MP_PACKET_TASKS; 46 48 the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet ); 47 49 the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet ); … … 92 94 93 95 the_packet = _RTEMS_tasks_MP_Get_packet(); 94 the_packet->Prefix.the_class = RTEMS_MP_PACKET_TASKS;96 the_packet->Prefix.the_class = MP_PACKET_TASKS; 95 97 the_packet->Prefix.length = sizeof ( RTEMS_tasks_MP_Packet ); 96 98 the_packet->Prefix.to_convert = sizeof ( RTEMS_tasks_MP_Packet ); … … 333 335 RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void ) 334 336 { 335 return ( (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet());337 return (RTEMS_tasks_MP_Packet *) _MPCI_Get_packet(); 336 338 } 337 339 -
cpukit/rtems/src/tasks.c
r5072b07 r3a4ae6c 15 15 16 16 #include <rtems/system.h> 17 #include <rtems/support.h> 18 #include <rtems/modes.h> 19 #include <rtems/object.h> 20 #include <rtems/stack.h> 21 #include <rtems/states.h> 22 #include <rtems/tasks.h> 23 #include <rtems/thread.h> 24 #include <rtems/threadq.h> 25 #include <rtems/tod.h> 26 #include <rtems/userext.h> 27 #include <rtems/wkspace.h> 17 #include <rtems/rtems/status.h> 18 #include <rtems/rtems/support.h> 19 #include <rtems/rtems/modes.h> 20 #include <rtems/core/object.h> 21 #include <rtems/core/stack.h> 22 #include <rtems/core/states.h> 23 #include <rtems/rtems/tasks.h> 24 #include <rtems/core/thread.h> 25 #include <rtems/core/threadq.h> 26 #include <rtems/core/tod.h> 27 #include <rtems/core/userext.h> 28 #include <rtems/core/wkspace.h> 29 #include <rtems/core/intthrd.h> 30 #include <rtems/sysstate.h> 31 32 /*PAGE 33 * 34 * _RTEMS_tasks_Create_extension 35 * 36 * XXX 37 */ 38 39 boolean _RTEMS_tasks_Create_extension( 40 Thread_Control *executing, 41 Thread_Control *created 42 ) 43 { 44 RTEMS_API_Control *api; 45 46 api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); 47 48 if ( !api ) 49 return FALSE; 50 51 created->API_Extensions[ THREAD_API_RTEMS ] = api; 52 53 api->pending_events = EVENT_SETS_NONE_PENDING; 54 _ASR_Initialize( &api->Signal ); 55 return TRUE; 56 } 57 58 /*PAGE 59 * 60 * _RTEMS_tasks_Start_extension 61 * 62 * XXX 63 */ 64 65 User_extensions_routine _RTEMS_tasks_Start_extension( 66 Thread_Control *executing, 67 Thread_Control *started 68 ) 69 { 70 RTEMS_API_Control *api; 71 72 api = started->API_Extensions[ THREAD_API_RTEMS ]; 73 74 api->pending_events = EVENT_SETS_NONE_PENDING; 75 76 _ASR_Initialize( &api->Signal ); 77 } 78 79 /*PAGE 80 * 81 * _RTEMS_tasks_Delete_extension 82 * 83 * XXX 84 */ 85 86 User_extensions_routine _RTEMS_tasks_Delete_extension( 87 Thread_Control *executing, 88 Thread_Control *deleted 89 ) 90 { 91 (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_RTEMS ] ); 92 93 deleted->API_Extensions[ THREAD_API_RTEMS ] = NULL; 94 } 95 96 /*PAGE 97 * 98 * _RTEMS_tasks_Switch_extension 99 * 100 * XXX 101 */ 102 103 User_extensions_routine _RTEMS_tasks_Switch_extension( 104 Thread_Control *executing 105 ) 106 { 107 ISR_Level level; 108 RTEMS_API_Control *api; 109 ASR_Information *asr; 110 rtems_signal_set signal_set; 111 Modes_Control prev_mode; 112 113 api = executing->API_Extensions[ THREAD_API_RTEMS ]; 114 asr = &api->Signal; 115 116 _ISR_Disable( level ); 117 118 signal_set = asr->signals_posted; 119 120 if ( signal_set ) { 121 /* if ( _ASR_Are_signals_pending( asr ) ) { 122 123 signal_set = asr->signals_posted; */ 124 asr->signals_posted = 0; 125 _ISR_Enable( level ); 126 127 asr->nest_level += 1; 128 rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); 129 130 (*asr->handler)( signal_set ); 131 132 asr->nest_level -= 1; 133 rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); 134 } 135 else 136 _ISR_Enable( level ); 137 138 } 139 140 Internal_threads_Extensions_control _RTEMS_tasks_Internal_thread_extensions = { 141 { NULL, NULL }, 142 NULL, /* predriver */ 143 _RTEMS_tasks_Initialize_user_tasks /* postdriver */ 144 }; 145 146 User_extensions_Control _RTEMS_tasks_API_extensions = { 147 { NULL, NULL }, 148 { _RTEMS_tasks_Create_extension, /* create */ 149 _RTEMS_tasks_Start_extension, /* start */ 150 _RTEMS_tasks_Start_extension, /* restart */ 151 _RTEMS_tasks_Delete_extension, /* delete */ 152 NULL, /* switch */ 153 _RTEMS_tasks_Switch_extension, /* post switch */ 154 NULL, /* begin */ 155 NULL, /* exitted */ 156 NULL /* fatal */ 157 } 158 }; 28 159 29 160 /*PAGE … … 40 171 41 172 void _RTEMS_tasks_Manager_initialization( 42 unsigned32 maximum_tasks 43 ) 44 { 173 unsigned32 maximum_tasks, 174 unsigned32 number_of_initialization_tasks, 175 rtems_initialization_tasks_table *user_tasks 176 ) 177 { 178 179 _RTEMS_tasks_Number_of_initialization_tasks = number_of_initialization_tasks; 180 _RTEMS_tasks_User_initialization_tasks = user_tasks; 181 182 if ( user_tasks == NULL || number_of_initialization_tasks == 0 ) 183 _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, RTEMS_TOO_MANY ); 184 45 185 _Objects_Initialize_information( 46 186 &_RTEMS_tasks_Information, … … 53 193 TRUE 54 194 ); 195 196 /* 197 * Add all the extensions for this API 198 */ 199 200 _User_extensions_Add_API_set( &_RTEMS_tasks_API_extensions ); 201 202 _Internal_threads_Add_extension( &_RTEMS_tasks_Internal_thread_extensions ); 203 204 /* 205 * Register the MP Process Packet routine. 206 */ 207 208 _MPCI_Register_packet_processor( 209 MP_PACKET_TASKS, 210 _RTEMS_tasks_MP_Process_packet 211 ); 212 55 213 } 56 214 … … 90 248 boolean is_fp; 91 249 boolean is_global; 250 boolean status; 92 251 rtems_attribute the_attribute_set; 93 252 Priority_Control core_priority; 253 RTEMS_API_Control *api; 254 ASR_Information *asr; 94 255 95 256 96 257 if ( !rtems_is_name_valid( name ) ) 97 return ( RTEMS_INVALID_NAME );258 return RTEMS_INVALID_NAME; 98 259 99 260 /* … … 104 265 #if 0 105 266 if ( !_Stack_Is_enough( stack_size ) ) 106 return ( RTEMS_INVALID_SIZE );267 return RTEMS_INVALID_SIZE; 107 268 #endif 108 269 … … 111 272 */ 112 273 113 if ( !_ Priority_Is_valid( initial_priority ) )114 return ( RTEMS_INVALID_PRIORITY );115 116 core_priority = _RTEMS_ Tasks_Priority_to_Core( initial_priority );274 if ( !_RTEMS_tasks_Priority_is_valid( initial_priority ) ) 275 return RTEMS_INVALID_PRIORITY; 276 277 core_priority = _RTEMS_tasks_Priority_to_Core( initial_priority ); 117 278 118 279 /* … … 138 299 is_global = TRUE; 139 300 140 if ( !_ Configuration_Is_multiprocessing())141 return ( RTEMS_MP_NOT_CONFIGURED );301 if ( !_System_state_Is_multiprocessing ) 302 return RTEMS_MP_NOT_CONFIGURED; 142 303 143 304 } else … … 168 329 if ( !the_thread ) { 169 330 _Thread_Enable_dispatch(); 170 return ( RTEMS_TOO_MANY );331 return RTEMS_TOO_MANY; 171 332 } 172 333 … … 177 338 _RTEMS_tasks_Free( the_thread ); 178 339 _Thread_Enable_dispatch(); 179 return ( RTEMS_TOO_MANY );340 return RTEMS_TOO_MANY; 180 341 } 181 342 } 182 343 183 #if 0184 /*185 * Allocate and initialize the RTEMS API specific information186 */187 188 the_thread->RTEMS_API = _Workspace_Allocate( sizeof( RTEMS_API_Control ) );189 190 if ( !the_thread->RTEMS_API ) {191 _RTEMS_tasks_Free( the_thread );192 if ( is_global )193 _Objects_MP_Free_global_object( the_global_object );194 _Thread_Enable_dispatch();195 return( RTEMS_UNSATISFIED );196 }197 198 the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;199 _ASR_Initialize( &the_thread->RTEMS_API->Signal );200 #endif201 202 344 /* 203 345 * Initialize the core thread for this task. 204 346 */ 205 347 206 /* XXX normalize mode */ 207 208 if ( !_Thread_Initialize( &_RTEMS_tasks_Information, the_thread, 209 NULL, stack_size, is_fp, core_priority, initial_modes, &name ) ) { 348 status = _Thread_Initialize( 349 &_RTEMS_tasks_Information, 350 the_thread, 351 NULL, 352 stack_size, 353 is_fp, 354 core_priority, 355 _Modes_Is_preempt(initial_modes) ? TRUE : FALSE, 356 _Modes_Is_timeslice(initial_modes) ? TRUE : FALSE, 357 _Modes_Get_interrupt_level(initial_modes), 358 &name 359 ); 360 361 if ( !status ) { 210 362 if ( is_global ) 211 363 _Objects_MP_Free_global_object( the_global_object ); 212 364 _RTEMS_tasks_Free( the_thread ); 213 365 _Thread_Enable_dispatch(); 214 return( RTEMS_UNSATISFIED ); 215 } 366 return RTEMS_UNSATISFIED; 367 } 368 369 api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; 370 asr = &api->Signal; 371 372 asr->is_enabled = _Modes_Is_asr_disabled(initial_modes) ? FALSE : TRUE; 216 373 217 374 *id = the_thread->Object.id; … … 219 376 if ( is_global ) { 220 377 221 the_thread-> RTEMS_API->is_global = TRUE;378 the_thread->is_global = TRUE; 222 379 223 380 _Objects_MP_Open( … … 237 394 238 395 _Thread_Enable_dispatch(); 239 return ( RTEMS_SUCCESSFUL );396 return RTEMS_SUCCESSFUL; 240 397 } 241 398 … … 264 421 ) 265 422 { 266 if ( name != OBJECTS_ID_OF_SELF ) 267 return( _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ) ); 268 269 *id = _Thread_Executing->Object.id; 270 return( RTEMS_SUCCESSFUL ); 423 Objects_Name_to_id_errors status; 424 425 if ( name == OBJECTS_ID_OF_SELF ) { 426 *id = _Thread_Executing->Object.id; 427 return RTEMS_SUCCESSFUL; 428 } 429 430 status = _Objects_Name_to_id( &_RTEMS_tasks_Information, &name, node, id ); 431 432 return _Status_Object_name_errors_to_status[ status ]; 271 433 } 272 434 … … 299 461 300 462 if ( entry_point == NULL ) 301 return ( RTEMS_INVALID_ADDRESS );463 return RTEMS_INVALID_ADDRESS; 302 464 303 465 the_thread = _Thread_Get( id, &location ); 304 466 switch ( location ) { 305 467 case OBJECTS_ERROR: 306 return ( RTEMS_INVALID_ID );468 return RTEMS_INVALID_ID; 307 469 case OBJECTS_REMOTE: 308 470 _Thread_Dispatch(); 309 return ( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );471 return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; 310 472 case OBJECTS_LOCAL: 311 473 if ( _Thread_Start( 312 474 the_thread, THREAD_START_NUMERIC, entry_point, NULL, argument ) ) { 313 475 _Thread_Enable_dispatch(); 314 return ( RTEMS_SUCCESSFUL );476 return RTEMS_SUCCESSFUL; 315 477 } 316 478 _Thread_Enable_dispatch(); 317 return ( RTEMS_INCORRECT_STATE );318 } 319 320 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */479 return RTEMS_INCORRECT_STATE; 480 } 481 482 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 321 483 } 322 484 … … 350 512 switch ( location ) { 351 513 case OBJECTS_ERROR: 352 return ( RTEMS_INVALID_ID );514 return RTEMS_INVALID_ID; 353 515 case OBJECTS_REMOTE: 354 516 _Thread_Dispatch(); 355 return ( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );517 return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; 356 518 case OBJECTS_LOCAL: 357 519 if ( _Thread_Restart( the_thread, NULL, argument ) ) { 358 359 /* XXX until these are in an API extension they are too late. */360 _ASR_Initialize( &the_thread->RTEMS_API->Signal );361 the_thread->RTEMS_API->pending_events = EVENT_SETS_NONE_PENDING;362 363 520 _Thread_Enable_dispatch(); 364 return ( RTEMS_SUCCESSFUL );521 return RTEMS_SUCCESSFUL; 365 522 } 366 523 _Thread_Enable_dispatch(); 367 return ( RTEMS_INCORRECT_STATE );368 } 369 370 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */524 return RTEMS_INCORRECT_STATE; 525 } 526 527 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 371 528 } 372 529 … … 399 556 switch ( location ) { 400 557 case OBJECTS_ERROR: 401 return ( RTEMS_INVALID_ID );558 return RTEMS_INVALID_ID; 402 559 case OBJECTS_REMOTE: 403 560 _Thread_Dispatch(); 404 return ( RTEMS_ILLEGAL_ON_REMOTE_OBJECT );561 return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; 405 562 case OBJECTS_LOCAL: 406 563 _Thread_Close( &_RTEMS_tasks_Information, the_thread ); 407 564 408 /* XXX */409 (void) _Workspace_Free( the_thread->RTEMS_API );410 411 565 _RTEMS_tasks_Free( the_thread ); 412 566 413 if ( _Attributes_Is_global( the_thread->RTEMS_API->is_global )) {567 if ( the_thread->is_global ) { 414 568 415 569 _Objects_MP_Close( &_RTEMS_tasks_Information, the_thread->Object.id ); … … 423 577 424 578 _Thread_Enable_dispatch(); 425 return ( RTEMS_SUCCESSFUL );426 } 427 428 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */579 return RTEMS_SUCCESSFUL; 580 } 581 582 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 429 583 } 430 584 … … 455 609 switch ( location ) { 456 610 case OBJECTS_ERROR: 457 return ( RTEMS_INVALID_ID );611 return RTEMS_INVALID_ID; 458 612 case OBJECTS_REMOTE: 459 return( 460 _RTEMS_tasks_MP_Send_request_packet( 461 RTEMS_TASKS_MP_SUSPEND_REQUEST, 462 id, 463 0, /* Not used */ 464 0, /* Not used */ 465 0 /* Not used */ 466 ) 613 return _RTEMS_tasks_MP_Send_request_packet( 614 RTEMS_TASKS_MP_SUSPEND_REQUEST, 615 id, 616 0, /* Not used */ 617 0, /* Not used */ 618 0 /* Not used */ 467 619 ); 468 620 case OBJECTS_LOCAL: … … 470 622 _Thread_Set_state( the_thread, STATES_SUSPENDED ); 471 623 _Thread_Enable_dispatch(); 472 return ( RTEMS_SUCCESSFUL );624 return RTEMS_SUCCESSFUL; 473 625 } 474 626 _Thread_Enable_dispatch(); 475 return ( RTEMS_ALREADY_SUSPENDED );476 } 477 478 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */627 return RTEMS_ALREADY_SUSPENDED; 628 } 629 630 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 479 631 } 480 632 … … 504 656 switch ( location ) { 505 657 case OBJECTS_ERROR: 506 return ( RTEMS_INVALID_ID );658 return RTEMS_INVALID_ID; 507 659 case OBJECTS_REMOTE: 508 660 return( … … 519 671 _Thread_Resume( the_thread ); 520 672 _Thread_Enable_dispatch(); 521 return ( RTEMS_SUCCESSFUL );673 return RTEMS_SUCCESSFUL; 522 674 } 523 675 _Thread_Enable_dispatch(); 524 return ( RTEMS_INCORRECT_STATE );525 } 526 527 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */676 return RTEMS_INCORRECT_STATE; 677 } 678 679 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 528 680 } 529 681 … … 557 709 558 710 if ( new_priority != RTEMS_CURRENT_PRIORITY && 559 !_ Priority_Is_valid( new_priority ) )560 return ( RTEMS_INVALID_PRIORITY );711 !_RTEMS_tasks_Priority_is_valid( new_priority ) ) 712 return RTEMS_INVALID_PRIORITY; 561 713 562 714 the_thread = _Thread_Get( id, &location ); 563 715 switch ( location ) { 564 716 case OBJECTS_ERROR: 565 return ( RTEMS_INVALID_ID );717 return RTEMS_INVALID_ID; 566 718 case OBJECTS_REMOTE: 567 719 _Thread_Executing->Wait.return_argument = old_priority; … … 584 736 } 585 737 _Thread_Enable_dispatch(); 586 return ( RTEMS_SUCCESSFUL );587 } 588 589 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */738 return RTEMS_SUCCESSFUL; 739 } 740 741 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 590 742 } 591 743 … … 604 756 * Output: 605 757 * *previous_mode_set - previous mode set 606 * always return s RTEMS_SUCCESSFUL758 * always return RTEMS_SUCCESSFUL; 607 759 */ 608 760 … … 613 765 ) 614 766 { 615 if ( _Thread_Change_mode( mode_set, mask, previous_mode_set ) ) 767 Thread_Control *executing; 768 RTEMS_API_Control *api; 769 ASR_Information *asr; 770 boolean is_asr_enabled = FALSE; 771 boolean needs_asr_dispatching = FALSE; 772 rtems_mode old_mode; 773 774 executing = _Thread_Executing; 775 api = executing->API_Extensions[ THREAD_API_RTEMS ]; 776 asr = &api->Signal; 777 778 old_mode = (executing->is_preemptible) ? RTEMS_PREEMPT : RTEMS_NO_PREEMPT; 779 old_mode |= (executing->is_timeslice) ? RTEMS_TIMESLICE : RTEMS_NO_TIMESLICE; 780 old_mode |= (asr->is_enabled) ? RTEMS_ASR : RTEMS_NO_ASR; 781 old_mode |= _ISR_Get_level(); 782 783 *previous_mode_set = old_mode; 784 785 /* 786 * These are generic thread scheduling characteristics. 787 */ 788 789 if ( mask & RTEMS_PREEMPT_MASK ) 790 executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE; 791 792 if ( mask & RTEMS_TIMESLICE_MASK ) 793 executing->is_timeslice = _Modes_Is_timeslice(mode_set) ? TRUE : FALSE; 794 795 /* 796 * Set the new interrupt level 797 */ 798 799 if ( mask & RTEMS_INTERRUPT_MASK ) 800 _Modes_Set_interrupt_level( mode_set ); 801 802 /* 803 * This is specific to the RTEMS API 804 */ 805 806 is_asr_enabled = FALSE; 807 needs_asr_dispatching = FALSE; 808 809 if ( mask & RTEMS_ASR_MASK ) { 810 is_asr_enabled = _Modes_Is_asr_disabled( mode_set ) ? FALSE : TRUE; 811 if ( is_asr_enabled != asr->is_enabled ) { 812 asr->is_enabled = is_asr_enabled; 813 _ASR_Swap_signals( asr ); 814 if ( _ASR_Are_signals_pending( asr ) ) 815 needs_asr_dispatching = TRUE; 816 } 817 } 818 819 if ( _Thread_Evaluate_mode() || needs_asr_dispatching ) 616 820 _Thread_Dispatch(); 617 return( RTEMS_SUCCESSFUL ); 821 822 return RTEMS_SUCCESSFUL; 618 823 } 619 824 … … 644 849 register Thread_Control *the_thread; 645 850 Objects_Locations location; 851 RTEMS_API_Control *api; 646 852 647 853 /* … … 651 857 652 858 if ( notepad > RTEMS_NOTEPAD_LAST ) 653 return ( RTEMS_INVALID_NUMBER );859 return RTEMS_INVALID_NUMBER; 654 860 655 861 /* … … 659 865 if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || 660 866 _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { 661 *note = _Thread_Executing->RTEMS_API->Notepads[ notepad ]; 662 return( RTEMS_SUCCESSFUL ); 867 api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; 868 *note = api->Notepads[ notepad ]; 869 return RTEMS_SUCCESSFUL; 663 870 } 664 871 … … 666 873 switch ( location ) { 667 874 case OBJECTS_ERROR: 668 return ( RTEMS_INVALID_ID );875 return RTEMS_INVALID_ID; 669 876 case OBJECTS_REMOTE: 670 877 _Thread_Executing->Wait.return_argument = note; … … 678 885 ); 679 886 case OBJECTS_LOCAL: 680 *note= the_thread->RTEMS_API->Notepads[ notepad ]; 887 api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; 888 *note = api->Notepads[ notepad ]; 681 889 _Thread_Enable_dispatch(); 682 return ( RTEMS_SUCCESSFUL );683 } 684 685 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */890 return RTEMS_SUCCESSFUL; 891 } 892 893 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 686 894 } 687 895 … … 711 919 register Thread_Control *the_thread; 712 920 Objects_Locations location; 921 RTEMS_API_Control *api; 713 922 714 923 /* … … 718 927 719 928 if ( notepad > RTEMS_NOTEPAD_LAST ) 720 return ( RTEMS_INVALID_NUMBER );929 return RTEMS_INVALID_NUMBER; 721 930 722 931 /* … … 726 935 if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) || 727 936 _Objects_Are_ids_equal( id, _Thread_Executing->Object.id ) ) { 728 _Thread_Executing->RTEMS_API->Notepads[ notepad ] = note; 729 return( RTEMS_SUCCESSFUL ); 937 api = _Thread_Executing->API_Extensions[ THREAD_API_RTEMS ]; 938 api->Notepads[ notepad ] = note; 939 return RTEMS_SUCCESSFUL; 730 940 } 731 941 … … 733 943 switch ( location ) { 734 944 case OBJECTS_ERROR: 735 return ( RTEMS_INVALID_ID );945 return RTEMS_INVALID_ID; 736 946 case OBJECTS_REMOTE: 737 947 return _RTEMS_tasks_MP_Send_request_packet( … … 744 954 745 955 case OBJECTS_LOCAL: 746 the_thread->RTEMS_API->Notepads[ notepad ] = note; 956 api = the_thread->API_Extensions[ THREAD_API_RTEMS ]; 957 api->Notepads[ notepad ] = note; 747 958 _Thread_Enable_dispatch(); 748 return ( RTEMS_SUCCESSFUL );749 } 750 751 return ( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */959 return RTEMS_SUCCESSFUL; 960 } 961 962 return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ 752 963 } 753 964 … … 786 997 _Thread_Enable_dispatch(); 787 998 } 788 return ( RTEMS_SUCCESSFUL );999 return RTEMS_SUCCESSFUL; 789 1000 } 790 1001 … … 808 1019 ) 809 1020 { 810 rtems_interval seconds; 811 rtems_status_code local_result; 1021 Watchdog_Interval seconds; 812 1022 813 1023 if ( !_TOD_Is_set() ) 814 return ( RTEMS_NOT_DEFINED );1024 return RTEMS_NOT_DEFINED; 815 1025 816 1026 time_buffer->ticks = 0; 817 1027 818 local_result = _TOD_Validate( time_buffer ); 819 820 if ( !rtems_is_status_successful( local_result ) ) 821 return( local_result ); 1028 if ( !_TOD_Validate( time_buffer ) ) 1029 return RTEMS_INVALID_CLOCK; 822 1030 823 1031 seconds = _TOD_To_seconds( time_buffer ); 824 1032 825 1033 if ( seconds <= _TOD_Seconds_since_epoch ) 826 return ( RTEMS_INVALID_CLOCK );1034 return RTEMS_INVALID_CLOCK; 827 1035 828 1036 _Thread_Disable_dispatch(); … … 837 1045 seconds - _TOD_Seconds_since_epoch, WATCHDOG_ACTIVATE_NOW ); 838 1046 _Thread_Enable_dispatch(); 839 return( RTEMS_SUCCESSFUL ); 840 } 1047 return RTEMS_SUCCESSFUL; 1048 } 1049 1050 /*PAGE 1051 * 1052 * _RTEMS_tasks_Initialize_user_tasks 1053 * 1054 * This routine creates and starts all configured user 1055 * initialzation threads. 1056 * 1057 * Input parameters: NONE 1058 * 1059 * Output parameters: NONE 1060 */ 1061 1062 void _RTEMS_tasks_Initialize_user_tasks( void ) 1063 { 1064 unsigned32 index; 1065 unsigned32 maximum; 1066 rtems_id id; 1067 rtems_status_code return_value; 1068 rtems_initialization_tasks_table *user_tasks; 1069 1070 /* 1071 * NOTE: This is slightly different from the Ada implementation. 1072 */ 1073 1074 user_tasks = _RTEMS_tasks_User_initialization_tasks; 1075 maximum = _RTEMS_tasks_Number_of_initialization_tasks; 1076 1077 for ( index=0 ; index < maximum ; index++ ) { 1078 return_value = rtems_task_create( 1079 user_tasks[ index ].name, 1080 user_tasks[ index ].initial_priority, 1081 user_tasks[ index ].stack_size, 1082 user_tasks[ index ].mode_set, 1083 user_tasks[ index ].attribute_set, 1084 &id 1085 ); 1086 1087 if ( !rtems_is_status_successful( return_value ) ) 1088 _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); 1089 1090 return_value = rtems_task_start( 1091 id, 1092 user_tasks[ index ].entry_point, 1093 user_tasks[ index ].argument 1094 ); 1095 1096 if ( !rtems_is_status_successful( return_value ) ) 1097 _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, TRUE, return_value ); 1098 } 1099 } 1100
Note: See TracChangeset
for help on using the changeset viewer.