- Timestamp:
- 08/17/95 19:51:51 (27 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 95fbca1
- Parents:
- 3b438fa
- Location:
- c/src
- Files:
-
- 49 added
- 64 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libcsupport/include/clockdrv.h
r3b438fa rb06e68ef 24 24 25 25 extern volatile rtems_unsigned32 Clock_driver_ticks; 26 extern rtems_device_major_number rtems_clock_major; 27 extern rtems_device_minor_number rtems_clock_minor; 26 28 27 /* functions */ 28 29 rtems_task Exit_task(); 30 void exit_task_init(); 31 32 void Install_clock( rtems_isr_entry ); 33 void ReInstall_clock( rtems_isr_entry ); 34 void Clock_exit(); 35 36 rtems_isr Clock_isr( 37 rtems_vector_number 38 ); 39 40 /* driver entries */ 29 /* default clock driver entry */ 41 30 42 31 #define CLOCK_DRIVER_TABLE_ENTRY \ 43 { Clock_initialize, NULL, NULL, NULL, NULL, NULL}44 32 { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } 33 45 34 rtems_device_driver Clock_initialize( 46 35 rtems_device_major_number, 47 36 rtems_device_minor_number, 48 void *, 49 rtems_id, 50 rtems_unsigned32 * 37 void * 38 ); 39 40 rtems_device_driver Clock_control( 41 rtems_device_major_number major, 42 rtems_device_minor_number minor, 43 void *pargp 51 44 ); 52 45 -
c/src/exec/rtems/headers/message.h
r3b438fa rb06e68ef 42 42 * The following defines the data types needed to manipulate 43 43 * the contents of message buffers. 44 * Since msgs are variable length we just make a ptr to 1. 44 45 */ 45 46 46 47 typedef struct { 47 unsigned32 field1; 48 unsigned32 field2; 49 unsigned32 field3; 50 unsigned32 field4; 51 } Message_queue_Buffer; 48 unsigned32 size; 49 50 #ifndef __cplusplus 51 /* NOTE: [0] is gcc specific, 52 * but specifically disallowed by ANSI STD C++ 53 * g++ warns about it, so we #ifdef it out to 54 * get rid of warnings when compiled by g++. 55 */ 56 unsigned32 buffer[0]; 57 #endif 58 59 } Message_queue_Buffer; 52 60 53 61 /* … … 69 77 Objects_Control Object; 70 78 Thread_queue_Control Wait_queue; 71 rtems_attribute attribute_set;79 rtems_attribute attribute_set; 72 80 unsigned32 maximum_pending_messages; 73 81 unsigned32 number_of_pending_messages; 82 unsigned32 maximum_message_size; 74 83 Chain_Control Pending_messages; 84 Message_queue_Buffer *message_buffers; 85 Chain_Control Inactive_messages; 75 86 } Message_queue_Control; 76 87 … … 81 92 82 93 EXTERN Objects_Information _Message_queue_Information; 83 84 /*85 * The following defines the data structures used to86 * manage the pool of inactive message buffers.87 */88 89 EXTERN Chain_Control _Message_queue_Inactive_messages;90 94 91 95 /* … … 109 113 110 114 void _Message_queue_Manager_initialization( 111 unsigned32 maximum_message_queues, 112 unsigned32 maximum_messages 115 unsigned32 maximum_message_queues 113 116 ); 114 117 … … 127 130 128 131 rtems_status_code rtems_message_queue_create( 129 Objects_Name name, 130 unsigned32 count, 132 Objects_Name name, 133 unsigned32 count, 134 unsigned32 max_message_size, 131 135 rtems_attribute attribute_set, 132 Objects_Id 136 Objects_Id *id 133 137 ); 134 138 … … 184 188 rtems_status_code rtems_message_queue_send( 185 189 Objects_Id id, 186 void *buffer 190 void *buffer, 191 unsigned32 size 187 192 ); 188 193 … … 205 210 rtems_status_code rtems_message_queue_urgent( 206 211 Objects_Id id, 207 void *buffer 212 void *buffer, 213 unsigned32 size 208 214 ); 209 215 … … 227 233 Objects_Id id, 228 234 void *buffer, 235 unsigned32 size, 229 236 unsigned32 *count 230 237 ); … … 247 254 Objects_Id id, 248 255 void *buffer, 256 unsigned32 *size_p, 249 257 unsigned32 option_set, 250 rtems_interval timeout258 rtems_interval timeout 251 259 ); 252 260 … … 277 285 278 286 STATIC INLINE void _Message_queue_Copy_buffer ( 279 Message_queue_Buffer *source, 280 Message_queue_Buffer *destination 287 void *source, 288 void *destination, 289 unsigned32 size 281 290 ); 282 291 … … 296 305 Message_queue_Control *the_message_queue, 297 306 unsigned32 option_set, 298 Message_queue_Buffer *buffer 307 void *buffer, 308 unsigned32 *size_p 299 309 ); 300 310 … … 323 333 rtems_status_code _Message_queue_Submit( 324 334 Objects_Id id, 325 Message_queue_Buffer *buffer, 335 void *buffer, 336 unsigned32 size, 326 337 Message_queue_Submit_types submit_type 327 338 ); … … 337 348 338 349 STATIC INLINE Message_queue_Buffer_control * 339 _Message_queue_Allocate_message_buffer ( void ); 350 _Message_queue_Allocate_message_buffer ( 351 Message_queue_Control *the_message_queue 352 ); 340 353 341 354 /* … … 349 362 350 363 STATIC INLINE void _Message_queue_Free_message_buffer ( 364 Message_queue_Control *the_message_queue, 351 365 Message_queue_Buffer_control *the_message 352 366 ); … … 416 430 */ 417 431 418 STATIC INLINE Message_queue_Control *_Message_queue_Allocate ( void ); 432 Message_queue_Control *_Message_queue_Allocate ( 433 unsigned32 count, 434 unsigned32 max_message_size 435 ); 419 436 420 437 /* … … 423 440 * DESCRIPTION: 424 441 * 425 * This routine allocates a message queue control block from442 * This routine deallocates a message queue control block into 426 443 * the inactive chain of free message queue control blocks. 427 444 */ -
c/src/exec/rtems/headers/msgmp.h
r3b438fa rb06e68ef 56 56 57 57 typedef struct { 58 rtems_packet_prefix 58 rtems_packet_prefix Prefix; 59 59 Message_queue_MP_Remote_operations operation; 60 60 Objects_Name name; 61 rtems_option option_set;61 rtems_option option_set; 62 62 Objects_Id proxy_id; 63 63 unsigned32 count; 64 unsigned32 size; 64 65 unsigned32 pad0; 65 unsigned32 pad1;66 unsigned32 pad2;67 66 Message_queue_Buffer Buffer; 68 67 } Message_queue_MP_Packet; … … 96 95 Message_queue_MP_Remote_operations operation, 97 96 Objects_Id message_queue_id, 98 Message_queue_Buffer *buffer, 99 rtems_option option_set, 100 rtems_interval timeout 97 void *buffer, 98 unsigned32 *size_p, 99 rtems_option option_set, 100 rtems_interval timeout 101 101 ); 102 102 -
c/src/exec/rtems/include/rtems/rtems/message.h
r3b438fa rb06e68ef 42 42 * The following defines the data types needed to manipulate 43 43 * the contents of message buffers. 44 * Since msgs are variable length we just make a ptr to 1. 44 45 */ 45 46 46 47 typedef struct { 47 unsigned32 field1; 48 unsigned32 field2; 49 unsigned32 field3; 50 unsigned32 field4; 51 } Message_queue_Buffer; 48 unsigned32 size; 49 50 #ifndef __cplusplus 51 /* NOTE: [0] is gcc specific, 52 * but specifically disallowed by ANSI STD C++ 53 * g++ warns about it, so we #ifdef it out to 54 * get rid of warnings when compiled by g++. 55 */ 56 unsigned32 buffer[0]; 57 #endif 58 59 } Message_queue_Buffer; 52 60 53 61 /* … … 69 77 Objects_Control Object; 70 78 Thread_queue_Control Wait_queue; 71 rtems_attribute attribute_set;79 rtems_attribute attribute_set; 72 80 unsigned32 maximum_pending_messages; 73 81 unsigned32 number_of_pending_messages; 82 unsigned32 maximum_message_size; 74 83 Chain_Control Pending_messages; 84 Message_queue_Buffer *message_buffers; 85 Chain_Control Inactive_messages; 75 86 } Message_queue_Control; 76 87 … … 81 92 82 93 EXTERN Objects_Information _Message_queue_Information; 83 84 /*85 * The following defines the data structures used to86 * manage the pool of inactive message buffers.87 */88 89 EXTERN Chain_Control _Message_queue_Inactive_messages;90 94 91 95 /* … … 109 113 110 114 void _Message_queue_Manager_initialization( 111 unsigned32 maximum_message_queues, 112 unsigned32 maximum_messages 115 unsigned32 maximum_message_queues 113 116 ); 114 117 … … 127 130 128 131 rtems_status_code rtems_message_queue_create( 129 Objects_Name name, 130 unsigned32 count, 132 Objects_Name name, 133 unsigned32 count, 134 unsigned32 max_message_size, 131 135 rtems_attribute attribute_set, 132 Objects_Id 136 Objects_Id *id 133 137 ); 134 138 … … 184 188 rtems_status_code rtems_message_queue_send( 185 189 Objects_Id id, 186 void *buffer 190 void *buffer, 191 unsigned32 size 187 192 ); 188 193 … … 205 210 rtems_status_code rtems_message_queue_urgent( 206 211 Objects_Id id, 207 void *buffer 212 void *buffer, 213 unsigned32 size 208 214 ); 209 215 … … 227 233 Objects_Id id, 228 234 void *buffer, 235 unsigned32 size, 229 236 unsigned32 *count 230 237 ); … … 247 254 Objects_Id id, 248 255 void *buffer, 256 unsigned32 *size_p, 249 257 unsigned32 option_set, 250 rtems_interval timeout258 rtems_interval timeout 251 259 ); 252 260 … … 277 285 278 286 STATIC INLINE void _Message_queue_Copy_buffer ( 279 Message_queue_Buffer *source, 280 Message_queue_Buffer *destination 287 void *source, 288 void *destination, 289 unsigned32 size 281 290 ); 282 291 … … 296 305 Message_queue_Control *the_message_queue, 297 306 unsigned32 option_set, 298 Message_queue_Buffer *buffer 307 void *buffer, 308 unsigned32 *size_p 299 309 ); 300 310 … … 323 333 rtems_status_code _Message_queue_Submit( 324 334 Objects_Id id, 325 Message_queue_Buffer *buffer, 335 void *buffer, 336 unsigned32 size, 326 337 Message_queue_Submit_types submit_type 327 338 ); … … 337 348 338 349 STATIC INLINE Message_queue_Buffer_control * 339 _Message_queue_Allocate_message_buffer ( void ); 350 _Message_queue_Allocate_message_buffer ( 351 Message_queue_Control *the_message_queue 352 ); 340 353 341 354 /* … … 349 362 350 363 STATIC INLINE void _Message_queue_Free_message_buffer ( 364 Message_queue_Control *the_message_queue, 351 365 Message_queue_Buffer_control *the_message 352 366 ); … … 416 430 */ 417 431 418 STATIC INLINE Message_queue_Control *_Message_queue_Allocate ( void ); 432 Message_queue_Control *_Message_queue_Allocate ( 433 unsigned32 count, 434 unsigned32 max_message_size 435 ); 419 436 420 437 /* … … 423 440 * DESCRIPTION: 424 441 * 425 * This routine allocates a message queue control block from442 * This routine deallocates a message queue control block into 426 443 * the inactive chain of free message queue control blocks. 427 444 */ -
c/src/exec/rtems/include/rtems/rtems/msgmp.h
r3b438fa rb06e68ef 56 56 57 57 typedef struct { 58 rtems_packet_prefix 58 rtems_packet_prefix Prefix; 59 59 Message_queue_MP_Remote_operations operation; 60 60 Objects_Name name; 61 rtems_option option_set;61 rtems_option option_set; 62 62 Objects_Id proxy_id; 63 63 unsigned32 count; 64 unsigned32 size; 64 65 unsigned32 pad0; 65 unsigned32 pad1;66 unsigned32 pad2;67 66 Message_queue_Buffer Buffer; 68 67 } Message_queue_MP_Packet; … … 96 95 Message_queue_MP_Remote_operations operation, 97 96 Objects_Id message_queue_id, 98 Message_queue_Buffer *buffer, 99 rtems_option option_set, 100 rtems_interval timeout 97 void *buffer, 98 unsigned32 *size_p, 99 rtems_option option_set, 100 rtems_interval timeout 101 101 ); 102 102 -
c/src/exec/rtems/inline/attr.inl
r3b438fa rb06e68ef 85 85 /*PAGE 86 86 * 87 * _Attributes_Is_limit88 *89 */90 91 STATIC INLINE boolean _Attributes_Is_limit(92 rtems_attribute attribute_set93 )94 {95 return ( attribute_set & RTEMS_LIMIT );96 }97 98 /*PAGE99 *100 87 * _Attributes_Is_binary_semaphore 101 88 * -
c/src/exec/rtems/inline/message.inl
r3b438fa rb06e68ef 18 18 #define __MESSAGE_QUEUE_inl 19 19 20 #include <rtems/wkspace.h> 21 20 22 /*PAGE 21 23 * … … 25 27 26 28 STATIC INLINE void _Message_queue_Copy_buffer ( 27 Message_queue_Buffer *source, 28 Message_queue_Buffer *destination 29 void *source, 30 void *destination, 31 unsigned32 size 29 32 ) 30 33 { 31 *destination = *source;34 memcpy(destination, source, size); 32 35 } 33 36 … … 39 42 40 43 STATIC INLINE Message_queue_Buffer_control * 41 _Message_queue_Allocate_message_buffer ( void ) 44 _Message_queue_Allocate_message_buffer ( 45 Message_queue_Control *the_message_queue 46 ) 42 47 { 43 48 return (Message_queue_Buffer_control *) 44 _Chain_Get( & _Message_queue_Inactive_messages );49 _Chain_Get( &the_message_queue->Inactive_messages ); 45 50 } 46 51 … … 52 57 53 58 STATIC INLINE void _Message_queue_Free_message_buffer ( 54 Message_queue_Buffer_control *the_message 59 Message_queue_Control *the_message_queue, 60 Message_queue_Buffer_control *the_message 55 61 ) 56 62 { 57 _Chain_Append( &_Message_queue_Inactive_messages, &the_message->Node );63 _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node ); 58 64 } 59 65 … … 117 123 } 118 124 119 /*PAGE120 *121 * _Message_queue_Allocate122 *123 */124 125 STATIC INLINE Message_queue_Control *_Message_queue_Allocate ( void )126 {127 return (Message_queue_Control *)128 _Objects_Allocate( &_Message_queue_Information );129 }130 125 131 126 /*PAGE … … 139 134 ) 140 135 { 136 if (the_message_queue->message_buffers) 137 { 138 _Workspace_Free((void *) the_message_queue->message_buffers); 139 the_message_queue->message_buffers = 0; 140 } 141 141 142 _Objects_Free( &_Message_queue_Information, &the_message_queue->Object ); 142 143 } -
c/src/exec/rtems/inline/rtems/rtems/attr.inl
r3b438fa rb06e68ef 85 85 /*PAGE 86 86 * 87 * _Attributes_Is_limit88 *89 */90 91 STATIC INLINE boolean _Attributes_Is_limit(92 rtems_attribute attribute_set93 )94 {95 return ( attribute_set & RTEMS_LIMIT );96 }97 98 /*PAGE99 *100 87 * _Attributes_Is_binary_semaphore 101 88 * -
c/src/exec/rtems/inline/rtems/rtems/message.inl
r3b438fa rb06e68ef 18 18 #define __MESSAGE_QUEUE_inl 19 19 20 #include <rtems/wkspace.h> 21 20 22 /*PAGE 21 23 * … … 25 27 26 28 STATIC INLINE void _Message_queue_Copy_buffer ( 27 Message_queue_Buffer *source, 28 Message_queue_Buffer *destination 29 void *source, 30 void *destination, 31 unsigned32 size 29 32 ) 30 33 { 31 *destination = *source;34 memcpy(destination, source, size); 32 35 } 33 36 … … 39 42 40 43 STATIC INLINE Message_queue_Buffer_control * 41 _Message_queue_Allocate_message_buffer ( void ) 44 _Message_queue_Allocate_message_buffer ( 45 Message_queue_Control *the_message_queue 46 ) 42 47 { 43 48 return (Message_queue_Buffer_control *) 44 _Chain_Get( & _Message_queue_Inactive_messages );49 _Chain_Get( &the_message_queue->Inactive_messages ); 45 50 } 46 51 … … 52 57 53 58 STATIC INLINE void _Message_queue_Free_message_buffer ( 54 Message_queue_Buffer_control *the_message 59 Message_queue_Control *the_message_queue, 60 Message_queue_Buffer_control *the_message 55 61 ) 56 62 { 57 _Chain_Append( &_Message_queue_Inactive_messages, &the_message->Node );63 _Chain_Append( &the_message_queue->Inactive_messages, &the_message->Node ); 58 64 } 59 65 … … 117 123 } 118 124 119 /*PAGE120 *121 * _Message_queue_Allocate122 *123 */124 125 STATIC INLINE Message_queue_Control *_Message_queue_Allocate ( void )126 {127 return (Message_queue_Control *)128 _Objects_Allocate( &_Message_queue_Information );129 }130 125 131 126 /*PAGE … … 139 134 ) 140 135 { 136 if (the_message_queue->message_buffers) 137 { 138 _Workspace_Free((void *) the_message_queue->message_buffers); 139 the_message_queue->message_buffers = 0; 140 } 141 141 142 _Objects_Free( &_Message_queue_Information, &the_message_queue->Object ); 142 143 } -
c/src/exec/rtems/macros/attr.inl
r3b438fa rb06e68ef 63 63 /*PAGE 64 64 * 65 * _Attributes_Is_limit66 *67 */68 69 #define _Attributes_Is_limit( _attribute_set ) \70 ( (_attribute_set) & RTEMS_LIMIT )71 72 /*PAGE73 *74 65 * _Attributes_Is_binary_semaphore 75 66 * -
c/src/exec/rtems/macros/rtems/rtems/attr.inl
r3b438fa rb06e68ef 63 63 /*PAGE 64 64 * 65 * _Attributes_Is_limit66 *67 */68 69 #define _Attributes_Is_limit( _attribute_set ) \70 ( (_attribute_set) & RTEMS_LIMIT )71 72 /*PAGE73 *74 65 * _Attributes_Is_binary_semaphore 75 66 * -
c/src/exec/rtems/optman/no-msg.c
r3b438fa rb06e68ef 27 27 28 28 void _Message_queue_Manager_initialization( 29 unsigned32 maximum_message_queues, 30 unsigned32 maximum_messages 29 unsigned32 maximum_message_queues 31 30 ) 32 31 { … … 36 35 Objects_Name name, 37 36 unsigned32 count, 38 rtems_attribute attribute_set, 37 unsigned32 max_message_size, 38 rtems_attribute attribute_set, 39 39 Objects_Id *id 40 40 ) … … 61 61 rtems_status_code rtems_message_queue_send( 62 62 Objects_Id id, 63 void *buffer 63 void *buffer, 64 unsigned32 size 64 65 ) 65 66 { … … 69 70 rtems_status_code rtems_message_queue_urgent( 70 71 Objects_Id id, 71 void *buffer 72 void *buffer, 73 unsigned32 size 72 74 ) 73 75 { … … 78 80 Objects_Id id, 79 81 void *buffer, 82 unsigned32 size, 80 83 unsigned32 *count 81 84 ) … … 87 90 Objects_Id id, 88 91 void *buffer, 92 unsigned32 *size_p, 89 93 unsigned32 option_set, 90 rtems_interval timeout94 rtems_interval timeout 91 95 ) 92 96 { … … 111 115 boolean _Message_queue_Seize( 112 116 Message_queue_Control *the_message_queue, 113 rtems_option option_set, 114 Message_queue_Buffer *buffer 117 rtems_option option_set, 118 void *buffer, 119 unsigned32 *size_p 115 120 ) 116 121 { … … 121 126 rtems_status_code _Message_queue_Submit( 122 127 Objects_Id id, 123 Message_queue_Buffer *buffer, 128 void *buffer, 129 unsigned32 size, 124 130 Message_queue_Submit_types submit_type 125 131 ) -
c/src/exec/sapi/headers/config.h
r3b438fa rb06e68ef 33 33 34 34 typedef struct { 35 Objects_Name name; /* task name */36 unsigned32 stack_size; /* task stack size */35 Objects_Name name; /* task name */ 36 unsigned32 stack_size; /* task stack size */ 37 37 rtems_task_priority initial_priority; /* task priority */ 38 rtems_attribute attribute_set; /* task attributes */39 rtems_task_entry 40 rtems_mode mode_set; /* task initial mode */41 unsigned32 argument; /* task argument */42 } 38 rtems_attribute attribute_set; /* task attributes */ 39 rtems_task_entry entry_point; /* task entry point */ 40 rtems_mode mode_set; /* task initial mode */ 41 unsigned32 argument; /* task argument */ 42 } rtems_initialization_tasks_table; 43 43 44 44 /* … … 57 57 typedef unsigned32 rtems_device_minor_number; 58 58 59 typedef voidrtems_device_driver;59 typedef rtems_status_code rtems_device_driver; 60 60 61 61 typedef rtems_device_driver ( *rtems_device_driver_entry )( 62 62 rtems_device_major_number, 63 63 rtems_device_minor_number, 64 void *, 65 Objects_Id, 66 unsigned32 * 64 void * 67 65 ); 68 66 … … 174 172 typedef struct { 175 173 unsigned32 default_timeout; /* in ticks */ 174 unsigned32 maximum_packet_size; 176 175 rtems_mpci_initialization_entry initialization; 177 176 rtems_mpci_get_packet_entry get_packet; … … 179 178 rtems_mpci_send_entry send_packet; 180 179 rtems_mpci_receive_entry receive_packet; 181 } 180 } rtems_mpci_table; 182 181 183 182 /* … … 193 192 unsigned32 maximum_global_objects; /* maximum # global objects */ 194 193 unsigned32 maximum_proxies; /* maximum # proxies */ 195 rtems_mpci_table *User_mpci_table; 196 /* pointer to MPCI table */ 194 rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */ 197 195 }; 198 196 … … 210 208 211 209 struct Configuration_Table { 212 void *work_space_start; 213 unsigned32 work_space_size; 214 unsigned32 maximum_tasks; 215 unsigned32 maximum_timers; 216 unsigned32 maximum_semaphores; 217 unsigned32 maximum_message_queues; 218 unsigned32 maximum_messages; 219 unsigned32 maximum_partitions; 220 unsigned32 maximum_regions; 221 unsigned32 maximum_ports; 222 unsigned32 maximum_periods; 223 unsigned32 maximum_extensions; 224 unsigned32 microseconds_per_tick; 225 unsigned32 ticks_per_timeslice; 226 unsigned32 number_of_initialization_tasks; 210 void *work_space_start; 211 unsigned32 work_space_size; 212 unsigned32 maximum_tasks; 213 unsigned32 maximum_timers; 214 unsigned32 maximum_semaphores; 215 unsigned32 maximum_message_queues; 216 unsigned32 maximum_partitions; 217 unsigned32 maximum_regions; 218 unsigned32 maximum_ports; 219 unsigned32 maximum_periods; 220 unsigned32 maximum_extensions; 221 unsigned32 microseconds_per_tick; 222 unsigned32 ticks_per_timeslice; 223 unsigned32 number_of_initialization_tasks; 227 224 rtems_initialization_tasks_table *User_initialization_tasks_table; 228 unsigned32 225 unsigned32 number_of_device_drivers; 229 226 rtems_driver_address_table *Device_driver_table; 230 rtems_extensions_table 227 rtems_extensions_table *User_extension_table; 231 228 rtems_multiprocessing_table *User_multiprocessing_table; 232 229 }; … … 245 242 */ 246 243 247 EXTERN rtems_configuration_table 244 EXTERN rtems_configuration_table *_Configuration_Table; 248 245 EXTERN rtems_multiprocessing_table *_Configuration_MP_table; 249 246 EXTERN rtems_mpci_table *_Configuration_MPCI_table; … … 259 256 260 257 STATIC INLINE void _Configuration_Handler_initialization( 261 rtems_configuration_table 258 rtems_configuration_table *configuration_table, 262 259 rtems_multiprocessing_table *multiprocessing_table, 263 260 rtems_mpci_table *users_mpci_table -
c/src/exec/sapi/headers/directives.h
r3b438fa rb06e68ef 11 11 * to the copyright license under the clause at DFARS 252.227-7013. This 12 12 * notice must appear in all copies of this file and its derivatives. 13 * 14 * $Id$ 13 15 */ 14 16 15 17 #ifndef __RTEMS_DIRECTIVES_h 16 #define RTEMS___DIRECTIVES_h18 #define __RTEMS_DIRECTIVES_h 17 19 18 20 #ifdef __cplusplus … … 86 88 #define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64 87 89 #define RTEMS_IO_INITIALIZE 65 88 #define RTEMS_IO_OPEN 66 89 #define RTEMS_IO_CLOSE 67 90 #define RTEMS_IO_READ 68 91 #define RTEMS_IO_WRITE 69 92 #define RTEMS_IO_CONTROL 70 93 #define RTEMS_FATAL_ERROR_OCCURRED 71 94 #define RTEMS_RATE_MONOTONIC_CREATE 72 95 #define RTEMS_RATE_MONOTONIC_NAME_TO_ID 73 96 #define RTEMS_RATE_MONOTONIC_DELETE 74 97 #define RTEMS_RATE_MONOTONIC_CANCEL 75 98 #define RTEMS_RATE_MONOTONIC_PERIOD 76 99 #define RTEMS_MULTIPROCESSING_ANNOUNCE 77 100 #define RTEMS_DEBUG_ENABLE 78 101 #define RTEMS_DEBUG_DISABLE 79 90 #define RTEMS_IO_REGISTER_NAME 66 91 #define RTEMS_IO_LOOKUP_NAME 67 92 #define RTEMS_IO_OPEN 68 93 #define RTEMS_IO_CLOSE 69 94 #define RTEMS_IO_READ 70 95 #define RTEMS_IO_WRITE 71 96 #define RTEMS_IO_CONTROL 72 97 #define RTEMS_FATAL_ERROR_OCCURRED 73 98 #define RTEMS_RATE_MONOTONIC_CREATE 74 99 #define RTEMS_RATE_MONOTONIC_NAME_TO_ID 75 100 #define RTEMS_RATE_MONOTONIC_DELETE 76 101 #define RTEMS_RATE_MONOTONIC_CANCEL 77 102 #define RTEMS_RATE_MONOTONIC_PERIOD 78 103 #define RTEMS_MULTIPROCESSING_ANNOUNCE 79 104 #define RTEMS_DEBUG_ENABLE 80 105 #define RTEMS_DEBUG_DISABLE 81 106 107 #define RTEMS_NUMBER_OF_ENTRY_POINTS 82 102 108 103 109 #ifdef __cplusplus -
c/src/exec/sapi/headers/io.h
r3b438fa rb06e68ef 36 36 37 37 /* 38 * The following type defines the set of IO operations which are39 * recognized by _IO_Handler and can be supported by a RTEMS40 * device driver.41 */42 43 typedef enum {44 IO_INITIALIZE_OPERATION = 0,45 IO_OPEN_OPERATION = 1,46 IO_CLOSE_OPERATION = 2,47 IO_READ_OPERATION = 3,48 IO_WRITE_OPERATION = 4,49 IO_CONTROL_OPERATION = 550 } IO_operations;51 52 /*53 38 * The following declare the data required to manage the Device Driver 54 39 * Address Table. 55 40 */ 56 41 57 EXTERN unsigned32 42 EXTERN unsigned32 _IO_Number_of_drivers; 58 43 EXTERN rtems_driver_address_table *_IO_Driver_address_table; 44 45 /* 46 * Table for the io device names 47 */ 48 49 typedef struct { 50 char *device_name; 51 unsigned32 device_name_length; 52 rtems_device_major_number major; 53 rtems_device_minor_number minor; 54 } rtems_driver_name_t; 55 56 /*XXX this really should be allocated some better way... */ 57 /*XXX it should probably be a chain and use a 'maximum' drivers field 58 * in config table */ 59 #define RTEMS_MAX_DRIVER_NAMES 20 60 EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; 61 59 62 60 63 /* … … 72 75 73 76 /* 77 * rtems_io_register_name 78 * 79 * DESCRIPTION: 80 * 81 * Associate a name with a driver. 82 * 83 */ 84 85 rtems_status_code rtems_io_register_name( 86 char *device_name, 87 rtems_device_major_number major, 88 rtems_device_minor_number minor 89 ); 90 91 92 /* 93 * rtems_io_lookup_name 94 * 95 * DESCRIPTION: 96 * 97 * Find what driver "owns" this name 98 */ 99 100 rtems_status_code rtems_io_lookup_name( 101 const char *pathname, 102 rtems_driver_name_t **rnp 103 ); 104 105 106 /* 74 107 * rtems_io_initialize 75 108 * … … 83 116 rtems_device_major_number major, 84 117 rtems_device_minor_number minor, 85 void *argument, 86 unsigned32 *return_value 118 void *argument 87 119 ); 88 120 … … 99 131 rtems_device_major_number major, 100 132 rtems_device_minor_number minor, 101 void *argument, 102 unsigned32 *return_value 133 void *argument 103 134 ); 104 135 … … 115 146 rtems_device_major_number major, 116 147 rtems_device_minor_number minor, 117 void *argument, 118 unsigned32 *return_value 148 void *argument 119 149 ); 120 150 … … 131 161 rtems_device_major_number major, 132 162 rtems_device_minor_number minor, 133 void *argument, 134 unsigned32 *return_value 163 void *argument 135 164 ); 136 165 … … 147 176 rtems_device_major_number major, 148 177 rtems_device_minor_number minor, 149 void *argument, 150 unsigned32 *return_value 178 void *argument 151 179 ); 152 180 … … 163 191 rtems_device_major_number major, 164 192 rtems_device_minor_number minor, 165 void *argument, 166 unsigned32 *return_value 193 void *argument 167 194 ); 168 195 … … 177 204 178 205 void _IO_Initialize_all_drivers( void ); 179 180 /*181 * _IO_Handler_routine182 *183 * DESCRIPTION:184 *185 * This routine provides the common foundation for all of the IO186 * Manager's directives.187 */188 189 rtems_status_code _IO_Handler_routine(190 IO_operations operation,191 rtems_device_major_number major,192 rtems_device_minor_number minor,193 void *argument,194 unsigned32 *return_value195 );196 206 197 207 #include <rtems/io.inl> -
c/src/exec/sapi/headers/sptables.h
r3b438fa rb06e68ef 50 50 */ 51 51 52 const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1] = {52 const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ] = { 53 53 (void *) rtems_initialize_executive, /* 0 */ 54 54 (void *) rtems_initialize_executive_early, /* 1 */ … … 117 117 (void *) rtems_port_internal_to_external, /* 64 */ 118 118 (void *) rtems_io_initialize, /* 65 */ 119 (void *) rtems_io_open, /* 66 */ 120 (void *) rtems_io_close, /* 67 */ 121 (void *) rtems_io_read, /* 68 */ 122 (void *) rtems_io_write, /* 69 */ 123 (void *) rtems_io_control, /* 70 */ 124 (void *) rtems_fatal_error_occurred, /* 71 */ 125 (void *) rtems_rate_monotonic_create, /* 72 */ 126 (void *) rtems_rate_monotonic_ident, /* 73 */ 127 (void *) rtems_rate_monotonic_delete, /* 74 */ 128 (void *) rtems_rate_monotonic_cancel, /* 75 */ 129 (void *) rtems_rate_monotonic_period, /* 76 */ 130 (void *) rtems_multiprocessing_announce, /* 77 */ 131 (void *) rtems_debug_enable, /* 78 */ 132 (void *) rtems_debug_disable /* 79 */ 119 (void *) rtems_io_register_name, /* 66 */ 120 (void *) rtems_io_lookup_name, /* 67 */ 121 (void *) rtems_io_open, /* 68 */ 122 (void *) rtems_io_close, /* 69 */ 123 (void *) rtems_io_read, /* 70 */ 124 (void *) rtems_io_write, /* 71 */ 125 (void *) rtems_io_control, /* 72 */ 126 (void *) rtems_fatal_error_occurred, /* 73 */ 127 (void *) rtems_rate_monotonic_create, /* 74 */ 128 (void *) rtems_rate_monotonic_ident, /* 75 */ 129 (void *) rtems_rate_monotonic_delete, /* 76 */ 130 (void *) rtems_rate_monotonic_cancel, /* 77 */ 131 (void *) rtems_rate_monotonic_period, /* 78 */ 132 (void *) rtems_multiprocessing_announce, /* 79 */ 133 (void *) rtems_debug_enable, /* 80 */ 134 (void *) rtems_debug_disable /* 81 */ 133 135 }; 134 136 -
c/src/exec/sapi/include/rtems/config.h
r3b438fa rb06e68ef 33 33 34 34 typedef struct { 35 Objects_Name name; /* task name */36 unsigned32 stack_size; /* task stack size */35 Objects_Name name; /* task name */ 36 unsigned32 stack_size; /* task stack size */ 37 37 rtems_task_priority initial_priority; /* task priority */ 38 rtems_attribute attribute_set; /* task attributes */39 rtems_task_entry 40 rtems_mode mode_set; /* task initial mode */41 unsigned32 argument; /* task argument */42 } 38 rtems_attribute attribute_set; /* task attributes */ 39 rtems_task_entry entry_point; /* task entry point */ 40 rtems_mode mode_set; /* task initial mode */ 41 unsigned32 argument; /* task argument */ 42 } rtems_initialization_tasks_table; 43 43 44 44 /* … … 57 57 typedef unsigned32 rtems_device_minor_number; 58 58 59 typedef voidrtems_device_driver;59 typedef rtems_status_code rtems_device_driver; 60 60 61 61 typedef rtems_device_driver ( *rtems_device_driver_entry )( 62 62 rtems_device_major_number, 63 63 rtems_device_minor_number, 64 void *, 65 Objects_Id, 66 unsigned32 * 64 void * 67 65 ); 68 66 … … 174 172 typedef struct { 175 173 unsigned32 default_timeout; /* in ticks */ 174 unsigned32 maximum_packet_size; 176 175 rtems_mpci_initialization_entry initialization; 177 176 rtems_mpci_get_packet_entry get_packet; … … 179 178 rtems_mpci_send_entry send_packet; 180 179 rtems_mpci_receive_entry receive_packet; 181 } 180 } rtems_mpci_table; 182 181 183 182 /* … … 193 192 unsigned32 maximum_global_objects; /* maximum # global objects */ 194 193 unsigned32 maximum_proxies; /* maximum # proxies */ 195 rtems_mpci_table *User_mpci_table; 196 /* pointer to MPCI table */ 194 rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */ 197 195 }; 198 196 … … 210 208 211 209 struct Configuration_Table { 212 void *work_space_start; 213 unsigned32 work_space_size; 214 unsigned32 maximum_tasks; 215 unsigned32 maximum_timers; 216 unsigned32 maximum_semaphores; 217 unsigned32 maximum_message_queues; 218 unsigned32 maximum_messages; 219 unsigned32 maximum_partitions; 220 unsigned32 maximum_regions; 221 unsigned32 maximum_ports; 222 unsigned32 maximum_periods; 223 unsigned32 maximum_extensions; 224 unsigned32 microseconds_per_tick; 225 unsigned32 ticks_per_timeslice; 226 unsigned32 number_of_initialization_tasks; 210 void *work_space_start; 211 unsigned32 work_space_size; 212 unsigned32 maximum_tasks; 213 unsigned32 maximum_timers; 214 unsigned32 maximum_semaphores; 215 unsigned32 maximum_message_queues; 216 unsigned32 maximum_partitions; 217 unsigned32 maximum_regions; 218 unsigned32 maximum_ports; 219 unsigned32 maximum_periods; 220 unsigned32 maximum_extensions; 221 unsigned32 microseconds_per_tick; 222 unsigned32 ticks_per_timeslice; 223 unsigned32 number_of_initialization_tasks; 227 224 rtems_initialization_tasks_table *User_initialization_tasks_table; 228 unsigned32 225 unsigned32 number_of_device_drivers; 229 226 rtems_driver_address_table *Device_driver_table; 230 rtems_extensions_table 227 rtems_extensions_table *User_extension_table; 231 228 rtems_multiprocessing_table *User_multiprocessing_table; 232 229 }; … … 245 242 */ 246 243 247 EXTERN rtems_configuration_table 244 EXTERN rtems_configuration_table *_Configuration_Table; 248 245 EXTERN rtems_multiprocessing_table *_Configuration_MP_table; 249 246 EXTERN rtems_mpci_table *_Configuration_MPCI_table; … … 259 256 260 257 STATIC INLINE void _Configuration_Handler_initialization( 261 rtems_configuration_table 258 rtems_configuration_table *configuration_table, 262 259 rtems_multiprocessing_table *multiprocessing_table, 263 260 rtems_mpci_table *users_mpci_table -
c/src/exec/sapi/include/rtems/directives.h
r3b438fa rb06e68ef 11 11 * to the copyright license under the clause at DFARS 252.227-7013. This 12 12 * notice must appear in all copies of this file and its derivatives. 13 * 14 * $Id$ 13 15 */ 14 16 15 17 #ifndef __RTEMS_DIRECTIVES_h 16 #define RTEMS___DIRECTIVES_h18 #define __RTEMS_DIRECTIVES_h 17 19 18 20 #ifdef __cplusplus … … 86 88 #define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64 87 89 #define RTEMS_IO_INITIALIZE 65 88 #define RTEMS_IO_OPEN 66 89 #define RTEMS_IO_CLOSE 67 90 #define RTEMS_IO_READ 68 91 #define RTEMS_IO_WRITE 69 92 #define RTEMS_IO_CONTROL 70 93 #define RTEMS_FATAL_ERROR_OCCURRED 71 94 #define RTEMS_RATE_MONOTONIC_CREATE 72 95 #define RTEMS_RATE_MONOTONIC_NAME_TO_ID 73 96 #define RTEMS_RATE_MONOTONIC_DELETE 74 97 #define RTEMS_RATE_MONOTONIC_CANCEL 75 98 #define RTEMS_RATE_MONOTONIC_PERIOD 76 99 #define RTEMS_MULTIPROCESSING_ANNOUNCE 77 100 #define RTEMS_DEBUG_ENABLE 78 101 #define RTEMS_DEBUG_DISABLE 79 90 #define RTEMS_IO_REGISTER_NAME 66 91 #define RTEMS_IO_LOOKUP_NAME 67 92 #define RTEMS_IO_OPEN 68 93 #define RTEMS_IO_CLOSE 69 94 #define RTEMS_IO_READ 70 95 #define RTEMS_IO_WRITE 71 96 #define RTEMS_IO_CONTROL 72 97 #define RTEMS_FATAL_ERROR_OCCURRED 73 98 #define RTEMS_RATE_MONOTONIC_CREATE 74 99 #define RTEMS_RATE_MONOTONIC_NAME_TO_ID 75 100 #define RTEMS_RATE_MONOTONIC_DELETE 76 101 #define RTEMS_RATE_MONOTONIC_CANCEL 77 102 #define RTEMS_RATE_MONOTONIC_PERIOD 78 103 #define RTEMS_MULTIPROCESSING_ANNOUNCE 79 104 #define RTEMS_DEBUG_ENABLE 80 105 #define RTEMS_DEBUG_DISABLE 81 106 107 #define RTEMS_NUMBER_OF_ENTRY_POINTS 82 102 108 103 109 #ifdef __cplusplus -
c/src/exec/sapi/include/rtems/io.h
r3b438fa rb06e68ef 36 36 37 37 /* 38 * The following type defines the set of IO operations which are39 * recognized by _IO_Handler and can be supported by a RTEMS40 * device driver.41 */42 43 typedef enum {44 IO_INITIALIZE_OPERATION = 0,45 IO_OPEN_OPERATION = 1,46 IO_CLOSE_OPERATION = 2,47 IO_READ_OPERATION = 3,48 IO_WRITE_OPERATION = 4,49 IO_CONTROL_OPERATION = 550 } IO_operations;51 52 /*53 38 * The following declare the data required to manage the Device Driver 54 39 * Address Table. 55 40 */ 56 41 57 EXTERN unsigned32 42 EXTERN unsigned32 _IO_Number_of_drivers; 58 43 EXTERN rtems_driver_address_table *_IO_Driver_address_table; 44 45 /* 46 * Table for the io device names 47 */ 48 49 typedef struct { 50 char *device_name; 51 unsigned32 device_name_length; 52 rtems_device_major_number major; 53 rtems_device_minor_number minor; 54 } rtems_driver_name_t; 55 56 /*XXX this really should be allocated some better way... */ 57 /*XXX it should probably be a chain and use a 'maximum' drivers field 58 * in config table */ 59 #define RTEMS_MAX_DRIVER_NAMES 20 60 EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; 61 59 62 60 63 /* … … 72 75 73 76 /* 77 * rtems_io_register_name 78 * 79 * DESCRIPTION: 80 * 81 * Associate a name with a driver. 82 * 83 */ 84 85 rtems_status_code rtems_io_register_name( 86 char *device_name, 87 rtems_device_major_number major, 88 rtems_device_minor_number minor 89 ); 90 91 92 /* 93 * rtems_io_lookup_name 94 * 95 * DESCRIPTION: 96 * 97 * Find what driver "owns" this name 98 */ 99 100 rtems_status_code rtems_io_lookup_name( 101 const char *pathname, 102 rtems_driver_name_t **rnp 103 ); 104 105 106 /* 74 107 * rtems_io_initialize 75 108 * … … 83 116 rtems_device_major_number major, 84 117 rtems_device_minor_number minor, 85 void *argument, 86 unsigned32 *return_value 118 void *argument 87 119 ); 88 120 … … 99 131 rtems_device_major_number major, 100 132 rtems_device_minor_number minor, 101 void *argument, 102 unsigned32 *return_value 133 void *argument 103 134 ); 104 135 … … 115 146 rtems_device_major_number major, 116 147 rtems_device_minor_number minor, 117 void *argument, 118 unsigned32 *return_value 148 void *argument 119 149 ); 120 150 … … 131 161 rtems_device_major_number major, 132 162 rtems_device_minor_number minor, 133 void *argument, 134 unsigned32 *return_value 163 void *argument 135 164 ); 136 165 … … 147 176 rtems_device_major_number major, 148 177 rtems_device_minor_number minor, 149 void *argument, 150 unsigned32 *return_value 178 void *argument 151 179 ); 152 180 … … 163 191 rtems_device_major_number major, 164 192 rtems_device_minor_number minor, 165 void *argument, 166 unsigned32 *return_value 193 void *argument 167 194 ); 168 195 … … 177 204 178 205 void _IO_Initialize_all_drivers( void ); 179 180 /*181 * _IO_Handler_routine182 *183 * DESCRIPTION:184 *185 * This routine provides the common foundation for all of the IO186 * Manager's directives.187 */188 189 rtems_status_code _IO_Handler_routine(190 IO_operations operation,191 rtems_device_major_number major,192 rtems_device_minor_number minor,193 void *argument,194 unsigned32 *return_value195 );196 206 197 207 #include <rtems/io.inl> -
c/src/exec/sapi/include/rtems/sptables.h
r3b438fa rb06e68ef 50 50 */ 51 51 52 const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1] = {52 const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ] = { 53 53 (void *) rtems_initialize_executive, /* 0 */ 54 54 (void *) rtems_initialize_executive_early, /* 1 */ … … 117 117 (void *) rtems_port_internal_to_external, /* 64 */ 118 118 (void *) rtems_io_initialize, /* 65 */ 119 (void *) rtems_io_open, /* 66 */ 120 (void *) rtems_io_close, /* 67 */ 121 (void *) rtems_io_read, /* 68 */ 122 (void *) rtems_io_write, /* 69 */ 123 (void *) rtems_io_control, /* 70 */ 124 (void *) rtems_fatal_error_occurred, /* 71 */ 125 (void *) rtems_rate_monotonic_create, /* 72 */ 126 (void *) rtems_rate_monotonic_ident, /* 73 */ 127 (void *) rtems_rate_monotonic_delete, /* 74 */ 128 (void *) rtems_rate_monotonic_cancel, /* 75 */ 129 (void *) rtems_rate_monotonic_period, /* 76 */ 130 (void *) rtems_multiprocessing_announce, /* 77 */ 131 (void *) rtems_debug_enable, /* 78 */ 132 (void *) rtems_debug_disable /* 79 */ 119 (void *) rtems_io_register_name, /* 66 */ 120 (void *) rtems_io_lookup_name, /* 67 */ 121 (void *) rtems_io_open, /* 68 */ 122 (void *) rtems_io_close, /* 69 */ 123 (void *) rtems_io_read, /* 70 */ 124 (void *) rtems_io_write, /* 71 */ 125 (void *) rtems_io_control, /* 72 */ 126 (void *) rtems_fatal_error_occurred, /* 73 */ 127 (void *) rtems_rate_monotonic_create, /* 74 */ 128 (void *) rtems_rate_monotonic_ident, /* 75 */ 129 (void *) rtems_rate_monotonic_delete, /* 76 */ 130 (void *) rtems_rate_monotonic_cancel, /* 77 */ 131 (void *) rtems_rate_monotonic_period, /* 78 */ 132 (void *) rtems_multiprocessing_announce, /* 79 */ 133 (void *) rtems_debug_enable, /* 80 */ 134 (void *) rtems_debug_disable /* 81 */ 133 135 }; 134 136 -
c/src/exec/sapi/optman/no-io.c
r3b438fa rb06e68ef 24 24 } 25 25 26 rtems_status_code rtems_io_register_name( 27 char *device_name, 28 rtems_device_major_number major, 29 rtems_device_minor_number minor 30 ) 31 { 32 return RTEMS_NOT_CONFIGURED; 33 } 34 35 rtems_status_code rtems_io_lookup_name( 36 const char *pathname, 37 rtems_driver_name_t **rnp 38 ) 39 { 40 return RTEMS_NOT_CONFIGURED; 41 } 42 26 43 rtems_status_code rtems_io_initialize( 27 44 rtems_device_major_number major, 28 45 rtems_device_minor_number minor, 29 void *argument, 30 unsigned32 *return_value 46 void *argument 31 47 ) 32 48 { … … 37 53 rtems_device_major_number major, 38 54 rtems_device_minor_number minor, 39 void *argument, 40 unsigned32 *return_value 55 void *argument 41 56 ) 42 57 { … … 47 62 rtems_device_major_number major, 48 63 rtems_device_minor_number minor, 49 void *argument, 50 unsigned32 *return_value 64 void *argument 51 65 ) 52 66 { … … 57 71 rtems_device_major_number major, 58 72 rtems_device_minor_number minor, 59 void *argument, 60 unsigned32 *return_value 73 void *argument 61 74 ) 62 75 { … … 67 80 rtems_device_major_number major, 68 81 rtems_device_minor_number minor, 69 void *argument, 70 unsigned32 *return_value 82 void *argument 71 83 ) 72 84 { … … 77 89 rtems_device_major_number major, 78 90 rtems_device_minor_number minor, 79 void *argument, 80 unsigned32 *return_value 91 void *argument 81 92 ) 82 93 { 83 94 return( RTEMS_NOT_CONFIGURED ); 84 95 } 85 86 rtems_status_code _IO_Handler_routine(87 IO_operations operation,88 rtems_device_major_number major,89 rtems_device_minor_number minor,90 void *argument,91 unsigned32 *return_value92 )93 {94 return( RTEMS_NOT_CONFIGURED );95 } -
c/src/exec/sapi/src/exinit.c
r3b438fa rb06e68ef 178 178 179 179 _Message_queue_Manager_initialization( 180 configuration_table->maximum_message_queues, 181 configuration_table->maximum_messages 180 configuration_table->maximum_message_queues 182 181 ); 183 182 -
c/src/exec/sapi/src/io.c
r3b438fa rb06e68ef 19 19 #include <rtems/isr.h> 20 20 #include <rtems/thread.h> 21 #include <rtems/intr.h> 22 23 #include <string.h> 21 24 22 25 /*PAGE … … 34 37 { 35 38 rtems_device_major_number major; 36 unsigned32 ignored;37 39 38 40 for ( major=0 ; major < _IO_Number_of_drivers ; major ++ ) 39 (void) rtems_io_initialize( major, 0, _Configuration_Table, &ignored ); 40 } 41 (void) rtems_io_initialize( major, 0, _Configuration_Table); 42 } 43 44 /*PAGE 45 * 46 * rtems_io_register_name 47 * 48 * Associate a name with a driver 49 * 50 * Input Paramters: 51 * 52 * Output Parameters: 53 */ 54 55 rtems_status_code rtems_io_register_name( 56 char *device_name, 57 rtems_device_major_number major, 58 rtems_device_minor_number minor 59 ) 60 { 61 rtems_driver_name_t *np; 62 unsigned32 level; 63 64 /* find an empty slot */ 65 for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++) 66 { 67 rtems_interrupt_disable(level); 68 if (np->device_name == 0) 69 { 70 np->device_name = device_name; 71 np->device_name_length = strlen(device_name); 72 np->major = major; 73 np->minor = minor; 74 rtems_interrupt_enable(level); 75 76 return RTEMS_SUCCESSFUL; 77 } 78 rtems_interrupt_enable(level); 79 } 80 81 return RTEMS_TOO_MANY; 82 } 83 84 /*PAGE 85 * 86 * rtems_io_lookup_name 87 * 88 * Find what driver "owns" this name 89 * 90 * Input Paramters: 91 * 92 * Output Parameters: 93 */ 94 95 rtems_status_code rtems_io_lookup_name( 96 const char *pathname, 97 rtems_driver_name_t **rnp 98 ) 99 { 100 rtems_driver_name_t *np; 101 102 for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++) 103 if (np->device_name) 104 if (strncmp(np->device_name, pathname, np->device_name_length) == 0) 105 { 106 *rnp = np; 107 return RTEMS_SUCCESSFUL; 108 } 109 110 *rnp = 0; 111 return RTEMS_UNSATISFIED; 112 } 113 41 114 42 115 /*PAGE … … 50 123 * minor - device number 51 124 * argument - pointer to argument(s) 52 * return_value - pointer to driver's return value 53 * 54 * Output Parameters: 55 * returns - return code 56 * *return_value - driver's return code 125 * 126 * Output Parameters: 127 * returns - return code 57 128 */ 58 129 … … 60 131 rtems_device_major_number major, 61 132 rtems_device_minor_number minor, 62 void *argument, 63 unsigned32 *return_value 64 ) 65 { 66 return _IO_Handler_routine( 67 IO_INITIALIZE_OPERATION, 68 major, 69 minor, 70 argument, 71 return_value 72 ); 133 void *argument 134 ) 135 { 136 rtems_device_driver_entry callout; 137 138 if ( major >= _IO_Number_of_drivers ) 139 return RTEMS_INVALID_NUMBER; 140 141 callout = _IO_Driver_address_table[major].initialization; 142 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 73 143 } 74 144 … … 83 153 * minor - device number 84 154 * argument - pointer to argument(s) 85 * return_value - pointer to driver's return value 86 * 87 * Output Parameters: 88 * returns - return code 89 * *return_value - driver's return code 155 * 156 * Output Parameters: 157 * returns - return code 90 158 */ 91 159 … … 93 161 rtems_device_major_number major, 94 162 rtems_device_minor_number minor, 95 void *argument, 96 unsigned32 *return_value 97 ) 98 { 99 return _IO_Handler_routine( 100 IO_OPEN_OPERATION, 101 major, 102 minor, 103 argument, 104 return_value 105 ); 163 void *argument 164 ) 165 { 166 rtems_device_driver_entry callout; 167 168 if ( major >= _IO_Number_of_drivers ) 169 return RTEMS_INVALID_NUMBER; 170 171 callout = _IO_Driver_address_table[major].open; 172 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 106 173 } 107 174 … … 116 183 * minor - device number 117 184 * argument - pointer to argument(s) 118 * return_value - pointer to driver's return value 119 * 120 * Output Parameters: 121 * returns - return code 122 * *return_value - driver's return code 185 * 186 * Output Parameters: 187 * returns - return code 123 188 */ 124 189 … … 126 191 rtems_device_major_number major, 127 192 rtems_device_minor_number minor, 128 void *argument, 129 unsigned32 *return_value 130 ) 131 { 132 return _IO_Handler_routine( 133 IO_CLOSE_OPERATION, 134 major, 135 minor, 136 argument, 137 return_value 138 ); 193 void *argument 194 ) 195 { 196 rtems_device_driver_entry callout; 197 198 if ( major >= _IO_Number_of_drivers ) 199 return RTEMS_INVALID_NUMBER; 200 201 callout = _IO_Driver_address_table[major].close; 202 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 139 203 } 140 204 … … 149 213 * minor - device number 150 214 * argument - pointer to argument(s) 151 * return_value - pointer to driver's return value 152 * 153 * Output Parameters: 154 * returns - return code 155 * *return_value - driver's return code 215 * 216 * Output Parameters: 217 * returns - return code 156 218 */ 157 219 … … 159 221 rtems_device_major_number major, 160 222 rtems_device_minor_number minor, 161 void *argument, 162 unsigned32 *return_value 163 ) 164 { 165 return _IO_Handler_routine( 166 IO_READ_OPERATION, 167 major, 168 minor, 169 argument, 170 return_value 171 ); 223 void *argument 224 ) 225 { 226 rtems_device_driver_entry callout; 227 228 if ( major >= _IO_Number_of_drivers ) 229 return RTEMS_INVALID_NUMBER; 230 231 callout = _IO_Driver_address_table[major].read; 232 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 172 233 } 173 234 … … 182 243 * minor - device number 183 244 * argument - pointer to argument(s) 184 * return_value - pointer to driver's return value 185 * 186 * Output Parameters: 187 * returns - return code 188 * *return_value - driver's return code 245 * 246 * Output Parameters: 247 * returns - return code 189 248 */ 190 249 … … 192 251 rtems_device_major_number major, 193 252 rtems_device_minor_number minor, 194 void *argument, 195 unsigned32 *return_value 196 ) 197 { 198 return _IO_Handler_routine( 199 IO_WRITE_OPERATION, 200 major, 201 minor, 202 argument, 203 return_value 204 ); 253 void *argument 254 ) 255 { 256 rtems_device_driver_entry callout; 257 258 if ( major >= _IO_Number_of_drivers ) 259 return RTEMS_INVALID_NUMBER; 260 261 callout = _IO_Driver_address_table[major].write; 262 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 205 263 } 206 264 … … 215 273 * minor - device number 216 274 * argument - pointer to argument(s) 217 * return_value - pointer to driver's return value 218 * 219 * Output Parameters: 220 * returns - return code 221 * *return_value - driver's return code 275 * 276 * Output Parameters: 277 * returns - return code 222 278 */ 223 279 … … 225 281 rtems_device_major_number major, 226 282 rtems_device_minor_number minor, 227 void *argument, 228 unsigned32 *return_value 229 ) 230 { 231 return _IO_Handler_routine( 232 IO_CONTROL_OPERATION, 233 major, 234 minor, 235 argument, 236 return_value 237 ); 238 } 239 240 /*PAGE 241 * 242 * _IO_Handler_routine 243 * 244 * This routine implements all IO manager directives. 245 * 246 * Input Paramters: 247 * operation - I/O operation to be performed 248 * major - device driver number 249 * minor - device number 250 * argument - pointer to argument(s) 251 * return_value - pointer to driver's return value 252 * 253 * Output Parameters: 254 * returns - return code 255 * *return_value - driver's return code 256 */ 257 258 rtems_status_code _IO_Handler_routine( 259 IO_operations operation, 260 rtems_device_major_number major, 261 rtems_device_minor_number minor, 262 void *argument, 263 unsigned32 *return_value 264 ) 265 { 266 rtems_device_driver_entry io_callout; 267 268 /* 269 * NOTE: There is no range checking as in Ada because: 270 * + arrays in Ada are not always zero based. 271 * + with zero based arrays, a comparison of an unsigned 272 * number being less than zero would be necessary to 273 * check it as a range. This would cause a warning for 274 * checking an unsigned number for being negative. 275 */ 276 277 if ( major >= _IO_Number_of_drivers ) 278 return ( RTEMS_INVALID_NUMBER ); 279 280 switch ( operation ) { 281 case IO_INITIALIZE_OPERATION: 282 io_callout = _IO_Driver_address_table[ major ].initialization; 283 break; 284 case IO_OPEN_OPERATION: 285 io_callout = _IO_Driver_address_table[ major ].open; 286 break; 287 case IO_CLOSE_OPERATION: 288 io_callout = _IO_Driver_address_table[ major ].close; 289 break; 290 case IO_READ_OPERATION: 291 io_callout = _IO_Driver_address_table[ major ].read; 292 break; 293 case IO_WRITE_OPERATION: 294 io_callout = _IO_Driver_address_table[ major ].write; 295 break; 296 case IO_CONTROL_OPERATION: 297 io_callout = _IO_Driver_address_table[ major ].control; 298 break; 299 default: /* unreached -- only to remove warnings */ 300 io_callout = NULL; 301 break; 302 } 303 304 if ( io_callout != NULL ) 305 (*io_callout)( 306 major, 307 minor, 308 argument, 309 _Thread_Executing->Object.id, 310 return_value 311 ); 312 else 313 *return_value = 0; 314 315 return( RTEMS_SUCCESSFUL ); 316 } 283 void *argument 284 ) 285 { 286 rtems_device_driver_entry callout; 287 288 if ( major >= _IO_Number_of_drivers ) 289 return RTEMS_INVALID_NUMBER; 290 291 callout = _IO_Driver_address_table[major].control; 292 return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL; 293 } 294 -
c/src/exec/score/headers/object.h
r3b438fa rb06e68ef 101 101 102 102 /* 103 * Parameters and return id's for _Objects_Get_next 104 */ 105 106 #define RTEMS_OBJECT_ID_INITIAL_INDEX (0) 107 #define RTEMS_OBJECT_ID_FINAL_INDEX (0xffff) 108 109 #define RTEMS_OBJECT_ID_INITIAL(node) (_Objects_Build_id( \ 110 node, \ 111 RTEMS_OBJECT_ID_INITIAL_INDEX)) 112 #define RTEMS_OBJECT_ID_FINAL ((Objects_Id) ~0) 113 114 /* 103 115 * _Objects_Handler_initialization 104 116 * … … 180 192 181 193 /* 194 * _Objects_Get_next 195 * 196 * DESCRIPTION: 197 * 198 * Like _Objects_Get, but is used to find "next" open object. 199 * 200 */ 201 202 Objects_Control *_Objects_Get_next( 203 Objects_Information *information, 204 Objects_Id id, 205 unsigned32 *location_p, 206 Objects_Id *next_id_p 207 ); 208 209 /* 182 210 * _Objects_Is_name_valid 183 211 * -
c/src/exec/score/headers/system.h
r3b438fa rb06e68ef 79 79 #include <rtems/cpu.h> /* processor specific information */ 80 80 #include <rtems/status.h> /* RTEMS status codes */ 81 #include <rtems/directives.h> 81 82 82 83 /* … … 104 105 #define stringify( _x ) # _x 105 106 107 #define RTEMS_offsetof(type, field) \ 108 ((unsigned32) &(((type *) 0)->field)) 109 106 110 /* 107 111 * The following is the extern for the RTEMS version string. … … 116 120 */ 117 121 118 #define NUMBER_OF_ENTRY_POINTS 79 119 extern const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1 ]; 122 extern const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; 120 123 121 124 /* -
c/src/exec/score/headers/thread.h
r3b438fa rb06e68ef 116 116 unsigned32 segment_size; /* size of segment requested */ 117 117 rtems_event_set event_condition; 118 unsigned32 *message_size_p; /* ptr for return size of message */ 118 119 } Extra; 119 120 void *return_argument; /* address of user return param */ -
c/src/exec/score/include/rtems/score/object.h
r3b438fa rb06e68ef 101 101 102 102 /* 103 * Parameters and return id's for _Objects_Get_next 104 */ 105 106 #define RTEMS_OBJECT_ID_INITIAL_INDEX (0) 107 #define RTEMS_OBJECT_ID_FINAL_INDEX (0xffff) 108 109 #define RTEMS_OBJECT_ID_INITIAL(node) (_Objects_Build_id( \ 110 node, \ 111 RTEMS_OBJECT_ID_INITIAL_INDEX)) 112 #define RTEMS_OBJECT_ID_FINAL ((Objects_Id) ~0) 113 114 /* 103 115 * _Objects_Handler_initialization 104 116 * … … 180 192 181 193 /* 194 * _Objects_Get_next 195 * 196 * DESCRIPTION: 197 * 198 * Like _Objects_Get, but is used to find "next" open object. 199 * 200 */ 201 202 Objects_Control *_Objects_Get_next( 203 Objects_Information *information, 204 Objects_Id id, 205 unsigned32 *location_p, 206 Objects_Id *next_id_p 207 ); 208 209 /* 182 210 * _Objects_Is_name_valid 183 211 * -
c/src/exec/score/include/rtems/score/thread.h
r3b438fa rb06e68ef 116 116 unsigned32 segment_size; /* size of segment requested */ 117 117 rtems_event_set event_condition; 118 unsigned32 *message_size_p; /* ptr for return size of message */ 118 119 } Extra; 119 120 void *return_argument; /* address of user return param */ -
c/src/exec/score/include/rtems/system.h
r3b438fa rb06e68ef 79 79 #include <rtems/cpu.h> /* processor specific information */ 80 80 #include <rtems/status.h> /* RTEMS status codes */ 81 #include <rtems/directives.h> 81 82 82 83 /* … … 104 105 #define stringify( _x ) # _x 105 106 107 #define RTEMS_offsetof(type, field) \ 108 ((unsigned32) &(((type *) 0)->field)) 109 106 110 /* 107 111 * The following is the extern for the RTEMS version string. … … 116 120 */ 117 121 118 #define NUMBER_OF_ENTRY_POINTS 79 119 extern const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1 ]; 122 extern const void * _Entry_points[ RTEMS_NUMBER_OF_ENTRY_POINTS ]; 120 123 121 124 /* -
c/src/exec/score/src/object.c
r3b438fa rb06e68ef 13 13 * $Id$ 14 14 */ 15 15 16 #include <rtems/system.h> 16 17 #include <rtems/chain.h> … … 227 228 return the_object; 228 229 } 230 231 232 /*PAGE 233 * 234 * _Objects_Get_next 235 * 236 * Like _Objects_Get, but considers the 'id' as a "hint" and 237 * finds next valid one after that point. 238 * Mostly used for monitor and debug traversal of an object. 239 * 240 * Input parameters: 241 * information - pointer to entry in table for this class 242 * id - object id to search for 243 * location - address of where to store the location 244 * next_id - address to store next id to try 245 * 246 * Output parameters: 247 * returns - address of object if local 248 * location - one of the following: 249 * OBJECTS_ERROR - invalid object ID 250 * OBJECTS_REMOTE - remote object 251 * OBJECTS_LOCAL - local object 252 * next_id - will contain a reasonable "next" id to continue traversal 253 * 254 * NOTE: 255 * assumes can add '1' to an id to get to next index. 256 */ 257 258 Objects_Control * 259 _Objects_Get_next( 260 Objects_Information *information, 261 Objects_Id id, 262 unsigned32 *location_p, 263 Objects_Id *next_id_p 264 ) 265 { 266 Objects_Control *object; 267 Objects_Id next_id; 268 269 if (rtems_get_index(id) == RTEMS_OBJECT_ID_INITIAL_INDEX) 270 next_id = information->minimum_id; 271 else 272 next_id = id; 273 274 do { 275 /* walked off end of list? */ 276 if (next_id > information->maximum_id) 277 { 278 *location_p = OBJECTS_ERROR; 279 goto final; 280 } 281 282 /* try to grab one */ 283 object = _Objects_Get(information, next_id, location_p); 284 285 next_id++; 286 287 } while (*location_p != OBJECTS_LOCAL); 288 289 *next_id_p = next_id; 290 return object; 291 292 final: 293 *next_id_p = RTEMS_OBJECT_ID_FINAL; 294 return 0; 295 } -
c/src/lib/include/clockdrv.h
r3b438fa rb06e68ef 24 24 25 25 extern volatile rtems_unsigned32 Clock_driver_ticks; 26 extern rtems_device_major_number rtems_clock_major; 27 extern rtems_device_minor_number rtems_clock_minor; 26 28 27 /* functions */ 28 29 rtems_task Exit_task(); 30 void exit_task_init(); 31 32 void Install_clock( rtems_isr_entry ); 33 void ReInstall_clock( rtems_isr_entry ); 34 void Clock_exit(); 35 36 rtems_isr Clock_isr( 37 rtems_vector_number 38 ); 39 40 /* driver entries */ 29 /* default clock driver entry */ 41 30 42 31 #define CLOCK_DRIVER_TABLE_ENTRY \ 43 { Clock_initialize, NULL, NULL, NULL, NULL, NULL}44 32 { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } 33 45 34 rtems_device_driver Clock_initialize( 46 35 rtems_device_major_number, 47 36 rtems_device_minor_number, 48 void *, 49 rtems_id, 50 rtems_unsigned32 * 37 void * 38 ); 39 40 rtems_device_driver Clock_control( 41 rtems_device_major_number major, 42 rtems_device_minor_number minor, 43 void *pargp 51 44 ); 52 45 -
c/src/lib/libbsp/hppa1.1/simhppa/include/bsp.h
r3b438fa rb06e68ef 22 22 23 23 #include <rtems.h> 24 #include <iosupp.h> 24 #include <clockdrv.h> 25 #include <rtems/ttydrv.h> 26 #include <libcsupport.h> 25 27 26 28 /* … … 66 68 67 69 /* 70 * Todo: this should be put somewhere else 71 */ 72 73 #undef CLOCK_DRIVER_TABLE_ENTRY 74 #define CLOCK_DRIVER_TABLE_ENTRY { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } 75 rtems_device_driver Clock_control( 76 rtems_device_major_number major, 77 rtems_device_minor_number minor, 78 void *pargp 79 ); 80 81 /* 68 82 * We printf() to a buffer if multiprocessing, *or* if this is set. 69 83 * ref: src/lib/libbsp/hppa/simhppa/iosupp/consupp.c … … 72 86 extern int use_print_buffer; 73 87 88 /* 89 * When not doing printf to a buffer, we do printf thru RTEMS libio 90 * and our tty driver. Set it up so that console is right. 91 */ 92 93 #define CONSOLE_DRIVER_TABLE_ENTRY \ 94 { tty_initialize, tty_open, tty_close, tty_read, tty_write, tty_control } 95 96 /* 97 * How many libio files we want 98 */ 99 #define BSP_LIBIO_MAX_FDS 20 100 74 101 #define HPPA_INTERRUPT_EXTERNAL_MPCI HPPA_INTERRUPT_EXTERNAL_10 102 103 rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int); 75 104 76 105 void bsp_start( void ); -
c/src/lib/libbsp/hppa1.1/simhppa/startup/bspstart.c
r3b438fa rb06e68ef 1 1 /* 2 * @(#)bspstart.c 1.14 - 95/05/16 3 * 2 * @(#)bspstart.c 1.16 - 95/06/28 4 3 */ 5 4 … … 25 24 * notice must appear in all copies of this file and its derivatives. 26 25 * 27 * bspstart.c,v 1.2 1995/05/09 20:17:33 joel Exp 28 */ 29 26 * $Id$ 27 */ 28 29 #include <rtems.h> 30 30 #include <bsp.h> 31 #include <rtems/libio.h> 32 31 33 #include <libcsupport.h> 32 34 33 35 #include <string.h> 36 #include <fcntl.h> 34 37 35 38 #ifdef STACK_CHECKER_ON … … 129 132 130 133 /* 134 * Init the RTEMS libio facility to provide UNIX-like system 135 * calls for use by newlib (ie: provide __open, __close, etc) 136 * Uses malloc() to get area for the iops, so must be after malloc init 137 */ 138 139 rtems_libio_init(); 140 141 /* 131 142 * Set up for the libc handling. 143 * XXX; this should allow for case of some other non-clock interrupts 132 144 */ 133 145 … … 218 230 Stack_check_Initialize(); 219 231 #endif 232 } 233 234 /* 235 * After drivers are setup, register some "filenames" 236 * and open stdin, stdout, stderr files 237 * 238 * Newlib will automatically associate the files with these 239 * (it hardcodes the numbers) 240 */ 241 242 void 243 bsp_postdriver_hook(void) 244 { 245 int stdin_fd, stdout_fd, stderr_fd; 246 247 if ((stdin_fd = __open("/dev/tty00", O_RDONLY, 0)) == -1) 248 rtems_fatal_error_occurred('STD0'); 249 250 if ((stdout_fd = __open("/dev/tty00", O_WRONLY, 0)) == -1) 251 rtems_fatal_error_occurred('STD1'); 252 253 if ((stderr_fd = __open("/dev/tty00", O_WRONLY, 0)) == -1) 254 rtems_fatal_error_occurred('STD2'); 255 256 if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2)) 257 rtems_fatal_error_occurred('STIO'); 220 258 } 221 259 … … 290 328 Cpu_table.predriver_hook = NULL; 291 329 292 Cpu_table.postdriver_hook = NULL;330 Cpu_table.postdriver_hook = bsp_postdriver_hook; /* register drivers */ 293 331 294 332 Cpu_table.idle_task = NULL; /* do not override system IDLE task */ … … 343 381 344 382 #ifdef STACK_CHECKER_ON 345 /*346 * Add 1 extension for stack checker347 */383 /* 384 * Add 1 extension for stack checker 385 */ 348 386 349 387 BSP_Configuration.maximum_extensions++; … … 351 389 352 390 #if SIMHPPA_FAST_IDLE 353 /*354 * Add 1 extension for fast idle355 */391 /* 392 * Add 1 extension for fast idle 393 */ 356 394 357 395 BSP_Configuration.maximum_extensions++; 358 396 #endif 397 398 /* 399 * Tell libio how many fd's we want and allow it to tweak config 400 */ 401 402 rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS); 359 403 360 404 /* -
c/src/lib/libbsp/shmdr/poll.c
r3b438fa rb06e68ef 17 17 * notice must appear in all copies of this file and its derivatives. 18 18 * 19 * poll.c,v 1.2 1995/05/09 20:22:57 joel Exp19 * $Id$ 20 20 */ 21 21 22 22 #include <rtems.h> 23 23 #include <rtems/sysstate.h> 24 #include <rtems/libio.h> 25 24 26 #include "shm.h" 25 #include "clockdrv.h"26 27 27 28 void Shm_Poll() 28 29 { 29 30 rtems_unsigned32 tmpfront; 31 rtems_libio_ioctl_args_t args; 30 32 31 Clock_isr( 0 ); /* invoke standard clock ISR */ 32 33 /* invoke clock isr */ 34 args.iop = 0; 35 args.command = rtems_build_name('I', 'S', 'R', ' '); 36 (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); 33 37 34 38 /* … … 40 44 if (_System_state_Is_up(_System_state_Get())) 41 45 { 42 /* enable_tracing(); */43 /* ticks += 1; */44 Shm_Lock( Shm_Local_receive_queue );45 46 tmpfront = Shm_Local_receive_queue->front; 46 Shm_Unlock( Shm_Local_receive_queue );47 if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ){48 rtems_multiprocessing_announce();49 Shm_Interrupt_count++;47 if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) 48 { 49 rtems_multiprocessing_announce(); 50 Shm_Interrupt_count++; 50 51 } 51 52 } -
c/src/lib/libbsp/shmdr/setckvec.c
r3b438fa rb06e68ef 20 20 21 21 #include <rtems.h> 22 #include <rtems/libio.h> 23 22 24 #include "shm.h" 23 #include "clockdrv.h"24 25 25 26 rtems_isr Shm_setclockvec() 26 27 { 27 ReInstall_clock( Shm_Poll ); 28 rtems_libio_ioctl_args_t args; 29 args.iop = 0; 30 args.command = rtems_build_name('N', 'E', 'W', ' '); 31 args.buffer = (void *) Shm_Poll; 32 33 (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); 28 34 } -
c/src/lib/libbsp/shmdr/shm.h
r3b438fa rb06e68ef 20 20 #ifndef __SHM_h 21 21 #define __SHM_h 22 23 #include <clockdrv.h> 22 24 23 25 #ifdef __cplusplus … … 519 521 rtems_mpci_table MPCI_table = { 520 522 100000, /* default timeout value in ticks */ 523 MAX_PACKET_SIZE, /* maximum packet size */ 521 524 Shm_Initialization, /* initialization procedure */ 522 525 Shm_Get_packet, /* get packet procedure */ -
c/src/lib/libbsp/shmdr/shm_driver.h
r3b438fa rb06e68ef 20 20 #ifndef __SHM_h 21 21 #define __SHM_h 22 23 #include <clockdrv.h> 22 24 23 25 #ifdef __cplusplus … … 519 521 rtems_mpci_table MPCI_table = { 520 522 100000, /* default timeout value in ticks */ 523 MAX_PACKET_SIZE, /* maximum packet size */ 521 524 Shm_Initialization, /* initialization procedure */ 522 525 Shm_Get_packet, /* get packet procedure */ -
c/src/lib/libbsp/unix/posix/clock/clock.c
r3b438fa rb06e68ef 1 1 /* Clock 2 2 * 3 * This routine initializes the interval timer on the4 * PA-RISC CPU.The tick frequency is specified by the bsp.3 * This routine generates clock ticks using standard POSIX services. 4 * The tick frequency is specified by the bsp. 5 5 * 6 6 * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. … … 16 16 17 17 #include <rtems.h> 18 #include <rtems/libio.h> 19 #include <bsp.h> 18 20 21 /* 22 * In order to get the types and prototypes used in this file under 23 * Solaris 2.3, it is necessary to pull the following magic. 24 */ 25 26 #if defined(solaris) 27 #warning "Ignore the undefining __STDC__ warning" 28 #undef __STDC__ 29 #define __STDC__ 0 30 #undef _POSIX_C_SOURCE 31 #endif 32 19 33 #include <stdlib.h> 20 34 #include <stdio.h> 21 35 #include <signal.h> 22 36 #include <time.h> 23 #include <sys/time.h>24 37 25 38 extern rtems_configuration_table Configuration; 26 extern sigset_t UNIX_SIGNAL_MASK;27 39 28 /* 29 * Function prototypes 30 */ 31 32 void Install_clock(); 33 void Clock_isr(); 34 void Clock_exit(); 35 36 /* 37 * CPU_HPPA_CLICKS_PER_TICK is either a #define or an rtems_unsigned32 38 * allocated and set by bsp_start() 39 */ 40 41 #ifndef CPU_HPPA_CLICKS_PER_TICK 42 extern rtems_unsigned32 CPU_HPPA_CLICKS_PER_TICK; 43 #endif 40 void Clock_exit(void); 44 41 45 42 volatile rtems_unsigned32 Clock_driver_ticks; 46 43 47 struct itimerval new; 44 /* 45 * These are set by clock driver during its init 46 */ 48 47 49 rtems_device_driver 50 Clock_initialize( 51 rtems_device_major_number major, 52 rtems_device_minor_number minor, 53 void *pargp, 54 rtems_id tid, 55 rtems_unsigned32 *rval 56 ) 57 { 58 Install_clock(Clock_isr); 59 } 60 61 void 62 ReInstall_clock(rtems_isr_entry new_clock_isr) 63 { 64 rtems_unsigned32 isrlevel = 0; 65 66 rtems_interrupt_disable(isrlevel); 67 (void)set_vector(new_clock_isr, SIGALRM, 1); 68 rtems_interrupt_enable(isrlevel); 69 } 48 rtems_device_major_number rtems_clock_major = ~0; 49 rtems_device_minor_number rtems_clock_minor; 70 50 71 51 void 72 52 Install_clock(rtems_isr_entry clock_isr) 73 53 { 54 struct itimerval new; 55 74 56 Clock_driver_ticks = 0; 75 57 … … 87 69 88 70 void 71 ReInstall_clock(rtems_isr_entry new_clock_isr) 72 { 73 rtems_unsigned32 isrlevel = 0; 74 75 rtems_interrupt_disable(isrlevel); 76 (void)set_vector(new_clock_isr, SIGALRM, 1); 77 rtems_interrupt_enable(isrlevel); 78 } 79 80 void 89 81 Clock_isr(int vector) 90 82 { 91 83 Clock_driver_ticks++; 92 93 84 rtems_clock_tick(); 94 85 } … … 102 93 Clock_exit(void) 103 94 { 95 struct itimerval new; 104 96 struct sigaction act; 105 97 … … 122 114 (void)set_vector(0, SIGALRM, 1); 123 115 } 116 117 rtems_device_driver 118 Clock_initialize( 119 rtems_device_major_number major, 120 rtems_device_minor_number minor, 121 void *pargp 122 ) 123 { 124 Install_clock((rtems_isr_entry) Clock_isr); 125 126 /* 127 * make major/minor avail to others such as shared memory driver 128 */ 129 rtems_clock_major = major; 130 rtems_clock_minor = minor; 131 132 return RTEMS_SUCCESSFUL; 133 } 134 135 rtems_device_driver Clock_control( 136 rtems_device_major_number major, 137 rtems_device_minor_number minor, 138 void *pargp 139 ) 140 { 141 rtems_libio_ioctl_args_t *args = pargp; 142 143 if (args == 0) 144 goto done; 145 146 /* 147 * This is hokey, but until we get a defined interface 148 * to do this, it will just be this simple... 149 */ 150 151 if (args->command == rtems_build_name('I', 'S', 'R', ' ')) 152 { 153 Clock_isr(SIGALRM); 154 } 155 else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) 156 { 157 ReInstall_clock(args->buffer); 158 } 159 160 done: 161 return RTEMS_SUCCESSFUL; 162 } -
c/src/lib/libbsp/unix/posix/console/console.c
r3b438fa rb06e68ef 29 29 console_initialize(rtems_device_major_number major, 30 30 rtems_device_minor_number minor, 31 void * arg, 32 rtems_id self, 33 rtems_unsigned32 * status) 31 void * arg 32 ) 34 33 { 35 *status =RTEMS_SUCCESSFUL;34 return RTEMS_SUCCESSFUL; 36 35 } 37 36 -
c/src/lib/libbsp/unix/posix/include/bsp.h
r3b438fa rb06e68ef 79 79 80 80 /* #define INTERRUPT_EXTERNAL_MPCI SIGUSR1 */ 81 82 /* 83 * Console driver init 84 */ 85 86 rtems_device_driver console_initialize( 87 rtems_device_major_number, rtems_device_minor_number minor, void *); 88 89 #define CONSOLE_DRIVER_TABLE_ENTRY \ 90 { console_initialize, NULL, NULL, NULL, NULL, NULL } 91 92 /* 93 * NOTE: Use the standard Clock driver entry 94 */ 81 95 82 96 /* functions */ -
c/src/lib/libc/syscalls.c
r3b438fa rb06e68ef 36 36 } 37 37 38 int39 __close(int _fd)40 {41 /* return value usually ignored anyhow */42 return 0;43 }44 45 int46 __open(const char *filename)47 {48 /* always fail */49 return -1;50 }51 52 int53 __lseek(int _fd, off_t offset, int whence)54 {55 /* nothing is ever seekable */56 return -1;57 }58 59 38 int stat( const char *path, struct stat *buf ) 60 39 { -
c/src/lib/libcpu/hppa1.1/clock/clock.c
r3b438fa rb06e68ef 15 15 */ 16 16 17 #include <rtems.h> 17 18 #include <bsp.h> 18 #include < clockdrv.h>19 #include <rtems/libio.h> 19 20 20 21 #include <stdlib.h> /* for atexit() */ … … 23 24 24 25 typedef unsigned long long hppa_click_count_t; 26 27 /* 28 * These are set by clock driver during its init 29 */ 30 31 rtems_device_major_number rtems_clock_major = ~0; 32 rtems_device_minor_number rtems_clock_minor; 25 33 26 34 /* … … 42 50 rtems_unsigned32 Clock_clicks_interrupt; 43 51 44 rtems_device_driver Clock_initialize( 45 rtems_device_major_number major, 46 rtems_device_minor_number minor, 47 void *pargp, 48 rtems_id tid, 49 rtems_unsigned32 *rval 50 ) 51 { 52 Install_clock(Clock_isr); 53 } 52 void Clock_exit(void); 54 53 55 54 void … … 219 218 } 220 219 220 rtems_device_driver Clock_initialize( 221 rtems_device_major_number major, 222 rtems_device_minor_number minor, 223 void *pargp 224 ) 225 { 226 Install_clock(Clock_isr); 227 228 /* 229 * make major/minor avail to others such as shared memory driver 230 */ 231 rtems_clock_major = major; 232 rtems_clock_minor = minor; 233 234 return RTEMS_SUCCESSFUL; 235 } 236 237 rtems_device_driver Clock_control( 238 rtems_device_major_number major, 239 rtems_device_minor_number minor, 240 void *pargp 241 ) 242 { 243 rtems_libio_ioctl_args_t *args = pargp; 244 245 if (args == 0) 246 goto done; 247 248 /* 249 * This is hokey, but until we get a defined interface 250 * to do this, it will just be this simple... 251 */ 252 253 if (args->command == rtems_build_name('I', 'S', 'R', ' ')) 254 { 255 Clock_isr(HPPA_INTERRUPT_EXTERNAL_INTERVAL_TIMER); 256 } 257 else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) 258 { 259 ReInstall_clock(args->buffer); 260 } 261 262 done: 263 return RTEMS_SUCCESSFUL; 264 } -
c/src/lib/libmisc/monitor/README
r3b438fa rb06e68ef 3 3 # 4 4 5 This is a snapshot of a work in process. It is the beginnings of a 6 debug monitor task and trap handler which is tasking aware. 5 monitor task 7 6 7 The monitor task is an optional task that knows about RTEMS 8 data structures and can print out information about them. 9 It is a work-in-progress and needs many more commands, but 10 is useful now. 11 12 The monitor works best when it is the highest priority task, 13 so all your other tasks should ideally be at some priority 14 greater than 1. 15 16 To use the monitor: 17 ------------------- 18 19 #include <rtems/monitor.h> 20 21 ... 22 23 rtems_monitor_init(0); 24 25 The parameter to rtems_monitor_init() tells the monitor whether 26 to suspend itself on startup. A value of 0 causes the monitor 27 to immediately enter command mode; a non-zero value causes the 28 monitor to suspend itself after creation and wait for explicit 29 wakeup. 30 31 32 rtems_monitor_wakeup(); 33 34 wakes up a suspended monitor and causes it to reenter command mode. 35 36 Monitor commands 37 ---------------- 38 39 The monitor prompt is 'rtems> '. 40 Can abbreviate commands to "uniquity" 41 There is a 'help' command. Here is the output from various 42 help commands: 43 44 Commands (may be abbreviated) 45 46 help -- get this message or command specific help 47 task -- show task information 48 queue -- show message queue information 49 symbol -- show entries from symbol table 50 pause -- pause monitor for a specified number of ticks 51 fatal -- invoke a fatal RTEMS error 52 53 task [id [id ...] ] 54 display information about the specified tasks. 55 Default is to display information about all tasks on this node 56 57 queue [id [id ... ] ] 58 display information about the specified message queues 59 Default is to display information about all queues on this node 60 61 symbol [ symbolname [symbolname ... ] ] 62 display value associated with specified symbol. 63 Defaults to displaying all known symbols. 64 65 pause [ticks] 66 monitor goes to "sleep" for specified ticks (default is 1) 67 monitor will resume at end of period or if explicitly awakened 68 69 fatal [status] 70 Invoke 'rtems_fatal_error_occurred' with 'status' 71 (default is RTEMS_INTERNAL_ERROR) 72 73 continue 74 put the monitor to sleep waiting for an explicit wakeup from the 75 program running. 76 77 78 Sample output from 'task' command 79 --------------------------------- 80 81 rtems> task 82 ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES 83 ------------------------------------------------------------------------ 84 00010001 UI1 2 READY P:T:nA NONE15: 0x40606348 85 00010002 RMON 1 READY nP NONE15: 0x40604110 86 87 'RMON' is the monitor itself, so we have 1 "user" task. 88 Its modes are P:T:nA which translate to: 89 90 preemptable 91 timesliced 92 no ASRS 93 94 It has no events. 95 It has a notepad value for notepad 15 which is 0x40606348 96 (this is the libc thread state) 97 -
c/src/lib/libmisc/monitor/mon-monitor.c
r3b438fa rb06e68ef 1 1 /* 2 * @(#)monitor.c 1. 6 - 95/04/242 * @(#)monitor.c 1.18 - 95/08/02 3 3 * 4 */ 5 6 /* 7 * mon-task.c 8 * 9 * Description: 10 * RTEMS monitor task 11 * 12 * 4 * 5 * RTEMS monitor main body 13 6 * 14 7 * TODO: 15 * add pause command (monitor sleeps for 'n' ticks, then wakes up) 16 * 8 * add stuff to RTEMS api 9 * rtems_get_name(id) 10 * rtems_get_type(id) 11 * rtems_build_id(node, type, num) 12 * Add a command to dump out info about an arbitrary id when 13 * types are added to id's 14 * rtems> id idnum 15 * idnum: node n, object: whatever, id: whatever 16 * allow id's to be specified as n:t:id, where 'n:t' is optional 17 * should have a separate monitor FILE stream (ala the debugger) 18 * remote request/response stuff should be cleaned up 19 * maybe we can use real rpc?? 20 * 21 * $Id$ 17 22 */ 18 23 19 24 #include <rtems.h> 20 /* #include <bsp.h> */21 22 #include "symbols.h"23 #include "monitor.h"24 25 25 26 #include <stdio.h> … … 28 29 #include <unistd.h> 29 30 30 # define STREQ(a,b) (strcmp(a,b) == 0)31 #include "monitor.h" 31 32 32 33 /* set by trap handler */ … … 35 36 extern rtems_unsigned32 debugger_trap; 36 37 37 /* our task id needs to be public so any debugger can resume us */ 38 rtems_unsigned32 rtems_monitor_task_id; 39 38 /* 39 * Various id's for the monitor 40 * They need to be public variables for access by other agencies 41 * such as debugger and remote servers' 42 */ 43 44 rtems_id rtems_monitor_task_id; 45 46 unsigned32 rtems_monitor_node; /* our node number */ 47 unsigned32 rtems_monitor_default_node; /* current default for commands */ 48 49 /* 50 * The rtems symbol table 51 */ 40 52 41 53 rtems_symbol_table_t *rtems_monitor_symbols; 42 54 43 44 #ifndef MONITOR_PROMPT 45 #define MONITOR_PROMPT "rtems> " 55 /* 56 * The top-level commands 57 */ 58 59 rtems_monitor_command_entry_t rtems_monitor_commands[] = { 60 { "--usage--", 61 "\n" 62 "RTEMS monitor\n" 63 "\n" 64 "Commands (may be abbreviated)\n" 65 "\n" 66 " help -- get this message or command specific help\n" 67 " pause -- pause monitor for a specified number of ticks\n" 68 " exit -- invoke a fatal RTEMS error\n" 69 " symbol -- show entries from symbol table\n" 70 " continue -- put monitor to sleep waiting for explicit wakeup\n" 71 " config -- show system configuration\n" 72 " itask -- list init tasks\n" 73 " mpci -- list mpci config\n" 74 " task -- show task information\n" 75 " queue -- show message queue information\n" 76 " extension -- user extensions\n" 77 " driver -- show information about named drivers\n" 78 " object -- generic object information\n" 79 " node -- specify default node for commands that take id's\n" 80 #ifdef CPU_INVOKE_DEBUGGER 81 " debugger -- invoke system debugger\n" 46 82 #endif 47 48 #define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0 49 50 /* 51 * Function: rtems_monitor_init 52 * 53 * Description: 54 * Create the RTEMS monitor task 55 * 56 * Parameters: 57 * 'monitor_suspend' arg is passed as initial arg to monitor task 58 * If TRUE, monitor will suspend itself as it starts up. Otherwise 59 * it will begin its command loop. 60 * 61 * Returns: 62 * 63 * 64 * Side Effects: 65 * 66 * 67 * Notes: 68 * 69 * 70 * Deficiencies/ToDo: 71 * 72 * 73 */ 74 75 /* 76 * make_argv(cp): token-count 77 * Break up the command line in 'cp' into global argv[] and argc (return 78 * value). 79 */ 80 81 int 82 rtems_monitor_make_argv( 83 char *cp, 84 int *argc_p, 85 char **argv) 86 { 87 int argc = 0; 88 89 while ((cp = strtok(cp, " \t\n\r"))) 90 { 91 argv[argc++] = cp; 92 cp = (char *) NULL; 93 } 94 argv[argc] = (char *) NULL; /* end of argv */ 95 96 return *argc_p = argc; 97 } 98 99 void 100 rtems_monitor_init(rtems_boolean monitor_suspend) 101 { 102 rtems_status_code status; 103 104 status = rtems_task_create(rtems_build_name('R', 'M', 'O', 'N'), 105 1, 0/*stack*/, RTEMS_NO_PREEMPT | RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &rtems_monitor_task_id); 106 if (status != RTEMS_SUCCESSFUL) 107 { 108 printf("could not create monitor task\n"); 109 goto done; 110 } 111 112 rtems_monitor_symbols_loadup(); 113 114 status = rtems_task_start(rtems_monitor_task_id, rtems_monitor_task, monitor_suspend); 115 if (status != RTEMS_SUCCESSFUL) 116 { 117 printf("could not start monitor!\n"); 118 goto done; 119 } 120 121 done: 122 } 83 , 84 0, 85 0, 86 (unsigned32) rtems_monitor_commands, 87 }, 88 { "config", 89 "config\n" 90 " Show the system configuration.\n", 91 0, 92 rtems_monitor_object_cmd, 93 RTEMS_OBJECT_CONFIG, 94 }, 95 { "itask", 96 "itask\n" 97 " List init tasks for the system\n", 98 0, 99 rtems_monitor_object_cmd, 100 RTEMS_OBJECT_INIT_TASK, 101 }, 102 { "mpci", 103 "mpci\n" 104 " Show the MPCI system configuration, if configured.\n", 105 0, 106 rtems_monitor_object_cmd, 107 RTEMS_OBJECT_MPCI, 108 }, 109 { "pause", 110 "pause [ticks]\n" 111 " monitor goes to \"sleep\" for specified ticks (default is 1)\n" 112 " monitor will resume at end of period or if explicitly awakened\n", 113 0, 114 rtems_monitor_pause_cmd, 115 0, 116 }, 117 { "continue", 118 "continue\n" 119 " put the monitor to sleep waiting for an explicit wakeup from the\n" 120 " program running.\n", 121 0, 122 rtems_monitor_continue_cmd, 123 0, 124 }, 125 { "go", 126 "go\n" 127 " Alias for 'continue'\n", 128 0, 129 rtems_monitor_continue_cmd, 130 0, 131 }, 132 { "node", 133 "node [ node number ]\n" 134 " Specify default node number for commands that take id's\n", 135 0, 136 rtems_monitor_node_cmd, 137 0, 138 }, 139 { "symbol", 140 "symbol [ symbolname [symbolname ... ] ]\n" 141 " display value associated with specified symbol.\n" 142 " Defaults to displaying all known symbols.\n", 143 0, 144 rtems_monitor_symbol_cmd, 145 (unsigned32) &rtems_monitor_symbols, 146 }, 147 { "extension", 148 "extension [id [id ...] ]\n" 149 " display information about specified extensions.\n" 150 " Default is to display information about all extensions on this node\n", 151 0, 152 rtems_monitor_object_cmd, 153 RTEMS_OBJECT_EXTENSION, 154 }, 155 { "task", 156 "task [id [id ...] ]\n" 157 " display information about the specified tasks.\n" 158 " Default is to display information about all tasks on this node\n", 159 0, 160 rtems_monitor_object_cmd, 161 RTEMS_OBJECT_TASK, 162 }, 163 { "queue", 164 "queue [id [id ... ] ]\n" 165 " display information about the specified message queues\n" 166 " Default is to display information about all queues on this node\n", 167 0, 168 rtems_monitor_object_cmd, 169 RTEMS_OBJECT_QUEUE, 170 }, 171 { "object", 172 "object [id [id ...] ]\n" 173 " display information about specified RTEMS objects.\n" 174 " Object id's must include 'type' information.\n" 175 " (which may normally be defaulted)\n", 176 0, 177 rtems_monitor_object_cmd, 178 RTEMS_OBJECT_INVALID, 179 }, 180 { "driver", 181 "driver [ major [ major ... ] ]\n" 182 " Display the RTEMS device driver table.\n", 183 0, 184 rtems_monitor_object_cmd, 185 RTEMS_OBJECT_DRIVER, 186 }, 187 { "dname", 188 "dname\n" 189 " Displays information about named drivers.\n", 190 0, 191 rtems_monitor_object_cmd, 192 RTEMS_OBJECT_DNAME, 193 }, 194 { "exit", 195 "exit [status]\n" 196 " Invoke 'rtems_fatal_error_occurred' with 'status'\n" 197 " (default is RTEMS_SUCCESSFUL)\n", 198 0, 199 rtems_monitor_fatal_cmd, 200 RTEMS_SUCCESSFUL, 201 }, 202 { "fatal", 203 "fatal [status]\n" 204 " 'exit' with fatal error; default error is RTEMS_TASK_EXITTED\n", 205 0, 206 rtems_monitor_fatal_cmd, 207 RTEMS_TASK_EXITTED, /* exit value */ 208 }, 209 { "quit", 210 "quit [status]\n" 211 " Alias for 'exit'\n", 212 0, 213 rtems_monitor_fatal_cmd, 214 RTEMS_SUCCESSFUL, /* exit value */ 215 }, 216 { "help", 217 "help [ command [ command ] ]\n" 218 " provide information about commands\n" 219 " Default is show basic command summary.\n", 220 0, 221 rtems_monitor_help_cmd, 222 (unsigned32) rtems_monitor_commands, 223 }, 224 #ifdef CPU_INVOKE_DEBUGGER 225 { "debugger", 226 "debugger\n" 227 " Enter the debugger, if possible.\n" 228 " A continue from the debugger will return to the monitor.\n", 229 0, 230 CPU_INVOKE_DEBUGGER, 231 0, 232 }, 233 #endif 234 { 0, 0, 0, 0, 0 }, 235 }; 236 123 237 124 238 rtems_status_code … … 128 242 rtems_status_code status; 129 243 130 status = rtems_event_receive(MONITOR_WAKEUP_EVENT, RTEMS_DEFAULT_OPTIONS, timeout, &event_set); 244 status = rtems_event_receive(MONITOR_WAKEUP_EVENT, 245 RTEMS_DEFAULT_OPTIONS, 246 timeout, 247 &event_set); 131 248 return status; 132 249 } … … 141 258 142 259 143 /* 144 * Read and break up a monitor command 145 * 146 * We have to loop on the gets call, since it will return NULL under UNIX 147 * RTEMS when we get a signal (eg: SIGALRM). 148 */ 149 150 int 151 rtems_monitor_read_command(char *command, 152 int *argc, 153 char **argv) 154 { 155 printf("%s", MONITOR_PROMPT); fflush(stdout); 156 while (gets(command) == (char *) 0) 157 ; 158 return rtems_monitor_make_argv(command, argc, argv); 159 } 160 161 void 162 rtems_monitor_task(rtems_task_argument monitor_suspend) 163 { 164 rtems_tcb *debugee = 0; 165 char command[513]; 166 rtems_context *rp; 167 rtems_context_fp *fp; 168 char *cp; 169 int argc; 170 char *argv[64]; 171 172 if ((rtems_boolean) monitor_suspend) 173 (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 174 175 for (;;) 260 void 261 rtems_monitor_pause_cmd( 262 int argc, 263 char **argv, 264 unsigned32 command_arg, 265 boolean verbose 266 ) 267 { 268 if (argc == 1) 269 rtems_monitor_suspend(1); 270 else 271 rtems_monitor_suspend(strtoul(argv[1], 0, 0)); 272 } 273 274 void 275 rtems_monitor_fatal_cmd( 276 int argc, 277 char **argv, 278 unsigned32 command_arg, 279 boolean verbose 280 ) 281 { 282 if (argc == 1) 283 rtems_fatal_error_occurred(command_arg); 284 else 285 rtems_fatal_error_occurred(strtoul(argv[1], 0, 0)); 286 } 287 288 void 289 rtems_monitor_continue_cmd( 290 int argc, 291 char **argv, 292 unsigned32 command_arg, 293 boolean verbose 294 ) 295 { 296 rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 297 } 298 299 300 void 301 rtems_monitor_node_cmd( 302 int argc, 303 char **argv, 304 unsigned32 command_arg, 305 boolean verbose 306 ) 307 { 308 unsigned32 new_node = rtems_monitor_default_node; 309 310 switch (argc) 176 311 { 177 extern rtems_tcb * _Thread_Executing; 178 debugee = _Thread_Executing; 179 rp = &debugee->Registers; 180 fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ 181 182 if (0 == rtems_monitor_read_command(command, &argc, argv)) 183 continue; 184 185 if (STREQ(argv[0], "quit")) 186 rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 187 else if (STREQ(argv[0], "pause")) 188 rtems_monitor_suspend(1); 189 190 #ifdef CPU_INVOKE_DEBUGGER 191 else if (STREQ(argv[0], "debug")) 192 { 193 CPU_INVOKE_DEBUGGER; 194 } 195 #endif 196 else if (STREQ(argv[0], "symbol")) 197 { 198 char *symbol; 199 char *value; 200 201 if (argc != 3) 202 { 203 printf("usage: symbol symname symvalue\n"); 204 continue; 205 } 206 207 symbol = argv[1]; 208 value = argv[2]; 209 if (symbol && value) 210 { 211 rtems_symbol_t *sp; 212 sp = rtems_symbol_create(rtems_monitor_symbols, 213 symbol, 214 (rtems_unsigned32) strtoul(value, 0, 16)); 215 if (sp) 216 printf("symbol defined is at %p\n", sp); 217 else 218 printf("could not define symbol\n"); 219 } 220 else 221 printf("parsing error\n"); 222 } 223 else 224 { 225 printf("Unrecognized command: '%s'\n", argv[0]); 226 } 312 case 1: /* no node, just set back to ours */ 313 new_node = rtems_monitor_node; 314 break; 315 316 case 2: 317 new_node = strtoul(argv[1], 0, 0); 318 break; 319 320 default: 321 printf("invalid syntax, try 'help node'\n"); 322 break; 227 323 } 228 } 324 325 if ((new_node >= 1) && (new_node <= _Configuration_MP_table->maximum_nodes)) 326 rtems_monitor_default_node = new_node; 327 } 328 229 329 230 330 /* … … 267 367 char buffer[128]; 268 368 369 if (rtems_monitor_symbols) 370 rtems_symbol_table_destroy(rtems_monitor_symbols); 371 269 372 rtems_monitor_symbols = rtems_symbol_table_create(10); 270 373 if (rtems_monitor_symbols == 0) 271 374 return; 272 375 273 fp = fdopen(8, "r"); 376 #ifdef simhppa 377 fp = fdopen(8, "r"); /* don't ask; don't tell */ 378 #else 379 fp = fopen("symbols", "r"); 380 #endif 381 274 382 if (fp == 0) 275 383 return; … … 293 401 if (sp == 0) 294 402 { 295 printf("could not define symbol \n");403 printf("could not define symbol '%s'\n", symbol); 296 404 goto done; 297 405 } … … 299 407 else 300 408 { 301 printf("parsing error \n");409 printf("parsing error on '%s'\n", buffer); 302 410 goto done; 303 411 } … … 306 414 done: 307 415 } 416 417 418 /* 419 * Main monitor command loop 420 */ 421 422 void 423 rtems_monitor_task( 424 rtems_task_argument monitor_flags 425 ) 426 { 427 rtems_tcb *debugee = 0; 428 rtems_context *rp; 429 rtems_context_fp *fp; 430 char command_buffer[513]; 431 int argc; 432 char *argv[64]; 433 boolean verbose = FALSE; 434 435 if (monitor_flags & RTEMS_MONITOR_SUSPEND) 436 (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 437 438 for (;;) 439 { 440 extern rtems_tcb * _Thread_Executing; 441 rtems_monitor_command_entry_t *command; 442 443 debugee = _Thread_Executing; 444 rp = &debugee->Registers; 445 fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ 446 447 if (0 == rtems_monitor_command_read(command_buffer, &argc, argv)) 448 continue; 449 if ((command = rtems_monitor_command_lookup(rtems_monitor_commands, 450 argc, 451 argv)) == 0) 452 continue; 453 454 command->command_function(argc, argv, command->command_arg, verbose); 455 456 fflush(stdout); 457 } 458 } 459 460 461 void 462 rtems_monitor_kill(void) 463 { 464 if (rtems_monitor_task_id) 465 rtems_task_delete(rtems_monitor_task_id); 466 rtems_monitor_task_id = 0; 467 468 rtems_monitor_server_kill(); 469 } 470 471 void 472 rtems_monitor_init( 473 unsigned32 monitor_flags 474 ) 475 { 476 rtems_status_code status; 477 478 rtems_monitor_kill(); 479 480 status = rtems_task_create(RTEMS_MONITOR_NAME, 481 1, 482 0 /* default stack */, 483 RTEMS_INTERRUPT_LEVEL(0), 484 RTEMS_DEFAULT_ATTRIBUTES, 485 &rtems_monitor_task_id); 486 if (status != RTEMS_SUCCESSFUL) 487 { 488 rtems_error(status, "could not create monitor task"); 489 goto done; 490 } 491 492 rtems_monitor_node = rtems_get_node(rtems_monitor_task_id); 493 rtems_monitor_default_node = rtems_monitor_node; 494 495 rtems_monitor_symbols_loadup(); 496 497 if (monitor_flags & RTEMS_MONITOR_GLOBAL) 498 rtems_monitor_server_init(monitor_flags); 499 500 /* 501 * Start the monitor task itself 502 */ 503 504 status = rtems_task_start(rtems_monitor_task_id, 505 rtems_monitor_task, 506 monitor_flags); 507 if (status != RTEMS_SUCCESSFUL) 508 { 509 rtems_error(status, "could not start monitor"); 510 goto done; 511 } 512 513 done: 514 } -
c/src/lib/libmisc/monitor/mon-symbols.c
r3b438fa rb06e68ef 1 1 /* 2 * @(#)symbols.c 1. 3 - 95/04/242 * @(#)symbols.c 1.10 - 95/08/02 3 3 * 4 * $Id$ 4 5 */ 5 6 … … 22 23 #include <string.h> 23 24 25 #include "monitor.h" 24 26 #include "symbols.h" 25 27 26 extern rtems_symbol_table_t *rtems_monitor_symbols;27 28 #ifdef RTEMS_DEBUG29 #define CHK_ADR_PTR(p) \30 do { \31 if (((p) < rtems_monitor_symbols->addresses) || \32 ((p) >= (rtems_monitor_symbols->addresses + rtems_monitor_symbols->next))) \33 { \34 printf("bad address pointer %p\n", (p)); \35 rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS); \36 } \37 } while (0)38 39 #define CHK_NAME_PTR(p) \40 do { \41 if (((p) < rtems_monitor_symbols->symbols) || \42 ((p) >= (rtems_monitor_symbols->symbols + rtems_monitor_symbols->next))) \43 { \44 printf("bad symbol pointer %p\n", (p)); \45 rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS); \46 } \47 } while (0)48 #else49 #define CHK_ADR_PTR(p)50 #define CHK_NAME_PTR(p)51 #endif52 28 53 29 rtems_symbol_table_t * … … 179 155 s2 = (rtems_symbol_t *) e2; 180 156 181 CHK_ADR_PTR(s1);182 CHK_ADR_PTR(s2);183 184 157 if (s1->value < s2->value) 185 158 return -1; … … 200 173 s1 = (rtems_symbol_t *) e1; 201 174 s2 = (rtems_symbol_t *) e2; 202 203 CHK_NAME_PTR(s1);204 CHK_NAME_PTR(s2);205 175 206 176 return strcasecmp(s1->name, s2->name); … … 252 222 rtems_unsigned32 best_distance = ~0; 253 223 rtems_unsigned32 elements; 224 225 if (table == 0) 226 table = rtems_monitor_symbols; 254 227 255 228 if ((table == 0) || (table->size == 0)) … … 301 274 rtems_symbol_t key; 302 275 276 if (table == 0) 277 table = rtems_monitor_symbols; 278 303 279 if ((table == 0) || (name == 0)) 304 280 goto done; 305 281 306 282 if (table->sorted == 0) 307 {308 283 rtems_symbol_sort(table); 309 }310 284 311 285 /* … … 326 300 } 327 301 302 void * 303 rtems_monitor_symbol_next( 304 void *object_info, 305 rtems_monitor_symbol_t *canonical, 306 rtems_id *next_id 307 ) 308 { 309 rtems_symbol_table_t *table; 310 int n = rtems_get_index(*next_id); 311 312 table = *(rtems_symbol_table_t **) object_info; 313 if (table == 0) 314 goto failed; 315 316 if (n >= table->next) 317 goto failed; 318 319 /* NOTE: symbols do not have id and name fields */ 320 321 if (table->sorted == 0) 322 rtems_symbol_sort(table); 323 324 _Thread_Disable_dispatch(); 325 326 *next_id += 1; 327 return (void *) (table->symbols + n); 328 329 failed: 330 *next_id = RTEMS_OBJECT_ID_FINAL; 331 return 0; 332 } 333 334 void 335 rtems_monitor_symbol_canonical( 336 rtems_monitor_symbol_t *canonical_symbol, 337 rtems_symbol_t *sp 338 ) 339 { 340 canonical_symbol->value = sp->value; 341 canonical_symbol->offset = 0; 342 strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name)); 343 } 344 345 346 void 347 rtems_monitor_symbol_canonical_by_name( 348 rtems_monitor_symbol_t *canonical_symbol, 349 char *name 350 ) 351 { 352 rtems_symbol_t *sp; 353 354 sp = rtems_symbol_name_lookup(0, name); 355 356 canonical_symbol->value = sp ? sp->value : 0; 357 358 strncpy(canonical_symbol->name, name, sizeof(canonical_symbol->name)); 359 canonical_symbol->offset = 0; 360 } 361 362 void 363 rtems_monitor_symbol_canonical_by_value( 364 rtems_monitor_symbol_t *canonical_symbol, 365 void *value_void_p 366 ) 367 { 368 unsigned32 value = (unsigned32) value_void_p; 369 rtems_symbol_t *sp; 370 371 sp = rtems_symbol_value_lookup(0, value); 372 if (sp) 373 { 374 canonical_symbol->value = sp->value; 375 canonical_symbol->offset = value - sp->value; 376 strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name)); 377 } 378 else 379 { 380 canonical_symbol->value = value; 381 canonical_symbol->offset = 0; 382 canonical_symbol->name[0] = '\0'; 383 } 384 } 385 386 387 unsigned32 388 rtems_monitor_symbol_dump( 389 rtems_monitor_symbol_t *canonical_symbol, 390 boolean verbose 391 ) 392 { 393 unsigned32 length = 0; 394 395 /* 396 * print the name if it exists AND if value is non-zero 397 * Ie: don't print some garbage symbol for address 0 398 */ 399 400 if (canonical_symbol->name[0] && (canonical_symbol->value != 0)) 401 { 402 if (canonical_symbol->offset == 0) 403 length += printf("%.*s", 404 sizeof(canonical_symbol->name), 405 canonical_symbol->name); 406 else 407 length += printf("<%.*s+0x%x>", 408 sizeof(canonical_symbol->name), 409 canonical_symbol->name, 410 canonical_symbol->offset); 411 if (verbose) 412 length += printf(" [0x%x]", canonical_symbol->value); 413 } 414 else 415 length += printf("[0x%x]", canonical_symbol->value); 416 417 return length; 418 } 419 420 421 void 422 rtems_monitor_symbol_dump_all( 423 rtems_symbol_table_t *table, 424 boolean verbose 425 ) 426 { 427 int s; 428 rtems_symbol_t *sp; 429 430 if (table == 0) 431 { 432 table = rtems_monitor_symbols; 433 if (table == 0) 434 return; 435 } 436 437 if (table->sorted == 0) 438 rtems_symbol_sort(table); 439 440 for (s = 0, sp = table->symbols; s < table->next; s++, sp++) 441 { 442 rtems_monitor_symbol_t canonical_symbol; 443 444 rtems_monitor_symbol_canonical(&canonical_symbol, sp); 445 rtems_monitor_symbol_dump(&canonical_symbol, TRUE); 446 printf("\n"); 447 } 448 } 449 450 451 /* 452 * 'symbol' command 453 */ 454 455 void 456 rtems_monitor_symbol_cmd( 457 int argc, 458 char **argv, 459 unsigned32 command_arg, 460 boolean verbose 461 ) 462 { 463 int arg; 464 rtems_symbol_table_t *table; 465 466 table = *(rtems_symbol_table_t **) command_arg; 467 if (table == 0) 468 { 469 table = rtems_monitor_symbols; 470 if (table == 0) 471 return; 472 } 473 474 /* 475 * Use object command to dump out whole symbol table 476 */ 477 if (argc == 1) 478 rtems_monitor_symbol_dump_all(table, verbose); 479 else 480 { 481 rtems_monitor_symbol_t canonical_symbol; 482 483 for (arg=1; argv[arg]; arg++) 484 { 485 rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]); 486 rtems_monitor_symbol_dump(&canonical_symbol, verbose); 487 printf("\n"); 488 } 489 } 490 } -
c/src/lib/libmisc/monitor/monitor.h
r3b438fa rb06e68ef 1 1 /* 2 * @(#)monitor.h 1. 2 - 95/04/242 * @(#)monitor.h 1.14 - 95/08/02 3 3 * 4 * $Id$ 4 5 */ 5 6 … … 10 11 * The RTEMS monitor task include file. 11 12 * 12 *13 *14 13 * TODO: 15 *16 14 */ 17 15 18 16 #ifndef __MONITOR_H 19 17 #define __MONITOR_H 18 19 #include "symbols.h" 20 #include <rtems/error.h> /* rtems_error() */ 20 21 21 22 #ifdef __cplusplus … … 23 24 #endif 24 25 25 void rtems_monitor_init(rtems_boolean monitor_suspend); 26 /* 27 * XXX this should be in rtems proper when type becomes part of id 28 */ 29 30 typedef enum { 31 RTEMS_OBJECT_INVALID = 0, 32 RTEMS_OBJECT_TASK = 1, 33 RTEMS_OBJECT_EXTENSION = 2, 34 RTEMS_OBJECT_QUEUE = 3, 35 RTEMS_OBJECT_SEMAPHORE = 4, 36 RTEMS_OBJECT_DRIVER = 5, 37 RTEMS_OBJECT_DNAME = 6, 38 RTEMS_OBJECT_CONFIG = 7, 39 RTEMS_OBJECT_INIT_TASK = 8, 40 RTEMS_OBJECT_MPCI = 9, 41 RTEMS_OBJECT_PARTITION = 10, 42 RTEMS_OBJECT_REGION = 11, 43 RTEMS_OBJECT_PORT = 12, 44 RTEMS_OBJECT_SYMBOL = 13, 45 } rtems_object_type_t; 46 47 /* 48 * rtems_monitor_init() flags 49 */ 50 51 #define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */ 52 #define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */ 53 54 55 /* 56 * Public interfaces for RTEMS data structures monitor is aware of. 57 * These are only used by the monitor. 58 * 59 * NOTE: 60 * All the canonical objects that correspond to RTEMS managed "objects" 61 * must have an identical first portion with 'id' and 'name' fields. 62 * 63 * Others do not have that restriction, even tho we would like them to. 64 * This is because some of the canonical structures are almost too big 65 * for shared memory driver (eg: mpci) and we are nickel and diming it. 66 */ 67 68 /* 69 * Type of a pointer that may be a symbol 70 */ 71 72 #define MONITOR_SYMBOL_LEN 20 73 typedef struct { 74 char name[MONITOR_SYMBOL_LEN]; 75 unsigned32 value; 76 unsigned32 offset; 77 } rtems_monitor_symbol_t; 78 79 typedef struct { 80 rtems_id id; 81 rtems_name name; 82 /* end of common portion */ 83 } rtems_monitor_generic_t; 84 85 /* 86 * Task 87 */ 88 typedef struct { 89 rtems_id id; 90 rtems_name name; 91 /* end of common portion */ 92 Thread_Entry entry; 93 unsigned32 argument; 94 void *stack; 95 unsigned32 stack_size; 96 rtems_task_priority priority; 97 States_Control state; 98 rtems_event_set events; 99 rtems_mode modes; 100 rtems_attribute attributes; 101 unsigned32 notepad[RTEMS_NUMBER_NOTEPADS]; 102 rtems_id wait_id; 103 unsigned32 wait_args; 104 } rtems_monitor_task_t; 105 106 /* 107 * Init task 108 */ 109 110 typedef struct { 111 rtems_id id; /* not really an id */ 112 rtems_name name; 113 /* end of common portion */ 114 rtems_monitor_symbol_t entry; 115 unsigned32 argument; 116 unsigned32 stack_size; 117 rtems_task_priority priority; 118 rtems_mode modes; 119 rtems_attribute attributes; 120 } rtems_monitor_init_task_t; 121 122 123 /* 124 * Message queue 125 */ 126 typedef struct { 127 rtems_id id; 128 rtems_name name; 129 /* end of common portion */ 130 rtems_attribute attributes; 131 unsigned32 number_of_pending_messages; 132 unsigned32 maximum_pending_messages; 133 unsigned32 maximum_message_size; 134 } rtems_monitor_queue_t; 135 136 /* 137 * Extension 138 */ 139 typedef struct { 140 rtems_id id; 141 rtems_name name; 142 /* end of common portion */ 143 rtems_monitor_symbol_t create; 144 rtems_monitor_symbol_t start; 145 rtems_monitor_symbol_t restart; 146 rtems_monitor_symbol_t delete; 147 rtems_monitor_symbol_t tswitch; 148 rtems_monitor_symbol_t begin; 149 rtems_monitor_symbol_t exitted; 150 rtems_monitor_symbol_t fatal; 151 } rtems_monitor_extension_t; 152 153 /* 154 * Device driver 155 */ 156 157 typedef struct { 158 rtems_id id; /* not really an id (should be tho) */ 159 rtems_name name; /* ditto */ 160 /* end of common portion */ 161 rtems_monitor_symbol_t initialization; /* initialization procedure */ 162 rtems_monitor_symbol_t open; /* open request procedure */ 163 rtems_monitor_symbol_t close; /* close request procedure */ 164 rtems_monitor_symbol_t read; /* read request procedure */ 165 rtems_monitor_symbol_t write; /* write request procedure */ 166 rtems_monitor_symbol_t control; /* special functions procedure */ 167 } rtems_monitor_driver_t; 168 169 typedef struct { 170 rtems_id id; /* not used for drivers (yet) */ 171 rtems_name name; /* not used for drivers (yet) */ 172 /* end of common portion */ 173 unsigned32 major; 174 unsigned32 minor; 175 char name_string[64]; 176 } rtems_monitor_dname_t; 177 178 /* 179 * System config 180 */ 181 182 typedef struct { 183 void *work_space_start; 184 unsigned32 work_space_size; 185 unsigned32 maximum_tasks; 186 unsigned32 maximum_timers; 187 unsigned32 maximum_semaphores; 188 unsigned32 maximum_message_queues; 189 unsigned32 maximum_partitions; 190 unsigned32 maximum_regions; 191 unsigned32 maximum_ports; 192 unsigned32 maximum_periods; 193 unsigned32 maximum_extensions; 194 unsigned32 microseconds_per_tick; 195 unsigned32 ticks_per_timeslice; 196 unsigned32 number_of_initialization_tasks; 197 } rtems_monitor_config_t; 198 199 /* 200 * MPCI config 201 */ 202 203 typedef struct { 204 unsigned32 node; /* local node number */ 205 unsigned32 maximum_nodes; /* maximum # nodes in system */ 206 unsigned32 maximum_global_objects; /* maximum # global objects */ 207 unsigned32 maximum_proxies; /* maximum # proxies */ 208 209 unsigned32 default_timeout; /* in ticks */ 210 unsigned32 maximum_packet_size; 211 rtems_monitor_symbol_t initialization; 212 rtems_monitor_symbol_t get_packet; 213 rtems_monitor_symbol_t return_packet; 214 rtems_monitor_symbol_t send_packet; 215 rtems_monitor_symbol_t receive_packet; 216 } rtems_monitor_mpci_t; 217 218 /* 219 * The generic canonical information union 220 */ 221 222 typedef union { 223 rtems_monitor_generic_t generic; 224 rtems_monitor_task_t task; 225 rtems_monitor_queue_t queue; 226 rtems_monitor_extension_t extension; 227 rtems_monitor_driver_t driver; 228 rtems_monitor_dname_t dname; 229 rtems_monitor_config_t config; 230 rtems_monitor_mpci_t mpci; 231 rtems_monitor_init_task_t itask; 232 } rtems_monitor_union_t; 233 234 /* 235 * Support for talking to other monitors 236 */ 237 238 /* 239 * Names of other monitors 240 */ 241 242 #define RTEMS_MONITOR_NAME (rtems_build_name('R', 'M', 'O', 'N')) 243 #define RTEMS_MONITOR_SERVER_NAME (rtems_build_name('R', 'M', 'S', 'V')) 244 #define RTEMS_MONITOR_QUEUE_NAME (rtems_build_name('R', 'M', 'S', 'Q')) 245 #define RTEMS_MONITOR_RESPONSE_QUEUE_NAME (rtems_build_name('R', 'M', 'R', 'Q')) 246 247 #define RTEMS_MONITOR_SERVER_RESPONSE 0x0001 248 #define RTEMS_MONITOR_SERVER_CANONICAL 0x0002 249 250 typedef struct 251 { 252 unsigned32 command; 253 rtems_id return_id; 254 unsigned32 argument0; 255 unsigned32 argument1; 256 unsigned32 argument2; 257 unsigned32 argument3; 258 unsigned32 argument4; 259 unsigned32 argument5; 260 } rtems_monitor_server_request_t; 261 262 typedef struct 263 { 264 unsigned32 command; 265 unsigned32 result0; 266 unsigned32 result1; 267 rtems_monitor_union_t payload; 268 } rtems_monitor_server_response_t; 269 270 extern rtems_id rtems_monitor_task_id; 271 272 extern unsigned32 rtems_monitor_node; /* our node number */ 273 extern unsigned32 rtems_monitor_default_node; /* current default for commands */ 274 275 /* 276 * Monitor command function and table entry 277 */ 278 279 typedef struct rtems_monitor_command_entry_s rtems_monitor_command_entry_t; 280 281 typedef void ( *rtems_monitor_command_function_t )( 282 int argc, 283 char **argv, 284 unsigned32 command_arg, 285 boolean verbose 286 ); 287 288 struct rtems_monitor_command_entry_s { 289 char *command; /* command name */ 290 char *usage; /* usage string for the command */ 291 unsigned32 arguments_required; /* # of required args */ 292 rtems_monitor_command_function_t command_function; 293 294 /* Some argument for the command */ 295 unsigned32 command_arg; 296 }; 297 298 typedef void *(*rtems_monitor_object_next_fn)(void *, void *, rtems_id *); 299 typedef void (*rtems_monitor_object_canonical_fn)(void *, void *); 300 typedef void (*rtems_monitor_object_dump_header_fn)(boolean); 301 typedef void (*rtems_monitor_object_dump_fn)(void *, boolean); 302 303 typedef struct { 304 rtems_object_type_t type; 305 void *object_information; 306 int size; /* of canonical object */ 307 rtems_monitor_object_next_fn next; 308 rtems_monitor_object_canonical_fn canonical; 309 rtems_monitor_object_dump_header_fn dump_header; 310 rtems_monitor_object_dump_fn dump; 311 } rtems_monitor_object_info_t; 312 313 314 /* monitor.c */ 315 void rtems_monitor_kill(void); 316 void rtems_monitor_init(rtems_boolean); 26 317 void rtems_monitor_wakeup(void); 27 void rtems_monitor_task(rtems_task_argument monitor_suspend); 318 void rtems_monitor_pause_cmd(int, char **, unsigned32, boolean); 319 void rtems_monitor_fatal_cmd(int, char **, unsigned32, boolean); 320 void rtems_monitor_continue_cmd(int, char **, unsigned32, boolean); 321 void rtems_monitor_node_cmd(int, char **, unsigned32, boolean); 28 322 void rtems_monitor_symbols_loadup(void); 29 30 extern rtems_unsigned32 rtems_monitor_task_id; 323 void rtems_monitor_task(rtems_task_argument); 324 325 /* server.c */ 326 void rtems_monitor_server_kill(void); 327 rtems_status_code rtems_monitor_server_request(unsigned32, rtems_monitor_server_request_t *, rtems_monitor_server_response_t *); 328 void rtems_monitor_server_task(rtems_task_argument); 329 void rtems_monitor_server_init(unsigned32); 330 331 /* command.c */ 332 int rtems_monitor_make_argv(char *, int *, char **); 333 int rtems_monitor_command_read(char *, int *, char **); 334 rtems_monitor_command_entry_t *rtems_monitor_command_lookup( 335 rtems_monitor_command_entry_t * table, int argc, char **argv); 336 void rtems_monitor_command_usage(rtems_monitor_command_entry_t *, char *); 337 void rtems_monitor_help_cmd(int, char **, unsigned32, boolean); 338 339 /* prmisc.c */ 340 void rtems_monitor_separator(void); 341 unsigned32 rtems_monitor_pad(unsigned32 dest_col, unsigned32 curr_col); 342 unsigned32 rtems_monitor_dump_char(unsigned8 ch); 343 unsigned32 rtems_monitor_dump_decimal(unsigned32 num); 344 unsigned32 rtems_monitor_dump_hex(unsigned32 num); 345 unsigned32 rtems_monitor_dump_id(rtems_id id); 346 unsigned32 rtems_monitor_dump_name(rtems_name name); 347 unsigned32 rtems_monitor_dump_priority(rtems_task_priority priority); 348 unsigned32 rtems_monitor_dump_state(States_Control state); 349 unsigned32 rtems_monitor_dump_modes(rtems_mode modes); 350 unsigned32 rtems_monitor_dump_attributes(rtems_attribute attributes); 351 unsigned32 rtems_monitor_dump_events(rtems_event_set events); 352 unsigned32 rtems_monitor_dump_notepad(unsigned32 *notepad); 353 354 /* object.c */ 355 rtems_id rtems_monitor_id_fixup(rtems_id, unsigned32, rtems_object_type_t); 356 rtems_id rtems_monitor_object_canonical_get(rtems_object_type_t, rtems_id, void *, unsigned32 *size_p); 357 rtems_id rtems_monitor_object_canonical_next(rtems_monitor_object_info_t *, rtems_id, void *); 358 void *rtems_monitor_object_next(void *, void *, rtems_id, rtems_id *); 359 rtems_id rtems_monitor_object_canonical(rtems_id, void *); 360 void rtems_monitor_object_cmd(int, char **, unsigned32, boolean); 361 362 /* manager.c */ 363 void *rtems_monitor_manager_next(void *, void *, rtems_id *); 364 365 /* config.c */ 366 void rtems_monitor_config_canonical(rtems_monitor_config_t *, void *); 367 void *rtems_monitor_config_next(void *, rtems_monitor_config_t *, rtems_id *); 368 void rtems_monitor_config_dump_header(boolean); 369 void rtems_monitor_config_dump(rtems_monitor_config_t *, boolean verbose); 370 371 /* mpci.c */ 372 void rtems_monitor_mpci_canonical(rtems_monitor_mpci_t *, void *); 373 void *rtems_monitor_mpci_next(void *, rtems_monitor_mpci_t *, rtems_id *); 374 void rtems_monitor_mpci_dump_header(boolean); 375 void rtems_monitor_mpci_dump(rtems_monitor_mpci_t *, boolean verbose); 376 377 /* itask.c */ 378 void rtems_monitor_init_task_canonical(rtems_monitor_init_task_t *, void *); 379 void *rtems_monitor_init_task_next(void *, rtems_monitor_init_task_t *, rtems_id *); 380 void rtems_monitor_init_task_dump_header(boolean); 381 void rtems_monitor_init_task_dump(rtems_monitor_init_task_t *, boolean verbose); 382 383 /* extension.c */ 384 void rtems_monitor_extension_canonical(rtems_monitor_extension_t *, void *); 385 void rtems_monitor_extension_dump_header(boolean verbose); 386 void rtems_monitor_extension_dump(rtems_monitor_extension_t *, boolean); 387 388 /* task.c */ 389 void rtems_monitor_task_canonical(rtems_monitor_task_t *, void *); 390 void rtems_monitor_task_dump_header(boolean verbose); 391 void rtems_monitor_task_dump(rtems_monitor_task_t *, boolean); 392 393 /* queue.c */ 394 void rtems_monitor_queue_canonical(rtems_monitor_queue_t *, void *); 395 void rtems_monitor_queue_dump_header(boolean verbose); 396 void rtems_monitor_queue_dump(rtems_monitor_queue_t *, boolean); 397 398 /* driver.c */ 399 void *rtems_monitor_driver_next(void *, rtems_monitor_driver_t *, rtems_id *); 400 void rtems_monitor_driver_canonical(rtems_monitor_driver_t *, void *); 401 void rtems_monitor_driver_dump_header(boolean); 402 void rtems_monitor_driver_dump(rtems_monitor_driver_t *, boolean); 403 404 /* dname.c */ 405 void *rtems_monitor_dname_next(void *, rtems_monitor_dname_t *, rtems_id *); 406 void rtems_monitor_dname_canonical(rtems_monitor_dname_t *, void *); 407 void rtems_monitor_dname_dump_header(boolean); 408 void rtems_monitor_dname_dump(rtems_monitor_dname_t *, boolean); 409 410 /* symbols.c */ 411 rtems_symbol_table_t *rtems_symbol_table_create(); 412 void rtems_symbol_table_destroy(rtems_symbol_table_t *table); 413 414 rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, unsigned32); 415 rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, unsigned32); 416 rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *); 417 void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *); 418 void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *); 419 void rtems_monitor_symbol_canonical_by_name(rtems_monitor_symbol_t *, char *); 420 void rtems_monitor_symbol_canonical_by_value(rtems_monitor_symbol_t *, void *); 421 unsigned32 rtems_monitor_symbol_dump(rtems_monitor_symbol_t *, boolean); 422 void rtems_monitor_symbol_cmd(int, char **, unsigned32, boolean); 423 31 424 32 425 extern rtems_symbol_table_t *rtems_monitor_symbols; 426 427 #ifndef MONITOR_PROMPT 428 #define MONITOR_PROMPT "rtems" /* will have '> ' appended */ 429 #endif 430 431 #define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0 432 433 434 #define STREQ(a,b) (strcmp(a,b) == 0) 435 #define STRNEQ(a,b,n) (strncmp(a,b,n) == 0) 33 436 34 437 #ifdef __cplusplus -
c/src/lib/libmisc/monitor/symbols.h
r3b438fa rb06e68ef 1 1 /* 2 * File: symbols.h 2 * @(#)symbols.h 1.3 - 95/06/09 3 * 4 * 5 * RTEMS monitor symbol table functions 3 6 * 4 7 * Description: … … 9 12 * TODO: 10 13 * 14 * $Id$ 11 15 */ 12 16 … … 62 66 } rtems_symbol_table_t; 63 67 64 void rtems_symbol_table_destroy(rtems_symbol_table_t *table);65 rtems_symbol_table_t *rtems_symbol_table_create();66 rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *,67 char *, rtems_unsigned32);68 rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *,69 rtems_unsigned32);70 rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *,71 char *);72 73 68 #define rtems_symbol_name(sp) ((sp)->name) 74 69 #define rtems_symbol_value(sp) ((sp)->value) -
c/src/libchip/shmdr/poll.c
r3b438fa rb06e68ef 17 17 * notice must appear in all copies of this file and its derivatives. 18 18 * 19 * poll.c,v 1.2 1995/05/09 20:22:57 joel Exp19 * $Id$ 20 20 */ 21 21 22 22 #include <rtems.h> 23 23 #include <rtems/sysstate.h> 24 #include <rtems/libio.h> 25 24 26 #include "shm.h" 25 #include "clockdrv.h"26 27 27 28 void Shm_Poll() 28 29 { 29 30 rtems_unsigned32 tmpfront; 31 rtems_libio_ioctl_args_t args; 30 32 31 Clock_isr( 0 ); /* invoke standard clock ISR */ 32 33 /* invoke clock isr */ 34 args.iop = 0; 35 args.command = rtems_build_name('I', 'S', 'R', ' '); 36 (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); 33 37 34 38 /* … … 40 44 if (_System_state_Is_up(_System_state_Get())) 41 45 { 42 /* enable_tracing(); */43 /* ticks += 1; */44 Shm_Lock( Shm_Local_receive_queue );45 46 tmpfront = Shm_Local_receive_queue->front; 46 Shm_Unlock( Shm_Local_receive_queue );47 if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ){48 rtems_multiprocessing_announce();49 Shm_Interrupt_count++;47 if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) 48 { 49 rtems_multiprocessing_announce(); 50 Shm_Interrupt_count++; 50 51 } 51 52 } -
c/src/libchip/shmdr/setckvec.c
r3b438fa rb06e68ef 20 20 21 21 #include <rtems.h> 22 #include <rtems/libio.h> 23 22 24 #include "shm.h" 23 #include "clockdrv.h"24 25 25 26 rtems_isr Shm_setclockvec() 26 27 { 27 ReInstall_clock( Shm_Poll ); 28 rtems_libio_ioctl_args_t args; 29 args.iop = 0; 30 args.command = rtems_build_name('N', 'E', 'W', ' '); 31 args.buffer = (void *) Shm_Poll; 32 33 (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); 28 34 } -
c/src/libchip/shmdr/shm_driver.h
r3b438fa rb06e68ef 20 20 #ifndef __SHM_h 21 21 #define __SHM_h 22 23 #include <clockdrv.h> 22 24 23 25 #ifdef __cplusplus … … 519 521 rtems_mpci_table MPCI_table = { 520 522 100000, /* default timeout value in ticks */ 523 MAX_PACKET_SIZE, /* maximum packet size */ 521 524 Shm_Initialization, /* initialization procedure */ 522 525 Shm_Get_packet, /* get packet procedure */ -
c/src/libmisc/monitor/README
r3b438fa rb06e68ef 3 3 # 4 4 5 This is a snapshot of a work in process. It is the beginnings of a 6 debug monitor task and trap handler which is tasking aware. 5 monitor task 7 6 7 The monitor task is an optional task that knows about RTEMS 8 data structures and can print out information about them. 9 It is a work-in-progress and needs many more commands, but 10 is useful now. 11 12 The monitor works best when it is the highest priority task, 13 so all your other tasks should ideally be at some priority 14 greater than 1. 15 16 To use the monitor: 17 ------------------- 18 19 #include <rtems/monitor.h> 20 21 ... 22 23 rtems_monitor_init(0); 24 25 The parameter to rtems_monitor_init() tells the monitor whether 26 to suspend itself on startup. A value of 0 causes the monitor 27 to immediately enter command mode; a non-zero value causes the 28 monitor to suspend itself after creation and wait for explicit 29 wakeup. 30 31 32 rtems_monitor_wakeup(); 33 34 wakes up a suspended monitor and causes it to reenter command mode. 35 36 Monitor commands 37 ---------------- 38 39 The monitor prompt is 'rtems> '. 40 Can abbreviate commands to "uniquity" 41 There is a 'help' command. Here is the output from various 42 help commands: 43 44 Commands (may be abbreviated) 45 46 help -- get this message or command specific help 47 task -- show task information 48 queue -- show message queue information 49 symbol -- show entries from symbol table 50 pause -- pause monitor for a specified number of ticks 51 fatal -- invoke a fatal RTEMS error 52 53 task [id [id ...] ] 54 display information about the specified tasks. 55 Default is to display information about all tasks on this node 56 57 queue [id [id ... ] ] 58 display information about the specified message queues 59 Default is to display information about all queues on this node 60 61 symbol [ symbolname [symbolname ... ] ] 62 display value associated with specified symbol. 63 Defaults to displaying all known symbols. 64 65 pause [ticks] 66 monitor goes to "sleep" for specified ticks (default is 1) 67 monitor will resume at end of period or if explicitly awakened 68 69 fatal [status] 70 Invoke 'rtems_fatal_error_occurred' with 'status' 71 (default is RTEMS_INTERNAL_ERROR) 72 73 continue 74 put the monitor to sleep waiting for an explicit wakeup from the 75 program running. 76 77 78 Sample output from 'task' command 79 --------------------------------- 80 81 rtems> task 82 ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES 83 ------------------------------------------------------------------------ 84 00010001 UI1 2 READY P:T:nA NONE15: 0x40606348 85 00010002 RMON 1 READY nP NONE15: 0x40604110 86 87 'RMON' is the monitor itself, so we have 1 "user" task. 88 Its modes are P:T:nA which translate to: 89 90 preemptable 91 timesliced 92 no ASRS 93 94 It has no events. 95 It has a notepad value for notepad 15 which is 0x40606348 96 (this is the libc thread state) 97 -
c/src/libmisc/monitor/mon-monitor.c
r3b438fa rb06e68ef 1 1 /* 2 * @(#)monitor.c 1. 6 - 95/04/242 * @(#)monitor.c 1.18 - 95/08/02 3 3 * 4 */ 5 6 /* 7 * mon-task.c 8 * 9 * Description: 10 * RTEMS monitor task 11 * 12 * 4 * 5 * RTEMS monitor main body 13 6 * 14 7 * TODO: 15 * add pause command (monitor sleeps for 'n' ticks, then wakes up) 16 * 8 * add stuff to RTEMS api 9 * rtems_get_name(id) 10 * rtems_get_type(id) 11 * rtems_build_id(node, type, num) 12 * Add a command to dump out info about an arbitrary id when 13 * types are added to id's 14 * rtems> id idnum 15 * idnum: node n, object: whatever, id: whatever 16 * allow id's to be specified as n:t:id, where 'n:t' is optional 17 * should have a separate monitor FILE stream (ala the debugger) 18 * remote request/response stuff should be cleaned up 19 * maybe we can use real rpc?? 20 * 21 * $Id$ 17 22 */ 18 23 19 24 #include <rtems.h> 20 /* #include <bsp.h> */21 22 #include "symbols.h"23 #include "monitor.h"24 25 25 26 #include <stdio.h> … … 28 29 #include <unistd.h> 29 30 30 # define STREQ(a,b) (strcmp(a,b) == 0)31 #include "monitor.h" 31 32 32 33 /* set by trap handler */ … … 35 36 extern rtems_unsigned32 debugger_trap; 36 37 37 /* our task id needs to be public so any debugger can resume us */ 38 rtems_unsigned32 rtems_monitor_task_id; 39 38 /* 39 * Various id's for the monitor 40 * They need to be public variables for access by other agencies 41 * such as debugger and remote servers' 42 */ 43 44 rtems_id rtems_monitor_task_id; 45 46 unsigned32 rtems_monitor_node; /* our node number */ 47 unsigned32 rtems_monitor_default_node; /* current default for commands */ 48 49 /* 50 * The rtems symbol table 51 */ 40 52 41 53 rtems_symbol_table_t *rtems_monitor_symbols; 42 54 43 44 #ifndef MONITOR_PROMPT 45 #define MONITOR_PROMPT "rtems> " 55 /* 56 * The top-level commands 57 */ 58 59 rtems_monitor_command_entry_t rtems_monitor_commands[] = { 60 { "--usage--", 61 "\n" 62 "RTEMS monitor\n" 63 "\n" 64 "Commands (may be abbreviated)\n" 65 "\n" 66 " help -- get this message or command specific help\n" 67 " pause -- pause monitor for a specified number of ticks\n" 68 " exit -- invoke a fatal RTEMS error\n" 69 " symbol -- show entries from symbol table\n" 70 " continue -- put monitor to sleep waiting for explicit wakeup\n" 71 " config -- show system configuration\n" 72 " itask -- list init tasks\n" 73 " mpci -- list mpci config\n" 74 " task -- show task information\n" 75 " queue -- show message queue information\n" 76 " extension -- user extensions\n" 77 " driver -- show information about named drivers\n" 78 " object -- generic object information\n" 79 " node -- specify default node for commands that take id's\n" 80 #ifdef CPU_INVOKE_DEBUGGER 81 " debugger -- invoke system debugger\n" 46 82 #endif 47 48 #define MONITOR_WAKEUP_EVENT RTEMS_EVENT_0 49 50 /* 51 * Function: rtems_monitor_init 52 * 53 * Description: 54 * Create the RTEMS monitor task 55 * 56 * Parameters: 57 * 'monitor_suspend' arg is passed as initial arg to monitor task 58 * If TRUE, monitor will suspend itself as it starts up. Otherwise 59 * it will begin its command loop. 60 * 61 * Returns: 62 * 63 * 64 * Side Effects: 65 * 66 * 67 * Notes: 68 * 69 * 70 * Deficiencies/ToDo: 71 * 72 * 73 */ 74 75 /* 76 * make_argv(cp): token-count 77 * Break up the command line in 'cp' into global argv[] and argc (return 78 * value). 79 */ 80 81 int 82 rtems_monitor_make_argv( 83 char *cp, 84 int *argc_p, 85 char **argv) 86 { 87 int argc = 0; 88 89 while ((cp = strtok(cp, " \t\n\r"))) 90 { 91 argv[argc++] = cp; 92 cp = (char *) NULL; 93 } 94 argv[argc] = (char *) NULL; /* end of argv */ 95 96 return *argc_p = argc; 97 } 98 99 void 100 rtems_monitor_init(rtems_boolean monitor_suspend) 101 { 102 rtems_status_code status; 103 104 status = rtems_task_create(rtems_build_name('R', 'M', 'O', 'N'), 105 1, 0/*stack*/, RTEMS_NO_PREEMPT | RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &rtems_monitor_task_id); 106 if (status != RTEMS_SUCCESSFUL) 107 { 108 printf("could not create monitor task\n"); 109 goto done; 110 } 111 112 rtems_monitor_symbols_loadup(); 113 114 status = rtems_task_start(rtems_monitor_task_id, rtems_monitor_task, monitor_suspend); 115 if (status != RTEMS_SUCCESSFUL) 116 { 117 printf("could not start monitor!\n"); 118 goto done; 119 } 120 121 done: 122 } 83 , 84 0, 85 0, 86 (unsigned32) rtems_monitor_commands, 87 }, 88 { "config", 89 "config\n" 90 " Show the system configuration.\n", 91 0, 92 rtems_monitor_object_cmd, 93 RTEMS_OBJECT_CONFIG, 94 }, 95 { "itask", 96 "itask\n" 97 " List init tasks for the system\n", 98 0, 99 rtems_monitor_object_cmd, 100 RTEMS_OBJECT_INIT_TASK, 101 }, 102 { "mpci", 103 "mpci\n" 104 " Show the MPCI system configuration, if configured.\n", 105 0, 106 rtems_monitor_object_cmd, 107 RTEMS_OBJECT_MPCI, 108 }, 109 { "pause", 110 "pause [ticks]\n" 111 " monitor goes to \"sleep\" for specified ticks (default is 1)\n" 112 " monitor will resume at end of period or if explicitly awakened\n", 113 0, 114 rtems_monitor_pause_cmd, 115 0, 116 }, 117 { "continue", 118 "continue\n" 119 " put the monitor to sleep waiting for an explicit wakeup from the\n" 120 " program running.\n", 121 0, 122 rtems_monitor_continue_cmd, 123 0, 124 }, 125 { "go", 126 "go\n" 127 " Alias for 'continue'\n", 128 0, 129 rtems_monitor_continue_cmd, 130 0, 131 }, 132 { "node", 133 "node [ node number ]\n" 134 " Specify default node number for commands that take id's\n", 135 0, 136 rtems_monitor_node_cmd, 137 0, 138 }, 139 { "symbol", 140 "symbol [ symbolname [symbolname ... ] ]\n" 141 " display value associated with specified symbol.\n" 142 " Defaults to displaying all known symbols.\n", 143 0, 144 rtems_monitor_symbol_cmd, 145 (unsigned32) &rtems_monitor_symbols, 146 }, 147 { "extension", 148 "extension [id [id ...] ]\n" 149 " display information about specified extensions.\n" 150 " Default is to display information about all extensions on this node\n", 151 0, 152 rtems_monitor_object_cmd, 153 RTEMS_OBJECT_EXTENSION, 154 }, 155 { "task", 156 "task [id [id ...] ]\n" 157 " display information about the specified tasks.\n" 158 " Default is to display information about all tasks on this node\n", 159 0, 160 rtems_monitor_object_cmd, 161 RTEMS_OBJECT_TASK, 162 }, 163 { "queue", 164 "queue [id [id ... ] ]\n" 165 " display information about the specified message queues\n" 166 " Default is to display information about all queues on this node\n", 167 0, 168 rtems_monitor_object_cmd, 169 RTEMS_OBJECT_QUEUE, 170 }, 171 { "object", 172 "object [id [id ...] ]\n" 173 " display information about specified RTEMS objects.\n" 174 " Object id's must include 'type' information.\n" 175 " (which may normally be defaulted)\n", 176 0, 177 rtems_monitor_object_cmd, 178 RTEMS_OBJECT_INVALID, 179 }, 180 { "driver", 181 "driver [ major [ major ... ] ]\n" 182 " Display the RTEMS device driver table.\n", 183 0, 184 rtems_monitor_object_cmd, 185 RTEMS_OBJECT_DRIVER, 186 }, 187 { "dname", 188 "dname\n" 189 " Displays information about named drivers.\n", 190 0, 191 rtems_monitor_object_cmd, 192 RTEMS_OBJECT_DNAME, 193 }, 194 { "exit", 195 "exit [status]\n" 196 " Invoke 'rtems_fatal_error_occurred' with 'status'\n" 197 " (default is RTEMS_SUCCESSFUL)\n", 198 0, 199 rtems_monitor_fatal_cmd, 200 RTEMS_SUCCESSFUL, 201 }, 202 { "fatal", 203 "fatal [status]\n" 204 " 'exit' with fatal error; default error is RTEMS_TASK_EXITTED\n", 205 0, 206 rtems_monitor_fatal_cmd, 207 RTEMS_TASK_EXITTED, /* exit value */ 208 }, 209 { "quit", 210 "quit [status]\n" 211 " Alias for 'exit'\n", 212 0, 213 rtems_monitor_fatal_cmd, 214 RTEMS_SUCCESSFUL, /* exit value */ 215 }, 216 { "help", 217 "help [ command [ command ] ]\n" 218 " provide information about commands\n" 219 " Default is show basic command summary.\n", 220 0, 221 rtems_monitor_help_cmd, 222 (unsigned32) rtems_monitor_commands, 223 }, 224 #ifdef CPU_INVOKE_DEBUGGER 225 { "debugger", 226 "debugger\n" 227 " Enter the debugger, if possible.\n" 228 " A continue from the debugger will return to the monitor.\n", 229 0, 230 CPU_INVOKE_DEBUGGER, 231 0, 232 }, 233 #endif 234 { 0, 0, 0, 0, 0 }, 235 }; 236 123 237 124 238 rtems_status_code … … 128 242 rtems_status_code status; 129 243 130 status = rtems_event_receive(MONITOR_WAKEUP_EVENT, RTEMS_DEFAULT_OPTIONS, timeout, &event_set); 244 status = rtems_event_receive(MONITOR_WAKEUP_EVENT, 245 RTEMS_DEFAULT_OPTIONS, 246 timeout, 247 &event_set); 131 248 return status; 132 249 } … … 141 258 142 259 143 /* 144 * Read and break up a monitor command 145 * 146 * We have to loop on the gets call, since it will return NULL under UNIX 147 * RTEMS when we get a signal (eg: SIGALRM). 148 */ 149 150 int 151 rtems_monitor_read_command(char *command, 152 int *argc, 153 char **argv) 154 { 155 printf("%s", MONITOR_PROMPT); fflush(stdout); 156 while (gets(command) == (char *) 0) 157 ; 158 return rtems_monitor_make_argv(command, argc, argv); 159 } 160 161 void 162 rtems_monitor_task(rtems_task_argument monitor_suspend) 163 { 164 rtems_tcb *debugee = 0; 165 char command[513]; 166 rtems_context *rp; 167 rtems_context_fp *fp; 168 char *cp; 169 int argc; 170 char *argv[64]; 171 172 if ((rtems_boolean) monitor_suspend) 173 (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 174 175 for (;;) 260 void 261 rtems_monitor_pause_cmd( 262 int argc, 263 char **argv, 264 unsigned32 command_arg, 265 boolean verbose 266 ) 267 { 268 if (argc == 1) 269 rtems_monitor_suspend(1); 270 else 271 rtems_monitor_suspend(strtoul(argv[1], 0, 0)); 272 } 273 274 void 275 rtems_monitor_fatal_cmd( 276 int argc, 277 char **argv, 278 unsigned32 command_arg, 279 boolean verbose 280 ) 281 { 282 if (argc == 1) 283 rtems_fatal_error_occurred(command_arg); 284 else 285 rtems_fatal_error_occurred(strtoul(argv[1], 0, 0)); 286 } 287 288 void 289 rtems_monitor_continue_cmd( 290 int argc, 291 char **argv, 292 unsigned32 command_arg, 293 boolean verbose 294 ) 295 { 296 rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 297 } 298 299 300 void 301 rtems_monitor_node_cmd( 302 int argc, 303 char **argv, 304 unsigned32 command_arg, 305 boolean verbose 306 ) 307 { 308 unsigned32 new_node = rtems_monitor_default_node; 309 310 switch (argc) 176 311 { 177 extern rtems_tcb * _Thread_Executing; 178 debugee = _Thread_Executing; 179 rp = &debugee->Registers; 180 fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ 181 182 if (0 == rtems_monitor_read_command(command, &argc, argv)) 183 continue; 184 185 if (STREQ(argv[0], "quit")) 186 rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 187 else if (STREQ(argv[0], "pause")) 188 rtems_monitor_suspend(1); 189 190 #ifdef CPU_INVOKE_DEBUGGER 191 else if (STREQ(argv[0], "debug")) 192 { 193 CPU_INVOKE_DEBUGGER; 194 } 195 #endif 196 else if (STREQ(argv[0], "symbol")) 197 { 198 char *symbol; 199 char *value; 200 201 if (argc != 3) 202 { 203 printf("usage: symbol symname symvalue\n"); 204 continue; 205 } 206 207 symbol = argv[1]; 208 value = argv[2]; 209 if (symbol && value) 210 { 211 rtems_symbol_t *sp; 212 sp = rtems_symbol_create(rtems_monitor_symbols, 213 symbol, 214 (rtems_unsigned32) strtoul(value, 0, 16)); 215 if (sp) 216 printf("symbol defined is at %p\n", sp); 217 else 218 printf("could not define symbol\n"); 219 } 220 else 221 printf("parsing error\n"); 222 } 223 else 224 { 225 printf("Unrecognized command: '%s'\n", argv[0]); 226 } 312 case 1: /* no node, just set back to ours */ 313 new_node = rtems_monitor_node; 314 break; 315 316 case 2: 317 new_node = strtoul(argv[1], 0, 0); 318 break; 319 320 default: 321 printf("invalid syntax, try 'help node'\n"); 322 break; 227 323 } 228 } 324 325 if ((new_node >= 1) && (new_node <= _Configuration_MP_table->maximum_nodes)) 326 rtems_monitor_default_node = new_node; 327 } 328 229 329 230 330 /* … … 267 367 char buffer[128]; 268 368 369 if (rtems_monitor_symbols) 370 rtems_symbol_table_destroy(rtems_monitor_symbols); 371 269 372 rtems_monitor_symbols = rtems_symbol_table_create(10); 270 373 if (rtems_monitor_symbols == 0) 271 374 return; 272 375 273 fp = fdopen(8, "r"); 376 #ifdef simhppa 377 fp = fdopen(8, "r"); /* don't ask; don't tell */ 378 #else 379 fp = fopen("symbols", "r"); 380 #endif 381 274 382 if (fp == 0) 275 383 return; … … 293 401 if (sp == 0) 294 402 { 295 printf("could not define symbol \n");403 printf("could not define symbol '%s'\n", symbol); 296 404 goto done; 297 405 } … … 299 407 else 300 408 { 301 printf("parsing error \n");409 printf("parsing error on '%s'\n", buffer); 302 410 goto done; 303 411 } … … 306 414 done: 307 415 } 416 417 418 /* 419 * Main monitor command loop 420 */ 421 422 void 423 rtems_monitor_task( 424 rtems_task_argument monitor_flags 425 ) 426 { 427 rtems_tcb *debugee = 0; 428 rtems_context *rp; 429 rtems_context_fp *fp; 430 char command_buffer[513]; 431 int argc; 432 char *argv[64]; 433 boolean verbose = FALSE; 434 435 if (monitor_flags & RTEMS_MONITOR_SUSPEND) 436 (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); 437 438 for (;;) 439 { 440 extern rtems_tcb * _Thread_Executing; 441 rtems_monitor_command_entry_t *command; 442 443 debugee = _Thread_Executing; 444 rp = &debugee->Registers; 445 fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ 446 447 if (0 == rtems_monitor_command_read(command_buffer, &argc, argv)) 448 continue; 449 if ((command = rtems_monitor_command_lookup(rtems_monitor_commands, 450 argc, 451 argv)) == 0) 452 continue; 453 454 command->command_function(argc, argv, command->command_arg, verbose); 455 456 fflush(stdout); 457 } 458 } 459 460 461 void 462 rtems_monitor_kill(void) 463 { 464 if (rtems_monitor_task_id) 465 rtems_task_delete(rtems_monitor_task_id); 466 rtems_monitor_task_id = 0; 467 468 rtems_monitor_server_kill(); 469 } 470 471 void 472 rtems_monitor_init( 473 unsigned32 monitor_flags 474 ) 475 { 476 rtems_status_code status; 477 478 rtems_monitor_kill(); 479 480 status = rtems_task_create(RTEMS_MONITOR_NAME, 481 1, 482 0 /* default stack */, 483 RTEMS_INTERRUPT_LEVEL(0), 484 RTEMS_DEFAULT_ATTRIBUTES, 485 &rtems_monitor_task_id); 486 if (status != RTEMS_SUCCESSFUL) 487 { 488 rtems_error(status, "could not create monitor task"); 489 goto done; 490 } 491 492 rtems_monitor_node = rtems_get_node(rtems_monitor_task_id); 493 rtems_monitor_default_node = rtems_monitor_node; 494 495 rtems_monitor_symbols_loadup(); 496 497 if (monitor_flags & RTEMS_MONITOR_GLOBAL) 498 rtems_monitor_server_init(monitor_flags); 499 500 /* 501 * Start the monitor task itself 502 */ 503 504 status = rtems_task_start(rtems_monitor_task_id, 505 rtems_monitor_task, 506 monitor_flags); 507 if (status != RTEMS_SUCCESSFUL) 508 { 509 rtems_error(status, "could not start monitor"); 510 goto done; 511 } 512 513 done: 514 } -
c/src/libmisc/monitor/mon-symbols.c
r3b438fa rb06e68ef 1 1 /* 2 * @(#)symbols.c 1. 3 - 95/04/242 * @(#)symbols.c 1.10 - 95/08/02 3 3 * 4 * $Id$ 4 5 */ 5 6 … … 22 23 #include <string.h> 23 24 25 #include "monitor.h" 24 26 #include "symbols.h" 25 27 26 extern rtems_symbol_table_t *rtems_monitor_symbols;27 28 #ifdef RTEMS_DEBUG29 #define CHK_ADR_PTR(p) \30 do { \31 if (((p) < rtems_monitor_symbols->addresses) || \32 ((p) >= (rtems_monitor_symbols->addresses + rtems_monitor_symbols->next))) \33 { \34 printf("bad address pointer %p\n", (p)); \35 rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS); \36 } \37 } while (0)38 39 #define CHK_NAME_PTR(p) \40 do { \41 if (((p) < rtems_monitor_symbols->symbols) || \42 ((p) >= (rtems_monitor_symbols->symbols + rtems_monitor_symbols->next))) \43 { \44 printf("bad symbol pointer %p\n", (p)); \45 rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS); \46 } \47 } while (0)48 #else49 #define CHK_ADR_PTR(p)50 #define CHK_NAME_PTR(p)51 #endif52 28 53 29 rtems_symbol_table_t * … … 179 155 s2 = (rtems_symbol_t *) e2; 180 156 181 CHK_ADR_PTR(s1);182 CHK_ADR_PTR(s2);183 184 157 if (s1->value < s2->value) 185 158 return -1; … … 200 173 s1 = (rtems_symbol_t *) e1; 201 174 s2 = (rtems_symbol_t *) e2; 202 203 CHK_NAME_PTR(s1);204 CHK_NAME_PTR(s2);205 175 206 176 return strcasecmp(s1->name, s2->name); … … 252 222 rtems_unsigned32 best_distance = ~0; 253 223 rtems_unsigned32 elements; 224 225 if (table == 0) 226 table = rtems_monitor_symbols; 254 227 255 228 if ((table == 0) || (table->size == 0)) … … 301 274 rtems_symbol_t key; 302 275 276 if (table == 0) 277 table = rtems_monitor_symbols; 278 303 279 if ((table == 0) || (name == 0)) 304 280 goto done; 305 281 306 282 if (table->sorted == 0) 307 {308 283 rtems_symbol_sort(table); 309 }310 284 311 285 /* … … 326 300 } 327 301 302 void * 303 rtems_monitor_symbol_next( 304 void *object_info, 305 rtems_monitor_symbol_t *canonical, 306 rtems_id *next_id 307 ) 308 { 309 rtems_symbol_table_t *table; 310 int n = rtems_get_index(*next_id); 311 312 table = *(rtems_symbol_table_t **) object_info; 313 if (table == 0) 314 goto failed; 315 316 if (n >= table->next) 317 goto failed; 318 319 /* NOTE: symbols do not have id and name fields */ 320 321 if (table->sorted == 0) 322 rtems_symbol_sort(table); 323 324 _Thread_Disable_dispatch(); 325 326 *next_id += 1; 327 return (void *) (table->symbols + n); 328 329 failed: 330 *next_id = RTEMS_OBJECT_ID_FINAL; 331 return 0; 332 } 333 334 void 335 rtems_monitor_symbol_canonical( 336 rtems_monitor_symbol_t *canonical_symbol, 337 rtems_symbol_t *sp 338 ) 339 { 340 canonical_symbol->value = sp->value; 341 canonical_symbol->offset = 0; 342 strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name)); 343 } 344 345 346 void 347 rtems_monitor_symbol_canonical_by_name( 348 rtems_monitor_symbol_t *canonical_symbol, 349 char *name 350 ) 351 { 352 rtems_symbol_t *sp; 353 354 sp = rtems_symbol_name_lookup(0, name); 355 356 canonical_symbol->value = sp ? sp->value : 0; 357 358 strncpy(canonical_symbol->name, name, sizeof(canonical_symbol->name)); 359 canonical_symbol->offset = 0; 360 } 361 362 void 363 rtems_monitor_symbol_canonical_by_value( 364 rtems_monitor_symbol_t *canonical_symbol, 365 void *value_void_p 366 ) 367 { 368 unsigned32 value = (unsigned32) value_void_p; 369 rtems_symbol_t *sp; 370 371 sp = rtems_symbol_value_lookup(0, value); 372 if (sp) 373 { 374 canonical_symbol->value = sp->value; 375 canonical_symbol->offset = value - sp->value; 376 strncpy(canonical_symbol->name, sp->name, sizeof(canonical_symbol->name)); 377 } 378 else 379 { 380 canonical_symbol->value = value; 381 canonical_symbol->offset = 0; 382 canonical_symbol->name[0] = '\0'; 383 } 384 } 385 386 387 unsigned32 388 rtems_monitor_symbol_dump( 389 rtems_monitor_symbol_t *canonical_symbol, 390 boolean verbose 391 ) 392 { 393 unsigned32 length = 0; 394 395 /* 396 * print the name if it exists AND if value is non-zero 397 * Ie: don't print some garbage symbol for address 0 398 */ 399 400 if (canonical_symbol->name[0] && (canonical_symbol->value != 0)) 401 { 402 if (canonical_symbol->offset == 0) 403 length += printf("%.*s", 404 sizeof(canonical_symbol->name), 405 canonical_symbol->name); 406 else 407 length += printf("<%.*s+0x%x>", 408 sizeof(canonical_symbol->name), 409 canonical_symbol->name, 410 canonical_symbol->offset); 411 if (verbose) 412 length += printf(" [0x%x]", canonical_symbol->value); 413 } 414 else 415 length += printf("[0x%x]", canonical_symbol->value); 416 417 return length; 418 } 419 420 421 void 422 rtems_monitor_symbol_dump_all( 423 rtems_symbol_table_t *table, 424 boolean verbose 425 ) 426 { 427 int s; 428 rtems_symbol_t *sp; 429 430 if (table == 0) 431 { 432 table = rtems_monitor_symbols; 433 if (table == 0) 434 return; 435 } 436 437 if (table->sorted == 0) 438 rtems_symbol_sort(table); 439 440 for (s = 0, sp = table->symbols; s < table->next; s++, sp++) 441 { 442 rtems_monitor_symbol_t canonical_symbol; 443 444 rtems_monitor_symbol_canonical(&canonical_symbol, sp); 445 rtems_monitor_symbol_dump(&canonical_symbol, TRUE); 446 printf("\n"); 447 } 448 } 449 450 451 /* 452 * 'symbol' command 453 */ 454 455 void 456 rtems_monitor_symbol_cmd( 457 int argc, 458 char **argv, 459 unsigned32 command_arg, 460 boolean verbose 461 ) 462 { 463 int arg; 464 rtems_symbol_table_t *table; 465 466 table = *(rtems_symbol_table_t **) command_arg; 467 if (table == 0) 468 { 469 table = rtems_monitor_symbols; 470 if (table == 0) 471 return; 472 } 473 474 /* 475 * Use object command to dump out whole symbol table 476 */ 477 if (argc == 1) 478 rtems_monitor_symbol_dump_all(table, verbose); 479 else 480 { 481 rtems_monitor_symbol_t canonical_symbol; 482 483 for (arg=1; argv[arg]; arg++) 484 { 485 rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]); 486 rtems_monitor_symbol_dump(&canonical_symbol, verbose); 487 printf("\n"); 488 } 489 } 490 } -
c/src/libmisc/monitor/monitor.h
r3b438fa rb06e68ef 1 1 /* 2 * @(#)monitor.h 1. 2 - 95/04/242 * @(#)monitor.h 1.14 - 95/08/02 3 3 * 4 * $Id$ 4 5 */ 5 6 … … 10 11 * The RTEMS monitor task include file. 11 12 * 12 *13 *14 13 * TODO: 15 *16 14 */ 17 15 18 16 #ifndef __MONITOR_H 19 17 #define __MONITOR_H 18 19 #include "symbols.h" 20 #include <rtems/error.h> /* rtems_error() */ 20 21 21 22 #ifdef __cplusplus … … 23 24 #endif 24 25 25 void rtems_monitor_init(rtems_boolean monitor_suspend); 26 /* 27 * XXX this should be in rtems proper when type becomes part of id 28 */ 29 30 typedef enum { 31 RTEMS_OBJECT_INVALID = 0, 32 RTEMS_OBJECT_TASK = 1, 33 RTEMS_OBJECT_EXTENSION = 2, 34 RTEMS_OBJECT_QUEUE = 3, 35 RTEMS_OBJECT_SEMAPHORE = 4, 36 RTEMS_OBJECT_DRIVER = 5, 37 RTEMS_OBJECT_DNAME = 6, 38 RTEMS_OBJECT_CONFIG = 7, 39 RTEMS_OBJECT_INIT_TASK = 8, 40 RTEMS_OBJECT_MPCI = 9, 41 RTEMS_OBJECT_PARTITION = 10, 42 RTEMS_OBJECT_REGION = 11, 43 RTEMS_OBJECT_PORT = 12, 44 RTEMS_OBJECT_SYMBOL = 13, 45 } rtems_object_type_t; 46 47 /* 48 * rtems_monitor_init() flags 49 */ 50 51 #define RTEMS_MONITOR_SUSPEND 0x0001 /* suspend monitor on startup */ 52 #define RTEMS_MONITOR_GLOBAL 0x0002 /* monitor should be global */ 53 54 55 /* 56 * Public interfaces for RTEMS data structures monitor is aware of. 57 * These are only used by the monitor. 58 * 59 * NOTE: 60 * All the canonical objects that correspond to RTEMS managed "objects" 61 * must have an identical first portion with 'id' and 'name' fields. 62 * 63 * Others do not have that restriction, even tho we would like them to. 64 * This is because some of the canonical structures are almost too big 65 * for shared memory driver (eg: mpci) and we are nickel and diming it. 66 */ 67 68 /* 69 * Type of a pointer that may be a symbol 70 */ 71 72 #define MONITOR_SYMBOL_LEN 20 73 typedef struct { 74 char name[MONITOR_SYMBOL_LEN]; 75 unsigned32 value; 76 unsigned32 offset; 77 } rtems_monitor_symbol_t; 78 79 typedef struct { 80 rtems_id id; 81 rtems_name name; 82 /* end of common portion */ 83 } rtems_monitor_generic_t; 84 85 /* 86 * Task 87 */ 88 typedef struct { 89 rtems_id id; 90 rtems_name name; 91 /* end of common portion */ 92 Thread_Entry entry; 93 unsigned32 argument; 94 void *stack; 95 unsigned32 stack_size; 96 rtems_task_priority priority; 97 States_Control state; 98 rtems_event_set events; 99 rtems_mode modes; 100 rtems_attribute attributes; 101 unsigned32 notepad[RTEMS_NUMBER_NOTEPADS]; 102 rtems_id wait_id; 103 unsigned32 wait_args; 104 } rtems_monitor_task_t; 105 106 /* 107 * Init task 108 */ 109 110 typedef struct { 111 rtems_id id; /* not really an id */ 112 rtems_name name; 113 /* end of common portion */ 114 rtems_monitor_symbol_t entry; 115 unsigned32 argument; 116 unsigned32 stack_size; 117 rtems_task_priority priority; 118 rtems_mode modes; 119 rtems_attribute attributes; 120 } rtems_monitor_init_task_t; 121 122 123 /* 124 * Message queue 125 */ 126 typedef struct { 127 rtems_id id; 128 rtems_name name; 129 /* end of common portion */ 130 rtems_attribute attributes; 131 unsigned32 number_of_pending_messages; 132 unsigned32 maximum_pending_messages; 133 unsigned32 maximum_message_size; 134 } rtems_monitor_queue_t; 135 136 /* 137 * Extension 138 */ 139 typedef struct { 140 rtems_id id; 141 rtems_name name; 142 /* end of common portion */ 143 rtems_monitor_symbol_t create; 144 rtems_monitor_symbol_t start; 145 rtems_monitor_symbol_t restart; 146 rtems_monitor_symbol_t delete; 147 rtems_monitor_symbol_t tswitch; 148 rtems_monitor_symbol_t begin; 149 rtems_monitor_symbol_t exitted; 150 rtems_monitor_symbol_t fatal; 151 } rtems_monitor_extension_t; 152 153 /* 154 * Device driver 155 */ 156 157 typedef struct { 158 rtems_id id; /* not really an id (should be tho) */ 159 rtems_name name; /* ditto */ 160 /* end of common portion */ 161 rtems_monitor_symbol_t initialization; /* initialization procedure