Changeset aed742c in rtems


Ignore:
Timestamp:
Apr 16, 2004, 12:06:28 PM (16 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
3906b3ea
Parents:
8486081
Message:

Remove stray white spaces.

Location:
cpukit/libmisc
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/capture/capture-cli.c

    r8486081 raed742c  
    33  $Id$
    44  ------------------------------------------------------------------------
    5  
     5
    66  Copyright Objective Design Systems Pty Ltd, 2002
    77  All rights reserved Objective Design Systems Pty Ltd, 2002
     
    1515
    1616  This software with is provided ``as is'' and with NO WARRANTY.
    17  
     17
    1818  ------------------------------------------------------------------------
    1919
     
    6464static void
    6565rtems_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,
    6969  boolean verbose )
    7070{
     
    113113  if (!enable)
    114114    return;
    115  
     115
    116116  sc = rtems_capture_control (enable);
    117117
     
    136136static void
    137137rtems_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,
    141141  boolean verbose )
    142142{
     
    165165static void
    166166rtems_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,
    170170  boolean verbose )
    171171{
     
    194194static void
    195195rtems_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,
    199199  boolean verbose )
    200200{
     
    223223static void
    224224rtems_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,
    228228  boolean verbose )
    229229{
     
    314314  rtems_task_priority floor = rtems_capture_watch_get_floor ();
    315315  int                 last_count = 0;
    316  
     316
    317317  printf ("\x1b[2J Press ENTER to exit.\n\n");
    318318  printf ("     PID NAME RPRI CPRI STATE  %%CPU     %%STK FLGS   EXEC TIME\n");
    319319
    320320  for (;;)
    321   { 
     321  {
    322322    rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
    323323    unsigned long long    load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
     
    329329
    330330    cli_load_thread_active = 1;
    331    
     331
    332332    /*
    333333     * Iterate over the tasks and sort the highest load tasks
     
    335335     * tasks.
    336336     */
    337    
     337
    338338    memset (tasks, 0, sizeof (tasks));
    339339    memset (load, 0, sizeof (load));
    340340
    341341    task = rtems_capture_get_task_list ();
    342  
     342
    343343    while (task)
    344344    {
     
    367367          break;
    368368        }
    369       }     
     369      }
    370370      task = rtems_capture_next_task (task);
    371371    }
     
    374374
    375375    total_time = 0;
    376    
     376
    377377    for (i = 0; i < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS; i++)
    378378      total_time += load[i];
     
    392392      if (!tasks[i])
    393393        break;
    394      
     394
    395395      j--;
    396396
     
    426426      else
    427427        printf ("%c%c",
    428                 rtems_capture_task_control (tasks[i]) ? 
     428                rtems_capture_task_control (tasks[i]) ?
    429429                (rtems_capture_task_control_flags (tasks[i]) &
    430430                 RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
    431431                rtems_capture_watch_global_on () ? 'g' : '-');
    432      
     432
    433433      printf ("   %qi\n", rtems_capture_task_time (tasks[i]));
    434434    }
     
    443443
    444444    cli_load_thread_active = 0;
    445    
     445
    446446    rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (5000000));
    447447  }
     
    459459static void
    460460rtems_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,
    464464  boolean verbose )
    465465{
     
    468468  rtems_name          name;
    469469  rtems_id            id;
    470  
     470
    471471  sc = rtems_task_set_priority (RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
    472472
     
    476476    return;
    477477  }
    478  
     478
    479479  memcpy (&name, "CPlt", 4);
    480  
     480
    481481  sc = rtems_task_create (name, priority, 1024,
    482482                          RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
    483483                          RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
    484484                          &id);
    485  
    486   if (sc != RTEMS_SUCCESSFUL) 
     485
     486  if (sc != RTEMS_SUCCESSFUL)
    487487  {
    488488    printf ("error: cannot create helper thread: %s\n", rtems_status_text (sc));
     
    491491
    492492  sc = rtems_task_start (id, rtems_capture_cli_task_load_thread, 0);
    493  
    494   if (sc != RTEMS_SUCCESSFUL) 
     493
     494  if (sc != RTEMS_SUCCESSFUL)
    495495  {
    496496    printf ("error: cannot start helper thread: %s\n", rtems_status_text (sc));
     
    506506    {
    507507      int loops = 20;
    508      
     508
    509509      while (loops && cli_load_thread_active)
    510510        rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (100000));
     
    530530static void
    531531rtems_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,
    535535  boolean verbose )
    536536{
     
    538538  rtems_task_priority      ceiling = rtems_capture_watch_get_ceiling ();
    539539  rtems_task_priority      floor = rtems_capture_watch_get_floor ();
    540  
     540
    541541  printf ("watch priority ceiling is %i\n", ceiling);
    542542  printf ("watch priority floor is %i\n", floor);
     
    550550    int fshowed;
    551551    int lf;
    552    
     552
    553553    printf (" ");
    554554    rtems_monitor_dump_id (rtems_capture_control_id (control));
     
    569569        lf = 0;
    570570      }
    571      
     571
    572572      /*
    573573       * FIXME: name test.
     
    620620   * See if the arg is all hex digits.
    621621   */
    622  
     622
    623623  l = strlen (arg);
    624624
     
    628628
    629629  *id = strtoul (arg, 0, 16);
    630      
     630
    631631  objclass = _Objects_Get_class (*id);
    632  
     632
    633633  if ((i == l))
    634634    *valid_id = 1;
     
    656656static void
    657657rtems_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,
    661661  boolean verbose )
    662662{
     
    718718static void
    719719rtems_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,
    723723  boolean verbose )
    724724{
     
    779779static void
    780780rtems_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,
    784784  boolean verbose )
    785785{
     
    845845static void
    846846rtems_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,
    850850  boolean verbose )
    851851{
     
    899899static void
    900900rtems_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,
    904904  boolean verbose )
    905905{
     
    950950static void
    951951rtems_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,
    955955  boolean verbose )
    956956{
     
    10011001static void
    10021002rtems_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,
    10061006  boolean verbose )
    10071007{
     
    11571157static void
    11581158rtems_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,
    11621162  boolean verbose )
    11631163{
     
    11701170  rtems_capture_record_t* rec;
    11711171  int                     arg;
    1172  
     1172
    11731173  for (arg = 1; arg < argc; arg++)
    11741174  {
     
    11971197            return;
    11981198          }
    1199            
     1199
    12001200        dump_total = strtoul (argv[arg], 0, 0);
    12011201      }
     
    12061206
    12071207  total = dump_total;
    1208  
     1208
    12091209  while (total)
    12101210  {
     
    12201220    if (read == 0)
    12211221      break;
    1222    
     1222
    12231223    for (count = 0; count < read; count++, rec++)
    12241224    {
     
    12371237
    12381238        event = rec->events >> RTEMS_CAPTURE_EVENT_START;
    1239        
     1239
    12401240        t  = rec->ticks;
    12411241        t *= rtems_capture_tick_time ();
     
    12821282static void
    12831283rtems_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,
    12871287  boolean verbose )
    12881288{
     
    14591459{
    14601460  int cmd;
    1461  
     1461
    14621462  capture_timestamp = timestamp;
    14631463
  • cpukit/libmisc/capture/capture-cli.h

    r8486081 raed742c  
    33  $Id$
    44  ------------------------------------------------------------------------
    5  
     5
    66  Copyright Objective Design Systems Pty Ltd, 2002
    77  All rights reserved Objective Design Systems Pty Ltd, 2002
     
    1515
    1616  This software with is provided ``as is'' and with NO WARRANTY.
    17  
     17
    1818  ------------------------------------------------------------------------
    1919
  • cpukit/libmisc/capture/capture.c

    r8486081 raed742c  
    33  $Id$
    44  ------------------------------------------------------------------------
    5  
     5
    66  Copyright Objective Design Systems Pty Ltd, 2002
    77  All rights reserved Objective Design Systems Pty Ltd, 2002
     
    1515
    1616  This software with is provided ``as is'' and with NO WARRANTY.
    17  
     17
    1818  ------------------------------------------------------------------------
    1919
     
    237237{
    238238  rtems_capture_control_t* control;
    239  
     239
    240240  for (control = capture_controls; control != NULL; control = control->next)
    241241    if (rtems_capture_match_name_id (name, id, control->name, control->id))
     
    263263
    264264  control = rtems_capture_find_control (name, id);
    265  
     265
    266266  if (control == NULL)
    267267  {
     
    273273      return NULL;
    274274    }
    275    
     275
    276276    control->name  = name;
    277277    control->id    = id;
     
    280280    memset (control->from,    0, sizeof (control->from));
    281281    memset (control->from_id, 0, sizeof (control->from_id));
    282    
     282
    283283    rtems_interrupt_disable (level);
    284284
     
    324324
    325325  rtems_capture_dup_name (&task->name, ((rtems_name) new_task->Object.name));
    326  
     326
    327327  task->id               = new_task->Object.id;
    328328  task->flags            = 0;
     
    360360                                     task->name, task->id))
    361361      task->control = control;
    362  
     362
    363363  return task;
    364364}
     
    399399    {
    400400      rtems_interrupt_level level;
    401      
     401
    402402      rtems_interrupt_disable (level);
    403    
     403
    404404      if (capture_count < capture_size)
    405405      {
     
    418418          capture_in = capture_records;
    419419        else
    420           capture_in++;         
     420          capture_in++;
    421421      }
    422422      else
     
    501501  rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT);
    502502  rtems_capture_record (st, RTEMS_CAPTURE_STARTED_EVENT);
    503  
     503
    504504  rtems_capture_init_stack_usage (st);
    505505}
     
    672672    uint32_t   ticks;
    673673    uint32_t   tick_offset;
    674      
     674
    675675    /*
    676676     * Get the cpature task control block so we can update the
     
    720720      ht->tick_offset_in = tick_offset;
    721721    }
    722  
     722
    723723    if (ct)
    724724    {
     
    729729      {
    730730        tick_offset += capture_tick_period - ct->tick_offset_in;
    731  
     731
    732732        if (tick_offset < capture_tick_period)
    733733          ct->tick_offset = tick_offset;
     
    755755      {
    756756        cc = ct->control;
    757      
     757
    758758        /*
    759759         * Check the current task for a TO_ANY trigger.
     
    855855   */
    856856  capture_tick_period = _Configuration_Table->microseconds_per_tick;
    857  
     857
    858858  /*
    859859   * Register the user extension handlers for the CAPture Engine.
     
    923923
    924924  task = capture_tasks;
    925  
     925
    926926  while (task)
    927927  {
     
    934934
    935935  control = capture_controls;
    936  
     936
    937937  while (control)
    938938  {
     
    10101010  capture_out    = 0;
    10111011
    1012   rtems_interrupt_enable (level); 
     1012  rtems_interrupt_enable (level);
    10131013
    10141014  return RTEMS_SUCCESSFUL;
     
    10751075    {
    10761076      rtems_interrupt_disable (level);
    1077      
     1077
    10781078      for (task = capture_tasks; task != NULL; task = task->next)
    10791079        if (task->control == control)
     
    11171117  rtems_capture_control_t* control;
    11181118  rtems_boolean            found = 0;
    1119  
     1119
    11201120  /*
    11211121   * Find the control and then set the watch. It must exist before it can
     
    11361136
    11371137      found = 1;
    1138     }   
     1138    }
    11391139  }
    11401140
     
    11581158{
    11591159  rtems_interrupt_level level;
    1160  
     1160
    11611161  rtems_interrupt_disable (level);
    11621162
     
    12791279  rtems_capture_control_t* control;
    12801280  int                      i;
    1281  
     1281
    12821282  /*
    12831283   * Find the capture control blocks for the from and to
     
    12981298    if (control == NULL)
    12991299      return RTEMS_NO_MEMORY;
    1300    
     1300
    13011301    if (trigger == rtems_capture_from_any)
    13021302      control->flags |= RTEMS_CAPTURE_FROM_ANY;
     
    13881388    if (count && ((capture_out + count) >= capture_size))
    13891389      *read = capture_size - capture_out;
    1390      
     1390
    13911391    /*
    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 ?
    13941394     */
    13951395    if ((*read == count) && threshold)
     
    14051405
    14061406        rtems_interrupt_disable (level);
    1407          
     1407
    14081408        capture_flags |= RTEMS_CAPTURE_READER_WAITING;
    14091409
    14101410        rtems_interrupt_enable (level);
    1411          
     1411
    14121412        sc = rtems_event_receive (RTEMS_EVENT_0,
    14131413                                  RTEMS_WAIT | RTEMS_EVENT_ANY,
     
    14821482 * This function returns the tick period in nano-seconds.
    14831483 */
    1484 uint32_t 
     1484uint32_t
    14851485rtems_capture_tick_time ()
    14861486{
     
    15271527 * is updated.
    15281528 */
    1529 uint32_t 
     1529uint32_t
    15301530rtems_capture_task_stack_usage (rtems_capture_task_t* task)
    15311531{
  • cpukit/libmisc/capture/capture.h

    r8486081 raed742c  
    33  $Id$
    44  ------------------------------------------------------------------------
    5  
     5
    66  Copyright Objective Design Systems Pty Ltd, 2002
    77  All rights reserved Objective Design Systems Pty Ltd, 2002
     
    1515
    1616  This software with is provided ``as is'' and with NO WARRANTY.
    17  
     17
    1818  ------------------------------------------------------------------------
    1919
     
    4343 *  DESCRIPTION:
    4444 *
    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
    4646 * tasks with the same name.
    4747 */
     
    6363#define RTEMS_CAPTURE_TO_ANY        (1 << 2)
    6464#define RTEMS_CAPTURE_FROM_TO       (1 << 3)
    65  
     65
    6666/*
    6767 * rtems_capture_control_t
     
    6969 *  DESCRIPTION:
    7070 *
    71  * RTEMS capture control provdes the information about a task, along 
     71 * RTEMS capture control provdes the information about a task, along
    7272 * 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
    7474 * capture record cannot assume the task will exist when the record is
    7575 * dumped via the target interface so task info needed for tracing is
     
    8080 *
    8181 * Note, the tracer code exploits the fact an rtems_name is a
    82  * 32bit value. 
     82 * 32bit value.
    8383 */
    8484typedef struct rtems_capture_task_s
     
    408408 * This function returns the tick period in micro-seconds.
    409409 */
    410 uint32_t 
     410uint32_t
    411411rtems_capture_tick_time ();
    412412
     
    418418 * This function returns the tick period in micro-seconds.
    419419 */
    420 uint32_t 
     420uint32_t
    421421rtems_capture_tick_time ();
    422422
     
    520520 * This function returns the task flags.
    521521 */
    522 static inline uint32_t 
     522static inline uint32_t
    523523rtems_capture_task_flags (rtems_capture_task_t* task)
    524524{
     
    546546 * This function returns the task control flags if a control is present.
    547547 */
    548 static inline uint32_t 
     548static inline uint32_t
    549549rtems_capture_task_control_flags (rtems_capture_task_t* task)
    550550{
     
    562562 * been switched into context.
    563563 */
    564 static inline uint32_t 
     564static inline uint32_t
    565565rtems_capture_task_switched_in (rtems_capture_task_t* task)
    566566{
     
    576576 * been switched out of context.
    577577 */
    578 static inline uint32_t 
     578static inline uint32_t
    579579rtems_capture_task_switched_out (rtems_capture_task_t* task)
    580580{
     
    634634 * is updated.
    635635 */
    636 uint32_t 
     636uint32_t
    637637rtems_capture_task_stack_usage (rtems_capture_task_t* task);
    638638
     
    644644 * This function returns the task's stack size.
    645645 */
    646 static inline uint32_t 
     646static inline uint32_t
    647647rtems_capture_task_stack_size (rtems_capture_task_t* task)
    648648{
     
    657657 * This function returns the amount of stack used.
    658658 */
    659 static inline uint32_t 
     659static inline uint32_t
    660660rtems_capture_task_stack_used (rtems_capture_task_t* task)
    661661{
     
    670670 * This function returns the current execution time as ticks.
    671671 */
    672 static inline uint32_t 
     672static inline uint32_t
    673673rtems_capture_task_ticks (rtems_capture_task_t* task)
    674674{
     
    683683 * This function returns the current execution time tick offset.
    684684 */
    685 static inline uint32_t 
     685static inline uint32_t
    686686rtems_capture_task_tick_offset (rtems_capture_task_t* task)
    687687{
     
    731731 * engine knows about.
    732732 */
    733 static inline uint32_t 
     733static inline uint32_t
    734734rtems_capture_task_count ()
    735735{
    736736  rtems_capture_task_t* task = rtems_capture_get_task_list ();
    737737  uint32_t        count = 0;
    738  
     738
    739739  while (task)
    740740  {
     
    804804 * This function returns the control flags.
    805805 */
    806 static inline uint32_t 
     806static inline uint32_t
    807807rtems_capture_control_flags (rtems_capture_control_t* control)
    808808{
     
    848848 * engine has.
    849849 */
    850 static inline uint32_t 
     850static inline uint32_t
    851851rtems_capture_control_count ()
    852852{
  • cpukit/libmisc/cpuuse/cpuuse.c

    r8486081 raed742c  
    5454      for ( i=1 ; i <= information->maximum ; i++ ) {
    5555        the_thread = (Thread_Control *)information->local_table[ i ];
    56  
     56
    5757        if ( the_thread )
    5858          total_units += the_thread->ticks_executed;
     
    6868#endif
    6969
    70   for ( api_index = 1 ; 
    71         api_index <= OBJECTS_APIS_LAST ; 
     70  for ( api_index = 1 ;
     71        api_index <= OBJECTS_APIS_LAST ;
    7272        api_index++ ) {
    7373    if ( !_Objects_Information_table[ api_index ] )
     
    7777      for ( i=1 ; i <= information->maximum ; i++ ) {
    7878        the_thread = (Thread_Control *)information->local_table[ i ];
    79        
     79
    8080        if ( !the_thread )
    8181          continue;
     
    107107          name,
    108108          the_thread->ticks_executed,
    109           (total_units) ? 
     109          (total_units) ?
    110110            (double)the_thread->ticks_executed / (double)total_units :
    111111            (double)total_units
  • cpukit/libmisc/devnull/devnull.c

    r8486081 raed742c  
    4646{
    4747  rtems_device_driver status;
    48  
     48
    4949  if ( !initialized ) {
    5050    initialized = 1;
     
    5858    if (status != RTEMS_SUCCESSFUL)
    5959      rtems_fatal_error_occurred(status);
    60      
     60
    6161    NULL_major = major;
    6262  }
    63  
     63
    6464  return RTEMS_SUCCESSFUL;
    6565}
     
    154154{
    155155  rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
    156  
     156
    157157  if ( rw_args )
    158158    rw_args->bytes_moved = rw_args->count;
    159  
     159
    160160  return NULL_SUCCESSFUL;
    161161}
  • cpukit/libmisc/dumpbuf/dumpbuf.c

    r8486081 raed742c  
    1818#include <ctype.h>
    1919#include <rtems/dumpbuf.h>
    20  
     20
    2121/*
    2222 *  Put the body below Dump_Buffer so it won't get inlined.
     
    2424
    2525static inline void Dump_Line(
    26   unsigned char *buffer, 
     26  unsigned char *buffer,
    2727  int            length
    2828);
     
    3333)
    3434{
    35  
     35
    3636  int i, mod, max;
    37  
     37
    3838  if ( !length ) return;
    39  
     39
    4040  mod = length % 16;
    41  
     41
    4242  max = length - mod;
    43  
     43
    4444  for ( i=0 ; i<max ; i+=16 )
    4545    Dump_Line( &buffer[ i ], 16 );
    46  
     46
    4747  if ( mod )
    4848    Dump_Line( &buffer[ max ], mod );
     
    5454)
    5555{
    56  
     56
    5757  int  i;
    5858  char line_buffer[120];
    59  
     59
    6060  line_buffer[0] = '\0';
    61  
     61
    6262  for( i=0 ; i<length ; i++ )
    6363    sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
    64  
     64
    6565  for( ; i<16 ; i++ )
    6666    strcat( line_buffer, "   " );
    67  
     67
    6868  strcat( line_buffer, "|" );
    6969  for( i=0 ; i<length ; i++ )
    7070    sprintf( line_buffer, "%s%c", line_buffer,
    7171             isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
    72  
     72
    7373  for( ; i<16 ; i++ )
    7474    strcat( line_buffer, " " );
    75  
     75
    7676  strcat( line_buffer, "|\n" );
    77  
     77
    7878  printf( line_buffer );
    7979}
  • cpukit/libmisc/fsmount/fsmount.c

    r8486081 raed742c  
    7979      if (0 != stat(tok_buffer,&file_info)) {
    8080        /*
    81          * if not, create directory 
     81         * if not, create directory
    8282         */
    8383        rc = mknod(tok_buffer,S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR,0);
     
    8787           (token_type != IMFS_NO_MORE_PATH) &&
    8888           (token_type != IMFS_INVALID_TOKEN));
    89  
     89
    9090  /*
    9191   * return token buffer to heap
     
    127127   * scan through all fstab entries;
    128128   */
    129   while (!terminate && 
     129  while (!terminate &&
    130130         (fstab_idx < fstab_count)) {
    131131    tmp_rc = 0;
     
    178178        if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_OK)) {
    179179          terminate = TRUE;
    180         }       
     180        }
    181181      }
    182     }   
     182    }
    183183    /*
    184184     * proceed to next entry
  • cpukit/libmisc/fsmount/fsmount.h

    r8486081 raed742c  
    3131 * bits to define, what errors will cause reporting (via printf) and
    3232 * abort of mount processing
    33  * Use a combination of these bits 
     33 * Use a combination of these bits
    3434 * for the fields "report_reasons" and "abort_reasons"
    35  */ 
     35 */
    3636#define FSMOUNT_MNT_OK        0x0001 /* mounted ok                 */
    3737#define FSMOUNT_MNTPNT_CRTERR 0x0002 /* cannot create mount point  */
  • cpukit/libmisc/monitor/mon-command.c

    r8486081 raed742c  
    2525/*
    2626 * 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
    2929 *  the monitor prompt via an environment variable:
    3030 *  RTEMS_MONITOR_PROMPT
     
    4848#define KEYS_RARROW      (5)
    4949#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)
    5353#define KEYS_F3          (10)
    5454#define KEYS_F4          (11)
     
    234234  history = history_next;
    235235  pos     = 0;
    236          
     236
    237237  if (!logged_in)
    238238    printf ("\nMonitor ready, press enter to login.\n\n");
     
    249249     */
    250250    extended_key &= ~KEYS_NORMAL_MASK;
    251    
     251
    252252    if (!extended_key && !logged_in)
    253253    {
     
    277277            pos = 0;
    278278            break;
    279        
     279
    280280          case KEYS_LARROW:
    281281            if (pos > 0)
     
    320320            }
    321321            break;
    322                  
     322
    323323          case KEYS_DARROW:
    324324            if (history < history_next)
     
    494494   */
    495495  if (!rtems_configuration_get_user_multiprocessing_table ())
    496     sprintf (monitor_prompt, "%s", 
     496    sprintf (monitor_prompt, "%s",
    497497             (env_prompt == NULL) ? MONITOR_PROMPT: env_prompt);
    498498  else if (rtems_monitor_default_node != rtems_monitor_node)
     
    501501             rtems_monitor_default_node);
    502502  else
    503     sprintf (monitor_prompt, "%d-%s", rtems_monitor_node, 
     503    sprintf (monitor_prompt, "%d-%s", rtems_monitor_node,
    504504             (env_prompt == NULL) ? MONITOR_PROMPT : env_prompt);
    505505
     
    536536  if ((table == 0) || (argv[0] == 0))
    537537    return 0;
    538    
     538
    539539  while (table)
    540540  {
     
    551551          return 0;
    552552        }
    553        
     553
    554554        else
    555555          found_it = table;
     
    597597      return;
    598598    }
    599  
     599
    600600    while (help_len)
    601601    {
    602602      printf ("%*c", spaces, ' ');
    603      
     603
    604604      if (line_one)
    605605        printf (" - ");
     
    612612       * from the end for a space, tab or lf or cr.
    613613       */
    614      
     614
    615615      if (help_len > MAX_HELP_LINE_LENGTH)
    616616      {
    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;
    619619             show_this_line--)
    620620          if ((help[show_this_line] == ' ') ||
     
    626626         * If show_this_line is 0, it is a very long word !!
    627627         */
    628      
     628
    629629        if (show_this_line == 0)
    630630          show_this_line = MAX_HELP_LINE_LENGTH - 1;
     
    640640
    641641      printf ("\n");
    642                  
     642
    643643      help     += show_this_line;
    644644      help_len -= show_this_line;
     
    647647       * Move past the line feeds or what ever else is being skipped.
    648648       */
    649    
     649
    650650      while (help_len)
    651651      {
     
    674674  rtems_monitor_command_entry_t *command = table;
    675675  int                           max_cmd_len = 0;
    676    
     676
    677677  /* if first entry in table is a usage, then print it out */
    678678
     
    680680  {
    681681    char *argv[2];
    682    
     682
    683683    argv[0] = command_string;
    684684    argv[1] = 0;
    685    
     685
    686686    command = rtems_monitor_command_lookup (table, 1, argv);
    687687
     
    692692    return;
    693693  }
    694  
     694
    695695  /*
    696696   * Find the largest command size.
    697697   */
    698  
     698
    699699  while (command)
    700700  {
     
    735735
    736736  command = command_arg->monitor_command_entry;
    737    
     737
    738738  if (argc == 1)
    739739    rtems_monitor_command_usage(command, 0);
  • cpukit/libmisc/monitor/mon-config.c

    r8486081 raed742c  
    4949    canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
    5050    canonical_config->number_of_initialization_tasks = r->number_of_initialization_tasks;
    51 }   
     51}
    5252
    5353/*
     
    6868    if (n >= 1)
    6969        goto failed;
    70    
     70
    7171    _Thread_Disable_dispatch();
    7272
  • cpukit/libmisc/monitor/mon-dname.c

    r8486081 raed742c  
    4747    canonical_dname->major = np->major;
    4848    canonical_dname->minor = np->minor;
    49 }   
     49}
    5050
    5151void *
     
    6464        if (np->device_name)
    6565            goto done;
    66    
     66
    6767    *next_id = RTEMS_OBJECT_ID_FINAL;
    6868    return 0;
     
    8080    *next_id += 1;
    8181    return np;
    82 }   
     82}
    8383
    8484void
  • cpukit/libmisc/monitor/mon-driver.c

    r8486081 raed742c  
    7272    if (n >= c->number_of_device_drivers)
    7373        goto failed;
    74    
     74
    7575    _Thread_Disable_dispatch();
    7676
  • cpukit/libmisc/monitor/mon-extension.c

    r8486081 raed742c  
    5151/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    52520         1         2         3         4         5         6         7       */
    53            
     53
    5454    rtems_monitor_separator();
    5555}
  • cpukit/libmisc/monitor/mon-itask.c

    r8486081 raed742c  
    2525{
    2626    rtems_initialization_tasks_table *rtems_itask = itask_void;
    27    
     27
    2828    rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
    2929                                            (void *) rtems_itask->entry_point);
     
    4949    if (n >= c->RTEMS_api_configuration->number_of_initialization_tasks)
    5050        goto failed;
    51    
     51
    5252    _Thread_Disable_dispatch();
    5353
     
    112112    length += rtems_monitor_pad(54, length);
    113113    length += rtems_monitor_dump_attributes(monitor_itask->attributes);
    114    
     114
    115115    length += rtems_monitor_pad(66, length);
    116116    length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);
  • cpukit/libmisc/monitor/mon-manager.c

    r8486081 raed742c  
    3434     * When we are called, it must be local
    3535     */
    36        
     36
    3737    if ( ! _Objects_Is_local_id(*next_id))
    3838        goto done;
    39    
     39
    4040    object = _Objects_Get_next(table, *next_id, &location, next_id);
    4141
  • cpukit/libmisc/monitor/mon-monitor.c

    r8486081 raed742c  
    11/*
    22 * RTEMS monitor main body
    3  *     
     3 *
    44 *  TODO:
    55 *      add stuff to RTEMS api
     
    8585      { RTEMS_MONITOR_OBJECT_INIT_TASK },
    8686      &rtems_monitor_commands[2],
    87     }, 
     87    },
    8888   { "mpci",
    8989      "Show the MPCI system configuration, if configured.",
     
    228228      &rtems_monitor_commands[19],
    229229    },
    230 #endif           
     230#endif
    231231    { 0, 0, 0, 0, { 0 }, &rtems_registered_commands },
    232232};
     
    238238    rtems_event_set event_set;
    239239    rtems_status_code status;
    240    
     240
    241241    status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
    242242                                 RTEMS_DEFAULT_OPTIONS,
     
    250250{
    251251    rtems_status_code status;
    252    
     252
    253253    status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT);
    254254}
     
    315315{
    316316    uint32_t   new_node = rtems_monitor_default_node;
    317    
     317
    318318    switch (argc)
    319319    {
     
    371371    if (rtems_monitor_symbols)
    372372        rtems_symbol_table_destroy(rtems_monitor_symbols);
    373    
     373
    374374    rtems_monitor_symbols = rtems_symbol_table_create(10);
    375375    if (rtems_monitor_symbols == 0)
     
    377377
    378378    fp = fopen("symbols", "r");
    379    
     379
    380380    if (fp == 0)
    381381        return;
     
    442442{
    443443    rtems_monitor_command_entry_t **p = & rtems_registered_commands.next;
    444                                                                                
     444
    445445    while (*p) {
    446446        if ( STREQ(command->command, (*p)->command) ) {
     
    469469    char command_buffer[513];
    470470    int argc;
    471     char *argv[64];       
     471    char *argv[64];
    472472    boolean verbose = FALSE;
    473473    struct termios term;
     
    476476     * Make the stdin stream characte not line based.
    477477     */
    478    
     478
    479479    if (tcgetattr (STDIN_FILENO, &term) < 0)
    480480    {
     
    488488
    489489      term.c_lflag &= ~(ECHO | ICANON | IEXTEN);
    490  
     490
    491491      /*
    492492       * No sigint on BREAK, CR-to-NL off, input parity off,
     
    503503      }
    504504    }
    505    
     505
    506506    if (monitor_flags & RTEMS_MONITOR_SUSPEND)
    507507        (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
     
    544544        rtems_task_delete(rtems_monitor_task_id);
    545545    rtems_monitor_task_id = 0;
    546    
     546
    547547    rtems_monitor_server_kill();
    548548}
     
    554554{
    555555    rtems_status_code status;
    556    
     556
    557557    rtems_monitor_kill();
    558558
     
    580580     * Start the monitor task itself
    581581     */
    582    
     582
    583583    status = rtems_task_start(rtems_monitor_task_id,
    584584                              rtems_monitor_task,
  • cpukit/libmisc/monitor/mon-mpci.c

    r8486081 raed742c  
    3939        return;
    4040    mt = m->User_mpci_table;
    41    
     41
    4242    canonical_mpci->node = m->node;
    4343    canonical_mpci->maximum_nodes = m->maximum_nodes;
     
    5959    rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet,
    6060                                            (void *) mt->receive_packet);
    61 }   
     61}
    6262
    6363/*
     
    7878    if (n >= 1)
    7979        goto failed;
    80    
     80
    8181    if ( ! c->User_multiprocessing_table)
    8282        goto failed;
    83    
     83
    8484    _Thread_Disable_dispatch();
    8585
     
    103103/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    1041040         1         2         3         4         5         6         7       */
    105            
     105
    106106    rtems_monitor_separator();
    107107}
     
    120120    length += rtems_monitor_pad(11, length);
    121121    length += printf("%d", monitor_mpci->maximum_nodes);
    122    
     122
    123123    length += rtems_monitor_pad(18, length);
    124124    length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
    125    
     125
    126126    length += rtems_monitor_pad(28, length);
    127127    length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies);
  • cpukit/libmisc/monitor/mon-object.c

    r8486081 raed742c  
    127127{
    128128    uint32_t    node;
    129    
     129
    130130    node = rtems_get_node(id);
    131131    if (node == 0)
     
    172172     * Send request
    173173     */
    174    
     174
    175175    request.command = RTEMS_MONITOR_SERVER_CANONICAL;
    176176    request.argument0 = (uint32_t  ) type;
     
    184184     * process response
    185185     */
    186    
     186
    187187    next_id = (rtems_id) response.result0;
    188188    if (next_id != RTEMS_OBJECT_ID_FINAL)
     
    214214    {
    215215        next_id = id;
    216        
     216
    217217        raw_item = (void *) info->next(info->object_information,
    218218                                       canonical,
     
    223223            info->canonical(canonical, raw_item);
    224224            _Thread_Enable_dispatch();
    225         }   
    226     }   
     225        }
     226    }
    227227    return next_id;
    228228}
     
    285285         *   memory driver (eg: mpci)
    286286         */
    287        
     287
    288288        if ((info->next != rtems_monitor_manager_next) ||
    289289            (id == canonical.generic.id))
     
    323323    rtems_monitor_object_info_t *info = 0;
    324324    rtems_monitor_object_type_t  type ;
    325    
     325
    326326    /* what is the default type? */
    327327    type = command_arg->monitor_object;
     
    334334            goto done;
    335335        }
    336        
     336
    337337        info = rtems_monitor_object_lookup(type);
    338338        if (info == 0)
     
    365365                if (info == 0)
    366366                    goto not_found;
    367            
     367
    368368                if (info->dump_header)
    369369                    info->dump_header(verbose);
     
    379379
    380380            default_node = rtems_get_node(id);
    381            
     381
    382382            last_type = type;
    383383        }
  • cpukit/libmisc/monitor/mon-prmisc.c

    r8486081 raed742c  
    2626}
    2727
    28 uint32_t 
     28uint32_t
    2929rtems_monitor_pad(
    3030    uint32_t    destination_column,
     
    3333{
    3434    int pad_length;
    35    
     35
    3636    if (destination_column <= current_column)
    3737        pad_length = 1;
     
    4242}
    4343
    44 uint32_t 
     44uint32_t
    4545rtems_monitor_dump_char(uint8_t   ch)
    4646{
     
    5151}
    5252
    53 uint32_t 
     53uint32_t
    5454rtems_monitor_dump_decimal(uint32_t   num)
    5555{
     
    5757}
    5858
    59 uint32_t 
     59uint32_t
    6060rtems_monitor_dump_hex(uint32_t   num)
    6161{
     
    6363}
    6464
    65 uint32_t 
     65uint32_t
    6666rtems_monitor_dump_assoc_bitfield(
    6767    rtems_assoc_t *ap,
     
    6969    uint32_t       value
    7070  )
    71 { 
     71{
    7272    uint32_t   b;
    7373    uint32_t   length = 0;
     
    8181
    8282            name = rtems_assoc_name_by_local(ap, b);
    83            
     83
    8484            if (name)
    8585                length += printf("%s", name);
     
    8787                length += printf("0x%x", b);
    8888        }
    89        
    90     return length;
    91 }
    92 
    93 uint32_t 
     89
     90    return length;
     91}
     92
     93uint32_t
    9494rtems_monitor_dump_id(rtems_id id)
    9595{
     
    9797}
    9898
    99 uint32_t 
     99uint32_t
    100100rtems_monitor_dump_name(rtems_name name)
    101101{
     
    106106        char       c[4];
    107107    } u;
    108    
     108
    109109    u.ui = (uint32_t  ) name;
    110    
     110
    111111#if (CPU_BIG_ENDIAN == TRUE)
    112112    for (i=0; i<sizeof(u.c); i++)
     
    119119}
    120120
    121 uint32_t 
     121uint32_t
    122122rtems_monitor_dump_priority(rtems_task_priority priority)
    123123{
     
    147147};
    148148
    149 uint32_t 
     149uint32_t
    150150rtems_monitor_dump_state(States_Control state)
    151151{
     
    154154    if (state == STATES_READY)  /* assoc doesn't deal with this as it is 0 */
    155155        length += printf("READY");
    156    
     156
    157157    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
    158158                                                ":",
     
    170170};
    171171
    172 uint32_t 
     172uint32_t
    173173rtems_monitor_dump_attributes(rtems_attribute attributes)
    174174{
     
    177177    if (attributes == RTEMS_DEFAULT_ATTRIBUTES)  /* value is 0 */
    178178        length += printf("DEFAULT");
    179    
     179
    180180    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
    181181                                                ":",
     
    191191};
    192192
    193 uint32_t 
     193uint32_t
    194194rtems_monitor_dump_modes(rtems_mode modes)
    195195{
     
    198198    if (modes == RTEMS_DEFAULT_MODES)  /* value is 0 */
    199199        length += printf("P:T:nA");
    200    
     200
    201201    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
    202202                                                ":",
     
    241241};
    242242
    243 uint32_t 
     243uint32_t
    244244rtems_monitor_dump_events(rtems_event_set events)
    245245{
     
    248248    if (events == EVENT_SETS_NONE_PENDING)  /* value is 0 */
    249249        length += printf("NONE");
    250    
     250
    251251    length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
    252252                                                ":",
     
    255255}
    256256
    257 uint32_t 
     257uint32_t
    258258rtems_monitor_dump_notepad(uint32_t   *notepad)
    259259{
  • cpukit/libmisc/monitor/mon-server.c

    r8486081 raed742c  
    4848     * Look it up if we don't know it yet.
    4949     */
    50    
     50
    5151    server_id = rtems_monitor_server_request_queue_ids[server_node];
    5252    if (server_id == 0)
     
    6060            goto done;
    6161        }
    62        
     62
    6363        rtems_monitor_server_request_queue_ids[server_node] = server_id;
    6464    }
     
    7272        goto done;
    7373    }
    74    
     74
    7575    /*
    7676     * Await response, if requested
     
    9898            status = RTEMS_INCORRECT_STATE;
    9999            goto done;
    100         }           
    101     }
    102    
     100        }
     101    }
     102
    103103done:
    104104    return status;
     
    135135            goto failed;
    136136        }
    137                                              
     137
    138138        if (size != sizeof(request))
    139139        {
     
    141141            goto failed;
    142142        }
    143        
     143
    144144        switch (request.command)
    145145        {
     
    163163#define SERVER_OVERHEAD  (RTEMS_offsetof(rtems_monitor_server_response_t, \
    164164                                         payload))
    165                    
     165
    166166                status = rtems_message_queue_send(request.return_id,
    167167                                                  &response,
     
    187187}
    188188
    189    
     189
    190190/*
    191191 * Kill off any old server
     
    220220{
    221221    rtems_status_code status;
    222    
     222
    223223    if (_System_state_Is_multiprocessing    &&
    224224        (_Configuration_MP_table->maximum_nodes > 1))
    225225    {
    226226        uint32_t   maximum_nodes = _Configuration_MP_table->maximum_nodes;
    227        
     227
    228228        /*
    229229         * create the msg que our server will listen
     
    238238                       RTEMS_GLOBAL,
    239239                       &rtems_monitor_server_request_queue_id);
    240        
     240
    241241        if (status != RTEMS_SUCCESSFUL)
    242242        {
     
    244244            goto done;
    245245        }
    246          
     246
    247247        /*
    248248         * create the msg que our responses will come on
     
    250250         * message queue.
    251251         */
    252        
     252
    253253        status = rtems_message_queue_create(
    254254                       RTEMS_MONITOR_RESPONSE_QUEUE_NAME,
     
    257257                       RTEMS_GLOBAL,
    258258                       &rtems_monitor_server_response_queue_id);
    259        
     259
    260260        if (status != RTEMS_SUCCESSFUL)
    261261        {
     
    263263            goto done;
    264264        }
    265          
     265
    266266        /* need an id for queue of each other server we might talk to */
    267267        /* indexed by node, so add 1 to maximum_nodes */
  • cpukit/libmisc/monitor/mon-symbols.c

    r8486081 raed742c  
    246246            return NULL;
    247247    }
    248    
     248
    249249    if (table->sorted)
    250250    {
     
    255255            return NULL;  /* not an exact match */
    256256    }
    257  
     257
    258258    for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
    259259    {
     
    286286            return NULL;
    287287    }
    288    
     288
    289289    for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
    290290    {
     
    314314
    315315    /* NOTE: symbols do not have id and name fields */
    316      
     316
    317317    if (table->sorted == 0)
    318318        rtems_symbol_sort(table);
     
    381381
    382382
    383 uint32_t 
     383uint32_t
    384384rtems_monitor_symbol_dump(
    385385    rtems_monitor_symbol_t *canonical_symbol,
  • cpukit/libmisc/monitor/mon-task.c

    r8486081 raed742c  
    2525
    2626    api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
    27    
     27
    2828    canonical_task->entry = rtems_thread->Start.entry_point;
    2929    canonical_task->argument = rtems_thread->Start.numeric_argument;
     
    5757/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    58580         1         2         3         4         5         6         7       */
    59            
     59
    6060    rtems_monitor_separator();
    6161}
  • cpukit/libmisc/monitor/monitor.h

    r8486081 raed742c  
    3939    /* following monitor objects are not known to RTEMS, but
    4040     * we like to have "types" for them anyway */
    41    
     41
    4242    RTEMS_MONITOR_OBJECT_DRIVER    =  OBJECTS_RTEMS_CLASSES_LAST+1,
    4343    RTEMS_MONITOR_OBJECT_DNAME,
     
    7272 * Type of a pointer that may be a symbol
    7373 */
    74    
     74
    7575#define MONITOR_SYMBOL_LEN 20
    7676typedef struct {
     
    7878    uint32_t   value;
    7979    uint32_t   offset;
    80 } rtems_monitor_symbol_t;   
     80} rtems_monitor_symbol_t;
    8181
    8282typedef struct {
     
    8484    rtems_name          name;
    8585  /* end of common portion */
    86 } rtems_monitor_generic_t;       
     86} rtems_monitor_generic_t;
    8787
    8888/*
     
    348348void    rtems_monitor_server_task(rtems_task_argument);
    349349void    rtems_monitor_server_init(uint32_t  );
    350  
     350
    351351/* command.c */
    352352int     rtems_monitor_make_argv(char *, int *, char **);
  • cpukit/libmisc/mw-fb/mw_fb.c

    r8486081 raed742c  
    44//
    55// Copyright (c) 2000 - Rosimildo da Silva
    6 // 
    7 // MODULE DESCRIPTION:
    8 // Wrapper API around the ioctls calls for the Micro FrameBuffer
    9 // interface for Embedded Systems
    106//
    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
    1212// decoded as an error. A list of errors will be created over time.
    1313//
     
    1515//
    1616// $Log$
     17// Revision 1.3  2004/04/15 13:24:46  ralf
     18// Remove stray white spaces.
     19//
    1720// Revision 1.2  2003/07/08 08:38:48  ralf
    1821// 2003-07-08   Ralf Corsepius <corsepiu@faw.uni-ulm.de>
     
    7881
    7982
    80 /* 
     83/*
    8184 * This function returns the information regarding the display.
    8285 * It is called just after the driver be opened to get all needed
     
    9194
    9295
    93 /* 
    94  * Returns the mode of the graphics subsystem 
     96/*
     97 * Returns the mode of the graphics subsystem
    9598 */
    9699 int ufb_get_mode( int fd, int *mode )
     
    103106
    104107
    105 /* 
    106  * Returns the current collor pallete 
     108/*
     109 * Returns the current collor pallete
    107110 */
    108111 int ufb_get_palette( int fd, struct fb_cmap *color )
     
    112115
    113116
    114 /* 
    115  * Set the current collor pallete 
     117/*
     118 * Set the current collor pallete
    116119 */
    117120 int ufb_set_palette( int fd, struct fb_cmap *color )
     
    120123 }
    121124
    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
    125128 */
    126129 int ufb_enter_graphics( int fd, int mode )
     
    133136
    134137
    135 /* 
     138/*
    136139 * Switch the device back to the default mode of operation.
    137140 * In most cases it put the device back to plain text mode.
     
    145148 }
    146149
    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
    151154 */
    152155 int ufb_buffer_is_dirty( int fd )
     
    160163
    161164
    162 /* 
     165/*
    163166 * This function maps the physical ( kernel mode ) address of the framebuffer device
    164167 * and maps it to the user space address.
     
    168171 #ifdef __rtems__
    169172    /* 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
    171174       pointer to the caller.
    172175     */
     
    174177      return 0;
    175178 #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,
    177180    maybe using mmap()
    178181  */
     
    183186
    184187
    185 /* 
     188/*
    186189 * This function unmaps memory of the FB from the user's space
    187190 */
  • cpukit/libmisc/mw-fb/mw_fb.h

    r8486081 raed742c  
    44//
    55// Copyright (c) 2000 - Rosimildo da Silva
    6 // 
    7 // MODULE DESCRIPTION: 
     6//
     7// MODULE DESCRIPTION:
    88// Micro FrameBuffer interface for Embedded Systems.
    99//
     
    1111//
    1212// $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//
    1330//
    1431/////////////////////////////////////////////////////////////////////////////
     
    7895#define FB_FUNC_GET_MODE         3
    7996
    80 struct fb_exec_function 
     97struct fb_exec_function
    8198{
    8299    int    func_no;
     
    87104/* Micro Framebuffer API Wrapper */
    88105
    89 /* 
     106/*
    90107 * This function returns the information regarding the display.
    91108 * It is called just after the driver be opened to get all needed
     
    96113
    97114
    98 /* 
    99  * Returns the mode of the graphics subsystem 
     115/*
     116 * Returns the mode of the graphics subsystem
    100117 */
    101118extern int ufb_get_mode( int fd, int *mode );
    102119
    103120
    104 /* 
    105  * Returns the current collor pallete 
     121/*
     122 * Returns the current collor pallete
    106123 */
    107124extern int ufb_get_palette( int fd, struct fb_cmap *color );
    108125
    109 /* 
    110  * Set the current collor pallete 
     126/*
     127 * Set the current collor pallete
    111128 */
    112129extern int ufb_set_palette( int fd, struct fb_cmap *color );
    113130
    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
    117134 */
    118135extern int ufb_enter_graphics( int fd, int mode );
    119136
    120137
    121 /* 
     138/*
    122139 * Switch the device back to the default mode of operation.
    123140 * In most cases it put the device back to plain text mode.
     
    126143
    127144
    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
    132149 */
    133150extern int ufb_buffer_is_dirty( int fd );
    134151
    135152
    136 /* 
     153/*
    137154 * This function maps the physical ( kernel mode ) address of the framebuffer device
    138155 * and maps it to the user space address.
     
    142159
    143160
    144 /* 
     161/*
    145162 * This function unmaps memory of the FB from the user's space
    146163 */
  • cpukit/libmisc/mw-fb/mw_uid.c

    r8486081 raed742c  
    44//
    55// Copyright (c) 2000 - Rosimildo da Silva
    6 // 
    7 // MODULE DESCRIPTION: 
     6//
     7// MODULE DESCRIPTION:
    88// This module implements the input devices interface used by MicroWindows
    99// in an embedded system environment.
     
    1414//
    1515// $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//
    1635// Revision 1.5  2003/07/08 08:38:48  ralf
    1736// 2003-07-08   Ralf Corsepius <corsepiu@faw.uni-ulm.de>
     
    138157      printk( "UID_Queue: id=%X\n", queue_id );
    139158#endif
    140    } 
     159   }
    141160   open_count++;
    142161   return 0;
     
    187206
    188207
    189 /* 
     208/*
    190209 * add a message to the queue of events. This method cna be used to
    191210 * simulate hardware events, and it can be very handy during development
     
    195214{
    196215  rtems_status_code status;
    197   status = rtems_message_queue_send( queue_id, ( void * )m, 
     216  status = rtems_message_queue_send( queue_id, ( void * )m,
    198217                                    sizeof( struct MW_UID_MESSAGE ) );
    199218  return status == RTEMS_SUCCESSFUL ? 0 : -1;
    200219}
    201220
    202 /* 
     221/*
    203222 * 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
    205224 */
    206225int uid_register_device( int fd, const char *q_name )
     
    218237int uid_set_kbd_mode( int fd, int mode, int *old_mode )
    219238{
    220    if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0) 
     239   if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0)
    221240   {
    222241      return -1;
    223242   }
    224    if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 ) 
     243   if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 )
    225244   {
    226245      return -1;
  • cpukit/libmisc/mw-fb/mw_uid.h

    r8486081 raed742c  
    44//
    55// Copyright (c) 2000 - Rosimildo da Silva
    6 // 
    7 // MODULE DESCRIPTION: 
     6//
     7// MODULE DESCRIPTION:
    88// This module defines the interface for input devices used by MicroWindows
    99// in an embedded system environment.
     
    1212//
    1313// $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//
    1431//
    1532/////////////////////////////////////////////////////////////////////////////
     
    2239#endif
    2340
    24 /* 0x41XX  -- IOCLT functions for the Micro Input Devices commands */ 
     41/* 0x41XX  -- IOCLT functions for the Micro Input Devices commands */
    2542#define MW_UID_REGISTER_DEVICE     0x4100
    2643#define MW_UID_UNREGISTER_DEVICE   0x4101
     
    2845
    2946/* devices supported by MicroWindows */
    30 enum MW_INPUT_DEVICE_TYPE 
     47enum MW_INPUT_DEVICE_TYPE
    3148{
    3249    MV_UID_INVALID   = 0,
     
    5471/* keyboard modes -- default ASCII     */
    5572#define MV_KEY_MODE_ASCII               0x01
    56 /* 
     73/*
    5774 * This mode one event is sent when a key is pressed,
    5875 * and another one is send when a key is released.
     
    6986
    7087/*
    71  * Message generated by input devices controlled by MicroWindows. 
     88 * Message generated by input devices controlled by MicroWindows.
    7289 */
    7390struct MW_UID_MESSAGE
     
    103120/*
    104121 * 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
    106123 * zero ( 0 ) on success. One exception for that is the "read" routine
    107124 * that returns the number of bytes read. Negaive numbers indicate errors
     
    118135extern int uid_close_queue( void );
    119136
    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
    122139 * timeout in mili-seconds.
    123140 */
  • cpukit/libmisc/rtmonuse/rtmonuse.c

    r8486081 raed742c  
    3939
    4040  maximum = _Configuration_Table->RTEMS_api_configuration->maximum_periods;
    41  
     41
    4242  Period_usage_Information = malloc( sizeof(Period_usage_t) * (maximum+1) );
    4343
     
    5959        i++ ) {
    6060    the_usage = &Period_usage_Information[ i ];
    61  
     61
    6262    the_usage->count           = 0;
    6363    the_usage->missed_count    = 0;
     
    6868    the_usage->max_wall_time   = 0;
    6969    the_usage->total_wall_time = 0;
    70  
     70
    7171  }
    7272}
     
    7777 */
    7878
    79 void Period_usage_Update( 
     79void Period_usage_Update(
    8080  rtems_id     id
    8181)
     
    136136  uint32_t                api_index;
    137137  Objects_Information    *information;
    138  
     138
    139139  if ( !Period_usage_Information ) {
    140140    printf( "Period statistics library is not initialized\n" );
     
    142142  }
    143143
    144   printf( "Period information by period\n" ); 
     144  printf( "Period information by period\n" );
    145145  printf( "   ID      OWNER   PERIODS  MISSED    CPU TIME    WALL TIME\n" );
    146146
  • cpukit/libmisc/rtmonuse/rtmonuse.h

    r8486081 raed742c  
    1010void Period_usage_Reset( void );
    1111
    12 void Period_usage_Update( 
     12void Period_usage_Update(
    1313  rtems_id     id
    1414);
  • cpukit/libmisc/serdbg/serdbg.c

    r8486081 raed742c  
    1717| 04.04.02  creation                                         doe  |
    1818\*===============================================================*/
    19 /* 
     19/*
    2020 * $Id$
    2121 */
     
    6161  }
    6262  is_initialized = TRUE;
    63   /* 
     63  /*
    6464   * try to open serial device
    6565   */
    6666  if (rc == RTEMS_SUCCESSFUL) {
    67     if ((serdbg_conf.open_io != NULL) && 
     67    if ((serdbg_conf.open_io != NULL) &&
    6868        (0 > serdbg_conf.open_io(serdbg_conf.devname,serdbg_conf.baudrate))) {
    6969      fprintf(stderr,
     
    8282   * now activate gdb stub
    8383   */
    84   if ((rc == RTEMS_SUCCESSFUL) && 
     84  if ((rc == RTEMS_SUCCESSFUL) &&
    8585      !serdbg_conf.skip_init_bkpt) {
    8686    breakpoint();
  • cpukit/libmisc/serdbg/serdbg.h

    r8486081 raed742c  
    1717| 04.04.02  creation                                         doe  |
    1818\*===============================================================*/
    19 /* 
    20  * $Id$ 
     19/*
     20 * $Id$
    2121 */
    2222#ifndef _SERDBG_H
  • cpukit/libmisc/serdbg/serdbgcnf.h

    r8486081 raed742c  
    1717| 13.05.02  creation                                         doe  |
    1818\*===============================================================*/
    19 /* 
     19/*
    2020 * $Id$
    2121 */
     
    6060
    6161  CONFIGURE_SERDBG_DEVNAME,
    62  
     62
    6363#ifdef CONFIGURE_SERDBG_SKIP_INIT_BKPT
    6464  TRUE,
  • cpukit/libmisc/serdbg/serdbgio.c

    r8486081 raed742c  
    107107  * skip any fds that are between 0..2, because they are
    108108  * reserved for stdin/out/err
    109   */ 
     109  */
    110110  if (!err_occurred &&
    111111      (dev_name != NULL) &&
     
    126126        }
    127127      }
    128     } while (!err_occurred && 
     128    } while (!err_occurred &&
    129129             (serdbg_fd < 3));
    130130  }
     
    138138
    139139  /*
    140    * capture tty structure 
     140   * capture tty structure
    141141   */
    142142  if (!err_occurred) {
     
    145145  }
    146146  /*
    147    * set device baudrate 
     147   * set device baudrate
    148148   * (and transp mode, this is not really needed)
    149149   * ...
     
    157157  }
    158158  if (!err_occurred) {
    159     act_termios.c_iflag 
     159    act_termios.c_iflag
    160160      &=  ~(IGNBRK|BRKINT|PARMRK|ISTRIP
    161161            |INLCR|IGNCR|ICRNL|IXON);
    162     act_termios.c_oflag 
     162    act_termios.c_oflag
    163163      &= ~OPOST;
    164    
     164
    165165    act_termios.c_lflag
    166166      &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
     
    173173    }
    174174  }
    175   return (err_occurred 
    176           ? -1 
     175  return (err_occurred
     176          ? -1
    177177          : 0);
    178178}
     
    198198{
    199199  /*
    200    * call serdbg polling callout, if available 
     200   * call serdbg polling callout, if available
    201201   */
    202202  if (serdbg_conf.callout != NULL) {
     
    206206   * check, whether debug serial port is available
    207207   */
    208   if ((serdbg_tty != NULL) && 
     208  if ((serdbg_tty != NULL) &&
    209209      (serdbg_tty->device.write != NULL)) {
    210210    /*
     
    238238   * check, whether debug serial port is available
    239239   */
    240   if ((serdbg_tty != NULL) && 
     240  if ((serdbg_tty != NULL) &&
    241241      (serdbg_tty->device.pollRead != NULL)) {
    242242    do {
    243243      /*
    244        * call serdbg polling callout, if available 
     244       * call serdbg polling callout, if available
    245245       */
    246246      if (serdbg_conf.callout != NULL) {
  • cpukit/libmisc/serdbg/termios_printk.c

    r8486081 raed742c  
    7474   */
    7575
    76   if ((termios_printk_tty != NULL) && 
     76  if ((termios_printk_tty != NULL) &&
    7777      (termios_printk_tty->device.write != NULL)) {
    7878    /*
    79      * call termios_printk polling callout, if available 
     79     * call termios_printk polling callout, if available
    8080     */
    8181    if (termios_printk_conf.callout != NULL) {
     
    8585     * send character to debug serial port
    8686     */
    87     if (c == '\n') {     
     87    if (c == '\n') {
    8888      termios_printk_tty->device.write(termios_printk_tty->minor,&cr,1);
    8989    }
     
    114114   * check, whether debug serial port is available
    115115   */
    116   if ((termios_printk_tty != NULL) && 
     116  if ((termios_printk_tty != NULL) &&
    117117      (termios_printk_tty->device.pollRead != NULL)) {
    118118    do {
    119119      /*
    120        * call termios_printk polling callout, if available 
     120       * call termios_printk polling callout, if available
    121121       */
    122122      if (termios_printk_conf.callout != NULL) {
     
    157157  struct termios act_termios;
    158158  tcflag_t baudcode = B0;
    159  
     159
    160160  if (termios_printk_fd >= 0) {
    161161    /*
     
    191191 /*
    192192  * open device for serdbg operation
    193   */ 
     193  */
    194194  if (!err_occurred &&
    195195      (dev_name != NULL) &&
     
    201201  }
    202202  /*
    203    * capture tty structure 
     203   * capture tty structure
    204204   */
    205205  if (!err_occurred) {
     
    208208  }
    209209  /*
    210    * set device baudrate 
     210   * set device baudrate
    211211   * (and transp mode, this is not really needed)
    212212   * ...
     
    232232    BSP_poll_char = termios_printk_inputchar;
    233233  }
    234   return (err_occurred 
    235           ? -1 
     234  return (err_occurred
     235          ? -1
    236236          : 0);
    237237}
  • cpukit/libmisc/serdbg/termios_printk.h

    r8486081 raed742c  
    1717| 13.04.02  creation                                         doe  |
    1818\*===============================================================*/
    19 /* 
     19/*
    2020 * $Id$
    2121 */
  • cpukit/libmisc/serdbg/termios_printk_cnf.h

    r8486081 raed742c  
    1717| 13.05.02  creation                                         doe  |
    1818\*===============================================================*/
    19 /* 
     19/*
    2020 * $Id$
    2121 */
     
    5353  NULL,
    5454#endif
    55   CONFIGURE_TERMIOS_PRINTK_DEVNAME, 
     55  CONFIGURE_TERMIOS_PRINTK_DEVNAME,
    5656};
    5757#endif
  • cpukit/libmisc/shell/cmds.c

    r8486081 raed742c  
    66 *
    77 * This file is inspired in rtems_monitor & Chris John MyRightBoot
    8  * 
     8 *
    99 * But I want to make it more user friendly
    1010 * A 'monitor' command is added to adapt the call rtems monitor commands
    1111 * at my call procedure
    12  * 
    13  * TODO: A lot of improvements of course. 
     12 *
     13 * TODO: A lot of improvements of course.
    1414 *      cp, mv, ...
    1515 *      hexdump,
    16  *     
     16 *
    1717 *      More? Say me it, please...
    18  *     
     18 *
    1919 *      The BSP Specific are not welcome here.
    20  *     
     20 *
    2121 * C&S welcome...
    2222 *
     
    5454 * ----------------------------------------------- */
    5555int str2int(char * s) {
    56  int sign=1;   
     56 int sign=1;
    5757 int base=10;
    5858 int value=0;
     
    7979             break;
    8080   }
    81   }; 
     81  };
    8282  while (*s) {
    8383   switch(*s) {
     
    9393    case '9':digit=*s-'0';
    9494             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':
    100100    case 'F':digit=*s-'A'+10;
    101101             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':
    107107    case 'f':digit=*s-'a'+10;
    108108             break;
    109     default:return value*sign;       
     109    default:return value*sign;
    110110   };
    111111   if (digit>base) return value*sign;
     
    114114  };
    115115 };
    116  return value*sign;     
     116 return value*sign;
    117117}
    118118/*----------------------------------------------------------------------------*
     
    220220#ifdef MALLOC_STATS  /* /rtems/s/src/lib/libc/malloc.c */
    221221int main_malloc_dump(int argc,char * argv[]) {
    222  void malloc_dump(void); 
    223  malloc_dump(); 
     222 void malloc_dump(void);
     223 malloc_dump();
    224224 return 0;
    225225}
     
    235235
    236236  rtems_interrupt_disable (level);
    237   for (;;) 
     237  for (;;)
    238238      ;
    239239  return 0;
     
    252252 };
    253253 return 0;
    254 } 
    255 /*-----------------------------------------------------------*         
     254}
     255/*-----------------------------------------------------------*
    256256 * Directory commands
    257257 *-----------------------------------------------------------*/
     
    287287      if (stat(nbuf, &stat_buf) == 0)
    288288      { /* 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));
    290290         pwd=getpwuid(stat_buf.st_uid);
    291291         user=pwd?pwd->pw_name:"nouser";
     
    305305                 (stat_buf.st_mode & S_IXOTH)?('x'):('-'),
    306306                 (int)stat_buf.st_nlink,
    307                  user,group, 
     307                 user,group,
    308308                 (int)stat_buf.st_size,
    309309                 sbuf,
     
    318318   return 0;
    319319}
    320 /*-----------------------------------------------------------*/         
     320/*-----------------------------------------------------------*/
    321321int main_pwd (int argc, char *argv[]) {
    322322   char dir[1024];
     
    325325   return 0;
    326326}
    327 /*-----------------------------------------------------------*/         
     327/*-----------------------------------------------------------*/
    328328int main_chdir (int argc, char *argv[]) {
    329329   char *dir;
     
    333333    printf("chdir to '%s' failed:%s\n",dir,strerror(errno));
    334334    return errno;
    335    }; 
    336    return 0;
    337 }
    338 /*-----------------------------------------------------------*/         
     335   };
     336   return 0;
     337}
     338/*-----------------------------------------------------------*/
    339339int main_mkdir (int argc, char *argv[]) {
    340340   char *dir;
     
    345345    if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
    346346      printf("mkdir '%s' failed:%s\n",dir,strerror(errno));
    347     }; 
    348    }; 
     347    };
     348   };
    349349   return errno;
    350350}
    351 /*-----------------------------------------------------------*/         
     351/*-----------------------------------------------------------*/
    352352int main_rmdir (int argc, char *argv[])
    353353{
     
    361361   return errno;
    362362}
    363 /*-----------------------------------------------------------*/         
     363/*-----------------------------------------------------------*/
    364364int main_chroot(int argc,char * argv[]) {
    365365 char * new_root="/";
     
    371371 return 0;
    372372}
    373 /*-----------------------------------------------------------*/         
     373/*-----------------------------------------------------------*/
    374374int main_cat   (int argc, char *argv[])
    375375{
     
    379379   return 0;
    380380}
    381 /*-----------------------------------------------------------*/         
     381/*-----------------------------------------------------------*/
    382382int main_rm    (int argc, char *argv[])
    383383{
     
    393393   return 0;
    394394}
    395 /*-----------------------------------------------------------*/         
     395/*-----------------------------------------------------------*/
    396396/* date - print time and date */
    397397
    398 int main_date(int argc,char *argv[]) 
     398int main_date(int argc,char *argv[])
    399399{
    400400  time_t t;
     
    404404}
    405405/*-----------------------------------------------------------*/
    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[]) 
     406int 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/*-----------------------------------------------------------*/
     413int main_tty   (int argc,char *argv[])
    414414{
    415415  printf("%s\n",ttyname(fileno(stdin)));
     
    417417}
    418418/*-----------------------------------------------------------*/
    419 int main_whoami(int argc,char *argv[]) 
     419int main_whoami(int argc,char *argv[])
    420420{
    421421   struct passwd     * pwd;
     
    425425}
    426426/*-----------------------------------------------------------*/
    427 int main_id    (int argc,char *argv[]) 
     427int main_id    (int argc,char *argv[])
    428428{
    429429   struct passwd     * pwd;
     
    442442}
    443443/*-----------------------------------------------------------*/
    444 int main_umask(int argc,char *argv[]) 
     444int main_umask(int argc,char *argv[])
    445445{
    446446   mode_t msk=umask(0);
     
    453453}
    454454/*-----------------------------------------------------------*/
    455 int main_chmod(int argc,char *argv[]) 
     455int main_chmod(int argc,char *argv[])
    456456{
    457457   int n;
     
    464464   return 0;
    465465}
    466 /*-----------------------------------------------------------*         
     466/*-----------------------------------------------------------*
    467467 * with this you can call at all the rtems monitor commands.
    468468 * Not all work fine but you can show the rtems status and more.
    469  *-----------------------------------------------------------*/         
     469 *-----------------------------------------------------------*/
    470470int main_monitor(int argc,char * argv[]) {
    471471 rtems_monitor_command_entry_t *command;
     
    477477 return 0;
    478478}
    479 /*-----------------------------------------------------------*/         
     479/*-----------------------------------------------------------*/
    480480void register_cmds(void) {
    481481  rtems_monitor_command_entry_t *command;
     
    504504  /* misc. topic */
    505505  shell_add_cmd  ("logoff","misc","logoff from the system"                    ,main_logoff);
    506   shell_alias_cmd("logoff","exit"); 
     506  shell_alias_cmd("logoff","exit");
    507507  shell_add_cmd  ("date" ,"misc","date"                                       ,main_date);
    508508  shell_add_cmd  ("reset","misc","reset the BSP"                              ,main_reset);
     
    522522#ifdef MALLOC_STATS  /* /rtems/s/src/lib/libc/malloc.c */
    523523  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  
    33 *  Instantatiate a new terminal shell.
    44 *
    5  *  Author: 
     5 *  Author:
    66 *
    7  *   WORK: fernando.ruiz@ctv.es 
     7 *   WORK: fernando.ruiz@ctv.es
    88 *   HOME: correo@fernando-ruiz.com
    99 *
     
    2323#include <rtems/error.h>
    2424#include <rtems/libio.h>
    25 #include <rtems/libio_.h> 
    26 #include <rtems/system.h> 
     25#include <rtems/libio_.h>
     26#include <rtems/system.h>
    2727#include <rtems/shell.h>
    2828
     
    6666static shell_topic_t * shell_first_topic;
    6767/* ----------------------------------------------- *
    68  * Using Chain I can reuse the rtems code. 
     68 * Using Chain I can reuse the rtems code.
    6969 * I am more comfortable with this, sorry.
    7070 * ----------------------------------------------- */
     
    8282 shell_topic_t * current,*aux;
    8383 if (!shell_first_topic) {
    84   aux=malloc(sizeof(shell_topic_t));   
     84  aux=malloc(sizeof(shell_topic_t));
    8585  aux->topic=topic;
    8686  aux->next=(shell_topic_t*)NULL;
     
    9292   if (!strcmp(topic,current->next->topic)) return current->next;
    9393   current=current->next;
    94   }; 
    95   aux=malloc(sizeof(shell_topic_t));   
     94  };
     95  aux=malloc(sizeof(shell_topic_t));
    9696  aux->topic=topic;
    9797  aux->next=(shell_topic_t*)NULL;
     
    186186  if (shell_cmd->alias) {
    187187   printf("is an <alias> for command '%s'",shell_cmd->alias->name);
    188   } else 
     188  } else
    189189  if (shell_cmd->usage) {
    190190   pc=shell_cmd->usage;
     
    199199               break;
    200200    };
    201     pc++;           
     201    pc++;
    202202    if(col>78) { /* What daring... 78?*/
    203203     if (*pc) {
     
    209209      printf("            ");
    210210      col=12;line++;
    211     }; 
     211    };
    212212   };
    213213  };
     
    221221 * ----------------------------------------------- */
    222222int shell_help(int argc,char * argv[]) {
    223   int col,line,arg;     
     223  int col,line,arg;
    224224  shell_topic_t *topic;
    225225  shell_cmd_t * shell_cmd=shell_first_cmd;
    226226  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");
    229229   topic=shell_first_topic;
    230230   col=0;
     
    238238     } else {
    239239      col+=printf(", %s",topic->topic);
    240      }; 
     240     };
    241241    };
    242242    topic=topic->next;
     
    265265   line++;
    266266   while (shell_cmd) {
    267     if (!strcmp(topic->topic,shell_cmd->topic)) 
     267    if (!strcmp(topic->topic,shell_cmd->topic))
    268268     line+=shell_help_cmd(shell_cmd);
    269269    if (line>16) {
     
    274274    shell_cmd=shell_cmd->next;
    275275   };
    276   }; 
     276  };
    277277  puts("");
    278278  return 0;
     
    285285  col=0;
    286286  if (*line) {
    287    col=strlen(line);     
     287   col=strlen(line);
    288288   if (out) fprintf(out,"%s",line);
    289289  };
     
    291291  if (out) tcdrain(fileno(out));
    292292  for (;;) {
    293    line[col]=0;   
     293   line[col]=0;
    294294   c=fgetc(in);
    295295   switch (c) {
     
    300300    case '\f':if (out) fputc('\f',out);
    301301    case 0x03:/*Control-C*/
    302               line[0]=0; 
     302              line[0]=0;
    303303    case '\r':if (out) fputc('\n',out);
    304304              return 1;
     
    317317    default  :if (!iscntrl(c)) {
    318318                if (col<size-1) {
    319                  line[col++]=c; 
     319                 line[col++]=c;
    320320                 if (out) fputc(c,out);
    321321                } else {
     
    323323                };
    324324              } else {
    325                 if (out) 
     325                if (out)
    326326                 if (c=='\a') fputc('\a',out);
    327327              };
     
    331331}
    332332/* ----------------------------------------------- *
    333  * - The shell TASK                               
     333 * - The shell TASK
    334334 * Poor but enough..
    335335 * TODO: Redirection. Tty Signals. ENVVARs. Shell language.
    336336 * ----------------------------------------------- */
    337337shell_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
     340extern char **environ;
    341341
    342342void cat_file(FILE * out,char * name) {
     
    349349           fclose(fd);
    350350          };
    351         }; 
     351        };
    352352}
    353353
     
    358358         fwrite(content,1,strlen(content),fd);
    359359         fclose(fd);
    360         }; 
     360        };
    361361}
    362362
     
    367367 issue_inited=TRUE;
    368368 getpwnam("root"); /* dummy call to init /etc dir */
    369  if (stat("/etc/issue",&buf)) 
     369 if (stat("/etc/issue",&buf))
    370370  write_file("/etc/issue",
    371371             "Welcome to @V\\n"
    372372             "Login into @S(@L)\\n");
    373  if (stat("/etc/issue.net",&buf)) 
     373 if (stat("/etc/issue.net",&buf))
    374374  write_file("/etc/issue.net",
    375375             "Welcome to %v\n"
     
    416416                      break;
    417417             };
    418             } else 
     418            } else
    419419            if (c=='\\')  {
    420420             switch(c=fgetc(fd)) {
     
    430430             };
    431431            } else {
    432              fputc(c,out);                             
    433             }; 
     432             fputc(c,out);
     433            };
    434434           };
    435435           fclose(fd);
    436           } 
    437          } else { 
     436          }
     437         } else {
    438438          fd=fopen("/etc/issue.net","r");
    439439          if (fd) {
     
    464464             };
    465465            } else {
    466              fputc(c,out);                             
    467             }; 
     466             fputc(c,out);
     467            };
    468468           };
    469469           fclose(fd);
    470           } 
     470          }
    471471         };
    472472        };
     
    484484                if ((passwd=getpwnam(name))) {
    485485                 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);
    488488                  rtems_current_user_env->euid=
    489489                  rtems_current_user_env->egid=0;
    490490                  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;
    493493                  if (!strcmp(passwd->pw_passwd,"*")) {
    494494                   /* /etc/shadow */
     
    514514  rtems_status_code sc;
    515515
    516   struct termios term; 
     516  struct termios term;
    517517  char * devname;
    518518
     
    525525  sc=rtems_task_variable_add(RTEMS_SELF,(void*)&current_shell_env,free);
    526526  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):");
    528528   rtems_task_delete(RTEMS_SELF);
    529   }; 
    530 
    531   current_shell_env=shell_env; 
    532  
     529  };
     530
     531  current_shell_env=shell_env;
     532
    533533  sc=rtems_libio_set_private_env();
    534534  if (sc!=RTEMS_SUCCESSFUL) {
    535    rtems_error(sc,"rtems_libio_set_private_env():");     
     535   rtems_error(sc,"rtems_libio_set_private_env():");
    536536   rtems_task_delete(RTEMS_SELF);
    537   }; 
     537  };
    538538
    539539
     
    545545
    546546  stdin =fopen(devname,"r+");
    547    
     547
    548548  if (!stdin) {
    549549   fprintf(stderr,"shell:unable to open stdin.%s:%s\n",devname,strerror(errno));
     
    579579  shell_add_cmd(NULL,NULL,NULL,NULL); /* init the chain list*/
    580580  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..*/
    582582  sc=rtems_libio_set_private_env();
    583583  if (sc!=RTEMS_SUCCESSFUL) {
    584    rtems_error(sc,"rtems_libio_set_private_env():");     
     584   rtems_error(sc,"rtems_libio_set_private_env():");
    585585   rtems_task_delete(RTEMS_SELF);
    586586  };
     
    594594   shell_env->exit_shell=FALSE;
    595595   for (;;) {
    596     /* Prompt section */         
     596    /* Prompt section */
    597597    /* XXX: show_prompt user adjustable */
    598598    getcwd(curdir,sizeof(curdir));
    599599    printf("%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#');
    600     /* getcmd section */         
     600    /* getcmd section */
    601601    if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/
    602     /* evaluate cmd section */   
     602    /* evaluate cmd section */
    603603    if (!strcmp(cmd,"e")) {  /* edit last command */
    604604     strcpy(cmd,last_cmd);
    605605     continue;
    606     } else 
     606    } else
    607607    if (!strcmp(cmd,"r")) {  /* repeat last command */
    608608     strcpy(cmd,last_cmd);
    609     } else 
     609    } else
    610610    if (strcmp(cmd,"")) { /* only for get a new prompt */
    611611     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.
    616616     *  Open a new stdio files with posibility of redirection *
    617617     *  Run in a new shell task background. (unix &)
    618618     *  Resuming. A little bash.
    619      */   
     619     */
    620620    if (shell_make_args(cmd,&argc,argv)) {
    621621     if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) {
     
    626626     };
    627627    };
    628     /* end exec cmd section */   
     628    /* end exec cmd section */
    629629    if (shell_env->exit_shell)  break;
    630630    cmd[0]=0;
     
    634634  } while (shell_env->forever);
    635635  fclose(stdin );
    636   fclose(stdout); 
     636  fclose(stdout);
    637637  fclose(stderr);
    638638  rtems_task_delete(RTEMS_SELF);
     
    655655                     &task_id);
    656656 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);
    658658  return sc;
    659  }; 
     659 };
    660660 shell_env=malloc(sizeof(shell_env_t));
    661661 if (!shell_env) {
    662662  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);
    665665  return sc;
    666666 };
     
    672672  global_shell_env.exit_shell=0;
    673673  global_shell_env.forever   =TRUE;
    674  }; 
    675  shell_env->magic     =global_shell_env.magic; 
     674 };
     675 shell_env->magic     =global_shell_env.magic;
    676676 shell_env->devname   =devname;
    677677 shell_env->taskname  =task_name;
  • cpukit/libmisc/shell/shell.h

    r8486081 raed742c  
    33 *  Instantatiate a new terminal shell.
    44 *
    5  *  Author: 
     5 *  Author:
    66 *
    7  *   WORK: fernando.ruiz@ctv.es 
     7 *   WORK: fernando.ruiz@ctv.es
    88 *   HOME: correo@fernando-ruiz.com
    99 *
     
    1919#ifdef __cplusplus
    2020extern "C" {
    21 #endif 
     21#endif
    2222
    23 #include <rtems.h>     
    24 #include <stdio.h>     
    25 #include <termios.h>   
     23#include <rtems.h>
     24#include <stdio.h>
     25#include <termios.h>
    2626
    2727typedef int (*shell_command_t)(int argc,char * argv[]);
     
    5252
    5353typedef struct  {
    54   rtems_name magic; /* 'S','E','N','V': Shell Environment */   
     54  rtems_name magic; /* 'S','E','N','V': Shell Environment */
    5555  char * devname;
    5656  char * taskname;
     
    6666void cat_file(FILE * out,char *name);
    6767void write_file(char *name,char * content);
    68        
     68
    6969rtems_status_code shell_init(char * task_name      ,
    7070                              uint32_t      task_stacksize,/*0 default*/
     
    7272                              char * devname      ,
    7373                              tcflag_t tcflag     ,
    74                               int forever         );   
     74                              int forever         );
    7575
    7676extern shell_env_t global_shell_env,
    7777                *  current_shell_env;
    7878/*--------*/
    79 /* cmds.c */ 
     79/* cmds.c */
    8080/*--------*/
    8181int str2int(char * s);
    8282void register_cmds(void);
    83  
     83
    8484#ifdef __cplusplus
    8585}
    86 #endif 
     86#endif
    8787
    8888#endif
  • cpukit/libmisc/stackchk/check.c

    r8486081 raed742c  
    530530  );
    531531
    532   for ( api_index = 1 ; 
    533         api_index <= OBJECTS_APIS_LAST ; 
     532  for ( api_index = 1 ;
     533        api_index <= OBJECTS_APIS_LAST ;
    534534        api_index++ ) {
    535535    if ( !_Objects_Information_table[ api_index ] )
  • cpukit/libmisc/untar/untar.c

    r8486081 raed742c  
    4848 *   512   (s+p)bytes  File contents (s+p) := (((s) + 511) & ~511),
    4949 *                     round up to 512 bytes
    50  * 
     50 *
    5151 *   Checksum:
    5252 *   int i, sum;
     
    166166
    167167      /******************************************************************
    168        * Compute the TAR checksum and check with the value in 
     168       * Compute the TAR checksum and check with the value in
    169169       * the archive.  The checksum is computed over the entire
    170170       * header, but the checksum field is substituted with blanks.
     
    313313
    314314      /******************************************************************
    315        * Compute the TAR checksum and check with the value in 
     315       * Compute the TAR checksum and check with the value in
    316316       * the archive.  The checksum is computed over the entire
    317317       * header, but the checksum field is substituted with blanks.
Note: See TracChangeset for help on using the changeset viewer.