Changeset aed742c in rtems
- Timestamp:
- Apr 16, 2004, 12:06:28 PM (17 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 3906b3ea
- Parents:
- 8486081
- Location:
- cpukit/libmisc
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libmisc/capture/capture-cli.c
r8486081 raed742c 3 3 $Id$ 4 4 ------------------------------------------------------------------------ 5 5 6 6 Copyright Objective Design Systems Pty Ltd, 2002 7 7 All rights reserved Objective Design Systems Pty Ltd, 2002 … … 15 15 16 16 This software with is provided ``as is'' and with NO WARRANTY. 17 17 18 18 ------------------------------------------------------------------------ 19 19 … … 64 64 static void 65 65 rtems_capture_cli_open ( 66 int argc, 67 char **argv, 68 rtems_monitor_command_arg_t *command_arg, 66 int argc, 67 char **argv, 68 rtems_monitor_command_arg_t *command_arg, 69 69 boolean verbose ) 70 70 { … … 113 113 if (!enable) 114 114 return; 115 115 116 116 sc = rtems_capture_control (enable); 117 117 … … 136 136 static void 137 137 rtems_capture_cli_close ( 138 int argc, 139 char **argv, 140 rtems_monitor_command_arg_t *command_arg, 138 int argc, 139 char **argv, 140 rtems_monitor_command_arg_t *command_arg, 141 141 boolean verbose ) 142 142 { … … 165 165 static void 166 166 rtems_capture_cli_enable ( 167 int argc, 168 char **argv, 169 rtems_monitor_command_arg_t *command_arg, 167 int argc, 168 char **argv, 169 rtems_monitor_command_arg_t *command_arg, 170 170 boolean verbose ) 171 171 { … … 194 194 static void 195 195 rtems_capture_cli_disable ( 196 int argc, 197 char **argv, 198 rtems_monitor_command_arg_t *command_arg, 196 int argc, 197 char **argv, 198 rtems_monitor_command_arg_t *command_arg, 199 199 boolean verbose ) 200 200 { … … 223 223 static void 224 224 rtems_capture_cli_task_list ( 225 int argc, 226 char **argv, 227 rtems_monitor_command_arg_t *command_arg, 225 int argc, 226 char **argv, 227 rtems_monitor_command_arg_t *command_arg, 228 228 boolean verbose ) 229 229 { … … 314 314 rtems_task_priority floor = rtems_capture_watch_get_floor (); 315 315 int last_count = 0; 316 316 317 317 printf ("\x1b[2J Press ENTER to exit.\n\n"); 318 318 printf (" PID NAME RPRI CPRI STATE %%CPU %%STK FLGS EXEC TIME\n"); 319 319 320 320 for (;;) 321 { 321 { 322 322 rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1]; 323 323 unsigned long long load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1]; … … 329 329 330 330 cli_load_thread_active = 1; 331 331 332 332 /* 333 333 * Iterate over the tasks and sort the highest load tasks … … 335 335 * tasks. 336 336 */ 337 337 338 338 memset (tasks, 0, sizeof (tasks)); 339 339 memset (load, 0, sizeof (load)); 340 340 341 341 task = rtems_capture_get_task_list (); 342 342 343 343 while (task) 344 344 { … … 367 367 break; 368 368 } 369 } 369 } 370 370 task = rtems_capture_next_task (task); 371 371 } … … 374 374 375 375 total_time = 0; 376 376 377 377 for (i = 0; i < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS; i++) 378 378 total_time += load[i]; … … 392 392 if (!tasks[i]) 393 393 break; 394 394 395 395 j--; 396 396 … … 426 426 else 427 427 printf ("%c%c", 428 rtems_capture_task_control (tasks[i]) ? 428 rtems_capture_task_control (tasks[i]) ? 429 429 (rtems_capture_task_control_flags (tasks[i]) & 430 430 RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-', 431 431 rtems_capture_watch_global_on () ? 'g' : '-'); 432 432 433 433 printf (" %qi\n", rtems_capture_task_time (tasks[i])); 434 434 } … … 443 443 444 444 cli_load_thread_active = 0; 445 445 446 446 rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (5000000)); 447 447 } … … 459 459 static void 460 460 rtems_capture_cli_task_load ( 461 int argc, 462 char **argv, 463 rtems_monitor_command_arg_t *command_arg, 461 int argc, 462 char **argv, 463 rtems_monitor_command_arg_t *command_arg, 464 464 boolean verbose ) 465 465 { … … 468 468 rtems_name name; 469 469 rtems_id id; 470 470 471 471 sc = rtems_task_set_priority (RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority); 472 472 … … 476 476 return; 477 477 } 478 478 479 479 memcpy (&name, "CPlt", 4); 480 480 481 481 sc = rtems_task_create (name, priority, 1024, 482 482 RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, 483 483 RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR, 484 484 &id); 485 486 if (sc != RTEMS_SUCCESSFUL) 485 486 if (sc != RTEMS_SUCCESSFUL) 487 487 { 488 488 printf ("error: cannot create helper thread: %s\n", rtems_status_text (sc)); … … 491 491 492 492 sc = rtems_task_start (id, rtems_capture_cli_task_load_thread, 0); 493 494 if (sc != RTEMS_SUCCESSFUL) 493 494 if (sc != RTEMS_SUCCESSFUL) 495 495 { 496 496 printf ("error: cannot start helper thread: %s\n", rtems_status_text (sc)); … … 506 506 { 507 507 int loops = 20; 508 508 509 509 while (loops && cli_load_thread_active) 510 510 rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (100000)); … … 530 530 static void 531 531 rtems_capture_cli_watch_list ( 532 int argc, 533 char **argv, 534 rtems_monitor_command_arg_t *command_arg, 532 int argc, 533 char **argv, 534 rtems_monitor_command_arg_t *command_arg, 535 535 boolean verbose ) 536 536 { … … 538 538 rtems_task_priority ceiling = rtems_capture_watch_get_ceiling (); 539 539 rtems_task_priority floor = rtems_capture_watch_get_floor (); 540 540 541 541 printf ("watch priority ceiling is %i\n", ceiling); 542 542 printf ("watch priority floor is %i\n", floor); … … 550 550 int fshowed; 551 551 int lf; 552 552 553 553 printf (" "); 554 554 rtems_monitor_dump_id (rtems_capture_control_id (control)); … … 569 569 lf = 0; 570 570 } 571 571 572 572 /* 573 573 * FIXME: name test. … … 620 620 * See if the arg is all hex digits. 621 621 */ 622 622 623 623 l = strlen (arg); 624 624 … … 628 628 629 629 *id = strtoul (arg, 0, 16); 630 630 631 631 objclass = _Objects_Get_class (*id); 632 632 633 633 if ((i == l)) 634 634 *valid_id = 1; … … 656 656 static void 657 657 rtems_capture_cli_watch_add ( 658 int argc, 659 char **argv, 660 rtems_monitor_command_arg_t *command_arg, 658 int argc, 659 char **argv, 660 rtems_monitor_command_arg_t *command_arg, 661 661 boolean verbose ) 662 662 { … … 718 718 static void 719 719 rtems_capture_cli_watch_del ( 720 int argc, 721 char **argv, 722 rtems_monitor_command_arg_t *command_arg, 720 int argc, 721 char **argv, 722 rtems_monitor_command_arg_t *command_arg, 723 723 boolean verbose ) 724 724 { … … 779 779 static void 780 780 rtems_capture_cli_watch_control ( 781 int argc, 782 char **argv, 783 rtems_monitor_command_arg_t *command_arg, 781 int argc, 782 char **argv, 783 rtems_monitor_command_arg_t *command_arg, 784 784 boolean verbose ) 785 785 { … … 845 845 static void 846 846 rtems_capture_cli_watch_global ( 847 int argc, 848 char **argv, 849 rtems_monitor_command_arg_t *command_arg, 847 int argc, 848 char **argv, 849 rtems_monitor_command_arg_t *command_arg, 850 850 boolean verbose ) 851 851 { … … 899 899 static void 900 900 rtems_capture_cli_watch_ceiling ( 901 int argc, 902 char **argv, 903 rtems_monitor_command_arg_t *command_arg, 901 int argc, 902 char **argv, 903 rtems_monitor_command_arg_t *command_arg, 904 904 boolean verbose ) 905 905 { … … 950 950 static void 951 951 rtems_capture_cli_watch_floor ( 952 int argc, 953 char **argv, 954 rtems_monitor_command_arg_t *command_arg, 952 int argc, 953 char **argv, 954 rtems_monitor_command_arg_t *command_arg, 955 955 boolean verbose ) 956 956 { … … 1001 1001 static void 1002 1002 rtems_capture_cli_trigger_set ( 1003 int argc, 1004 char **argv, 1005 rtems_monitor_command_arg_t *command_arg, 1003 int argc, 1004 char **argv, 1005 rtems_monitor_command_arg_t *command_arg, 1006 1006 boolean verbose ) 1007 1007 { … … 1157 1157 static void 1158 1158 rtems_capture_cli_trace_records ( 1159 int argc, 1160 char **argv, 1161 rtems_monitor_command_arg_t *command_arg, 1159 int argc, 1160 char **argv, 1161 rtems_monitor_command_arg_t *command_arg, 1162 1162 boolean verbose ) 1163 1163 { … … 1170 1170 rtems_capture_record_t* rec; 1171 1171 int arg; 1172 1172 1173 1173 for (arg = 1; arg < argc; arg++) 1174 1174 { … … 1197 1197 return; 1198 1198 } 1199 1199 1200 1200 dump_total = strtoul (argv[arg], 0, 0); 1201 1201 } … … 1206 1206 1207 1207 total = dump_total; 1208 1208 1209 1209 while (total) 1210 1210 { … … 1220 1220 if (read == 0) 1221 1221 break; 1222 1222 1223 1223 for (count = 0; count < read; count++, rec++) 1224 1224 { … … 1237 1237 1238 1238 event = rec->events >> RTEMS_CAPTURE_EVENT_START; 1239 1239 1240 1240 t = rec->ticks; 1241 1241 t *= rtems_capture_tick_time (); … … 1282 1282 static void 1283 1283 rtems_capture_cli_flush ( 1284 int argc, 1285 char **argv, 1286 rtems_monitor_command_arg_t *command_arg, 1284 int argc, 1285 char **argv, 1286 rtems_monitor_command_arg_t *command_arg, 1287 1287 boolean verbose ) 1288 1288 { … … 1459 1459 { 1460 1460 int cmd; 1461 1461 1462 1462 capture_timestamp = timestamp; 1463 1463 -
cpukit/libmisc/capture/capture-cli.h
r8486081 raed742c 3 3 $Id$ 4 4 ------------------------------------------------------------------------ 5 5 6 6 Copyright Objective Design Systems Pty Ltd, 2002 7 7 All rights reserved Objective Design Systems Pty Ltd, 2002 … … 15 15 16 16 This software with is provided ``as is'' and with NO WARRANTY. 17 17 18 18 ------------------------------------------------------------------------ 19 19 -
cpukit/libmisc/capture/capture.c
r8486081 raed742c 3 3 $Id$ 4 4 ------------------------------------------------------------------------ 5 5 6 6 Copyright Objective Design Systems Pty Ltd, 2002 7 7 All rights reserved Objective Design Systems Pty Ltd, 2002 … … 15 15 16 16 This software with is provided ``as is'' and with NO WARRANTY. 17 17 18 18 ------------------------------------------------------------------------ 19 19 … … 237 237 { 238 238 rtems_capture_control_t* control; 239 239 240 240 for (control = capture_controls; control != NULL; control = control->next) 241 241 if (rtems_capture_match_name_id (name, id, control->name, control->id)) … … 263 263 264 264 control = rtems_capture_find_control (name, id); 265 265 266 266 if (control == NULL) 267 267 { … … 273 273 return NULL; 274 274 } 275 275 276 276 control->name = name; 277 277 control->id = id; … … 280 280 memset (control->from, 0, sizeof (control->from)); 281 281 memset (control->from_id, 0, sizeof (control->from_id)); 282 282 283 283 rtems_interrupt_disable (level); 284 284 … … 324 324 325 325 rtems_capture_dup_name (&task->name, ((rtems_name) new_task->Object.name)); 326 326 327 327 task->id = new_task->Object.id; 328 328 task->flags = 0; … … 360 360 task->name, task->id)) 361 361 task->control = control; 362 362 363 363 return task; 364 364 } … … 399 399 { 400 400 rtems_interrupt_level level; 401 401 402 402 rtems_interrupt_disable (level); 403 403 404 404 if (capture_count < capture_size) 405 405 { … … 418 418 capture_in = capture_records; 419 419 else 420 capture_in++; 420 capture_in++; 421 421 } 422 422 else … … 501 501 rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT); 502 502 rtems_capture_record (st, RTEMS_CAPTURE_STARTED_EVENT); 503 503 504 504 rtems_capture_init_stack_usage (st); 505 505 } … … 672 672 uint32_t ticks; 673 673 uint32_t tick_offset; 674 674 675 675 /* 676 676 * Get the cpature task control block so we can update the … … 720 720 ht->tick_offset_in = tick_offset; 721 721 } 722 722 723 723 if (ct) 724 724 { … … 729 729 { 730 730 tick_offset += capture_tick_period - ct->tick_offset_in; 731 731 732 732 if (tick_offset < capture_tick_period) 733 733 ct->tick_offset = tick_offset; … … 755 755 { 756 756 cc = ct->control; 757 757 758 758 /* 759 759 * Check the current task for a TO_ANY trigger. … … 855 855 */ 856 856 capture_tick_period = _Configuration_Table->microseconds_per_tick; 857 857 858 858 /* 859 859 * Register the user extension handlers for the CAPture Engine. … … 923 923 924 924 task = capture_tasks; 925 925 926 926 while (task) 927 927 { … … 934 934 935 935 control = capture_controls; 936 936 937 937 while (control) 938 938 { … … 1010 1010 capture_out = 0; 1011 1011 1012 rtems_interrupt_enable (level); 1012 rtems_interrupt_enable (level); 1013 1013 1014 1014 return RTEMS_SUCCESSFUL; … … 1075 1075 { 1076 1076 rtems_interrupt_disable (level); 1077 1077 1078 1078 for (task = capture_tasks; task != NULL; task = task->next) 1079 1079 if (task->control == control) … … 1117 1117 rtems_capture_control_t* control; 1118 1118 rtems_boolean found = 0; 1119 1119 1120 1120 /* 1121 1121 * Find the control and then set the watch. It must exist before it can … … 1136 1136 1137 1137 found = 1; 1138 } 1138 } 1139 1139 } 1140 1140 … … 1158 1158 { 1159 1159 rtems_interrupt_level level; 1160 1160 1161 1161 rtems_interrupt_disable (level); 1162 1162 … … 1279 1279 rtems_capture_control_t* control; 1280 1280 int i; 1281 1281 1282 1282 /* 1283 1283 * Find the capture control blocks for the from and to … … 1298 1298 if (control == NULL) 1299 1299 return RTEMS_NO_MEMORY; 1300 1300 1301 1301 if (trigger == rtems_capture_from_any) 1302 1302 control->flags |= RTEMS_CAPTURE_FROM_ANY; … … 1388 1388 if (count && ((capture_out + count) >= capture_size)) 1389 1389 *read = capture_size - capture_out; 1390 1390 1391 1391 /* 1392 * Do we have a threshold and the current count has not wrapped 1393 * around the end of the capture record buffer ? 1392 * Do we have a threshold and the current count has not wrapped 1393 * around the end of the capture record buffer ? 1394 1394 */ 1395 1395 if ((*read == count) && threshold) … … 1405 1405 1406 1406 rtems_interrupt_disable (level); 1407 1407 1408 1408 capture_flags |= RTEMS_CAPTURE_READER_WAITING; 1409 1409 1410 1410 rtems_interrupt_enable (level); 1411 1411 1412 1412 sc = rtems_event_receive (RTEMS_EVENT_0, 1413 1413 RTEMS_WAIT | RTEMS_EVENT_ANY, … … 1482 1482 * This function returns the tick period in nano-seconds. 1483 1483 */ 1484 uint32_t 1484 uint32_t 1485 1485 rtems_capture_tick_time () 1486 1486 { … … 1527 1527 * is updated. 1528 1528 */ 1529 uint32_t 1529 uint32_t 1530 1530 rtems_capture_task_stack_usage (rtems_capture_task_t* task) 1531 1531 { -
cpukit/libmisc/capture/capture.h
r8486081 raed742c 3 3 $Id$ 4 4 ------------------------------------------------------------------------ 5 5 6 6 Copyright Objective Design Systems Pty Ltd, 2002 7 7 All rights reserved Objective Design Systems Pty Ltd, 2002 … … 15 15 16 16 This software with is provided ``as is'' and with NO WARRANTY. 17 17 18 18 ------------------------------------------------------------------------ 19 19 … … 43 43 * DESCRIPTION: 44 44 * 45 * RTEMS control holds the trigger and watch configuration for a group of 45 * RTEMS control holds the trigger and watch configuration for a group of 46 46 * tasks with the same name. 47 47 */ … … 63 63 #define RTEMS_CAPTURE_TO_ANY (1 << 2) 64 64 #define RTEMS_CAPTURE_FROM_TO (1 << 3) 65 65 66 66 /* 67 67 * rtems_capture_control_t … … 69 69 * DESCRIPTION: 70 70 * 71 * RTEMS capture control provdes the information about a task, along 71 * RTEMS capture control provdes the information about a task, along 72 72 * with its trigger state. The control is referenced by each 73 * capture record. This is* information neeed by the decoder. The 73 * capture record. This is* information neeed by the decoder. The 74 74 * capture record cannot assume the task will exist when the record is 75 75 * dumped via the target interface so task info needed for tracing is … … 80 80 * 81 81 * Note, the tracer code exploits the fact an rtems_name is a 82 * 32bit value. 82 * 32bit value. 83 83 */ 84 84 typedef struct rtems_capture_task_s … … 408 408 * This function returns the tick period in micro-seconds. 409 409 */ 410 uint32_t 410 uint32_t 411 411 rtems_capture_tick_time (); 412 412 … … 418 418 * This function returns the tick period in micro-seconds. 419 419 */ 420 uint32_t 420 uint32_t 421 421 rtems_capture_tick_time (); 422 422 … … 520 520 * This function returns the task flags. 521 521 */ 522 static inline uint32_t 522 static inline uint32_t 523 523 rtems_capture_task_flags (rtems_capture_task_t* task) 524 524 { … … 546 546 * This function returns the task control flags if a control is present. 547 547 */ 548 static inline uint32_t 548 static inline uint32_t 549 549 rtems_capture_task_control_flags (rtems_capture_task_t* task) 550 550 { … … 562 562 * been switched into context. 563 563 */ 564 static inline uint32_t 564 static inline uint32_t 565 565 rtems_capture_task_switched_in (rtems_capture_task_t* task) 566 566 { … … 576 576 * been switched out of context. 577 577 */ 578 static inline uint32_t 578 static inline uint32_t 579 579 rtems_capture_task_switched_out (rtems_capture_task_t* task) 580 580 { … … 634 634 * is updated. 635 635 */ 636 uint32_t 636 uint32_t 637 637 rtems_capture_task_stack_usage (rtems_capture_task_t* task); 638 638 … … 644 644 * This function returns the task's stack size. 645 645 */ 646 static inline uint32_t 646 static inline uint32_t 647 647 rtems_capture_task_stack_size (rtems_capture_task_t* task) 648 648 { … … 657 657 * This function returns the amount of stack used. 658 658 */ 659 static inline uint32_t 659 static inline uint32_t 660 660 rtems_capture_task_stack_used (rtems_capture_task_t* task) 661 661 { … … 670 670 * This function returns the current execution time as ticks. 671 671 */ 672 static inline uint32_t 672 static inline uint32_t 673 673 rtems_capture_task_ticks (rtems_capture_task_t* task) 674 674 { … … 683 683 * This function returns the current execution time tick offset. 684 684 */ 685 static inline uint32_t 685 static inline uint32_t 686 686 rtems_capture_task_tick_offset (rtems_capture_task_t* task) 687 687 { … … 731 731 * engine knows about. 732 732 */ 733 static inline uint32_t 733 static inline uint32_t 734 734 rtems_capture_task_count () 735 735 { 736 736 rtems_capture_task_t* task = rtems_capture_get_task_list (); 737 737 uint32_t count = 0; 738 738 739 739 while (task) 740 740 { … … 804 804 * This function returns the control flags. 805 805 */ 806 static inline uint32_t 806 static inline uint32_t 807 807 rtems_capture_control_flags (rtems_capture_control_t* control) 808 808 { … … 848 848 * engine has. 849 849 */ 850 static inline uint32_t 850 static inline uint32_t 851 851 rtems_capture_control_count () 852 852 { -
cpukit/libmisc/cpuuse/cpuuse.c
r8486081 raed742c 54 54 for ( i=1 ; i <= information->maximum ; i++ ) { 55 55 the_thread = (Thread_Control *)information->local_table[ i ]; 56 56 57 57 if ( the_thread ) 58 58 total_units += the_thread->ticks_executed; … … 68 68 #endif 69 69 70 for ( api_index = 1 ; 71 api_index <= OBJECTS_APIS_LAST ; 70 for ( api_index = 1 ; 71 api_index <= OBJECTS_APIS_LAST ; 72 72 api_index++ ) { 73 73 if ( !_Objects_Information_table[ api_index ] ) … … 77 77 for ( i=1 ; i <= information->maximum ; i++ ) { 78 78 the_thread = (Thread_Control *)information->local_table[ i ]; 79 79 80 80 if ( !the_thread ) 81 81 continue; … … 107 107 name, 108 108 the_thread->ticks_executed, 109 (total_units) ? 109 (total_units) ? 110 110 (double)the_thread->ticks_executed / (double)total_units : 111 111 (double)total_units -
cpukit/libmisc/devnull/devnull.c
r8486081 raed742c 46 46 { 47 47 rtems_device_driver status; 48 48 49 49 if ( !initialized ) { 50 50 initialized = 1; … … 58 58 if (status != RTEMS_SUCCESSFUL) 59 59 rtems_fatal_error_occurred(status); 60 60 61 61 NULL_major = major; 62 62 } 63 63 64 64 return RTEMS_SUCCESSFUL; 65 65 } … … 154 154 { 155 155 rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp; 156 156 157 157 if ( rw_args ) 158 158 rw_args->bytes_moved = rw_args->count; 159 159 160 160 return NULL_SUCCESSFUL; 161 161 } -
cpukit/libmisc/dumpbuf/dumpbuf.c
r8486081 raed742c 18 18 #include <ctype.h> 19 19 #include <rtems/dumpbuf.h> 20 20 21 21 /* 22 22 * Put the body below Dump_Buffer so it won't get inlined. … … 24 24 25 25 static inline void Dump_Line( 26 unsigned char *buffer, 26 unsigned char *buffer, 27 27 int length 28 28 ); … … 33 33 ) 34 34 { 35 35 36 36 int i, mod, max; 37 37 38 38 if ( !length ) return; 39 39 40 40 mod = length % 16; 41 41 42 42 max = length - mod; 43 43 44 44 for ( i=0 ; i<max ; i+=16 ) 45 45 Dump_Line( &buffer[ i ], 16 ); 46 46 47 47 if ( mod ) 48 48 Dump_Line( &buffer[ max ], mod ); … … 54 54 ) 55 55 { 56 56 57 57 int i; 58 58 char line_buffer[120]; 59 59 60 60 line_buffer[0] = '\0'; 61 61 62 62 for( i=0 ; i<length ; i++ ) 63 63 sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] ); 64 64 65 65 for( ; i<16 ; i++ ) 66 66 strcat( line_buffer, " " ); 67 67 68 68 strcat( line_buffer, "|" ); 69 69 for( i=0 ; i<length ; i++ ) 70 70 sprintf( line_buffer, "%s%c", line_buffer, 71 71 isprint( buffer[ i ] ) ? buffer[ i ] : '.' ); 72 72 73 73 for( ; i<16 ; i++ ) 74 74 strcat( line_buffer, " " ); 75 75 76 76 strcat( line_buffer, "|\n" ); 77 77 78 78 printf( line_buffer ); 79 79 } -
cpukit/libmisc/fsmount/fsmount.c
r8486081 raed742c 79 79 if (0 != stat(tok_buffer,&file_info)) { 80 80 /* 81 * if not, create directory 81 * if not, create directory 82 82 */ 83 83 rc = mknod(tok_buffer,S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR,0); … … 87 87 (token_type != IMFS_NO_MORE_PATH) && 88 88 (token_type != IMFS_INVALID_TOKEN)); 89 89 90 90 /* 91 91 * return token buffer to heap … … 127 127 * scan through all fstab entries; 128 128 */ 129 while (!terminate && 129 while (!terminate && 130 130 (fstab_idx < fstab_count)) { 131 131 tmp_rc = 0; … … 178 178 if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_OK)) { 179 179 terminate = TRUE; 180 } 180 } 181 181 } 182 } 182 } 183 183 /* 184 184 * proceed to next entry -
cpukit/libmisc/fsmount/fsmount.h
r8486081 raed742c 31 31 * bits to define, what errors will cause reporting (via printf) and 32 32 * abort of mount processing 33 * Use a combination of these bits 33 * Use a combination of these bits 34 34 * for the fields "report_reasons" and "abort_reasons" 35 */ 35 */ 36 36 #define FSMOUNT_MNT_OK 0x0001 /* mounted ok */ 37 37 #define FSMOUNT_MNTPNT_CRTERR 0x0002 /* cannot create mount point */ -
cpukit/libmisc/monitor/mon-command.c
r8486081 raed742c 25 25 /* 26 26 * 2001-01-30 KJO (vac4050@cae597.rsc.raytheon.com): 27 * Fixed rtems_monitor_command_lookup() to accept partial 28 * commands to uniqeness. Added support for setting 27 * Fixed rtems_monitor_command_lookup() to accept partial 28 * commands to uniqeness. Added support for setting 29 29 * the monitor prompt via an environment variable: 30 30 * RTEMS_MONITOR_PROMPT … … 48 48 #define KEYS_RARROW (5) 49 49 #define KEYS_HOME (6) 50 #define KEYS_END (7) 51 #define KEYS_F1 (8) 52 #define KEYS_F2 (9) 50 #define KEYS_END (7) 51 #define KEYS_F1 (8) 52 #define KEYS_F2 (9) 53 53 #define KEYS_F3 (10) 54 54 #define KEYS_F4 (11) … … 234 234 history = history_next; 235 235 pos = 0; 236 236 237 237 if (!logged_in) 238 238 printf ("\nMonitor ready, press enter to login.\n\n"); … … 249 249 */ 250 250 extended_key &= ~KEYS_NORMAL_MASK; 251 251 252 252 if (!extended_key && !logged_in) 253 253 { … … 277 277 pos = 0; 278 278 break; 279 279 280 280 case KEYS_LARROW: 281 281 if (pos > 0) … … 320 320 } 321 321 break; 322 322 323 323 case KEYS_DARROW: 324 324 if (history < history_next) … … 494 494 */ 495 495 if (!rtems_configuration_get_user_multiprocessing_table ()) 496 sprintf (monitor_prompt, "%s", 496 sprintf (monitor_prompt, "%s", 497 497 (env_prompt == NULL) ? MONITOR_PROMPT: env_prompt); 498 498 else if (rtems_monitor_default_node != rtems_monitor_node) … … 501 501 rtems_monitor_default_node); 502 502 else 503 sprintf (monitor_prompt, "%d-%s", rtems_monitor_node, 503 sprintf (monitor_prompt, "%d-%s", rtems_monitor_node, 504 504 (env_prompt == NULL) ? MONITOR_PROMPT : env_prompt); 505 505 … … 536 536 if ((table == 0) || (argv[0] == 0)) 537 537 return 0; 538 538 539 539 while (table) 540 540 { … … 551 551 return 0; 552 552 } 553 553 554 554 else 555 555 found_it = table; … … 597 597 return; 598 598 } 599 599 600 600 while (help_len) 601 601 { 602 602 printf ("%*c", spaces, ' '); 603 603 604 604 if (line_one) 605 605 printf (" - "); … … 612 612 * from the end for a space, tab or lf or cr. 613 613 */ 614 614 615 615 if (help_len > MAX_HELP_LINE_LENGTH) 616 616 { 617 for (show_this_line = MAX_HELP_LINE_LENGTH - 1; 618 show_this_line; 617 for (show_this_line = MAX_HELP_LINE_LENGTH - 1; 618 show_this_line; 619 619 show_this_line--) 620 620 if ((help[show_this_line] == ' ') || … … 626 626 * If show_this_line is 0, it is a very long word !! 627 627 */ 628 628 629 629 if (show_this_line == 0) 630 630 show_this_line = MAX_HELP_LINE_LENGTH - 1; … … 640 640 641 641 printf ("\n"); 642 642 643 643 help += show_this_line; 644 644 help_len -= show_this_line; … … 647 647 * Move past the line feeds or what ever else is being skipped. 648 648 */ 649 649 650 650 while (help_len) 651 651 { … … 674 674 rtems_monitor_command_entry_t *command = table; 675 675 int max_cmd_len = 0; 676 676 677 677 /* if first entry in table is a usage, then print it out */ 678 678 … … 680 680 { 681 681 char *argv[2]; 682 682 683 683 argv[0] = command_string; 684 684 argv[1] = 0; 685 685 686 686 command = rtems_monitor_command_lookup (table, 1, argv); 687 687 … … 692 692 return; 693 693 } 694 694 695 695 /* 696 696 * Find the largest command size. 697 697 */ 698 698 699 699 while (command) 700 700 { … … 735 735 736 736 command = command_arg->monitor_command_entry; 737 737 738 738 if (argc == 1) 739 739 rtems_monitor_command_usage(command, 0); -
cpukit/libmisc/monitor/mon-config.c
r8486081 raed742c 49 49 canonical_config->ticks_per_timeslice = c->ticks_per_timeslice; 50 50 canonical_config->number_of_initialization_tasks = r->number_of_initialization_tasks; 51 } 51 } 52 52 53 53 /* … … 68 68 if (n >= 1) 69 69 goto failed; 70 70 71 71 _Thread_Disable_dispatch(); 72 72 -
cpukit/libmisc/monitor/mon-dname.c
r8486081 raed742c 47 47 canonical_dname->major = np->major; 48 48 canonical_dname->minor = np->minor; 49 } 49 } 50 50 51 51 void * … … 64 64 if (np->device_name) 65 65 goto done; 66 66 67 67 *next_id = RTEMS_OBJECT_ID_FINAL; 68 68 return 0; … … 80 80 *next_id += 1; 81 81 return np; 82 } 82 } 83 83 84 84 void -
cpukit/libmisc/monitor/mon-driver.c
r8486081 raed742c 72 72 if (n >= c->number_of_device_drivers) 73 73 goto failed; 74 74 75 75 _Thread_Disable_dispatch(); 76 76 -
cpukit/libmisc/monitor/mon-extension.c
r8486081 raed742c 51 51 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 52 52 0 1 2 3 4 5 6 7 */ 53 53 54 54 rtems_monitor_separator(); 55 55 } -
cpukit/libmisc/monitor/mon-itask.c
r8486081 raed742c 25 25 { 26 26 rtems_initialization_tasks_table *rtems_itask = itask_void; 27 27 28 28 rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry, 29 29 (void *) rtems_itask->entry_point); … … 49 49 if (n >= c->RTEMS_api_configuration->number_of_initialization_tasks) 50 50 goto failed; 51 51 52 52 _Thread_Disable_dispatch(); 53 53 … … 112 112 length += rtems_monitor_pad(54, length); 113 113 length += rtems_monitor_dump_attributes(monitor_itask->attributes); 114 114 115 115 length += rtems_monitor_pad(66, length); 116 116 length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size); -
cpukit/libmisc/monitor/mon-manager.c
r8486081 raed742c 34 34 * When we are called, it must be local 35 35 */ 36 36 37 37 if ( ! _Objects_Is_local_id(*next_id)) 38 38 goto done; 39 39 40 40 object = _Objects_Get_next(table, *next_id, &location, next_id); 41 41 -
cpukit/libmisc/monitor/mon-monitor.c
r8486081 raed742c 1 1 /* 2 2 * RTEMS monitor main body 3 * 3 * 4 4 * TODO: 5 5 * add stuff to RTEMS api … … 85 85 { RTEMS_MONITOR_OBJECT_INIT_TASK }, 86 86 &rtems_monitor_commands[2], 87 }, 87 }, 88 88 { "mpci", 89 89 "Show the MPCI system configuration, if configured.", … … 228 228 &rtems_monitor_commands[19], 229 229 }, 230 #endif 230 #endif 231 231 { 0, 0, 0, 0, { 0 }, &rtems_registered_commands }, 232 232 }; … … 238 238 rtems_event_set event_set; 239 239 rtems_status_code status; 240 240 241 241 status = rtems_event_receive(MONITOR_WAKEUP_EVENT, 242 242 RTEMS_DEFAULT_OPTIONS, … … 250 250 { 251 251 rtems_status_code status; 252 252 253 253 status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT); 254 254 } … … 315 315 { 316 316 uint32_t new_node = rtems_monitor_default_node; 317 317 318 318 switch (argc) 319 319 { … … 371 371 if (rtems_monitor_symbols) 372 372 rtems_symbol_table_destroy(rtems_monitor_symbols); 373 373 374 374 rtems_monitor_symbols = rtems_symbol_table_create(10); 375 375 if (rtems_monitor_symbols == 0) … … 377 377 378 378 fp = fopen("symbols", "r"); 379 379 380 380 if (fp == 0) 381 381 return; … … 442 442 { 443 443 rtems_monitor_command_entry_t **p = & rtems_registered_commands.next; 444 444 445 445 while (*p) { 446 446 if ( STREQ(command->command, (*p)->command) ) { … … 469 469 char command_buffer[513]; 470 470 int argc; 471 char *argv[64]; 471 char *argv[64]; 472 472 boolean verbose = FALSE; 473 473 struct termios term; … … 476 476 * Make the stdin stream characte not line based. 477 477 */ 478 478 479 479 if (tcgetattr (STDIN_FILENO, &term) < 0) 480 480 { … … 488 488 489 489 term.c_lflag &= ~(ECHO | ICANON | IEXTEN); 490 490 491 491 /* 492 492 * No sigint on BREAK, CR-to-NL off, input parity off, … … 503 503 } 504 504 } 505 505 506 506 if (monitor_flags & RTEMS_MONITOR_SUSPEND) 507 507 (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); … … 544 544 rtems_task_delete(rtems_monitor_task_id); 545 545 rtems_monitor_task_id = 0; 546 546 547 547 rtems_monitor_server_kill(); 548 548 } … … 554 554 { 555 555 rtems_status_code status; 556 556 557 557 rtems_monitor_kill(); 558 558 … … 580 580 * Start the monitor task itself 581 581 */ 582 582 583 583 status = rtems_task_start(rtems_monitor_task_id, 584 584 rtems_monitor_task, -
cpukit/libmisc/monitor/mon-mpci.c
r8486081 raed742c 39 39 return; 40 40 mt = m->User_mpci_table; 41 41 42 42 canonical_mpci->node = m->node; 43 43 canonical_mpci->maximum_nodes = m->maximum_nodes; … … 59 59 rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet, 60 60 (void *) mt->receive_packet); 61 } 61 } 62 62 63 63 /* … … 78 78 if (n >= 1) 79 79 goto failed; 80 80 81 81 if ( ! c->User_multiprocessing_table) 82 82 goto failed; 83 83 84 84 _Thread_Disable_dispatch(); 85 85 … … 103 103 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 104 104 0 1 2 3 4 5 6 7 */ 105 105 106 106 rtems_monitor_separator(); 107 107 } … … 120 120 length += rtems_monitor_pad(11, length); 121 121 length += printf("%d", monitor_mpci->maximum_nodes); 122 122 123 123 length += rtems_monitor_pad(18, length); 124 124 length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects); 125 125 126 126 length += rtems_monitor_pad(28, length); 127 127 length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies); -
cpukit/libmisc/monitor/mon-object.c
r8486081 raed742c 127 127 { 128 128 uint32_t node; 129 129 130 130 node = rtems_get_node(id); 131 131 if (node == 0) … … 172 172 * Send request 173 173 */ 174 174 175 175 request.command = RTEMS_MONITOR_SERVER_CANONICAL; 176 176 request.argument0 = (uint32_t ) type; … … 184 184 * process response 185 185 */ 186 186 187 187 next_id = (rtems_id) response.result0; 188 188 if (next_id != RTEMS_OBJECT_ID_FINAL) … … 214 214 { 215 215 next_id = id; 216 216 217 217 raw_item = (void *) info->next(info->object_information, 218 218 canonical, … … 223 223 info->canonical(canonical, raw_item); 224 224 _Thread_Enable_dispatch(); 225 } 226 } 225 } 226 } 227 227 return next_id; 228 228 } … … 285 285 * memory driver (eg: mpci) 286 286 */ 287 287 288 288 if ((info->next != rtems_monitor_manager_next) || 289 289 (id == canonical.generic.id)) … … 323 323 rtems_monitor_object_info_t *info = 0; 324 324 rtems_monitor_object_type_t type ; 325 325 326 326 /* what is the default type? */ 327 327 type = command_arg->monitor_object; … … 334 334 goto done; 335 335 } 336 336 337 337 info = rtems_monitor_object_lookup(type); 338 338 if (info == 0) … … 365 365 if (info == 0) 366 366 goto not_found; 367 367 368 368 if (info->dump_header) 369 369 info->dump_header(verbose); … … 379 379 380 380 default_node = rtems_get_node(id); 381 381 382 382 last_type = type; 383 383 } -
cpukit/libmisc/monitor/mon-prmisc.c
r8486081 raed742c 26 26 } 27 27 28 uint32_t 28 uint32_t 29 29 rtems_monitor_pad( 30 30 uint32_t destination_column, … … 33 33 { 34 34 int pad_length; 35 35 36 36 if (destination_column <= current_column) 37 37 pad_length = 1; … … 42 42 } 43 43 44 uint32_t 44 uint32_t 45 45 rtems_monitor_dump_char(uint8_t ch) 46 46 { … … 51 51 } 52 52 53 uint32_t 53 uint32_t 54 54 rtems_monitor_dump_decimal(uint32_t num) 55 55 { … … 57 57 } 58 58 59 uint32_t 59 uint32_t 60 60 rtems_monitor_dump_hex(uint32_t num) 61 61 { … … 63 63 } 64 64 65 uint32_t 65 uint32_t 66 66 rtems_monitor_dump_assoc_bitfield( 67 67 rtems_assoc_t *ap, … … 69 69 uint32_t value 70 70 ) 71 { 71 { 72 72 uint32_t b; 73 73 uint32_t length = 0; … … 81 81 82 82 name = rtems_assoc_name_by_local(ap, b); 83 83 84 84 if (name) 85 85 length += printf("%s", name); … … 87 87 length += printf("0x%x", b); 88 88 } 89 90 return length; 91 } 92 93 uint32_t 89 90 return length; 91 } 92 93 uint32_t 94 94 rtems_monitor_dump_id(rtems_id id) 95 95 { … … 97 97 } 98 98 99 uint32_t 99 uint32_t 100 100 rtems_monitor_dump_name(rtems_name name) 101 101 { … … 106 106 char c[4]; 107 107 } u; 108 108 109 109 u.ui = (uint32_t ) name; 110 110 111 111 #if (CPU_BIG_ENDIAN == TRUE) 112 112 for (i=0; i<sizeof(u.c); i++) … … 119 119 } 120 120 121 uint32_t 121 uint32_t 122 122 rtems_monitor_dump_priority(rtems_task_priority priority) 123 123 { … … 147 147 }; 148 148 149 uint32_t 149 uint32_t 150 150 rtems_monitor_dump_state(States_Control state) 151 151 { … … 154 154 if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */ 155 155 length += printf("READY"); 156 156 157 157 length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc, 158 158 ":", … … 170 170 }; 171 171 172 uint32_t 172 uint32_t 173 173 rtems_monitor_dump_attributes(rtems_attribute attributes) 174 174 { … … 177 177 if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */ 178 178 length += printf("DEFAULT"); 179 179 180 180 length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc, 181 181 ":", … … 191 191 }; 192 192 193 uint32_t 193 uint32_t 194 194 rtems_monitor_dump_modes(rtems_mode modes) 195 195 { … … 198 198 if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */ 199 199 length += printf("P:T:nA"); 200 200 201 201 length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc, 202 202 ":", … … 241 241 }; 242 242 243 uint32_t 243 uint32_t 244 244 rtems_monitor_dump_events(rtems_event_set events) 245 245 { … … 248 248 if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */ 249 249 length += printf("NONE"); 250 250 251 251 length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc, 252 252 ":", … … 255 255 } 256 256 257 uint32_t 257 uint32_t 258 258 rtems_monitor_dump_notepad(uint32_t *notepad) 259 259 { -
cpukit/libmisc/monitor/mon-server.c
r8486081 raed742c 48 48 * Look it up if we don't know it yet. 49 49 */ 50 50 51 51 server_id = rtems_monitor_server_request_queue_ids[server_node]; 52 52 if (server_id == 0) … … 60 60 goto done; 61 61 } 62 62 63 63 rtems_monitor_server_request_queue_ids[server_node] = server_id; 64 64 } … … 72 72 goto done; 73 73 } 74 74 75 75 /* 76 76 * Await response, if requested … … 98 98 status = RTEMS_INCORRECT_STATE; 99 99 goto done; 100 } 101 } 102 100 } 101 } 102 103 103 done: 104 104 return status; … … 135 135 goto failed; 136 136 } 137 137 138 138 if (size != sizeof(request)) 139 139 { … … 141 141 goto failed; 142 142 } 143 143 144 144 switch (request.command) 145 145 { … … 163 163 #define SERVER_OVERHEAD (RTEMS_offsetof(rtems_monitor_server_response_t, \ 164 164 payload)) 165 165 166 166 status = rtems_message_queue_send(request.return_id, 167 167 &response, … … 187 187 } 188 188 189 189 190 190 /* 191 191 * Kill off any old server … … 220 220 { 221 221 rtems_status_code status; 222 222 223 223 if (_System_state_Is_multiprocessing && 224 224 (_Configuration_MP_table->maximum_nodes > 1)) 225 225 { 226 226 uint32_t maximum_nodes = _Configuration_MP_table->maximum_nodes; 227 227 228 228 /* 229 229 * create the msg que our server will listen … … 238 238 RTEMS_GLOBAL, 239 239 &rtems_monitor_server_request_queue_id); 240 240 241 241 if (status != RTEMS_SUCCESSFUL) 242 242 { … … 244 244 goto done; 245 245 } 246 246 247 247 /* 248 248 * create the msg que our responses will come on … … 250 250 * message queue. 251 251 */ 252 252 253 253 status = rtems_message_queue_create( 254 254 RTEMS_MONITOR_RESPONSE_QUEUE_NAME, … … 257 257 RTEMS_GLOBAL, 258 258 &rtems_monitor_server_response_queue_id); 259 259 260 260 if (status != RTEMS_SUCCESSFUL) 261 261 { … … 263 263 goto done; 264 264 } 265 265 266 266 /* need an id for queue of each other server we might talk to */ 267 267 /* indexed by node, so add 1 to maximum_nodes */ -
cpukit/libmisc/monitor/mon-symbols.c
r8486081 raed742c 246 246 return NULL; 247 247 } 248 248 249 249 if (table->sorted) 250 250 { … … 255 255 return NULL; /* not an exact match */ 256 256 } 257 257 258 258 for (s = 0, sp = table->addresses; s < table->next; s++, sp++) 259 259 { … … 286 286 return NULL; 287 287 } 288 288 289 289 for (s = 0, sp = table->addresses; s < table->next; s++, sp++) 290 290 { … … 314 314 315 315 /* NOTE: symbols do not have id and name fields */ 316 316 317 317 if (table->sorted == 0) 318 318 rtems_symbol_sort(table); … … 381 381 382 382 383 uint32_t 383 uint32_t 384 384 rtems_monitor_symbol_dump( 385 385 rtems_monitor_symbol_t *canonical_symbol, -
cpukit/libmisc/monitor/mon-task.c
r8486081 raed742c 25 25 26 26 api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ]; 27 27 28 28 canonical_task->entry = rtems_thread->Start.entry_point; 29 29 canonical_task->argument = rtems_thread->Start.numeric_argument; … … 57 57 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 58 58 0 1 2 3 4 5 6 7 */ 59 59 60 60 rtems_monitor_separator(); 61 61 } -
cpukit/libmisc/monitor/monitor.h
r8486081 raed742c 39 39 /* following monitor objects are not known to RTEMS, but 40 40 * we like to have "types" for them anyway */ 41 41 42 42 RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_RTEMS_CLASSES_LAST+1, 43 43 RTEMS_MONITOR_OBJECT_DNAME, … … 72 72 * Type of a pointer that may be a symbol 73 73 */ 74 74 75 75 #define MONITOR_SYMBOL_LEN 20 76 76 typedef struct { … … 78 78 uint32_t value; 79 79 uint32_t offset; 80 } rtems_monitor_symbol_t; 80 } rtems_monitor_symbol_t; 81 81 82 82 typedef struct { … … 84 84 rtems_name name; 85 85 /* end of common portion */ 86 } rtems_monitor_generic_t; 86 } rtems_monitor_generic_t; 87 87 88 88 /* … … 348 348 void rtems_monitor_server_task(rtems_task_argument); 349 349 void rtems_monitor_server_init(uint32_t ); 350 350 351 351 /* command.c */ 352 352 int rtems_monitor_make_argv(char *, int *, char **); -
cpukit/libmisc/mw-fb/mw_fb.c
r8486081 raed742c 4 4 // 5 5 // Copyright (c) 2000 - Rosimildo da Silva 6 //7 // MODULE DESCRIPTION:8 // Wrapper API around the ioctls calls for the Micro FrameBuffer9 // interface for Embedded Systems10 6 // 11 // All functions returns 0 on success. Any other value should be 7 // MODULE DESCRIPTION: 8 // Wrapper API around the ioctls calls for the Micro FrameBuffer 9 // interface for Embedded Systems 10 // 11 // All functions returns 0 on success. Any other value should be 12 12 // decoded as an error. A list of errors will be created over time. 13 13 // … … 15 15 // 16 16 // $Log$ 17 // Revision 1.3 2004/04/15 13:24:46 ralf 18 // Remove stray white spaces. 19 // 17 20 // Revision 1.2 2003/07/08 08:38:48 ralf 18 21 // 2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de> … … 78 81 79 82 80 /* 83 /* 81 84 * This function returns the information regarding the display. 82 85 * It is called just after the driver be opened to get all needed … … 91 94 92 95 93 /* 94 * Returns the mode of the graphics subsystem 96 /* 97 * Returns the mode of the graphics subsystem 95 98 */ 96 99 int ufb_get_mode( int fd, int *mode ) … … 103 106 104 107 105 /* 106 * Returns the current collor pallete 108 /* 109 * Returns the current collor pallete 107 110 */ 108 111 int ufb_get_palette( int fd, struct fb_cmap *color ) … … 112 115 113 116 114 /* 115 * Set the current collor pallete 117 /* 118 * Set the current collor pallete 116 119 */ 117 120 int ufb_set_palette( int fd, struct fb_cmap *color ) … … 120 123 } 121 124 122 /* 123 * Does all necessary initialization to put the device in 124 * graphics mode 125 /* 126 * Does all necessary initialization to put the device in 127 * graphics mode 125 128 */ 126 129 int ufb_enter_graphics( int fd, int mode ) … … 133 136 134 137 135 /* 138 /* 136 139 * Switch the device back to the default mode of operation. 137 140 * In most cases it put the device back to plain text mode. … … 145 148 } 146 149 147 /* 148 * Tell the driver that the "virtual buffer" is dirty, and an update 149 * of it to the real device, maybe a serial/parallel LCD or whatever 150 * is required 150 /* 151 * Tell the driver that the "virtual buffer" is dirty, and an update 152 * of it to the real device, maybe a serial/parallel LCD or whatever 153 * is required 151 154 */ 152 155 int ufb_buffer_is_dirty( int fd ) … … 160 163 161 164 162 /* 165 /* 163 166 * This function maps the physical ( kernel mode ) address of the framebuffer device 164 167 * and maps it to the user space address. … … 168 171 #ifdef __rtems__ 169 172 /* RTEMS runs in ring 0, and there is no distinction between 170 user space and kernel space, so we just return the same 173 user space and kernel space, so we just return the same 171 174 pointer to the caller. 172 175 */ … … 174 177 return 0; 175 178 #else 176 /* other kernels might want to map it to the user space, 179 /* other kernels might want to map it to the user space, 177 180 maybe using mmap() 178 181 */ … … 183 186 184 187 185 /* 188 /* 186 189 * This function unmaps memory of the FB from the user's space 187 190 */ -
cpukit/libmisc/mw-fb/mw_fb.h
r8486081 raed742c 4 4 // 5 5 // Copyright (c) 2000 - Rosimildo da Silva 6 // 7 // MODULE DESCRIPTION: 6 // 7 // MODULE DESCRIPTION: 8 8 // Micro FrameBuffer interface for Embedded Systems. 9 9 // … … 11 11 // 12 12 // $Log$ 13 // Revision 1.1 2000/08/30 08:21:24 joel 14 // 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> 15 // 16 // * Added generic Micro FrameBuffer interface for MicroWindows. 17 // This interface allows MicroWindows to under RTEMS. A sample 18 // driver has been developed for the pc386 BSP. See 19 // pc386/fb_vga.c as a sample. 20 // * Added Uniform Input Device interface for MicroWindows. 21 // See PC386 bsp for sample drivers for mouse and keyboard (console). 22 // * mw-bf: New directory. 23 // * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb. 24 // * mw-fb/Makefile.am: New file. 25 // * mw-fb/mw_fb.c: New file. 26 // * mw-fb/mw_fb.h: New file. 27 // * mw-fb/mw_uid.c: New file. 28 // * mw-fb/mw_uid.h: New file. 29 // 13 30 // 14 31 ///////////////////////////////////////////////////////////////////////////// … … 78 95 #define FB_FUNC_GET_MODE 3 79 96 80 struct fb_exec_function 97 struct fb_exec_function 81 98 { 82 99 int func_no; … … 87 104 /* Micro Framebuffer API Wrapper */ 88 105 89 /* 106 /* 90 107 * This function returns the information regarding the display. 91 108 * It is called just after the driver be opened to get all needed … … 96 113 97 114 98 /* 99 * Returns the mode of the graphics subsystem 115 /* 116 * Returns the mode of the graphics subsystem 100 117 */ 101 118 extern int ufb_get_mode( int fd, int *mode ); 102 119 103 120 104 /* 105 * Returns the current collor pallete 121 /* 122 * Returns the current collor pallete 106 123 */ 107 124 extern int ufb_get_palette( int fd, struct fb_cmap *color ); 108 125 109 /* 110 * Set the current collor pallete 126 /* 127 * Set the current collor pallete 111 128 */ 112 129 extern int ufb_set_palette( int fd, struct fb_cmap *color ); 113 130 114 /* 115 * Does all necessary initialization to put the device in 116 * graphics mode 131 /* 132 * Does all necessary initialization to put the device in 133 * graphics mode 117 134 */ 118 135 extern int ufb_enter_graphics( int fd, int mode ); 119 136 120 137 121 /* 138 /* 122 139 * Switch the device back to the default mode of operation. 123 140 * In most cases it put the device back to plain text mode. … … 126 143 127 144 128 /* 129 * Tell the driver that the "virtual buffer" is dirty, and an update 130 * of it to the real device, maybe a serial/parallel LCD or whatever 131 * is required 145 /* 146 * Tell the driver that the "virtual buffer" is dirty, and an update 147 * of it to the real device, maybe a serial/parallel LCD or whatever 148 * is required 132 149 */ 133 150 extern int ufb_buffer_is_dirty( int fd ); 134 151 135 152 136 /* 153 /* 137 154 * This function maps the physical ( kernel mode ) address of the framebuffer device 138 155 * and maps it to the user space address. … … 142 159 143 160 144 /* 161 /* 145 162 * This function unmaps memory of the FB from the user's space 146 163 */ -
cpukit/libmisc/mw-fb/mw_uid.c
r8486081 raed742c 4 4 // 5 5 // Copyright (c) 2000 - Rosimildo da Silva 6 // 7 // MODULE DESCRIPTION: 6 // 7 // MODULE DESCRIPTION: 8 8 // This module implements the input devices interface used by MicroWindows 9 9 // in an embedded system environment. … … 14 14 // 15 15 // $Log$ 16 // Revision 1.6 2004/03/26 06:59:18 ralf 17 // 2004-03-26 Ralf Corsepius <ralf_corsepius@rtems.org> 18 // 19 // * libmisc/capture/capture-cli.c, libmisc/capture/capture.c, 20 // libmisc/capture/capture.h, libmisc/cpuuse/cpuuse.c, 21 // libmisc/devnull/devnull.c, libmisc/fsmount/fsmount.h, 22 // libmisc/monitor/mon-config.c, libmisc/monitor/mon-dname.c, 23 // libmisc/monitor/mon-driver.c, libmisc/monitor/mon-extension.c, 24 // libmisc/monitor/mon-itask.c, libmisc/monitor/mon-monitor.c, 25 // libmisc/monitor/mon-mpci.c, libmisc/monitor/mon-object.c, 26 // libmisc/monitor/mon-prmisc.c, libmisc/monitor/mon-queue.c, 27 // libmisc/monitor/mon-server.c, libmisc/monitor/mon-symbols.c, 28 // libmisc/monitor/monitor.h, libmisc/monitor/symbols.h, 29 // libmisc/mw-fb/mw_uid.c, libmisc/rtmonuse/rtmonuse.c, 30 // libmisc/serdbg/serdbg.h, libmisc/serdbg/serdbgio.c, 31 // libmisc/serdbg/termios_printk.c, libmisc/serdbg/termios_printk.h, 32 // libmisc/shell/shell.c, libmisc/shell/shell.h, libmisc/stackchk/check.c, 33 // libmisc/stackchk/internal.h: Convert to using c99 fixed size types. 34 // 16 35 // Revision 1.5 2003/07/08 08:38:48 ralf 17 36 // 2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de> … … 138 157 printk( "UID_Queue: id=%X\n", queue_id ); 139 158 #endif 140 } 159 } 141 160 open_count++; 142 161 return 0; … … 187 206 188 207 189 /* 208 /* 190 209 * add a message to the queue of events. This method cna be used to 191 210 * simulate hardware events, and it can be very handy during development … … 195 214 { 196 215 rtems_status_code status; 197 status = rtems_message_queue_send( queue_id, ( void * )m, 216 status = rtems_message_queue_send( queue_id, ( void * )m, 198 217 sizeof( struct MW_UID_MESSAGE ) ); 199 218 return status == RTEMS_SUCCESSFUL ? 0 : -1; 200 219 } 201 220 202 /* 221 /* 203 222 * register the device to insert events to the message 204 * queue named as the value passed in q_name 223 * queue named as the value passed in q_name 205 224 */ 206 225 int uid_register_device( int fd, const char *q_name ) … … 218 237 int uid_set_kbd_mode( int fd, int mode, int *old_mode ) 219 238 { 220 if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0) 239 if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0) 221 240 { 222 241 return -1; 223 242 } 224 if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 ) 243 if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 ) 225 244 { 226 245 return -1; -
cpukit/libmisc/mw-fb/mw_uid.h
r8486081 raed742c 4 4 // 5 5 // Copyright (c) 2000 - Rosimildo da Silva 6 // 7 // MODULE DESCRIPTION: 6 // 7 // MODULE DESCRIPTION: 8 8 // This module defines the interface for input devices used by MicroWindows 9 9 // in an embedded system environment. … … 12 12 // 13 13 // $Log$ 14 // Revision 1.1 2000/08/30 08:21:24 joel 15 // 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> 16 // 17 // * Added generic Micro FrameBuffer interface for MicroWindows. 18 // This interface allows MicroWindows to under RTEMS. A sample 19 // driver has been developed for the pc386 BSP. See 20 // pc386/fb_vga.c as a sample. 21 // * Added Uniform Input Device interface for MicroWindows. 22 // See PC386 bsp for sample drivers for mouse and keyboard (console). 23 // * mw-bf: New directory. 24 // * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb. 25 // * mw-fb/Makefile.am: New file. 26 // * mw-fb/mw_fb.c: New file. 27 // * mw-fb/mw_fb.h: New file. 28 // * mw-fb/mw_uid.c: New file. 29 // * mw-fb/mw_uid.h: New file. 30 // 14 31 // 15 32 ///////////////////////////////////////////////////////////////////////////// … … 22 39 #endif 23 40 24 /* 0x41XX -- IOCLT functions for the Micro Input Devices commands */ 41 /* 0x41XX -- IOCLT functions for the Micro Input Devices commands */ 25 42 #define MW_UID_REGISTER_DEVICE 0x4100 26 43 #define MW_UID_UNREGISTER_DEVICE 0x4101 … … 28 45 29 46 /* devices supported by MicroWindows */ 30 enum MW_INPUT_DEVICE_TYPE 47 enum MW_INPUT_DEVICE_TYPE 31 48 { 32 49 MV_UID_INVALID = 0, … … 54 71 /* keyboard modes -- default ASCII */ 55 72 #define MV_KEY_MODE_ASCII 0x01 56 /* 73 /* 57 74 * This mode one event is sent when a key is pressed, 58 75 * and another one is send when a key is released. … … 69 86 70 87 /* 71 * Message generated by input devices controlled by MicroWindows. 88 * Message generated by input devices controlled by MicroWindows. 72 89 */ 73 90 struct MW_UID_MESSAGE … … 103 120 /* 104 121 * API for creating/closing/accessing the message queue used by the micro 105 * input device interface. All functions in this interface returns a 122 * input device interface. All functions in this interface returns a 106 123 * zero ( 0 ) on success. One exception for that is the "read" routine 107 124 * that returns the number of bytes read. Negaive numbers indicate errors … … 118 135 extern int uid_close_queue( void ); 119 136 120 /* 121 * reads a message from the queue. It waits up to the specified 137 /* 138 * reads a message from the queue. It waits up to the specified 122 139 * timeout in mili-seconds. 123 140 */ -
cpukit/libmisc/rtmonuse/rtmonuse.c
r8486081 raed742c 39 39 40 40 maximum = _Configuration_Table->RTEMS_api_configuration->maximum_periods; 41 41 42 42 Period_usage_Information = malloc( sizeof(Period_usage_t) * (maximum+1) ); 43 43 … … 59 59 i++ ) { 60 60 the_usage = &Period_usage_Information[ i ]; 61 61 62 62 the_usage->count = 0; 63 63 the_usage->missed_count = 0; … … 68 68 the_usage->max_wall_time = 0; 69 69 the_usage->total_wall_time = 0; 70 70 71 71 } 72 72 } … … 77 77 */ 78 78 79 void Period_usage_Update( 79 void Period_usage_Update( 80 80 rtems_id id 81 81 ) … … 136 136 uint32_t api_index; 137 137 Objects_Information *information; 138 138 139 139 if ( !Period_usage_Information ) { 140 140 printf( "Period statistics library is not initialized\n" ); … … 142 142 } 143 143 144 printf( "Period information by period\n" ); 144 printf( "Period information by period\n" ); 145 145 printf( " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" ); 146 146 -
cpukit/libmisc/rtmonuse/rtmonuse.h
r8486081 raed742c 10 10 void Period_usage_Reset( void ); 11 11 12 void Period_usage_Update( 12 void Period_usage_Update( 13 13 rtems_id id 14 14 ); -
cpukit/libmisc/serdbg/serdbg.c
r8486081 raed742c 17 17 | 04.04.02 creation doe | 18 18 \*===============================================================*/ 19 /* 19 /* 20 20 * $Id$ 21 21 */ … … 61 61 } 62 62 is_initialized = TRUE; 63 /* 63 /* 64 64 * try to open serial device 65 65 */ 66 66 if (rc == RTEMS_SUCCESSFUL) { 67 if ((serdbg_conf.open_io != NULL) && 67 if ((serdbg_conf.open_io != NULL) && 68 68 (0 > serdbg_conf.open_io(serdbg_conf.devname,serdbg_conf.baudrate))) { 69 69 fprintf(stderr, … … 82 82 * now activate gdb stub 83 83 */ 84 if ((rc == RTEMS_SUCCESSFUL) && 84 if ((rc == RTEMS_SUCCESSFUL) && 85 85 !serdbg_conf.skip_init_bkpt) { 86 86 breakpoint(); -
cpukit/libmisc/serdbg/serdbg.h
r8486081 raed742c 17 17 | 04.04.02 creation doe | 18 18 \*===============================================================*/ 19 /* 20 * $Id$ 19 /* 20 * $Id$ 21 21 */ 22 22 #ifndef _SERDBG_H -
cpukit/libmisc/serdbg/serdbgcnf.h
r8486081 raed742c 17 17 | 13.05.02 creation doe | 18 18 \*===============================================================*/ 19 /* 19 /* 20 20 * $Id$ 21 21 */ … … 60 60 61 61 CONFIGURE_SERDBG_DEVNAME, 62 62 63 63 #ifdef CONFIGURE_SERDBG_SKIP_INIT_BKPT 64 64 TRUE, -
cpukit/libmisc/serdbg/serdbgio.c
r8486081 raed742c 107 107 * skip any fds that are between 0..2, because they are 108 108 * reserved for stdin/out/err 109 */ 109 */ 110 110 if (!err_occurred && 111 111 (dev_name != NULL) && … … 126 126 } 127 127 } 128 } while (!err_occurred && 128 } while (!err_occurred && 129 129 (serdbg_fd < 3)); 130 130 } … … 138 138 139 139 /* 140 * capture tty structure 140 * capture tty structure 141 141 */ 142 142 if (!err_occurred) { … … 145 145 } 146 146 /* 147 * set device baudrate 147 * set device baudrate 148 148 * (and transp mode, this is not really needed) 149 149 * ... … … 157 157 } 158 158 if (!err_occurred) { 159 act_termios.c_iflag 159 act_termios.c_iflag 160 160 &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP 161 161 |INLCR|IGNCR|ICRNL|IXON); 162 act_termios.c_oflag 162 act_termios.c_oflag 163 163 &= ~OPOST; 164 164 165 165 act_termios.c_lflag 166 166 &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); … … 173 173 } 174 174 } 175 return (err_occurred 176 ? -1 175 return (err_occurred 176 ? -1 177 177 : 0); 178 178 } … … 198 198 { 199 199 /* 200 * call serdbg polling callout, if available 200 * call serdbg polling callout, if available 201 201 */ 202 202 if (serdbg_conf.callout != NULL) { … … 206 206 * check, whether debug serial port is available 207 207 */ 208 if ((serdbg_tty != NULL) && 208 if ((serdbg_tty != NULL) && 209 209 (serdbg_tty->device.write != NULL)) { 210 210 /* … … 238 238 * check, whether debug serial port is available 239 239 */ 240 if ((serdbg_tty != NULL) && 240 if ((serdbg_tty != NULL) && 241 241 (serdbg_tty->device.pollRead != NULL)) { 242 242 do { 243 243 /* 244 * call serdbg polling callout, if available 244 * call serdbg polling callout, if available 245 245 */ 246 246 if (serdbg_conf.callout != NULL) { -
cpukit/libmisc/serdbg/termios_printk.c
r8486081 raed742c 74 74 */ 75 75 76 if ((termios_printk_tty != NULL) && 76 if ((termios_printk_tty != NULL) && 77 77 (termios_printk_tty->device.write != NULL)) { 78 78 /* 79 * call termios_printk polling callout, if available 79 * call termios_printk polling callout, if available 80 80 */ 81 81 if (termios_printk_conf.callout != NULL) { … … 85 85 * send character to debug serial port 86 86 */ 87 if (c == '\n') { 87 if (c == '\n') { 88 88 termios_printk_tty->device.write(termios_printk_tty->minor,&cr,1); 89 89 } … … 114 114 * check, whether debug serial port is available 115 115 */ 116 if ((termios_printk_tty != NULL) && 116 if ((termios_printk_tty != NULL) && 117 117 (termios_printk_tty->device.pollRead != NULL)) { 118 118 do { 119 119 /* 120 * call termios_printk polling callout, if available 120 * call termios_printk polling callout, if available 121 121 */ 122 122 if (termios_printk_conf.callout != NULL) { … … 157 157 struct termios act_termios; 158 158 tcflag_t baudcode = B0; 159 159 160 160 if (termios_printk_fd >= 0) { 161 161 /* … … 191 191 /* 192 192 * open device for serdbg operation 193 */ 193 */ 194 194 if (!err_occurred && 195 195 (dev_name != NULL) && … … 201 201 } 202 202 /* 203 * capture tty structure 203 * capture tty structure 204 204 */ 205 205 if (!err_occurred) { … … 208 208 } 209 209 /* 210 * set device baudrate 210 * set device baudrate 211 211 * (and transp mode, this is not really needed) 212 212 * ... … … 232 232 BSP_poll_char = termios_printk_inputchar; 233 233 } 234 return (err_occurred 235 ? -1 234 return (err_occurred 235 ? -1 236 236 : 0); 237 237 } -
cpukit/libmisc/serdbg/termios_printk.h
r8486081 raed742c 17 17 | 13.04.02 creation doe | 18 18 \*===============================================================*/ 19 /* 19 /* 20 20 * $Id$ 21 21 */ -
cpukit/libmisc/serdbg/termios_printk_cnf.h
r8486081 raed742c 17 17 | 13.05.02 creation doe | 18 18 \*===============================================================*/ 19 /* 19 /* 20 20 * $Id$ 21 21 */ … … 53 53 NULL, 54 54 #endif 55 CONFIGURE_TERMIOS_PRINTK_DEVNAME, 55 CONFIGURE_TERMIOS_PRINTK_DEVNAME, 56 56 }; 57 57 #endif -
cpukit/libmisc/shell/cmds.c
r8486081 raed742c 6 6 * 7 7 * This file is inspired in rtems_monitor & Chris John MyRightBoot 8 * 8 * 9 9 * But I want to make it more user friendly 10 10 * A 'monitor' command is added to adapt the call rtems monitor commands 11 11 * at my call procedure 12 * 13 * TODO: A lot of improvements of course. 12 * 13 * TODO: A lot of improvements of course. 14 14 * cp, mv, ... 15 15 * hexdump, 16 * 16 * 17 17 * More? Say me it, please... 18 * 18 * 19 19 * The BSP Specific are not welcome here. 20 * 20 * 21 21 * C&S welcome... 22 22 * … … 54 54 * ----------------------------------------------- */ 55 55 int str2int(char * s) { 56 int sign=1; 56 int sign=1; 57 57 int base=10; 58 58 int value=0; … … 79 79 break; 80 80 } 81 }; 81 }; 82 82 while (*s) { 83 83 switch(*s) { … … 93 93 case '9':digit=*s-'0'; 94 94 break; 95 case 'A': 96 case 'B': 97 case 'C': 98 case 'D': 99 case 'E': 95 case 'A': 96 case 'B': 97 case 'C': 98 case 'D': 99 case 'E': 100 100 case 'F':digit=*s-'A'+10; 101 101 break; 102 case 'a': 103 case 'b': 104 case 'c': 105 case 'd': 106 case 'e': 102 case 'a': 103 case 'b': 104 case 'c': 105 case 'd': 106 case 'e': 107 107 case 'f':digit=*s-'a'+10; 108 108 break; 109 default:return value*sign; 109 default:return value*sign; 110 110 }; 111 111 if (digit>base) return value*sign; … … 114 114 }; 115 115 }; 116 return value*sign; 116 return value*sign; 117 117 } 118 118 /*----------------------------------------------------------------------------* … … 220 220 #ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */ 221 221 int main_malloc_dump(int argc,char * argv[]) { 222 void malloc_dump(void); 223 malloc_dump(); 222 void malloc_dump(void); 223 malloc_dump(); 224 224 return 0; 225 225 } … … 235 235 236 236 rtems_interrupt_disable (level); 237 for (;;) 237 for (;;) 238 238 ; 239 239 return 0; … … 252 252 }; 253 253 return 0; 254 } 255 /*-----------------------------------------------------------* 254 } 255 /*-----------------------------------------------------------* 256 256 * Directory commands 257 257 *-----------------------------------------------------------*/ … … 287 287 if (stat(nbuf, &stat_buf) == 0) 288 288 { /* AWFUL buts works...*/ 289 strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime)); 289 strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime)); 290 290 pwd=getpwuid(stat_buf.st_uid); 291 291 user=pwd?pwd->pw_name:"nouser"; … … 305 305 (stat_buf.st_mode & S_IXOTH)?('x'):('-'), 306 306 (int)stat_buf.st_nlink, 307 user,group, 307 user,group, 308 308 (int)stat_buf.st_size, 309 309 sbuf, … … 318 318 return 0; 319 319 } 320 /*-----------------------------------------------------------*/ 320 /*-----------------------------------------------------------*/ 321 321 int main_pwd (int argc, char *argv[]) { 322 322 char dir[1024]; … … 325 325 return 0; 326 326 } 327 /*-----------------------------------------------------------*/ 327 /*-----------------------------------------------------------*/ 328 328 int main_chdir (int argc, char *argv[]) { 329 329 char *dir; … … 333 333 printf("chdir to '%s' failed:%s\n",dir,strerror(errno)); 334 334 return errno; 335 }; 336 return 0; 337 } 338 /*-----------------------------------------------------------*/ 335 }; 336 return 0; 337 } 338 /*-----------------------------------------------------------*/ 339 339 int main_mkdir (int argc, char *argv[]) { 340 340 char *dir; … … 345 345 if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) { 346 346 printf("mkdir '%s' failed:%s\n",dir,strerror(errno)); 347 }; 348 }; 347 }; 348 }; 349 349 return errno; 350 350 } 351 /*-----------------------------------------------------------*/ 351 /*-----------------------------------------------------------*/ 352 352 int main_rmdir (int argc, char *argv[]) 353 353 { … … 361 361 return errno; 362 362 } 363 /*-----------------------------------------------------------*/ 363 /*-----------------------------------------------------------*/ 364 364 int main_chroot(int argc,char * argv[]) { 365 365 char * new_root="/"; … … 371 371 return 0; 372 372 } 373 /*-----------------------------------------------------------*/ 373 /*-----------------------------------------------------------*/ 374 374 int main_cat (int argc, char *argv[]) 375 375 { … … 379 379 return 0; 380 380 } 381 /*-----------------------------------------------------------*/ 381 /*-----------------------------------------------------------*/ 382 382 int main_rm (int argc, char *argv[]) 383 383 { … … 393 393 return 0; 394 394 } 395 /*-----------------------------------------------------------*/ 395 /*-----------------------------------------------------------*/ 396 396 /* date - print time and date */ 397 397 398 int main_date(int argc,char *argv[]) 398 int main_date(int argc,char *argv[]) 399 399 { 400 400 time_t t; … … 404 404 } 405 405 /*-----------------------------------------------------------*/ 406 int main_logoff(int argc,char *argv[]) 407 { 408 printf("logoff from the system..."); 409 current_shell_env->exit_shell=TRUE; 410 return 0; 411 } 412 /*-----------------------------------------------------------*/ 413 int main_tty (int argc,char *argv[]) 406 int main_logoff(int argc,char *argv[]) 407 { 408 printf("logoff from the system..."); 409 current_shell_env->exit_shell=TRUE; 410 return 0; 411 } 412 /*-----------------------------------------------------------*/ 413 int main_tty (int argc,char *argv[]) 414 414 { 415 415 printf("%s\n",ttyname(fileno(stdin))); … … 417 417 } 418 418 /*-----------------------------------------------------------*/ 419 int main_whoami(int argc,char *argv[]) 419 int main_whoami(int argc,char *argv[]) 420 420 { 421 421 struct passwd * pwd; … … 425 425 } 426 426 /*-----------------------------------------------------------*/ 427 int main_id (int argc,char *argv[]) 427 int main_id (int argc,char *argv[]) 428 428 { 429 429 struct passwd * pwd; … … 442 442 } 443 443 /*-----------------------------------------------------------*/ 444 int main_umask(int argc,char *argv[]) 444 int main_umask(int argc,char *argv[]) 445 445 { 446 446 mode_t msk=umask(0); … … 453 453 } 454 454 /*-----------------------------------------------------------*/ 455 int main_chmod(int argc,char *argv[]) 455 int main_chmod(int argc,char *argv[]) 456 456 { 457 457 int n; … … 464 464 return 0; 465 465 } 466 /*-----------------------------------------------------------* 466 /*-----------------------------------------------------------* 467 467 * with this you can call at all the rtems monitor commands. 468 468 * Not all work fine but you can show the rtems status and more. 469 *-----------------------------------------------------------*/ 469 *-----------------------------------------------------------*/ 470 470 int main_monitor(int argc,char * argv[]) { 471 471 rtems_monitor_command_entry_t *command; … … 477 477 return 0; 478 478 } 479 /*-----------------------------------------------------------*/ 479 /*-----------------------------------------------------------*/ 480 480 void register_cmds(void) { 481 481 rtems_monitor_command_entry_t *command; … … 504 504 /* misc. topic */ 505 505 shell_add_cmd ("logoff","misc","logoff from the system" ,main_logoff); 506 shell_alias_cmd("logoff","exit"); 506 shell_alias_cmd("logoff","exit"); 507 507 shell_add_cmd ("date" ,"misc","date" ,main_date); 508 508 shell_add_cmd ("reset","misc","reset the BSP" ,main_reset); … … 522 522 #ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */ 523 523 shell_add_cmd ("malloc","mem","mem show memory malloc'ed" ,main_mem); 524 #endif 525 } 526 /*-----------------------------------------------------------*/ 524 #endif 525 } 526 /*-----------------------------------------------------------*/ -
cpukit/libmisc/shell/shell.c
r8486081 raed742c 3 3 * Instantatiate a new terminal shell. 4 4 * 5 * Author: 5 * Author: 6 6 * 7 * WORK: fernando.ruiz@ctv.es 7 * WORK: fernando.ruiz@ctv.es 8 8 * HOME: correo@fernando-ruiz.com 9 9 * … … 23 23 #include <rtems/error.h> 24 24 #include <rtems/libio.h> 25 #include <rtems/libio_.h> 26 #include <rtems/system.h> 25 #include <rtems/libio_.h> 26 #include <rtems/system.h> 27 27 #include <rtems/shell.h> 28 28 … … 66 66 static shell_topic_t * shell_first_topic; 67 67 /* ----------------------------------------------- * 68 * Using Chain I can reuse the rtems code. 68 * Using Chain I can reuse the rtems code. 69 69 * I am more comfortable with this, sorry. 70 70 * ----------------------------------------------- */ … … 82 82 shell_topic_t * current,*aux; 83 83 if (!shell_first_topic) { 84 aux=malloc(sizeof(shell_topic_t)); 84 aux=malloc(sizeof(shell_topic_t)); 85 85 aux->topic=topic; 86 86 aux->next=(shell_topic_t*)NULL; … … 92 92 if (!strcmp(topic,current->next->topic)) return current->next; 93 93 current=current->next; 94 }; 95 aux=malloc(sizeof(shell_topic_t)); 94 }; 95 aux=malloc(sizeof(shell_topic_t)); 96 96 aux->topic=topic; 97 97 aux->next=(shell_topic_t*)NULL; … … 186 186 if (shell_cmd->alias) { 187 187 printf("is an <alias> for command '%s'",shell_cmd->alias->name); 188 } else 188 } else 189 189 if (shell_cmd->usage) { 190 190 pc=shell_cmd->usage; … … 199 199 break; 200 200 }; 201 pc++; 201 pc++; 202 202 if(col>78) { /* What daring... 78?*/ 203 203 if (*pc) { … … 209 209 printf(" "); 210 210 col=12;line++; 211 }; 211 }; 212 212 }; 213 213 }; … … 221 221 * ----------------------------------------------- */ 222 222 int shell_help(int argc,char * argv[]) { 223 int col,line,arg; 223 int col,line,arg; 224 224 shell_topic_t *topic; 225 225 shell_cmd_t * shell_cmd=shell_first_cmd; 226 226 if (argc<2) { 227 printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n" 228 " TOPIC? The topics are\n"); 227 printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n" 228 " TOPIC? The topics are\n"); 229 229 topic=shell_first_topic; 230 230 col=0; … … 238 238 } else { 239 239 col+=printf(", %s",topic->topic); 240 }; 240 }; 241 241 }; 242 242 topic=topic->next; … … 265 265 line++; 266 266 while (shell_cmd) { 267 if (!strcmp(topic->topic,shell_cmd->topic)) 267 if (!strcmp(topic->topic,shell_cmd->topic)) 268 268 line+=shell_help_cmd(shell_cmd); 269 269 if (line>16) { … … 274 274 shell_cmd=shell_cmd->next; 275 275 }; 276 }; 276 }; 277 277 puts(""); 278 278 return 0; … … 285 285 col=0; 286 286 if (*line) { 287 col=strlen(line); 287 col=strlen(line); 288 288 if (out) fprintf(out,"%s",line); 289 289 }; … … 291 291 if (out) tcdrain(fileno(out)); 292 292 for (;;) { 293 line[col]=0; 293 line[col]=0; 294 294 c=fgetc(in); 295 295 switch (c) { … … 300 300 case '\f':if (out) fputc('\f',out); 301 301 case 0x03:/*Control-C*/ 302 line[0]=0; 302 line[0]=0; 303 303 case '\r':if (out) fputc('\n',out); 304 304 return 1; … … 317 317 default :if (!iscntrl(c)) { 318 318 if (col<size-1) { 319 line[col++]=c; 319 line[col++]=c; 320 320 if (out) fputc(c,out); 321 321 } else { … … 323 323 }; 324 324 } else { 325 if (out) 325 if (out) 326 326 if (c=='\a') fputc('\a',out); 327 327 }; … … 331 331 } 332 332 /* ----------------------------------------------- * 333 * - The shell TASK 333 * - The shell TASK 334 334 * Poor but enough.. 335 335 * TODO: Redirection. Tty Signals. ENVVARs. Shell language. 336 336 * ----------------------------------------------- */ 337 337 shell_env_t global_shell_env , 338 * current_shell_env=&global_shell_env; 339 340 extern char **environ; 338 * current_shell_env=&global_shell_env; 339 340 extern char **environ; 341 341 342 342 void cat_file(FILE * out,char * name) { … … 349 349 fclose(fd); 350 350 }; 351 }; 351 }; 352 352 } 353 353 … … 358 358 fwrite(content,1,strlen(content),fd); 359 359 fclose(fd); 360 }; 360 }; 361 361 } 362 362 … … 367 367 issue_inited=TRUE; 368 368 getpwnam("root"); /* dummy call to init /etc dir */ 369 if (stat("/etc/issue",&buf)) 369 if (stat("/etc/issue",&buf)) 370 370 write_file("/etc/issue", 371 371 "Welcome to @V\\n" 372 372 "Login into @S(@L)\\n"); 373 if (stat("/etc/issue.net",&buf)) 373 if (stat("/etc/issue.net",&buf)) 374 374 write_file("/etc/issue.net", 375 375 "Welcome to %v\n" … … 416 416 break; 417 417 }; 418 } else 418 } else 419 419 if (c=='\\') { 420 420 switch(c=fgetc(fd)) { … … 430 430 }; 431 431 } else { 432 fputc(c,out); 433 }; 432 fputc(c,out); 433 }; 434 434 }; 435 435 fclose(fd); 436 } 437 } else { 436 } 437 } else { 438 438 fd=fopen("/etc/issue.net","r"); 439 439 if (fd) { … … 464 464 }; 465 465 } else { 466 fputc(c,out); 467 }; 466 fputc(c,out); 467 }; 468 468 }; 469 469 fclose(fd); 470 } 470 } 471 471 }; 472 472 }; … … 484 484 if ((passwd=getpwnam(name))) { 485 485 if (strcmp(passwd->pw_passwd,"!")) { /* valid user */ 486 setuid(passwd->pw_uid); 487 setgid(passwd->pw_gid); 486 setuid(passwd->pw_uid); 487 setgid(passwd->pw_gid); 488 488 rtems_current_user_env->euid= 489 489 rtems_current_user_env->egid=0; 490 490 chown(current_shell_env->devname,passwd->pw_uid,0); 491 rtems_current_user_env->euid=passwd->pw_uid; 492 rtems_current_user_env->egid=passwd->pw_gid; 491 rtems_current_user_env->euid=passwd->pw_uid; 492 rtems_current_user_env->egid=passwd->pw_gid; 493 493 if (!strcmp(passwd->pw_passwd,"*")) { 494 494 /* /etc/shadow */ … … 514 514 rtems_status_code sc; 515 515 516 struct termios term; 516 struct termios term; 517 517 char * devname; 518 518 … … 525 525 sc=rtems_task_variable_add(RTEMS_SELF,(void*)¤t_shell_env,free); 526 526 if (sc!=RTEMS_SUCCESSFUL) { 527 rtems_error(sc,"rtems_task_variable_add(current_shell_env):"); 527 rtems_error(sc,"rtems_task_variable_add(current_shell_env):"); 528 528 rtems_task_delete(RTEMS_SELF); 529 }; 530 531 current_shell_env=shell_env; 532 529 }; 530 531 current_shell_env=shell_env; 532 533 533 sc=rtems_libio_set_private_env(); 534 534 if (sc!=RTEMS_SUCCESSFUL) { 535 rtems_error(sc,"rtems_libio_set_private_env():"); 535 rtems_error(sc,"rtems_libio_set_private_env():"); 536 536 rtems_task_delete(RTEMS_SELF); 537 }; 537 }; 538 538 539 539 … … 545 545 546 546 stdin =fopen(devname,"r+"); 547 547 548 548 if (!stdin) { 549 549 fprintf(stderr,"shell:unable to open stdin.%s:%s\n",devname,strerror(errno)); … … 579 579 shell_add_cmd(NULL,NULL,NULL,NULL); /* init the chain list*/ 580 580 do { 581 /* Set again root user and root filesystem, side effect of set_priv..*/ 581 /* Set again root user and root filesystem, side effect of set_priv..*/ 582 582 sc=rtems_libio_set_private_env(); 583 583 if (sc!=RTEMS_SUCCESSFUL) { 584 rtems_error(sc,"rtems_libio_set_private_env():"); 584 rtems_error(sc,"rtems_libio_set_private_env():"); 585 585 rtems_task_delete(RTEMS_SELF); 586 586 }; … … 594 594 shell_env->exit_shell=FALSE; 595 595 for (;;) { 596 /* Prompt section */ 596 /* Prompt section */ 597 597 /* XXX: show_prompt user adjustable */ 598 598 getcwd(curdir,sizeof(curdir)); 599 599 printf("%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#'); 600 /* getcmd section */ 600 /* getcmd section */ 601 601 if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/ 602 /* evaluate cmd section */ 602 /* evaluate cmd section */ 603 603 if (!strcmp(cmd,"e")) { /* edit last command */ 604 604 strcpy(cmd,last_cmd); 605 605 continue; 606 } else 606 } else 607 607 if (!strcmp(cmd,"r")) { /* repeat last command */ 608 608 strcpy(cmd,last_cmd); 609 } else 609 } else 610 610 if (strcmp(cmd,"")) { /* only for get a new prompt */ 611 611 strcpy(last_cmd,cmd); 612 }; 613 /* exec cmd section */ 614 /* TODO: 615 * To avoid user crash catch the signals. 612 }; 613 /* exec cmd section */ 614 /* TODO: 615 * To avoid user crash catch the signals. 616 616 * Open a new stdio files with posibility of redirection * 617 617 * Run in a new shell task background. (unix &) 618 618 * Resuming. A little bash. 619 */ 619 */ 620 620 if (shell_make_args(cmd,&argc,argv)) { 621 621 if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) { … … 626 626 }; 627 627 }; 628 /* end exec cmd section */ 628 /* end exec cmd section */ 629 629 if (shell_env->exit_shell) break; 630 630 cmd[0]=0; … … 634 634 } while (shell_env->forever); 635 635 fclose(stdin ); 636 fclose(stdout); 636 fclose(stdout); 637 637 fclose(stderr); 638 638 rtems_task_delete(RTEMS_SELF); … … 655 655 &task_id); 656 656 if (sc!=RTEMS_SUCCESSFUL) { 657 rtems_error(sc,"creating task %s in shell_init()",task_name); 657 rtems_error(sc,"creating task %s in shell_init()",task_name); 658 658 return sc; 659 }; 659 }; 660 660 shell_env=malloc(sizeof(shell_env_t)); 661 661 if (!shell_env) { 662 662 rtems_task_delete(task_id); 663 sc=RTEMS_NO_MEMORY; 664 rtems_error(sc,"allocating shell_env %s in shell_init()",task_name); 663 sc=RTEMS_NO_MEMORY; 664 rtems_error(sc,"allocating shell_env %s in shell_init()",task_name); 665 665 return sc; 666 666 }; … … 672 672 global_shell_env.exit_shell=0; 673 673 global_shell_env.forever =TRUE; 674 }; 675 shell_env->magic =global_shell_env.magic; 674 }; 675 shell_env->magic =global_shell_env.magic; 676 676 shell_env->devname =devname; 677 677 shell_env->taskname =task_name; -
cpukit/libmisc/shell/shell.h
r8486081 raed742c 3 3 * Instantatiate a new terminal shell. 4 4 * 5 * Author: 5 * Author: 6 6 * 7 * WORK: fernando.ruiz@ctv.es 7 * WORK: fernando.ruiz@ctv.es 8 8 * HOME: correo@fernando-ruiz.com 9 9 * … … 19 19 #ifdef __cplusplus 20 20 extern "C" { 21 #endif 21 #endif 22 22 23 #include <rtems.h> 24 #include <stdio.h> 25 #include <termios.h> 23 #include <rtems.h> 24 #include <stdio.h> 25 #include <termios.h> 26 26 27 27 typedef int (*shell_command_t)(int argc,char * argv[]); … … 52 52 53 53 typedef struct { 54 rtems_name magic; /* 'S','E','N','V': Shell Environment */ 54 rtems_name magic; /* 'S','E','N','V': Shell Environment */ 55 55 char * devname; 56 56 char * taskname; … … 66 66 void cat_file(FILE * out,char *name); 67 67 void write_file(char *name,char * content); 68 68 69 69 rtems_status_code shell_init(char * task_name , 70 70 uint32_t task_stacksize,/*0 default*/ … … 72 72 char * devname , 73 73 tcflag_t tcflag , 74 int forever ); 74 int forever ); 75 75 76 76 extern shell_env_t global_shell_env, 77 77 * current_shell_env; 78 78 /*--------*/ 79 /* cmds.c */ 79 /* cmds.c */ 80 80 /*--------*/ 81 81 int str2int(char * s); 82 82 void register_cmds(void); 83 83 84 84 #ifdef __cplusplus 85 85 } 86 #endif 86 #endif 87 87 88 88 #endif -
cpukit/libmisc/stackchk/check.c
r8486081 raed742c 530 530 ); 531 531 532 for ( api_index = 1 ; 533 api_index <= OBJECTS_APIS_LAST ; 532 for ( api_index = 1 ; 533 api_index <= OBJECTS_APIS_LAST ; 534 534 api_index++ ) { 535 535 if ( !_Objects_Information_table[ api_index ] ) -
cpukit/libmisc/untar/untar.c
r8486081 raed742c 48 48 * 512 (s+p)bytes File contents (s+p) := (((s) + 511) & ~511), 49 49 * round up to 512 bytes 50 * 50 * 51 51 * Checksum: 52 52 * int i, sum; … … 166 166 167 167 /****************************************************************** 168 * Compute the TAR checksum and check with the value in 168 * Compute the TAR checksum and check with the value in 169 169 * the archive. The checksum is computed over the entire 170 170 * header, but the checksum field is substituted with blanks. … … 313 313 314 314 /****************************************************************** 315 * Compute the TAR checksum and check with the value in 315 * Compute the TAR checksum and check with the value in 316 316 * the archive. The checksum is computed over the entire 317 317 * header, but the checksum field is substituted with blanks.
Note: See TracChangeset
for help on using the changeset viewer.