Remove stray white spaces.

This commit is contained in:
Ralf Corsepius
2004-04-16 12:06:28 +00:00
parent 84860816e3
commit aed742c9a0
42 changed files with 578 additions and 522 deletions

View File

@@ -2,7 +2,7 @@
------------------------------------------------------------------------
$Id$
------------------------------------------------------------------------
Copyright Objective Design Systems Pty Ltd, 2002
All rights reserved Objective Design Systems Pty Ltd, 2002
Chris Johns (ccj@acm.org)
@@ -14,7 +14,7 @@
found in the file LICENSE in this distribution.
This software with is provided ``as is'' and with NO WARRANTY.
------------------------------------------------------------------------
RTEMS Performance Monitoring and Measurement Framework.
@@ -63,9 +63,9 @@ static const char* open_usage = "usage: copen [-i] size\n";
static void
rtems_capture_cli_open (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
uint32_t size = 0;
@@ -112,7 +112,7 @@ rtems_capture_cli_open (
if (!enable)
return;
sc = rtems_capture_control (enable);
if (sc != RTEMS_SUCCESSFUL)
@@ -135,9 +135,9 @@ rtems_capture_cli_open (
static void
rtems_capture_cli_close (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -164,9 +164,9 @@ rtems_capture_cli_close (
static void
rtems_capture_cli_enable (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -193,9 +193,9 @@ rtems_capture_cli_enable (
static void
rtems_capture_cli_disable (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -222,9 +222,9 @@ rtems_capture_cli_disable (
static void
rtems_capture_cli_task_list (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
@@ -313,12 +313,12 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
rtems_task_priority floor = rtems_capture_watch_get_floor ();
int last_count = 0;
printf ("\x1b[2J Press ENTER to exit.\n\n");
printf (" PID NAME RPRI CPRI STATE %%CPU %%STK FLGS EXEC TIME\n");
for (;;)
{
{
rtems_capture_task_t* tasks[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
unsigned long long load[RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS + 1];
rtems_capture_task_t* task;
@@ -328,18 +328,18 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
int j;
cli_load_thread_active = 1;
/*
* Iterate over the tasks and sort the highest load tasks
* into our local arrays. We only handle a limited number of
* tasks.
*/
memset (tasks, 0, sizeof (tasks));
memset (load, 0, sizeof (load));
task = rtems_capture_get_task_list ();
while (task)
{
if (rtems_capture_task_valid (task))
@@ -366,14 +366,14 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
load[i] = l;
break;
}
}
}
task = rtems_capture_next_task (task);
}
printf ("\x1b[4;0H");
total_time = 0;
for (i = 0; i < RTEMS_CAPTURE_CLI_MAX_LOAD_TASKS; i++)
total_time += load[i];
@@ -391,7 +391,7 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
if (!tasks[i])
break;
j--;
stack_used = rtems_capture_task_stack_usage (tasks[i]) * 100;
@@ -425,11 +425,11 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
printf ("--");
else
printf ("%c%c",
rtems_capture_task_control (tasks[i]) ?
rtems_capture_task_control (tasks[i]) ?
(rtems_capture_task_control_flags (tasks[i]) &
RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
rtems_capture_watch_global_on () ? 'g' : '-');
printf (" %qi\n", rtems_capture_task_time (tasks[i]));
}
@@ -442,7 +442,7 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
last_count = count;
cli_load_thread_active = 0;
rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (5000000));
}
}
@@ -458,16 +458,16 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
static void
rtems_capture_cli_task_load (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
rtems_task_priority priority;
rtems_name name;
rtems_id id;
sc = rtems_task_set_priority (RTEMS_SELF, RTEMS_CURRENT_PRIORITY, &priority);
if (sc != RTEMS_SUCCESSFUL)
@@ -475,23 +475,23 @@ rtems_capture_cli_task_load (
printf ("error: cannot obtain the current priority: %s\n", rtems_status_text (sc));
return;
}
memcpy (&name, "CPlt", 4);
sc = rtems_task_create (name, priority, 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id);
if (sc != RTEMS_SUCCESSFUL)
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: cannot create helper thread: %s\n", rtems_status_text (sc));
return;
}
sc = rtems_task_start (id, rtems_capture_cli_task_load_thread, 0);
if (sc != RTEMS_SUCCESSFUL)
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: cannot start helper thread: %s\n", rtems_status_text (sc));
rtems_task_delete (id);
@@ -505,7 +505,7 @@ rtems_capture_cli_task_load (
if ((c == '\r') || (c == '\n'))
{
int loops = 20;
while (loops && cli_load_thread_active)
rtems_task_wake_after (TOD_MICROSECONDS_TO_TICKS (100000));
@@ -529,15 +529,15 @@ rtems_capture_cli_task_load (
static void
rtems_capture_cli_watch_list (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_capture_control_t* control = rtems_capture_get_control_list ();
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
rtems_task_priority floor = rtems_capture_watch_get_floor ();
printf ("watch priority ceiling is %i\n", ceiling);
printf ("watch priority floor is %i\n", floor);
printf ("global watch is %s\n",
@@ -549,7 +549,7 @@ rtems_capture_cli_watch_list (
int f;
int fshowed;
int lf;
printf (" ");
rtems_monitor_dump_id (rtems_capture_control_id (control));
printf (" ");
@@ -568,7 +568,7 @@ rtems_capture_cli_watch_list (
printf ("\n");
lf = 0;
}
/*
* FIXME: name test.
*/
@@ -619,7 +619,7 @@ rtems_capture_cli_get_name_id (char* arg,
/*
* See if the arg is all hex digits.
*/
l = strlen (arg);
for (i = 0; i < l; i++)
@@ -627,9 +627,9 @@ rtems_capture_cli_get_name_id (char* arg,
break;
*id = strtoul (arg, 0, 16);
objclass = _Objects_Get_class (*id);
if ((i == l))
*valid_id = 1;
else
@@ -655,9 +655,9 @@ static char const * watch_add_usage = "usage: cwadd [task name] [id]\n";
static void
rtems_capture_cli_watch_add (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -717,9 +717,9 @@ static char const * watch_del_usage = "usage: cwdel [task name] [id]\n";
static void
rtems_capture_cli_watch_del (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -778,9 +778,9 @@ static char const * watch_control_usage = "usage: cwctl [task name] [id] on/off\
static void
rtems_capture_cli_watch_control (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -844,9 +844,9 @@ static char const * watch_global_usage = "usage: cwglob on/off\n";
static void
rtems_capture_cli_watch_global (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -898,9 +898,9 @@ static char const * watch_ceiling_usage = "usage: cwceil priority\n";
static void
rtems_capture_cli_watch_ceiling (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -949,9 +949,9 @@ static char const * watch_floor_usage = "usage: cwfloor priority\n";
static void
rtems_capture_cli_watch_floor (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -1000,9 +1000,9 @@ static char const *trigger_set_usage = "usage: ctrig type [from] [fromid] [to] [
static void
rtems_capture_cli_trigger_set (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -1156,9 +1156,9 @@ rtems_capture_cli_trigger_set (
static void
rtems_capture_cli_trace_records (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -1169,7 +1169,7 @@ rtems_capture_cli_trace_records (
uint32_t read;
rtems_capture_record_t* rec;
int arg;
for (arg = 1; arg < argc; arg++)
{
if (argv[arg][0] == '-')
@@ -1196,7 +1196,7 @@ rtems_capture_cli_trace_records (
printf ("error: option -r requires number and currently it is not\n");
return;
}
dump_total = strtoul (argv[arg], 0, 0);
}
else
@@ -1205,7 +1205,7 @@ rtems_capture_cli_trace_records (
}
total = dump_total;
while (total)
{
sc = rtems_capture_read (0, 0, &read, &rec);
@@ -1219,7 +1219,7 @@ rtems_capture_cli_trace_records (
if (read == 0)
break;
for (count = 0; count < read; count++, rec++)
{
if (csv)
@@ -1236,7 +1236,7 @@ rtems_capture_cli_trace_records (
int e;
event = rec->events >> RTEMS_CAPTURE_EVENT_START;
t = rec->ticks;
t *= rtems_capture_tick_time ();
t += rec->tick_offset;
@@ -1281,9 +1281,9 @@ rtems_capture_cli_trace_records (
static void
rtems_capture_cli_flush (
int argc,
int argc,
char **argv,
rtems_monitor_command_arg_t *command_arg,
rtems_monitor_command_arg_t *command_arg,
boolean verbose )
{
rtems_status_code sc;
@@ -1458,7 +1458,7 @@ rtems_status_code
rtems_capture_cli_init (rtems_capture_timestamp timestamp)
{
int cmd;
capture_timestamp = timestamp;
for (cmd = 0;

View File

@@ -2,7 +2,7 @@
------------------------------------------------------------------------
$Id$
------------------------------------------------------------------------
Copyright Objective Design Systems Pty Ltd, 2002
All rights reserved Objective Design Systems Pty Ltd, 2002
Chris Johns (ccj@acm.org)
@@ -14,7 +14,7 @@
found in the file LICENSE in this distribution.
This software with is provided ``as is'' and with NO WARRANTY.
------------------------------------------------------------------------
RTEMS Performance Monitoring and Measurement Framework.

View File

@@ -2,7 +2,7 @@
------------------------------------------------------------------------
$Id$
------------------------------------------------------------------------
Copyright Objective Design Systems Pty Ltd, 2002
All rights reserved Objective Design Systems Pty Ltd, 2002
Chris Johns (ccj@acm.org)
@@ -14,7 +14,7 @@
found in the file LICENSE in this distribution.
This software with is provided ``as is'' and with NO WARRANTY.
------------------------------------------------------------------------
RTEMS Performance Monitoring and Measurement Framework.
@@ -236,7 +236,7 @@ static inline rtems_capture_control_t*
rtems_capture_find_control (rtems_name name, rtems_id id)
{
rtems_capture_control_t* control;
for (control = capture_controls; control != NULL; control = control->next)
if (rtems_capture_match_name_id (name, id, control->name, control->id))
break;
@@ -262,7 +262,7 @@ rtems_capture_create_control (rtems_name name, rtems_id id)
return NULL;
control = rtems_capture_find_control (name, id);
if (control == NULL)
{
control = _Workspace_Allocate (sizeof (rtems_capture_control_t));
@@ -272,14 +272,14 @@ rtems_capture_create_control (rtems_name name, rtems_id id)
capture_flags |= RTEMS_CAPTURE_NO_MEMORY;
return NULL;
}
control->name = name;
control->id = id;
control->flags = 0;
memset (control->from, 0, sizeof (control->from));
memset (control->from_id, 0, sizeof (control->from_id));
rtems_interrupt_disable (level);
control->next = capture_controls;
@@ -323,7 +323,7 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
}
rtems_capture_dup_name (&task->name, ((rtems_name) new_task->Object.name));
task->id = new_task->Object.id;
task->flags = 0;
task->in = 0;
@@ -359,7 +359,7 @@ rtems_capture_create_capture_task (rtems_tcb* new_task)
if (rtems_capture_match_name_id (control->name, control->id,
task->name, task->id))
task->control = control;
return task;
}
@@ -398,9 +398,9 @@ rtems_capture_record (rtems_capture_task_t* task,
(control && (control->flags & RTEMS_CAPTURE_WATCH)))))
{
rtems_interrupt_level level;
rtems_interrupt_disable (level);
if (capture_count < capture_size)
{
capture_count++;
@@ -417,7 +417,7 @@ rtems_capture_record (rtems_capture_task_t* task,
if (capture_in == &capture_records[capture_size - 1])
capture_in = capture_records;
else
capture_in++;
capture_in++;
}
else
capture_flags |= RTEMS_CAPTURE_OVERFLOW;
@@ -500,7 +500,7 @@ rtems_capture_start_task (rtems_tcb* current_task,
rtems_capture_record (ct, RTEMS_CAPTURE_STARTED_BY_EVENT);
rtems_capture_record (st, RTEMS_CAPTURE_STARTED_EVENT);
rtems_capture_init_stack_usage (st);
}
@@ -671,7 +671,7 @@ rtems_capture_switch_task (rtems_tcb* current_task,
{
uint32_t ticks;
uint32_t tick_offset;
/*
* Get the cpature task control block so we can update the
* reference anbd perform any watch or trigger functions.
@@ -719,7 +719,7 @@ rtems_capture_switch_task (rtems_tcb* current_task,
ht->ticks_in = ticks;
ht->tick_offset_in = tick_offset;
}
if (ct)
{
ct->out++;
@@ -728,7 +728,7 @@ rtems_capture_switch_task (rtems_tcb* current_task,
if (capture_timestamp)
{
tick_offset += capture_tick_period - ct->tick_offset_in;
if (tick_offset < capture_tick_period)
ct->tick_offset = tick_offset;
else
@@ -754,7 +754,7 @@ rtems_capture_switch_task (rtems_tcb* current_task,
if (ct)
{
cc = ct->control;
/*
* Check the current task for a TO_ANY trigger.
*/
@@ -854,7 +854,7 @@ rtems_capture_open (uint32_t size, rtems_capture_timestamp timestamp)
* Get the tick period from the BSP Configuration Table.
*/
capture_tick_period = _Configuration_Table->microseconds_per_tick;
/*
* Register the user extension handlers for the CAPture Engine.
*/
@@ -922,7 +922,7 @@ rtems_capture_close ()
return sc;
task = capture_tasks;
while (task)
{
rtems_capture_task_t* delete = task;
@@ -933,7 +933,7 @@ rtems_capture_close ()
capture_tasks = NULL;
control = capture_controls;
while (control)
{
rtems_capture_control_t* delete = control;
@@ -1009,7 +1009,7 @@ rtems_capture_flush (rtems_boolean prime)
capture_in = capture_records;
capture_out = 0;
rtems_interrupt_enable (level);
rtems_interrupt_enable (level);
return RTEMS_SUCCESSFUL;
}
@@ -1074,7 +1074,7 @@ rtems_capture_watch_del (rtems_name name, rtems_id id)
if (rtems_capture_match_name_id (name, id, control->name, control->id))
{
rtems_interrupt_disable (level);
for (task = capture_tasks; task != NULL; task = task->next)
if (task->control == control)
task->control = 0;
@@ -1116,7 +1116,7 @@ rtems_capture_watch_ctrl (rtems_name name, rtems_id id, rtems_boolean enable)
rtems_interrupt_level level;
rtems_capture_control_t* control;
rtems_boolean found = 0;
/*
* Find the control and then set the watch. It must exist before it can
* be controlled.
@@ -1135,7 +1135,7 @@ rtems_capture_watch_ctrl (rtems_name name, rtems_id id, rtems_boolean enable)
rtems_interrupt_enable (level);
found = 1;
}
}
}
if (found)
@@ -1157,7 +1157,7 @@ rtems_status_code
rtems_capture_watch_global (rtems_boolean enable)
{
rtems_interrupt_level level;
rtems_interrupt_disable (level);
/*
@@ -1278,7 +1278,7 @@ rtems_capture_set_trigger (rtems_name from,
{
rtems_capture_control_t* control;
int i;
/*
* Find the capture control blocks for the from and to
* tasks.
@@ -1297,7 +1297,7 @@ rtems_capture_set_trigger (rtems_name from,
control = rtems_capture_create_control (to, to_id);
if (control == NULL)
return RTEMS_NO_MEMORY;
if (trigger == rtems_capture_from_any)
control->flags |= RTEMS_CAPTURE_FROM_ANY;
else
@@ -1387,10 +1387,10 @@ rtems_capture_read (uint32_t threshold,
*/
if (count && ((capture_out + count) >= capture_size))
*read = capture_size - capture_out;
/*
* Do we have a threshold and the current count has not wrapped
* around the end of the capture record buffer ?
* Do we have a threshold and the current count has not wrapped
* around the end of the capture record buffer ?
*/
if ((*read == count) && threshold)
{
@@ -1404,11 +1404,11 @@ rtems_capture_read (uint32_t threshold,
rtems_task_ident (RTEMS_SELF, RTEMS_LOCAL, &capture_reader);
rtems_interrupt_disable (level);
capture_flags |= RTEMS_CAPTURE_READER_WAITING;
rtems_interrupt_enable (level);
sc = rtems_event_receive (RTEMS_EVENT_0,
RTEMS_WAIT | RTEMS_EVENT_ANY,
TOD_MICROSECONDS_TO_TICKS (timeout),
@@ -1481,7 +1481,7 @@ rtems_capture_release (uint32_t count)
*
* This function returns the tick period in nano-seconds.
*/
uint32_t
uint32_t
rtems_capture_tick_time ()
{
return capture_tick_period;
@@ -1526,7 +1526,7 @@ rtems_capture_get_task_list ()
* This function updates the stack usage. The task control block
* is updated.
*/
uint32_t
uint32_t
rtems_capture_task_stack_usage (rtems_capture_task_t* task)
{
if (task->tcb)

View File

@@ -2,7 +2,7 @@
------------------------------------------------------------------------
$Id$
------------------------------------------------------------------------
Copyright Objective Design Systems Pty Ltd, 2002
All rights reserved Objective Design Systems Pty Ltd, 2002
Chris Johns (ccj@acm.org)
@@ -14,7 +14,7 @@
found in the file LICENSE in this distribution.
This software with is provided ``as is'' and with NO WARRANTY.
------------------------------------------------------------------------
RTEMS Performance Monitoring and Measurement Framework.
@@ -42,7 +42,7 @@ extern "C" {
*
* DESCRIPTION:
*
* RTEMS control holds the trigger and watch configuration for a group of
* RTEMS control holds the trigger and watch configuration for a group of
* tasks with the same name.
*/
typedef struct rtems_capture_control_s
@@ -62,15 +62,15 @@ typedef struct rtems_capture_control_s
#define RTEMS_CAPTURE_FROM_ANY (1 << 1)
#define RTEMS_CAPTURE_TO_ANY (1 << 2)
#define RTEMS_CAPTURE_FROM_TO (1 << 3)
/*
* rtems_capture_control_t
*
* DESCRIPTION:
*
* RTEMS capture control provdes the information about a task, along
* RTEMS capture control provdes the information about a task, along
* with its trigger state. The control is referenced by each
* capture record. This is* information neeed by the decoder. The
* capture record. This is* information neeed by the decoder. The
* capture record cannot assume the task will exist when the record is
* dumped via the target interface so task info needed for tracing is
* copied and held here.
@@ -79,7 +79,7 @@ typedef struct rtems_capture_control_s
* contained in this structure.
*
* Note, the tracer code exploits the fact an rtems_name is a
* 32bit value.
* 32bit value.
*/
typedef struct rtems_capture_task_s
{
@@ -407,7 +407,7 @@ rtems_capture_release (uint32_t count);
*
* This function returns the tick period in micro-seconds.
*/
uint32_t
uint32_t
rtems_capture_tick_time ();
/*
@@ -417,7 +417,7 @@ rtems_capture_tick_time ();
*
* This function returns the tick period in micro-seconds.
*/
uint32_t
uint32_t
rtems_capture_tick_time ();
/*
@@ -519,7 +519,7 @@ rtems_capture_task_name (rtems_capture_task_t* task)
*
* This function returns the task flags.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_flags (rtems_capture_task_t* task)
{
return task->flags;
@@ -545,7 +545,7 @@ rtems_capture_task_control (rtems_capture_task_t* task)
*
* This function returns the task control flags if a control is present.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_control_flags (rtems_capture_task_t* task)
{
if (!task->control)
@@ -561,7 +561,7 @@ rtems_capture_task_control_flags (rtems_capture_task_t* task)
* This function returns the number of times the task has
* been switched into context.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_switched_in (rtems_capture_task_t* task)
{
return task->in;
@@ -575,7 +575,7 @@ rtems_capture_task_switched_in (rtems_capture_task_t* task)
* This function returns the number of times the task has
* been switched out of context.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_switched_out (rtems_capture_task_t* task)
{
return task->out;
@@ -633,7 +633,7 @@ rtems_capture_task_curr_priority (rtems_capture_task_t* task)
* This function updates the stack usage. The task control block
* is updated.
*/
uint32_t
uint32_t
rtems_capture_task_stack_usage (rtems_capture_task_t* task);
/*
@@ -643,7 +643,7 @@ rtems_capture_task_stack_usage (rtems_capture_task_t* task);
*
* This function returns the task's stack size.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_stack_size (rtems_capture_task_t* task)
{
return task->stack_size;
@@ -656,7 +656,7 @@ rtems_capture_task_stack_size (rtems_capture_task_t* task)
*
* This function returns the amount of stack used.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_stack_used (rtems_capture_task_t* task)
{
return task->stack_size - task->stack_clean;
@@ -669,7 +669,7 @@ rtems_capture_task_stack_used (rtems_capture_task_t* task)
*
* This function returns the current execution time as ticks.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_ticks (rtems_capture_task_t* task)
{
return task->ticks;
@@ -682,7 +682,7 @@ rtems_capture_task_ticks (rtems_capture_task_t* task)
*
* This function returns the current execution time tick offset.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_tick_offset (rtems_capture_task_t* task)
{
return task->tick_offset;
@@ -730,12 +730,12 @@ rtems_capture_task_delta_time (rtems_capture_task_t* task)
* This function returns the number of tasks the capture
* engine knows about.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_task_count ()
{
rtems_capture_task_t* task = rtems_capture_get_task_list ();
uint32_t count = 0;
while (task)
{
count++;
@@ -803,7 +803,7 @@ rtems_capture_control_name (rtems_capture_control_t* control)
*
* This function returns the control flags.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_control_flags (rtems_capture_control_t* control)
{
return control->flags;
@@ -847,7 +847,7 @@ rtems_capture_control_from_id (rtems_capture_control_t* control, int from)
* This function returns the number of controls the capture
* engine has.
*/
static inline uint32_t
static inline uint32_t
rtems_capture_control_count ()
{
rtems_capture_control_t* control = rtems_capture_get_control_list ();

View File

@@ -53,7 +53,7 @@ void CPU_usage_Dump( void )
if ( information ) {
for ( i=1 ; i <= information->maximum ; i++ ) {
the_thread = (Thread_Control *)information->local_table[ i ];
if ( the_thread )
total_units += the_thread->ticks_executed;
}
@@ -67,8 +67,8 @@ void CPU_usage_Dump( void )
printf( " ID NAME TICKS\n" );
#endif
for ( api_index = 1 ;
api_index <= OBJECTS_APIS_LAST ;
for ( api_index = 1 ;
api_index <= OBJECTS_APIS_LAST ;
api_index++ ) {
if ( !_Objects_Information_table[ api_index ] )
continue;
@@ -76,7 +76,7 @@ void CPU_usage_Dump( void )
if ( information ) {
for ( i=1 ; i <= information->maximum ; i++ ) {
the_thread = (Thread_Control *)information->local_table[ i ];
if ( !the_thread )
continue;
@@ -106,7 +106,7 @@ void CPU_usage_Dump( void )
the_thread->Object.id,
name,
the_thread->ticks_executed,
(total_units) ?
(total_units) ?
(double)the_thread->ticks_executed / (double)total_units :
(double)total_units
);

View File

@@ -45,7 +45,7 @@ rtems_device_driver null_initialize(
)
{
rtems_device_driver status;
if ( !initialized ) {
initialized = 1;
@@ -57,10 +57,10 @@ rtems_device_driver null_initialize(
if (status != RTEMS_SUCCESSFUL)
rtems_fatal_error_occurred(status);
NULL_major = major;
}
return RTEMS_SUCCESSFUL;
}
@@ -153,10 +153,10 @@ rtems_device_driver null_write(
)
{
rtems_libio_rw_args_t *rw_args = (rtems_libio_rw_args_t *) pargp;
if ( rw_args )
rw_args->bytes_moved = rw_args->count;
return NULL_SUCCESSFUL;
}

View File

@@ -17,13 +17,13 @@
#include <string.h>
#include <ctype.h>
#include <rtems/dumpbuf.h>
/*
* Put the body below Dump_Buffer so it won't get inlined.
*/
static inline void Dump_Line(
unsigned char *buffer,
unsigned char *buffer,
int length
);
@@ -32,18 +32,18 @@ void Dump_Buffer(
int length
)
{
int i, mod, max;
if ( !length ) return;
mod = length % 16;
max = length - mod;
for ( i=0 ; i<max ; i+=16 )
Dump_Line( &buffer[ i ], 16 );
if ( mod )
Dump_Line( &buffer[ max ], mod );
}
@@ -53,27 +53,27 @@ static inline void Dump_Line(
int length
)
{
int i;
char line_buffer[120];
line_buffer[0] = '\0';
for( i=0 ; i<length ; i++ )
sprintf( line_buffer, "%s%02x ", line_buffer, buffer[ i ] );
for( ; i<16 ; i++ )
strcat( line_buffer, " " );
strcat( line_buffer, "|" );
for( i=0 ; i<length ; i++ )
sprintf( line_buffer, "%s%c", line_buffer,
isprint( buffer[ i ] ) ? buffer[ i ] : '.' );
for( ; i<16 ; i++ )
strcat( line_buffer, " " );
strcat( line_buffer, "|\n" );
printf( line_buffer );
}

View File

@@ -78,7 +78,7 @@ int rtems_fsmount_create_mountpoint
*/
if (0 != stat(tok_buffer,&file_info)) {
/*
* if not, create directory
* if not, create directory
*/
rc = mknod(tok_buffer,S_IRWXU | S_IRWXG | S_IRWXO | S_IFDIR,0);
}
@@ -86,7 +86,7 @@ int rtems_fsmount_create_mountpoint
} while ((rc == 0) &&
(token_type != IMFS_NO_MORE_PATH) &&
(token_type != IMFS_INVALID_TOKEN));
/*
* return token buffer to heap
*/
@@ -126,7 +126,7 @@ int rtems_fsmount
/*
* scan through all fstab entries;
*/
while (!terminate &&
while (!terminate &&
(fstab_idx < fstab_count)) {
tmp_rc = 0;
/*
@@ -177,9 +177,9 @@ int rtems_fsmount
}
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_OK)) {
terminate = TRUE;
}
}
}
}
}
/*
* proceed to next entry
*/

View File

@@ -30,9 +30,9 @@
/*
* bits to define, what errors will cause reporting (via printf) and
* abort of mount processing
* Use a combination of these bits
* Use a combination of these bits
* for the fields "report_reasons" and "abort_reasons"
*/
*/
#define FSMOUNT_MNT_OK 0x0001 /* mounted ok */
#define FSMOUNT_MNTPNT_CRTERR 0x0002 /* cannot create mount point */
#define FSMOUNT_MNT_FAILED 0x0004 /* mounting failed */

View File

@@ -24,8 +24,8 @@
/*
* 2001-01-30 KJO (vac4050@cae597.rsc.raytheon.com):
* Fixed rtems_monitor_command_lookup() to accept partial
* commands to uniqeness. Added support for setting
* Fixed rtems_monitor_command_lookup() to accept partial
* commands to uniqeness. Added support for setting
* the monitor prompt via an environment variable:
* RTEMS_MONITOR_PROMPT
*
@@ -47,9 +47,9 @@
#define KEYS_LARROW (4)
#define KEYS_RARROW (5)
#define KEYS_HOME (6)
#define KEYS_END (7)
#define KEYS_F1 (8)
#define KEYS_F2 (9)
#define KEYS_END (7)
#define KEYS_F1 (8)
#define KEYS_F2 (9)
#define KEYS_F3 (10)
#define KEYS_F4 (11)
#define KEYS_F5 (12)
@@ -233,7 +233,7 @@ rtems_monitor_line_editor (
memset (buffer, 0, RTEMS_COMMAND_BUFFER_SIZE);
history = history_next;
pos = 0;
if (!logged_in)
printf ("\nMonitor ready, press enter to login.\n\n");
else
@@ -248,7 +248,7 @@ rtems_monitor_line_editor (
* Make the extended_key usable as a boolean.
*/
extended_key &= ~KEYS_NORMAL_MASK;
if (!extended_key && !logged_in)
{
if (c == '\n')
@@ -276,7 +276,7 @@ rtems_monitor_line_editor (
printf ("\r%s $ ", monitor_prompt);
pos = 0;
break;
case KEYS_LARROW:
if (pos > 0)
{
@@ -319,7 +319,7 @@ rtems_monitor_line_editor (
putchar ('\b');
}
break;
case KEYS_DARROW:
if (history < history_next)
{
@@ -493,14 +493,14 @@ rtems_monitor_command_read(char *command,
* put node number in the prompt if we are multiprocessing
*/
if (!rtems_configuration_get_user_multiprocessing_table ())
sprintf (monitor_prompt, "%s",
sprintf (monitor_prompt, "%s",
(env_prompt == NULL) ? MONITOR_PROMPT: env_prompt);
else if (rtems_monitor_default_node != rtems_monitor_node)
sprintf (monitor_prompt, "%d-%s-%d", rtems_monitor_node,
(env_prompt == NULL) ? MONITOR_PROMPT : env_prompt,
rtems_monitor_default_node);
else
sprintf (monitor_prompt, "%d-%s", rtems_monitor_node,
sprintf (monitor_prompt, "%d-%s", rtems_monitor_node,
(env_prompt == NULL) ? MONITOR_PROMPT : env_prompt);
#if defined(RTEMS_UNIX)
@@ -535,7 +535,7 @@ rtems_monitor_command_lookup(
if ((table == 0) || (argv[0] == 0))
return 0;
while (table)
{
if (table->command)
@@ -550,7 +550,7 @@ rtems_monitor_command_lookup(
{
return 0;
}
else
found_it = table;
}
@@ -596,11 +596,11 @@ rtems_monitor_show_help (
printf (" - No help associated.\n");
return;
}
while (help_len)
{
printf ("%*c", spaces, ' ');
if (line_one)
printf (" - ");
@@ -611,11 +611,11 @@ rtems_monitor_show_help (
* See if greater then the line length if so, work back
* from the end for a space, tab or lf or cr.
*/
if (help_len > MAX_HELP_LINE_LENGTH)
{
for (show_this_line = MAX_HELP_LINE_LENGTH - 1;
show_this_line;
for (show_this_line = MAX_HELP_LINE_LENGTH - 1;
show_this_line;
show_this_line--)
if ((help[show_this_line] == ' ') ||
(help[show_this_line] == '\n') ||
@@ -625,7 +625,7 @@ rtems_monitor_show_help (
/*
* If show_this_line is 0, it is a very long word !!
*/
if (show_this_line == 0)
show_this_line = MAX_HELP_LINE_LENGTH - 1;
}
@@ -639,14 +639,14 @@ rtems_monitor_show_help (
putchar (help[c]);
printf ("\n");
help += show_this_line;
help_len -= show_this_line;
/*
* Move past the line feeds or what ever else is being skipped.
*/
while (help_len)
{
if ((*help != '\r') && (*help != '\n'))
@@ -673,16 +673,16 @@ rtems_monitor_command_usage(
{
rtems_monitor_command_entry_t *command = table;
int max_cmd_len = 0;
/* if first entry in table is a usage, then print it out */
if (command_string && (*command_string != '\0'))
{
char *argv[2];
argv[0] = command_string;
argv[1] = 0;
command = rtems_monitor_command_lookup (table, 1, argv);
if (command)
@@ -691,11 +691,11 @@ rtems_monitor_command_usage(
printf ("Unrecognised command; try just 'help'\n");
return;
}
/*
* Find the largest command size.
*/
while (command)
{
int len = command->command ? strlen (command->command) : 0 ;
@@ -734,7 +734,7 @@ rtems_monitor_help_cmd(
rtems_monitor_command_entry_t *command;
command = command_arg->monitor_command_entry;
if (argc == 1)
rtems_monitor_command_usage(command, 0);
else

View File

@@ -48,7 +48,7 @@ rtems_monitor_config_canonical(
canonical_config->microseconds_per_tick = c->microseconds_per_tick;
canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
canonical_config->number_of_initialization_tasks = r->number_of_initialization_tasks;
}
}
/*
* This is easy, since there is only 1 (altho we could get them from
@@ -67,7 +67,7 @@ rtems_monitor_config_next(
if (n >= 1)
goto failed;
_Thread_Disable_dispatch();
*next_id += 1;

View File

@@ -46,7 +46,7 @@ rtems_monitor_dname_canonical(
(void) strncpy(canonical_dname->name_string, np->device_name, sizeof(canonical_dname->name_string));
canonical_dname->major = np->major;
canonical_dname->minor = np->minor;
}
}
void *
rtems_monitor_dname_next(
@@ -63,7 +63,7 @@ rtems_monitor_dname_next(
for (np = table + n ; n<_IO_Number_of_devices; n++, np++)
if (np->device_name)
goto done;
*next_id = RTEMS_OBJECT_ID_FINAL;
return 0;
@@ -79,7 +79,7 @@ done:
*next_id += 1;
return np;
}
}
void
rtems_monitor_dname_dump_header(

View File

@@ -71,7 +71,7 @@ rtems_monitor_driver_next(
if (n >= c->number_of_device_drivers)
goto failed;
_Thread_Disable_dispatch();
/*

View File

@@ -50,7 +50,7 @@ rtems_monitor_extension_dump_header(
ID NAME\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */
rtems_monitor_separator();
}

View File

@@ -24,7 +24,7 @@ rtems_monitor_init_task_canonical(
)
{
rtems_initialization_tasks_table *rtems_itask = itask_void;
rtems_monitor_symbol_canonical_by_value(&canonical_itask->entry,
(void *) rtems_itask->entry_point);
@@ -48,7 +48,7 @@ rtems_monitor_init_task_next(
if (n >= c->RTEMS_api_configuration->number_of_initialization_tasks)
goto failed;
_Thread_Disable_dispatch();
itask = c->RTEMS_api_configuration->User_initialization_tasks_table + n;
@@ -111,7 +111,7 @@ rtems_monitor_init_task_dump(
length += rtems_monitor_pad(54, length);
length += rtems_monitor_dump_attributes(monitor_itask->attributes);
length += rtems_monitor_pad(66, length);
length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);

View File

@@ -33,10 +33,10 @@ rtems_monitor_manager_next(
/*
* When we are called, it must be local
*/
if ( ! _Objects_Is_local_id(*next_id))
goto done;
object = _Objects_Get_next(table, *next_id, &location, next_id);
if (object)

View File

@@ -1,6 +1,6 @@
/*
* RTEMS monitor main body
*
*
* TODO:
* add stuff to RTEMS api
* rtems_get_name(id)
@@ -84,7 +84,7 @@ rtems_monitor_command_entry_t rtems_monitor_commands[] = {
rtems_monitor_object_cmd,
{ RTEMS_MONITOR_OBJECT_INIT_TASK },
&rtems_monitor_commands[2],
},
},
{ "mpci",
"Show the MPCI system configuration, if configured.",
0,
@@ -227,7 +227,7 @@ rtems_monitor_command_entry_t rtems_monitor_commands[] = {
{ 0 },
&rtems_monitor_commands[19],
},
#endif
#endif
{ 0, 0, 0, 0, { 0 }, &rtems_registered_commands },
};
@@ -237,7 +237,7 @@ rtems_monitor_suspend(rtems_interval timeout)
{
rtems_event_set event_set;
rtems_status_code status;
status = rtems_event_receive(MONITOR_WAKEUP_EVENT,
RTEMS_DEFAULT_OPTIONS,
timeout,
@@ -249,7 +249,7 @@ void
rtems_monitor_wakeup(void)
{
rtems_status_code status;
status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT);
}
@@ -314,7 +314,7 @@ rtems_monitor_node_cmd(
)
{
uint32_t new_node = rtems_monitor_default_node;
switch (argc)
{
case 1: /* no node, just set back to ours */
@@ -370,13 +370,13 @@ rtems_monitor_symbols_loadup(void)
if (rtems_monitor_symbols)
rtems_symbol_table_destroy(rtems_monitor_symbols);
rtems_monitor_symbols = rtems_symbol_table_create(10);
if (rtems_monitor_symbols == 0)
return;
fp = fopen("symbols", "r");
if (fp == 0)
return;
@@ -441,7 +441,7 @@ rtems_monitor_erase_cmd (
)
{
rtems_monitor_command_entry_t **p = & rtems_registered_commands.next;
while (*p) {
if ( STREQ(command->command, (*p)->command) ) {
*p = (*p)->next;
@@ -468,14 +468,14 @@ rtems_monitor_task(
rtems_context_fp *fp;
char command_buffer[513];
int argc;
char *argv[64];
char *argv[64];
boolean verbose = FALSE;
struct termios term;
/*
* Make the stdin stream characte not line based.
*/
if (tcgetattr (STDIN_FILENO, &term) < 0)
{
printf("rtems-monitor: cannot get terminal attributes.\n");
@@ -487,7 +487,7 @@ rtems_monitor_task(
*/
term.c_lflag &= ~(ECHO | ICANON | IEXTEN);
/*
* No sigint on BREAK, CR-to-NL off, input parity off,
* don't strip 8th bit on input, output flow control off
@@ -502,7 +502,7 @@ rtems_monitor_task(
printf("cannot set terminal attributes\n");
}
}
if (monitor_flags & RTEMS_MONITOR_SUSPEND)
(void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT);
@@ -543,7 +543,7 @@ rtems_monitor_kill(void)
if (rtems_monitor_task_id)
rtems_task_delete(rtems_monitor_task_id);
rtems_monitor_task_id = 0;
rtems_monitor_server_kill();
}
@@ -553,7 +553,7 @@ rtems_monitor_init(
)
{
rtems_status_code status;
rtems_monitor_kill();
status = rtems_task_create(RTEMS_MONITOR_NAME,
@@ -579,7 +579,7 @@ rtems_monitor_init(
/*
* Start the monitor task itself
*/
status = rtems_task_start(rtems_monitor_task_id,
rtems_monitor_task,
monitor_flags);

View File

@@ -38,7 +38,7 @@ rtems_monitor_mpci_canonical(
if (m == 0)
return;
mt = m->User_mpci_table;
canonical_mpci->node = m->node;
canonical_mpci->maximum_nodes = m->maximum_nodes;
canonical_mpci->maximum_global_objects = m->maximum_global_objects;
@@ -58,7 +58,7 @@ rtems_monitor_mpci_canonical(
(void *) mt->send_packet);
rtems_monitor_symbol_canonical_by_value(&canonical_mpci->receive_packet,
(void *) mt->receive_packet);
}
}
/*
* This is easy, since there is only 1 (altho we could get them from
@@ -77,10 +77,10 @@ rtems_monitor_mpci_next(
if (n >= 1)
goto failed;
if ( ! c->User_multiprocessing_table)
goto failed;
_Thread_Disable_dispatch();
*next_id += 1;
@@ -102,7 +102,7 @@ rtems_monitor_mpci_dump_header(
node nodes globals proxies timeout pktsize\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */
rtems_monitor_separator();
}
@@ -119,10 +119,10 @@ rtems_monitor_mpci_dump(
length += printf(" %d", monitor_mpci->node);
length += rtems_monitor_pad(11, length);
length += printf("%d", monitor_mpci->maximum_nodes);
length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
length += rtems_monitor_pad(28, length);
length += rtems_monitor_dump_decimal(monitor_mpci->maximum_proxies);

View File

@@ -126,7 +126,7 @@ rtems_monitor_id_fixup(
)
{
uint32_t node;
node = rtems_get_node(id);
if (node == 0)
{
@@ -171,7 +171,7 @@ rtems_monitor_object_canonical_next_remote(
/*
* Send request
*/
request.command = RTEMS_MONITOR_SERVER_CANONICAL;
request.argument0 = (uint32_t ) type;
request.argument1 = (uint32_t ) id;
@@ -183,7 +183,7 @@ rtems_monitor_object_canonical_next_remote(
/*
* process response
*/
next_id = (rtems_id) response.result0;
if (next_id != RTEMS_OBJECT_ID_FINAL)
(void) memcpy(canonical, &response.payload, response.result1);
@@ -213,7 +213,7 @@ rtems_monitor_object_canonical_next(
else
{
next_id = id;
raw_item = (void *) info->next(info->object_information,
canonical,
&next_id);
@@ -222,8 +222,8 @@ rtems_monitor_object_canonical_next(
{
info->canonical(canonical, raw_item);
_Thread_Enable_dispatch();
}
}
}
}
return next_id;
}
@@ -284,7 +284,7 @@ rtems_monitor_object_dump_1(
* of the canonical structures are almost too big for shared
* memory driver (eg: mpci)
*/
if ((info->next != rtems_monitor_manager_next) ||
(id == canonical.generic.id))
info->dump(&canonical, verbose);
@@ -322,7 +322,7 @@ rtems_monitor_object_cmd(
int arg;
rtems_monitor_object_info_t *info = 0;
rtems_monitor_object_type_t type ;
/* what is the default type? */
type = command_arg->monitor_object;
@@ -333,7 +333,7 @@ rtems_monitor_object_cmd(
printf("A type must be specified to \"dump all\"\n");
goto done;
}
info = rtems_monitor_object_lookup(type);
if (info == 0)
goto not_found;
@@ -364,7 +364,7 @@ rtems_monitor_object_cmd(
info = rtems_monitor_object_lookup(type);
if (info == 0)
goto not_found;
if (info->dump_header)
info->dump_header(verbose);
}
@@ -378,7 +378,7 @@ not_found: printf("Invalid or unsupported type %d\n", type);
rtems_monitor_object_dump_1(info, id, verbose);
default_node = rtems_get_node(id);
last_type = type;
}
}

View File

@@ -25,14 +25,14 @@ rtems_monitor_separator(void)
printf("------------------------------------------------------------------------------\n");
}
uint32_t
uint32_t
rtems_monitor_pad(
uint32_t destination_column,
uint32_t current_column
)
{
int pad_length;
if (destination_column <= current_column)
pad_length = 1;
else
@@ -41,7 +41,7 @@ rtems_monitor_pad(
return printf("%*s", pad_length, "");
}
uint32_t
uint32_t
rtems_monitor_dump_char(uint8_t ch)
{
if (isprint(ch))
@@ -50,25 +50,25 @@ rtems_monitor_dump_char(uint8_t ch)
return printf("%02x", ch);
}
uint32_t
uint32_t
rtems_monitor_dump_decimal(uint32_t num)
{
return printf("%4d", num);
}
uint32_t
uint32_t
rtems_monitor_dump_hex(uint32_t num)
{
return printf("0x%x", num);
}
uint32_t
uint32_t
rtems_monitor_dump_assoc_bitfield(
rtems_assoc_t *ap,
char *separator,
uint32_t value
)
{
{
uint32_t b;
uint32_t length = 0;
const char *name;
@@ -80,23 +80,23 @@ rtems_monitor_dump_assoc_bitfield(
length += printf("%s", separator);
name = rtems_assoc_name_by_local(ap, b);
if (name)
length += printf("%s", name);
else
length += printf("0x%x", b);
}
return length;
}
uint32_t
uint32_t
rtems_monitor_dump_id(rtems_id id)
{
return printf("%08x", id);
}
uint32_t
uint32_t
rtems_monitor_dump_name(rtems_name name)
{
uint32_t i;
@@ -105,9 +105,9 @@ rtems_monitor_dump_name(rtems_name name)
uint32_t ui;
char c[4];
} u;
u.ui = (uint32_t ) name;
#if (CPU_BIG_ENDIAN == TRUE)
for (i=0; i<sizeof(u.c); i++)
length += rtems_monitor_dump_char(u.c[i]);
@@ -118,7 +118,7 @@ rtems_monitor_dump_name(rtems_name name)
return length;
}
uint32_t
uint32_t
rtems_monitor_dump_priority(rtems_task_priority priority)
{
return printf("%3d", priority);
@@ -146,14 +146,14 @@ rtems_assoc_t rtems_monitor_state_assoc[] = {
{ 0, 0, 0 },
};
uint32_t
uint32_t
rtems_monitor_dump_state(States_Control state)
{
uint32_t length = 0;
if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */
length += printf("READY");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
":",
state);
@@ -169,14 +169,14 @@ rtems_assoc_t rtems_monitor_attribute_assoc[] = {
{ 0, 0, 0 },
};
uint32_t
uint32_t
rtems_monitor_dump_attributes(rtems_attribute attributes)
{
uint32_t length = 0;
if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */
length += printf("DEFAULT");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
":",
attributes);
@@ -190,14 +190,14 @@ rtems_assoc_t rtems_monitor_modes_assoc[] = {
{ 0, 0, 0 },
};
uint32_t
uint32_t
rtems_monitor_dump_modes(rtems_mode modes)
{
uint32_t length = 0;
if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */
length += printf("P:T:nA");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
":",
modes);
@@ -240,21 +240,21 @@ rtems_assoc_t rtems_monitor_events_assoc[] = {
{ 0, 0, 0 },
};
uint32_t
uint32_t
rtems_monitor_dump_events(rtems_event_set events)
{
uint32_t length = 0;
if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */
length += printf("NONE");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
":",
events);
return length;
}
uint32_t
uint32_t
rtems_monitor_dump_notepad(uint32_t *notepad)
{
uint32_t length = 0;

View File

@@ -47,7 +47,7 @@ rtems_monitor_server_request(
* What is id of monitor on target node?
* Look it up if we don't know it yet.
*/
server_id = rtems_monitor_server_request_queue_ids[server_node];
if (server_id == 0)
{
@@ -59,7 +59,7 @@ rtems_monitor_server_request(
rtems_error(status, "ident of remote server failed");
goto done;
}
rtems_monitor_server_request_queue_ids[server_node] = server_id;
}
@@ -71,7 +71,7 @@ rtems_monitor_server_request(
rtems_error(status, "monitor server request send failed");
goto done;
}
/*
* Await response, if requested
*/
@@ -97,9 +97,9 @@ rtems_monitor_server_request(
{
status = RTEMS_INCORRECT_STATE;
goto done;
}
}
}
done:
return status;
}
@@ -134,13 +134,13 @@ rtems_monitor_server_task(
rtems_error(status, "monitor server msg queue receive error");
goto failed;
}
if (size != sizeof(request))
{
rtems_error(0, "monitor server bad size on receive");
goto failed;
}
switch (request.command)
{
case RTEMS_MONITOR_SERVER_CANONICAL:
@@ -162,7 +162,7 @@ rtems_monitor_server_task(
#define SERVER_OVERHEAD (RTEMS_offsetof(rtems_monitor_server_response_t, \
payload))
status = rtems_message_queue_send(request.return_id,
&response,
size + SERVER_OVERHEAD);
@@ -186,7 +186,7 @@ failed:
rtems_task_delete(RTEMS_SELF);
}
/*
* Kill off any old server
* Not sure if this is useful, but it doesn't help
@@ -219,12 +219,12 @@ rtems_monitor_server_init(
)
{
rtems_status_code status;
if (_System_state_Is_multiprocessing &&
(_Configuration_MP_table->maximum_nodes > 1))
{
uint32_t maximum_nodes = _Configuration_MP_table->maximum_nodes;
/*
* create the msg que our server will listen
* Since we only get msgs from other RTEMS monitors, we just
@@ -237,32 +237,32 @@ rtems_monitor_server_init(
sizeof(rtems_monitor_server_request_t),
RTEMS_GLOBAL,
&rtems_monitor_server_request_queue_id);
if (status != RTEMS_SUCCESSFUL)
{
rtems_error(status, "could not create monitor server message queue");
goto done;
}
/*
* create the msg que our responses will come on
* Since monitor just does one thing at a time, we only need 1 item
* message queue.
*/
status = rtems_message_queue_create(
RTEMS_MONITOR_RESPONSE_QUEUE_NAME,
1, /* depth */
sizeof(rtems_monitor_server_response_t),
RTEMS_GLOBAL,
&rtems_monitor_server_response_queue_id);
if (status != RTEMS_SUCCESSFUL)
{
rtems_error(status, "could not create monitor response message queue");
goto done;
}
/* need an id for queue of each other server we might talk to */
/* indexed by node, so add 1 to maximum_nodes */
rtems_monitor_server_request_queue_ids =

View File

@@ -245,7 +245,7 @@ rtems_symbol_value_lookup_exact(
if (table == 0)
return NULL;
}
if (table->sorted)
{
sp = rtems_symbol_value_lookup(table, value);
@@ -254,7 +254,7 @@ rtems_symbol_value_lookup_exact(
else
return NULL; /* not an exact match */
}
for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
{
if ( sp->value == value )
@@ -285,7 +285,7 @@ rtems_symbol_name_lookup(
if (table == 0)
return NULL;
}
for (s = 0, sp = table->addresses; s < table->next; s++, sp++)
{
if ( strcasecmp(sp->name, name) == 0 )
@@ -313,7 +313,7 @@ rtems_monitor_symbol_next(
goto failed;
/* NOTE: symbols do not have id and name fields */
if (table->sorted == 0)
rtems_symbol_sort(table);
@@ -380,7 +380,7 @@ rtems_monitor_symbol_canonical_by_value(
}
uint32_t
uint32_t
rtems_monitor_symbol_dump(
rtems_monitor_symbol_t *canonical_symbol,
boolean verbose

View File

@@ -24,7 +24,7 @@ rtems_monitor_task_canonical(
RTEMS_API_Control *api;
api = rtems_thread->API_Extensions[ THREAD_API_RTEMS ];
canonical_task->entry = rtems_thread->Start.entry_point;
canonical_task->argument = rtems_thread->Start.numeric_argument;
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
@@ -56,7 +56,7 @@ rtems_monitor_task_dump_header(
ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */
rtems_monitor_separator();
}

View File

@@ -38,7 +38,7 @@ typedef enum {
/* following monitor objects are not known to RTEMS, but
* we like to have "types" for them anyway */
RTEMS_MONITOR_OBJECT_DRIVER = OBJECTS_RTEMS_CLASSES_LAST+1,
RTEMS_MONITOR_OBJECT_DNAME,
RTEMS_MONITOR_OBJECT_CONFIG,
@@ -71,19 +71,19 @@ typedef enum {
/*
* Type of a pointer that may be a symbol
*/
#define MONITOR_SYMBOL_LEN 20
typedef struct {
char name[MONITOR_SYMBOL_LEN];
uint32_t value;
uint32_t offset;
} rtems_monitor_symbol_t;
} rtems_monitor_symbol_t;
typedef struct {
rtems_id id;
rtems_name name;
/* end of common portion */
} rtems_monitor_generic_t;
} rtems_monitor_generic_t;
/*
* Task
@@ -347,7 +347,7 @@ void rtems_monitor_server_kill(void);
rtems_status_code rtems_monitor_server_request(uint32_t , rtems_monitor_server_request_t *, rtems_monitor_server_response_t *);
void rtems_monitor_server_task(rtems_task_argument);
void rtems_monitor_server_init(uint32_t );
/* command.c */
int rtems_monitor_make_argv(char *, int *, char **);
int rtems_monitor_command_read(char *, int *, char **);

View File

@@ -3,17 +3,20 @@
// $Header$
//
// Copyright (c) 2000 - Rosimildo da Silva
//
// MODULE DESCRIPTION:
// Wrapper API around the ioctls calls for the Micro FrameBuffer
// interface for Embedded Systems
//
// All functions returns 0 on success. Any other value should be
// MODULE DESCRIPTION:
// Wrapper API around the ioctls calls for the Micro FrameBuffer
// interface for Embedded Systems
//
// All functions returns 0 on success. Any other value should be
// decoded as an error. A list of errors will be created over time.
//
// MODIFICATION/HISTORY:
//
// $Log$
// Revision 1.3 2004/04/15 13:24:46 ralf
// Remove stray white spaces.
//
// Revision 1.2 2003/07/08 08:38:48 ralf
// 2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
//
@@ -77,7 +80,7 @@
#include <rtems/mw_fb.h>
/*
/*
* This function returns the information regarding the display.
* It is called just after the driver be opened to get all needed
* information about the driver. No change in the mode of operation
@@ -90,8 +93,8 @@
/*
* Returns the mode of the graphics subsystem
/*
* Returns the mode of the graphics subsystem
*/
int ufb_get_mode( int fd, int *mode )
{
@@ -102,8 +105,8 @@
}
/*
* Returns the current collor pallete
/*
* Returns the current collor pallete
*/
int ufb_get_palette( int fd, struct fb_cmap *color )
{
@@ -111,17 +114,17 @@
}
/*
* Set the current collor pallete
/*
* Set the current collor pallete
*/
int ufb_set_palette( int fd, struct fb_cmap *color )
{
return ioctl( fd, FB_SETPALETTE, ( void *)color );
}
/*
* Does all necessary initialization to put the device in
* graphics mode
/*
* Does all necessary initialization to put the device in
* graphics mode
*/
int ufb_enter_graphics( int fd, int mode )
{
@@ -132,7 +135,7 @@
}
/*
/*
* Switch the device back to the default mode of operation.
* In most cases it put the device back to plain text mode.
*/
@@ -144,10 +147,10 @@
return ioctl( fd, FB_EXEC_FUNCTION , ( void *)&exec );
}
/*
* Tell the driver that the "virtual buffer" is dirty, and an update
* of it to the real device, maybe a serial/parallel LCD or whatever
* is required
/*
* Tell the driver that the "virtual buffer" is dirty, and an update
* of it to the real device, maybe a serial/parallel LCD or whatever
* is required
*/
int ufb_buffer_is_dirty( int fd )
{
@@ -159,7 +162,7 @@
/*
/*
* This function maps the physical ( kernel mode ) address of the framebuffer device
* and maps it to the user space address.
*/
@@ -167,13 +170,13 @@
{
#ifdef __rtems__
/* RTEMS runs in ring 0, and there is no distinction between
user space and kernel space, so we just return the same
user space and kernel space, so we just return the same
pointer to the caller.
*/
*fb_addr = physical_addr;
return 0;
#else
/* other kernels might want to map it to the user space,
/* other kernels might want to map it to the user space,
maybe using mmap()
*/
return 0;
@@ -182,7 +185,7 @@
}
/*
/*
* This function unmaps memory of the FB from the user's space
*/
int ufb_unmmap_from_user_space( int fd, void *addr )

View File

@@ -3,13 +3,30 @@
// $Header$
//
// Copyright (c) 2000 - Rosimildo da Silva
//
// MODULE DESCRIPTION:
//
// MODULE DESCRIPTION:
// Micro FrameBuffer interface for Embedded Systems.
//
// MODIFICATION/HISTORY:
//
// $Log$
// Revision 1.1 2000/08/30 08:21:24 joel
// 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com>
//
// * Added generic Micro FrameBuffer interface for MicroWindows.
// This interface allows MicroWindows to under RTEMS. A sample
// driver has been developed for the pc386 BSP. See
// pc386/fb_vga.c as a sample.
// * Added Uniform Input Device interface for MicroWindows.
// See PC386 bsp for sample drivers for mouse and keyboard (console).
// * mw-bf: New directory.
// * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb.
// * mw-fb/Makefile.am: New file.
// * mw-fb/mw_fb.c: New file.
// * mw-fb/mw_fb.h: New file.
// * mw-fb/mw_uid.c: New file.
// * mw-fb/mw_uid.h: New file.
//
//
/////////////////////////////////////////////////////////////////////////////
*/
@@ -77,7 +94,7 @@ struct fb_cmap {
#define FB_FUNC_IS_DIRTY 2
#define FB_FUNC_GET_MODE 3
struct fb_exec_function
struct fb_exec_function
{
int func_no;
void *param;
@@ -86,7 +103,7 @@ struct fb_exec_function
/* Micro Framebuffer API Wrapper */
/*
/*
* This function returns the information regarding the display.
* It is called just after the driver be opened to get all needed
* information about the driver. No change in the mode of operation
@@ -95,45 +112,45 @@ struct fb_exec_function
extern int ufb_get_screen_info( int fd, struct fb_screeninfo *info );
/*
* Returns the mode of the graphics subsystem
/*
* Returns the mode of the graphics subsystem
*/
extern int ufb_get_mode( int fd, int *mode );
/*
* Returns the current collor pallete
/*
* Returns the current collor pallete
*/
extern int ufb_get_palette( int fd, struct fb_cmap *color );
/*
* Set the current collor pallete
/*
* Set the current collor pallete
*/
extern int ufb_set_palette( int fd, struct fb_cmap *color );
/*
* Does all necessary initialization to put the device in
* graphics mode
/*
* Does all necessary initialization to put the device in
* graphics mode
*/
extern int ufb_enter_graphics( int fd, int mode );
/*
/*
* Switch the device back to the default mode of operation.
* In most cases it put the device back to plain text mode.
*/
extern int ufb_exit_graphics( int fd );
/*
* Tell the driver that the "virtual buffer" is dirty, and an update
* of it to the real device, maybe a serial/parallel LCD or whatever
* is required
/*
* Tell the driver that the "virtual buffer" is dirty, and an update
* of it to the real device, maybe a serial/parallel LCD or whatever
* is required
*/
extern int ufb_buffer_is_dirty( int fd );
/*
/*
* This function maps the physical ( kernel mode ) address of the framebuffer device
* and maps it to the user space address.
*/
@@ -141,7 +158,7 @@ extern int ufb_buffer_is_dirty( int fd );
/*
/*
* This function unmaps memory of the FB from the user's space
*/
int ufb_unmmap_from_user_space( int fd, void *addr );

View File

@@ -3,8 +3,8 @@
// $Header$
//
// Copyright (c) 2000 - Rosimildo da Silva
//
// MODULE DESCRIPTION:
//
// MODULE DESCRIPTION:
// This module implements the input devices interface used by MicroWindows
// in an embedded system environment.
// It uses the RTEMS message queue as the repository for the messages posted
@@ -13,6 +13,25 @@
// MODIFICATION/HISTORY:
//
// $Log$
// Revision 1.6 2004/03/26 06:59:18 ralf
// 2004-03-26 Ralf Corsepius <ralf_corsepius@rtems.org>
//
// * libmisc/capture/capture-cli.c, libmisc/capture/capture.c,
// libmisc/capture/capture.h, libmisc/cpuuse/cpuuse.c,
// libmisc/devnull/devnull.c, libmisc/fsmount/fsmount.h,
// libmisc/monitor/mon-config.c, libmisc/monitor/mon-dname.c,
// libmisc/monitor/mon-driver.c, libmisc/monitor/mon-extension.c,
// libmisc/monitor/mon-itask.c, libmisc/monitor/mon-monitor.c,
// libmisc/monitor/mon-mpci.c, libmisc/monitor/mon-object.c,
// libmisc/monitor/mon-prmisc.c, libmisc/monitor/mon-queue.c,
// libmisc/monitor/mon-server.c, libmisc/monitor/mon-symbols.c,
// libmisc/monitor/monitor.h, libmisc/monitor/symbols.h,
// libmisc/mw-fb/mw_uid.c, libmisc/rtmonuse/rtmonuse.c,
// libmisc/serdbg/serdbg.h, libmisc/serdbg/serdbgio.c,
// libmisc/serdbg/termios_printk.c, libmisc/serdbg/termios_printk.h,
// libmisc/shell/shell.c, libmisc/shell/shell.h, libmisc/stackchk/check.c,
// libmisc/stackchk/internal.h: Convert to using c99 fixed size types.
//
// Revision 1.5 2003/07/08 08:38:48 ralf
// 2003-07-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
//
@@ -137,7 +156,7 @@ int uid_open_queue( const char *q_name, int flags, size_t max_msgs )
#ifdef MW_DEBUG_ON
printk( "UID_Queue: id=%X\n", queue_id );
#endif
}
}
open_count++;
return 0;
}
@@ -186,7 +205,7 @@ int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout )
}
/*
/*
* add a message to the queue of events. This method cna be used to
* simulate hardware events, and it can be very handy during development
* a new interface.
@@ -194,14 +213,14 @@ int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout )
int uid_send_message( struct MW_UID_MESSAGE *m )
{
rtems_status_code status;
status = rtems_message_queue_send( queue_id, ( void * )m,
status = rtems_message_queue_send( queue_id, ( void * )m,
sizeof( struct MW_UID_MESSAGE ) );
return status == RTEMS_SUCCESSFUL ? 0 : -1;
}
/*
/*
* register the device to insert events to the message
* queue named as the value passed in q_name
* queue named as the value passed in q_name
*/
int uid_register_device( int fd, const char *q_name )
{
@@ -217,11 +236,11 @@ int uid_unregister_device( int fd )
/* set the keyboard */
int uid_set_kbd_mode( int fd, int mode, int *old_mode )
{
if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0)
if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0)
{
return -1;
}
if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 )
if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 )
{
return -1;
}

View File

@@ -3,14 +3,31 @@
// $Header$
//
// Copyright (c) 2000 - Rosimildo da Silva
//
// MODULE DESCRIPTION:
//
// MODULE DESCRIPTION:
// This module defines the interface for input devices used by MicroWindows
// in an embedded system environment.
//
// MODIFICATION/HISTORY:
//
// $Log$
// Revision 1.1 2000/08/30 08:21:24 joel
// 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com>
//
// * Added generic Micro FrameBuffer interface for MicroWindows.
// This interface allows MicroWindows to under RTEMS. A sample
// driver has been developed for the pc386 BSP. See
// pc386/fb_vga.c as a sample.
// * Added Uniform Input Device interface for MicroWindows.
// See PC386 bsp for sample drivers for mouse and keyboard (console).
// * mw-bf: New directory.
// * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb.
// * mw-fb/Makefile.am: New file.
// * mw-fb/mw_fb.c: New file.
// * mw-fb/mw_fb.h: New file.
// * mw-fb/mw_uid.c: New file.
// * mw-fb/mw_uid.h: New file.
//
//
/////////////////////////////////////////////////////////////////////////////
*/
@@ -21,13 +38,13 @@
extern "C" {
#endif
/* 0x41XX -- IOCLT functions for the Micro Input Devices commands */
/* 0x41XX -- IOCLT functions for the Micro Input Devices commands */
#define MW_UID_REGISTER_DEVICE 0x4100
#define MW_UID_UNREGISTER_DEVICE 0x4101
/* devices supported by MicroWindows */
enum MW_INPUT_DEVICE_TYPE
enum MW_INPUT_DEVICE_TYPE
{
MV_UID_INVALID = 0,
MV_UID_REL_POS = 1, /* mouse */
@@ -53,7 +70,7 @@ enum MW_INPUT_DEVICE_TYPE
/* keyboard modes -- default ASCII */
#define MV_KEY_MODE_ASCII 0x01
/*
/*
* This mode one event is sent when a key is pressed,
* and another one is send when a key is released.
*/
@@ -68,7 +85,7 @@ enum MW_INPUT_DEVICE_TYPE
#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */
/*
* Message generated by input devices controlled by MicroWindows.
* Message generated by input devices controlled by MicroWindows.
*/
struct MW_UID_MESSAGE
{
@@ -102,7 +119,7 @@ struct MW_UID_MESSAGE
/*
* API for creating/closing/accessing the message queue used by the micro
* input device interface. All functions in this interface returns a
* input device interface. All functions in this interface returns a
* zero ( 0 ) on success. One exception for that is the "read" routine
* that returns the number of bytes read. Negaive numbers indicate errors
*
@@ -117,8 +134,8 @@ extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs );
/* closes message queue */
extern int uid_close_queue( void );
/*
* reads a message from the queue. It waits up to the specified
/*
* reads a message from the queue. It waits up to the specified
* timeout in mili-seconds.
*/
extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout );

View File

@@ -38,7 +38,7 @@ void Period_usage_Initialize( void )
int maximum;
maximum = _Configuration_Table->RTEMS_api_configuration->maximum_periods;
Period_usage_Information = malloc( sizeof(Period_usage_t) * (maximum+1) );
Period_usage_Reset();
@@ -58,7 +58,7 @@ void Period_usage_Reset( void )
i<_Configuration_Table->RTEMS_api_configuration->maximum_periods ;
i++ ) {
the_usage = &Period_usage_Information[ i ];
the_usage->count = 0;
the_usage->missed_count = 0;
the_usage->min_cpu_time = 0xFFFFFFFF;
@@ -67,7 +67,7 @@ void Period_usage_Reset( void )
the_usage->min_wall_time = 0xFFFFFFFF;
the_usage->max_wall_time = 0;
the_usage->total_wall_time = 0;
}
}
@@ -76,7 +76,7 @@ void Period_usage_Reset( void )
* Period_usage_Update
*/
void Period_usage_Update(
void Period_usage_Update(
rtems_id id
)
{
@@ -135,13 +135,13 @@ void Period_usage_Dump( void )
char name[5];
uint32_t api_index;
Objects_Information *information;
if ( !Period_usage_Information ) {
printf( "Period statistics library is not initialized\n" );
return;
}
printf( "Period information by period\n" );
printf( "Period information by period\n" );
printf( " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" );
/*

View File

@@ -9,7 +9,7 @@ void Period_usage_Initialize( void );
void Period_usage_Reset( void );
void Period_usage_Update(
void Period_usage_Update(
rtems_id id
);

View File

@@ -16,7 +16,7 @@
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 04.04.02 creation doe |
\*===============================================================*/
/*
/*
* $Id$
*/
@@ -60,11 +60,11 @@ int serdbg_init_dbg
return RTEMS_SUCCESSFUL;
}
is_initialized = TRUE;
/*
/*
* try to open serial device
*/
if (rc == RTEMS_SUCCESSFUL) {
if ((serdbg_conf.open_io != NULL) &&
if ((serdbg_conf.open_io != NULL) &&
(0 > serdbg_conf.open_io(serdbg_conf.devname,serdbg_conf.baudrate))) {
fprintf(stderr,
"remote_gdb_init: cannot open device %s "
@@ -81,7 +81,7 @@ int serdbg_init_dbg
/*
* now activate gdb stub
*/
if ((rc == RTEMS_SUCCESSFUL) &&
if ((rc == RTEMS_SUCCESSFUL) &&
!serdbg_conf.skip_init_bkpt) {
breakpoint();
}

View File

@@ -16,8 +16,8 @@
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 04.04.02 creation doe |
\*===============================================================*/
/*
* $Id$
/*
* $Id$
*/
#ifndef _SERDBG_H
#define _SERDBG_H

View File

@@ -16,7 +16,7 @@
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 13.05.02 creation doe |
\*===============================================================*/
/*
/*
* $Id$
*/
#ifndef _SERDBGCNF_H
@@ -59,7 +59,7 @@ serdbg_conf_t serdbg_conf = {
#endif
CONFIGURE_SERDBG_DEVNAME,
#ifdef CONFIGURE_SERDBG_SKIP_INIT_BKPT
TRUE,
#else

View File

@@ -106,7 +106,7 @@ int serdbg_open
* open device for serdbg operation
* skip any fds that are between 0..2, because they are
* reserved for stdin/out/err
*/
*/
if (!err_occurred &&
(dev_name != NULL) &&
(dev_name[0] != '\0')) {
@@ -125,7 +125,7 @@ int serdbg_open
}
}
}
} while (!err_occurred &&
} while (!err_occurred &&
(serdbg_fd < 3));
}
/*
@@ -137,14 +137,14 @@ int serdbg_open
}
/*
* capture tty structure
* capture tty structure
*/
if (!err_occurred) {
iop = &rtems_libio_iops[serdbg_fd];
serdbg_tty = iop->data1;
}
/*
* set device baudrate
* set device baudrate
* (and transp mode, this is not really needed)
* ...
*/
@@ -156,12 +156,12 @@ int serdbg_open
err_occurred = TRUE;
}
if (!err_occurred) {
act_termios.c_iflag
act_termios.c_iflag
&= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
act_termios.c_oflag
act_termios.c_oflag
&= ~OPOST;
act_termios.c_lflag
&= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
@@ -172,8 +172,8 @@ int serdbg_open
err_occurred = TRUE;
}
}
return (err_occurred
? -1
return (err_occurred
? -1
: 0);
}
@@ -197,7 +197,7 @@ void putDebugChar
\*=========================================================================*/
{
/*
* call serdbg polling callout, if available
* call serdbg polling callout, if available
*/
if (serdbg_conf.callout != NULL) {
serdbg_conf.callout();
@@ -205,7 +205,7 @@ void putDebugChar
/*
* check, whether debug serial port is available
*/
if ((serdbg_tty != NULL) &&
if ((serdbg_tty != NULL) &&
(serdbg_tty->device.write != NULL)) {
/*
* send character to debug serial port
@@ -237,11 +237,11 @@ int getDebugChar
/*
* check, whether debug serial port is available
*/
if ((serdbg_tty != NULL) &&
if ((serdbg_tty != NULL) &&
(serdbg_tty->device.pollRead != NULL)) {
do {
/*
* call serdbg polling callout, if available
* call serdbg polling callout, if available
*/
if (serdbg_conf.callout != NULL) {
serdbg_conf.callout();

View File

@@ -73,10 +73,10 @@ void termios_printk_outputchar
* check, whether printk serial port is available
*/
if ((termios_printk_tty != NULL) &&
if ((termios_printk_tty != NULL) &&
(termios_printk_tty->device.write != NULL)) {
/*
* call termios_printk polling callout, if available
* call termios_printk polling callout, if available
*/
if (termios_printk_conf.callout != NULL) {
termios_printk_conf.callout();
@@ -84,7 +84,7 @@ void termios_printk_outputchar
/*
* send character to debug serial port
*/
if (c == '\n') {
if (c == '\n') {
termios_printk_tty->device.write(termios_printk_tty->minor,&cr,1);
}
termios_printk_tty->device.write(termios_printk_tty->minor,&c,1);
@@ -113,11 +113,11 @@ char termios_printk_inputchar
/*
* check, whether debug serial port is available
*/
if ((termios_printk_tty != NULL) &&
if ((termios_printk_tty != NULL) &&
(termios_printk_tty->device.pollRead != NULL)) {
do {
/*
* call termios_printk polling callout, if available
* call termios_printk polling callout, if available
*/
if (termios_printk_conf.callout != NULL) {
termios_printk_conf.callout();
@@ -156,7 +156,7 @@ int termios_printk_open
rtems_libio_t *iop = NULL;
struct termios act_termios;
tcflag_t baudcode = B0;
if (termios_printk_fd >= 0) {
/*
* already initialized
@@ -190,7 +190,7 @@ int termios_printk_open
}
/*
* open device for serdbg operation
*/
*/
if (!err_occurred &&
(dev_name != NULL) &&
(dev_name[0] != '\0')) {
@@ -200,14 +200,14 @@ int termios_printk_open
}
}
/*
* capture tty structure
* capture tty structure
*/
if (!err_occurred) {
iop = &rtems_libio_iops[termios_printk_fd];
termios_printk_tty = iop->data1;
}
/*
* set device baudrate
* set device baudrate
* (and transp mode, this is not really needed)
* ...
*/
@@ -231,7 +231,7 @@ int termios_printk_open
BSP_output_char = termios_printk_outputchar;
BSP_poll_char = termios_printk_inputchar;
}
return (err_occurred
? -1
return (err_occurred
? -1
: 0);
}

View File

@@ -16,7 +16,7 @@
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 13.04.02 creation doe |
\*===============================================================*/
/*
/*
* $Id$
*/
#ifndef _TERMIOS_PRINTK_H

View File

@@ -16,7 +16,7 @@
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 13.05.02 creation doe |
\*===============================================================*/
/*
/*
* $Id$
*/
#ifndef _TERMIOS_PRINTK_CNF_H
@@ -52,7 +52,7 @@ termios_printk_conf_t termios_printk_conf = {
#else
NULL,
#endif
CONFIGURE_TERMIOS_PRINTK_DEVNAME,
CONFIGURE_TERMIOS_PRINTK_DEVNAME,
};
#endif

View File

@@ -5,19 +5,19 @@
* Home: correo@fernando-ruiz.com
*
* This file is inspired in rtems_monitor & Chris John MyRightBoot
*
*
* But I want to make it more user friendly
* A 'monitor' command is added to adapt the call rtems monitor commands
* at my call procedure
*
* TODO: A lot of improvements of course.
*
* TODO: A lot of improvements of course.
* cp, mv, ...
* hexdump,
*
*
* More? Say me it, please...
*
*
* The BSP Specific are not welcome here.
*
*
* C&S welcome...
*
* $Id$
@@ -53,7 +53,7 @@
- str to int "0xaffe" "0b010010" "0123" "192939"
* ----------------------------------------------- */
int str2int(char * s) {
int sign=1;
int sign=1;
int base=10;
int value=0;
int digit;
@@ -78,7 +78,7 @@ int str2int(char * s) {
default :base=8;
break;
}
};
};
while (*s) {
switch(*s) {
case '0':
@@ -92,28 +92,28 @@ int str2int(char * s) {
case '8':
case '9':digit=*s-'0';
break;
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':digit=*s-'A'+10;
break;
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':digit=*s-'a'+10;
break;
default:return value*sign;
default:return value*sign;
};
if (digit>base) return value*sign;
value=value*base+digit;
s++;
};
};
return value*sign;
return value*sign;
}
/*----------------------------------------------------------------------------*
* RAM MEMORY COMMANDS
@@ -219,8 +219,8 @@ int main_mmove(int argc,char * argv[]) {
/*----------------------------------------------------------------------------*/
#ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */
int main_malloc_dump(int argc,char * argv[]) {
void malloc_dump(void);
malloc_dump();
void malloc_dump(void);
malloc_dump();
return 0;
}
#endif
@@ -234,7 +234,7 @@ int main_reset (int argc, char **argv)
tcdrain(fileno(stdout));
rtems_interrupt_disable (level);
for (;;)
for (;;)
;
return 0;
}
@@ -251,8 +251,8 @@ int main_alias (int argc, char **argv)
printf("unable to make an alias(%s,%s)\n",argv[1],argv[2]);
};
return 0;
}
/*-----------------------------------------------------------*
}
/*-----------------------------------------------------------*
* Directory commands
*-----------------------------------------------------------*/
int main_ls(int argc, char *argv[])
@@ -286,7 +286,7 @@ int main_ls(int argc, char *argv[])
strcat(nbuf,dp->d_name); /* always the fullpathname. Avoid ftpd problem.*/
if (stat(nbuf, &stat_buf) == 0)
{ /* AWFUL buts works...*/
strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime));
strftime(sbuf,sizeof(sbuf)-1,"%b %d %H:%M",gmtime(&stat_buf.st_mtime));
pwd=getpwuid(stat_buf.st_uid);
user=pwd?pwd->pw_name:"nouser";
grp=getgrgid(stat_buf.st_gid);
@@ -304,7 +304,7 @@ int main_ls(int argc, char *argv[])
(stat_buf.st_mode & S_IWOTH)?('w'):('-'),
(stat_buf.st_mode & S_IXOTH)?('x'):('-'),
(int)stat_buf.st_nlink,
user,group,
user,group,
(int)stat_buf.st_size,
sbuf,
dp->d_name,
@@ -317,14 +317,14 @@ int main_ls(int argc, char *argv[])
closedir(dirp);
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_pwd (int argc, char *argv[]) {
char dir[1024];
getcwd(dir,1024);
printf("%s\n",dir);
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_chdir (int argc, char *argv[]) {
char *dir;
dir="/";
@@ -332,10 +332,10 @@ int main_chdir (int argc, char *argv[]) {
if (chdir(dir)) {
printf("chdir to '%s' failed:%s\n",dir,strerror(errno));
return errno;
};
};
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_mkdir (int argc, char *argv[]) {
char *dir;
int n;
@@ -344,11 +344,11 @@ int main_mkdir (int argc, char *argv[]) {
dir=argv[n++];
if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
printf("mkdir '%s' failed:%s\n",dir,strerror(errno));
};
};
};
};
return errno;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_rmdir (int argc, char *argv[])
{
char *dir;
@@ -360,7 +360,7 @@ int main_rmdir (int argc, char *argv[])
};
return errno;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_chroot(int argc,char * argv[]) {
char * new_root="/";
if (argc==2) new_root=argv[1];
@@ -370,7 +370,7 @@ int main_chroot(int argc,char * argv[]) {
};
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_cat (int argc, char *argv[])
{
int n;
@@ -378,7 +378,7 @@ int main_cat (int argc, char *argv[])
while (n<argc) cat_file(stdout,argv[n++]);
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
int main_rm (int argc, char *argv[])
{
int n;
@@ -392,10 +392,10 @@ int main_rm (int argc, char *argv[])
};
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
/* date - print time and date */
int main_date(int argc,char *argv[])
int main_date(int argc,char *argv[])
{
time_t t;
time(&t);
@@ -403,20 +403,20 @@ int main_date(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
int main_logoff(int argc,char *argv[])
int main_logoff(int argc,char *argv[])
{
printf("logoff from the system...");
current_shell_env->exit_shell=TRUE;
printf("logoff from the system...");
current_shell_env->exit_shell=TRUE;
return 0;
}
/*-----------------------------------------------------------*/
int main_tty (int argc,char *argv[])
int main_tty (int argc,char *argv[])
{
printf("%s\n",ttyname(fileno(stdin)));
return 0;
}
/*-----------------------------------------------------------*/
int main_whoami(int argc,char *argv[])
int main_whoami(int argc,char *argv[])
{
struct passwd * pwd;
pwd=getpwuid(getuid());
@@ -424,7 +424,7 @@ int main_whoami(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
int main_id (int argc,char *argv[])
int main_id (int argc,char *argv[])
{
struct passwd * pwd;
struct group * grp;
@@ -441,7 +441,7 @@ int main_id (int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
int main_umask(int argc,char *argv[])
int main_umask(int argc,char *argv[])
{
mode_t msk=umask(0);
if (argc == 2) msk=str2int(argv[1]);
@@ -452,7 +452,7 @@ int main_umask(int argc,char *argv[])
return 0;
}
/*-----------------------------------------------------------*/
int main_chmod(int argc,char *argv[])
int main_chmod(int argc,char *argv[])
{
int n;
mode_t mode;
@@ -463,10 +463,10 @@ int main_chmod(int argc,char *argv[])
};
return 0;
}
/*-----------------------------------------------------------*
/*-----------------------------------------------------------*
* with this you can call at all the rtems monitor commands.
* Not all work fine but you can show the rtems status and more.
*-----------------------------------------------------------*/
*-----------------------------------------------------------*/
int main_monitor(int argc,char * argv[]) {
rtems_monitor_command_entry_t *command;
rtems_task_ident(RTEMS_SELF,0,&rtems_monitor_task_id);
@@ -476,7 +476,7 @@ int main_monitor(int argc,char * argv[]) {
command->command_function(argc, argv, &command->command_arg, 0);
return 0;
}
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
void register_cmds(void) {
rtems_monitor_command_entry_t *command;
/* monitor topic */
@@ -503,7 +503,7 @@ void register_cmds(void) {
/* misc. topic */
shell_add_cmd ("logoff","misc","logoff from the system" ,main_logoff);
shell_alias_cmd("logoff","exit");
shell_alias_cmd("logoff","exit");
shell_add_cmd ("date" ,"misc","date" ,main_date);
shell_add_cmd ("reset","misc","reset the BSP" ,main_reset);
shell_add_cmd ("alias","misc","alias old new" ,main_alias);
@@ -521,6 +521,6 @@ void register_cmds(void) {
shell_add_cmd ("mmove","mem" ,"mmove dst src size" ,main_mmove);
#ifdef MALLOC_STATS /* /rtems/s/src/lib/libc/malloc.c */
shell_add_cmd ("malloc","mem","mem show memory malloc'ed" ,main_mem);
#endif
#endif
}
/*-----------------------------------------------------------*/

View File

@@ -2,9 +2,9 @@
*
* Instantatiate a new terminal shell.
*
* Author:
* Author:
*
* WORK: fernando.ruiz@ctv.es
* WORK: fernando.ruiz@ctv.es
* HOME: correo@fernando-ruiz.com
*
* Thanks at:
@@ -22,8 +22,8 @@
#include <rtems.h>
#include <rtems/error.h>
#include <rtems/libio.h>
#include <rtems/libio_.h>
#include <rtems/system.h>
#include <rtems/libio_.h>
#include <rtems/system.h>
#include <rtems/shell.h>
#include <termios.h>
@@ -65,7 +65,7 @@ struct shell_topic_tt {
static shell_cmd_t * shell_first_cmd;
static shell_topic_t * shell_first_topic;
/* ----------------------------------------------- *
* Using Chain I can reuse the rtems code.
* Using Chain I can reuse the rtems code.
* I am more comfortable with this, sorry.
* ----------------------------------------------- */
shell_topic_t * shell_lookup_topic(char * topic) {
@@ -81,7 +81,7 @@ shell_topic_t * shell_lookup_topic(char * topic) {
shell_topic_t * shell_add_topic(char * topic) {
shell_topic_t * current,*aux;
if (!shell_first_topic) {
aux=malloc(sizeof(shell_topic_t));
aux=malloc(sizeof(shell_topic_t));
aux->topic=topic;
aux->next=(shell_topic_t*)NULL;
return shell_first_topic=aux;
@@ -91,8 +91,8 @@ shell_topic_t * shell_add_topic(char * topic) {
while (current->next) {
if (!strcmp(topic,current->next->topic)) return current->next;
current=current->next;
};
aux=malloc(sizeof(shell_topic_t));
};
aux=malloc(sizeof(shell_topic_t));
aux->topic=topic;
aux->next=(shell_topic_t*)NULL;
current->next=aux;
@@ -185,7 +185,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
line=1;
if (shell_cmd->alias) {
printf("is an <alias> for command '%s'",shell_cmd->alias->name);
} else
} else
if (shell_cmd->usage) {
pc=shell_cmd->usage;
while (*pc) {
@@ -198,7 +198,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
col++;
break;
};
pc++;
pc++;
if(col>78) { /* What daring... 78?*/
if (*pc) {
putchar('\n');
@@ -208,7 +208,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
if (!col && *pc) {
printf(" ");
col=12;line++;
};
};
};
};
puts("");
@@ -220,12 +220,12 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
* The same with all the commands....
* ----------------------------------------------- */
int shell_help(int argc,char * argv[]) {
int col,line,arg;
int col,line,arg;
shell_topic_t *topic;
shell_cmd_t * shell_cmd=shell_first_cmd;
if (argc<2) {
printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
" TOPIC? The topics are\n");
printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n"
" TOPIC? The topics are\n");
topic=shell_first_topic;
col=0;
while (topic) {
@@ -237,7 +237,7 @@ int shell_help(int argc,char * argv[]) {
col=printf(" %s",topic->topic);
} else {
col+=printf(", %s",topic->topic);
};
};
};
topic=topic->next;
};
@@ -264,7 +264,7 @@ int shell_help(int argc,char * argv[]) {
printf("help: list for the topic '%s'\n",argv[arg]);
line++;
while (shell_cmd) {
if (!strcmp(topic->topic,shell_cmd->topic))
if (!strcmp(topic->topic,shell_cmd->topic))
line+=shell_help_cmd(shell_cmd);
if (line>16) {
printf("Press any key to continue...");getchar();
@@ -273,7 +273,7 @@ int shell_help(int argc,char * argv[]) {
};
shell_cmd=shell_cmd->next;
};
};
};
puts("");
return 0;
}
@@ -284,13 +284,13 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
int c,col;
col=0;
if (*line) {
col=strlen(line);
col=strlen(line);
if (out) fprintf(out,"%s",line);
};
tcdrain(fileno(in ));
if (out) tcdrain(fileno(out));
for (;;) {
line[col]=0;
line[col]=0;
c=fgetc(in);
switch (c) {
case 0x04:/*Control-d*/
@@ -299,7 +299,7 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
case '\n':break;
case '\f':if (out) fputc('\f',out);
case 0x03:/*Control-C*/
line[0]=0;
line[0]=0;
case '\r':if (out) fputc('\n',out);
return 1;
case 127:
@@ -316,13 +316,13 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
break;
default :if (!iscntrl(c)) {
if (col<size-1) {
line[col++]=c;
line[col++]=c;
if (out) fputc(c,out);
} else {
if (out) fputc('\a',out);
};
} else {
if (out)
if (out)
if (c=='\a') fputc('\a',out);
};
break;
@@ -330,14 +330,14 @@ int shell_scanline(char * line,int size,FILE * in,FILE * out) {
};
}
/* ----------------------------------------------- *
* - The shell TASK
* - The shell TASK
* Poor but enough..
* TODO: Redirection. Tty Signals. ENVVARs. Shell language.
* ----------------------------------------------- */
shell_env_t global_shell_env ,
* current_shell_env=&global_shell_env;
* current_shell_env=&global_shell_env;
extern char **environ;
extern char **environ;
void cat_file(FILE * out,char * name) {
FILE * fd;
@@ -348,7 +348,7 @@ void cat_file(FILE * out,char * name) {
while ((c=fgetc(fd))!=EOF) fputc(c,out);
fclose(fd);
};
};
};
}
void write_file(char * name,char * content) {
@@ -357,7 +357,7 @@ void write_file(char * name,char * content) {
if (fd) {
fwrite(content,1,strlen(content),fd);
fclose(fd);
};
};
}
void init_issue(void) {
@@ -366,11 +366,11 @@ void init_issue(void) {
if (issue_inited) return;
issue_inited=TRUE;
getpwnam("root"); /* dummy call to init /etc dir */
if (stat("/etc/issue",&buf))
if (stat("/etc/issue",&buf))
write_file("/etc/issue",
"Welcome to @V\\n"
"Login into @S(@L)\\n");
if (stat("/etc/issue.net",&buf))
if (stat("/etc/issue.net",&buf))
write_file("/etc/issue.net",
"Welcome to %v\n"
"running on %m\n");
@@ -415,7 +415,7 @@ int shell_login(FILE * in,FILE * out) {
default :fprintf(out,"@%c",c);
break;
};
} else
} else
if (c=='\\') {
switch(c=fgetc(fd)) {
case '\\':fprintf(out,"\\");
@@ -429,12 +429,12 @@ int shell_login(FILE * in,FILE * out) {
case '@':fprintf(out,"@"); break;
};
} else {
fputc(c,out);
};
fputc(c,out);
};
};
fclose(fd);
}
} else {
}
} else {
fd=fopen("/etc/issue.net","r");
if (fd) {
while ((c=fgetc(fd))!=EOF) {
@@ -463,11 +463,11 @@ int shell_login(FILE * in,FILE * out) {
break;
};
} else {
fputc(c,out);
};
fputc(c,out);
};
};
fclose(fd);
}
}
};
};
times=0;
@@ -483,13 +483,13 @@ int shell_login(FILE * in,FILE * out) {
if (out) fprintf(out,"\n");
if ((passwd=getpwnam(name))) {
if (strcmp(passwd->pw_passwd,"!")) { /* valid user */
setuid(passwd->pw_uid);
setgid(passwd->pw_gid);
setuid(passwd->pw_uid);
setgid(passwd->pw_gid);
rtems_current_user_env->euid=
rtems_current_user_env->egid=0;
chown(current_shell_env->devname,passwd->pw_uid,0);
rtems_current_user_env->euid=passwd->pw_uid;
rtems_current_user_env->egid=passwd->pw_gid;
rtems_current_user_env->euid=passwd->pw_uid;
rtems_current_user_env->egid=passwd->pw_gid;
if (!strcmp(passwd->pw_passwd,"*")) {
/* /etc/shadow */
return 0;
@@ -513,7 +513,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
rtems_status_code sc;
struct termios term;
struct termios term;
char * devname;
char curdir[256];
@@ -524,17 +524,17 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
sc=rtems_task_variable_add(RTEMS_SELF,(void*)&current_shell_env,free);
if (sc!=RTEMS_SUCCESSFUL) {
rtems_error(sc,"rtems_task_variable_add(current_shell_env):");
rtems_error(sc,"rtems_task_variable_add(current_shell_env):");
rtems_task_delete(RTEMS_SELF);
};
};
current_shell_env=shell_env;
current_shell_env=shell_env;
sc=rtems_libio_set_private_env();
if (sc!=RTEMS_SUCCESSFUL) {
rtems_error(sc,"rtems_libio_set_private_env():");
rtems_error(sc,"rtems_libio_set_private_env():");
rtems_task_delete(RTEMS_SELF);
};
};
devname=shell_env->devname;
@@ -544,7 +544,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
rtems_current_user_env->egid=0;
stdin =fopen(devname,"r+");
if (!stdin) {
fprintf(stderr,"shell:unable to open stdin.%s:%s\n",devname,strerror(errno));
rtems_task_delete(RTEMS_SELF);
@@ -578,10 +578,10 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
};
shell_add_cmd(NULL,NULL,NULL,NULL); /* init the chain list*/
do {
/* Set again root user and root filesystem, side effect of set_priv..*/
/* Set again root user and root filesystem, side effect of set_priv..*/
sc=rtems_libio_set_private_env();
if (sc!=RTEMS_SUCCESSFUL) {
rtems_error(sc,"rtems_libio_set_private_env():");
rtems_error(sc,"rtems_libio_set_private_env():");
rtems_task_delete(RTEMS_SELF);
};
if (!shell_login(stdin,stdout)) {
@@ -593,30 +593,30 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
chdir("/"); /* XXX: chdir to getpwent homedir */
shell_env->exit_shell=FALSE;
for (;;) {
/* Prompt section */
/* Prompt section */
/* XXX: show_prompt user adjustable */
getcwd(curdir,sizeof(curdir));
printf("%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#');
/* getcmd section */
/* getcmd section */
if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/
/* evaluate cmd section */
/* evaluate cmd section */
if (!strcmp(cmd,"e")) { /* edit last command */
strcpy(cmd,last_cmd);
continue;
} else
} else
if (!strcmp(cmd,"r")) { /* repeat last command */
strcpy(cmd,last_cmd);
} else
} else
if (strcmp(cmd,"")) { /* only for get a new prompt */
strcpy(last_cmd,cmd);
};
/* exec cmd section */
/* TODO:
* To avoid user crash catch the signals.
};
/* exec cmd section */
/* TODO:
* To avoid user crash catch the signals.
* Open a new stdio files with posibility of redirection *
* Run in a new shell task background. (unix &)
* Resuming. A little bash.
*/
*/
if (shell_make_args(cmd,&argc,argv)) {
if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) {
shell_env->errorlevel=shell_cmd->command(argc,argv);
@@ -625,7 +625,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
shell_env->errorlevel=-1;
};
};
/* end exec cmd section */
/* end exec cmd section */
if (shell_env->exit_shell) break;
cmd[0]=0;
};
@@ -633,7 +633,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
};
} while (shell_env->forever);
fclose(stdin );
fclose(stdout);
fclose(stdout);
fclose(stderr);
rtems_task_delete(RTEMS_SELF);
}
@@ -654,14 +654,14 @@ rtems_status_code shell_init (char * task_name,
RTEMS_LOCAL | RTEMS_FLOATING_POINT,
&task_id);
if (sc!=RTEMS_SUCCESSFUL) {
rtems_error(sc,"creating task %s in shell_init()",task_name);
rtems_error(sc,"creating task %s in shell_init()",task_name);
return sc;
};
};
shell_env=malloc(sizeof(shell_env_t));
if (!shell_env) {
rtems_task_delete(task_id);
sc=RTEMS_NO_MEMORY;
rtems_error(sc,"allocating shell_env %s in shell_init()",task_name);
sc=RTEMS_NO_MEMORY;
rtems_error(sc,"allocating shell_env %s in shell_init()",task_name);
return sc;
};
if (global_shell_env.magic!=new_rtems_name("SENV")) {
@@ -671,8 +671,8 @@ rtems_status_code shell_init (char * task_name,
global_shell_env.tcflag =0;
global_shell_env.exit_shell=0;
global_shell_env.forever =TRUE;
};
shell_env->magic =global_shell_env.magic;
};
shell_env->magic =global_shell_env.magic;
shell_env->devname =devname;
shell_env->taskname =task_name;
shell_env->tcflag =tcflag;

View File

@@ -2,9 +2,9 @@
*
* Instantatiate a new terminal shell.
*
* Author:
* Author:
*
* WORK: fernando.ruiz@ctv.es
* WORK: fernando.ruiz@ctv.es
* HOME: correo@fernando-ruiz.com
*
* Thanks at:
@@ -18,11 +18,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#endif
#include <rtems.h>
#include <stdio.h>
#include <termios.h>
#include <rtems.h>
#include <stdio.h>
#include <termios.h>
typedef int (*shell_command_t)(int argc,char * argv[]);
@@ -51,7 +51,7 @@ int shell_make_args(char * cmd,
char * argv[]);
typedef struct {
rtems_name magic; /* 'S','E','N','V': Shell Environment */
rtems_name magic; /* 'S','E','N','V': Shell Environment */
char * devname;
char * taskname;
tcflag_t tcflag;
@@ -65,24 +65,24 @@ typedef struct {
int shell_scanline(char * line,int size,FILE * in,FILE * out) ;
void cat_file(FILE * out,char *name);
void write_file(char *name,char * content);
rtems_status_code shell_init(char * task_name ,
uint32_t task_stacksize,/*0 default*/
rtems_task_priority task_priority ,
char * devname ,
tcflag_t tcflag ,
int forever );
int forever );
extern shell_env_t global_shell_env,
* current_shell_env;
/*--------*/
/* cmds.c */
/* cmds.c */
/*--------*/
int str2int(char * s);
void register_cmds(void);
#ifdef __cplusplus
}
#endif
#endif
#endif

View File

@@ -529,8 +529,8 @@ void Stack_check_Dump_usage( void )
" ID NAME LOW HIGH AVAILABLE USED\n"
);
for ( api_index = 1 ;
api_index <= OBJECTS_APIS_LAST ;
for ( api_index = 1 ;
api_index <= OBJECTS_APIS_LAST ;
api_index++ ) {
if ( !_Objects_Information_table[ api_index ] )
continue;

View File

@@ -47,7 +47,7 @@
* 345 167 bytes Padding
* 512 (s+p)bytes File contents (s+p) := (((s) + 511) & ~511),
* round up to 512 bytes
*
*
* Checksum:
* int i, sum;
* char* header = tar_header_pointer;
@@ -165,7 +165,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size)
file_size = octal2ulong(&bufr[124], 12);
/******************************************************************
* Compute the TAR checksum and check with the value in
* Compute the TAR checksum and check with the value in
* the archive. The checksum is computed over the entire
* header, but the checksum field is substituted with blanks.
******************************************************************/
@@ -312,7 +312,7 @@ Untar_FromFile(char *tar_name)
size = octal2ulong(&bufr[124], 12);
/******************************************************************
* Compute the TAR checksum and check with the value in
* Compute the TAR checksum and check with the value in
* the archive. The checksum is computed over the entire
* header, but the checksum field is substituted with blanks.
******************************************************************/