summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-07 18:12:41 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-04-07 18:12:41 +0000
commitb467831a38559a9cc8364b69f2078121463bc17f (patch)
tree00b916620f87e52782b0cc55c9245853c9fe71b8 /tools
parent2011-04-07 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-b467831a38559a9cc8364b69f2078121463bc17f.tar.bz2
2011-04-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* shared/main_clocktick.c, shared/main_semcreate.c, shared/main_semdelete.c, shared/main_semflush.c, shared/main_semobtain.c, shared/main_semrelease.c, shared/main_taskcreate.c, shared/main_taskdelete.c, shared/main_taskmode.c, shared/main_taskpriority.c, shared/main_taskresume.c, shared/main_tasksuspend.c, shared/main_taskwakeafter.c, shared/schedsim_shell.h: Compiles now and do not core dump when RTEMS is not initialized.
Diffstat (limited to 'tools')
-rw-r--r--tools/schedsim/shell/ChangeLog11
-rw-r--r--tools/schedsim/shell/shared/main_clocktick.c2
-rw-r--r--tools/schedsim/shell/shared/main_semcreate.c2
-rw-r--r--tools/schedsim/shell/shared/main_semdelete.c2
-rw-r--r--tools/schedsim/shell/shared/main_semflush.c2
-rw-r--r--tools/schedsim/shell/shared/main_semobtain.c2
-rw-r--r--tools/schedsim/shell/shared/main_semrelease.c2
-rw-r--r--tools/schedsim/shell/shared/main_taskcreate.c2
-rw-r--r--tools/schedsim/shell/shared/main_taskdelete.c2
-rw-r--r--tools/schedsim/shell/shared/main_taskmode.c2
-rw-r--r--tools/schedsim/shell/shared/main_taskpriority.c9
-rw-r--r--tools/schedsim/shell/shared/main_taskresume.c2
-rw-r--r--tools/schedsim/shell/shared/main_tasksuspend.c2
-rw-r--r--tools/schedsim/shell/shared/main_taskwakeafter.c2
-rw-r--r--tools/schedsim/shell/shared/schedsim_shell.h8
15 files changed, 50 insertions, 2 deletions
diff --git a/tools/schedsim/shell/ChangeLog b/tools/schedsim/shell/ChangeLog
index fbd9ea94d7..ca335db1a1 100644
--- a/tools/schedsim/shell/ChangeLog
+++ b/tools/schedsim/shell/ChangeLog
@@ -1,3 +1,14 @@
+2011-04-07 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ * shared/main_clocktick.c, shared/main_semcreate.c,
+ shared/main_semdelete.c, shared/main_semflush.c,
+ shared/main_semobtain.c, shared/main_semrelease.c,
+ shared/main_taskcreate.c, shared/main_taskdelete.c,
+ shared/main_taskmode.c, shared/main_taskpriority.c,
+ shared/main_taskresume.c, shared/main_tasksuspend.c,
+ shared/main_taskwakeafter.c, shared/schedsim_shell.h: Compiles now
+ and do not core dump when RTEMS is not initialized.
+
2010-12-17 Joel Sherrill <joel.sherrill@oarcorp.com>
Jennifer Averett <jennifer.averett@oarcorp.com>
diff --git a/tools/schedsim/shell/shared/main_clocktick.c b/tools/schedsim/shell/shared/main_clocktick.c
index bfc413655e..ab6918aa51 100644
--- a/tools/schedsim/shell/shared/main_clocktick.c
+++ b/tools/schedsim/shell/shared/main_clocktick.c
@@ -33,6 +33,8 @@ int rtems_shell_main_clock_tick(
unsigned long tmp;
rtems_interval t;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage ticks\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_semcreate.c b/tools/schedsim/shell/shared/main_semcreate.c
index 1bfd3cd84b..ad2c9f8464 100644
--- a/tools/schedsim/shell/shared/main_semcreate.c
+++ b/tools/schedsim/shell/shared/main_semcreate.c
@@ -41,6 +41,8 @@ int rtems_shell_main_semaphore_create(
char option;
int value;
+ CHECK_RTEMS_IS_UP();
+
ceiling = 0;
attr = RTEMS_DEFAULT_ATTRIBUTES;
value = 0;
diff --git a/tools/schedsim/shell/shared/main_semdelete.c b/tools/schedsim/shell/shared/main_semdelete.c
index 1bead03235..a3e93b7776 100644
--- a/tools/schedsim/shell/shared/main_semdelete.c
+++ b/tools/schedsim/shell/shared/main_semdelete.c
@@ -31,6 +31,8 @@ int rtems_shell_main_semaphore_delete(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_semflush.c b/tools/schedsim/shell/shared/main_semflush.c
index fb656204c9..17638e8c25 100644
--- a/tools/schedsim/shell/shared/main_semflush.c
+++ b/tools/schedsim/shell/shared/main_semflush.c
@@ -31,6 +31,8 @@ int rtems_shell_main_semaphore_flush(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_semobtain.c b/tools/schedsim/shell/shared/main_semobtain.c
index dc02f9aec9..83ac8d31cd 100644
--- a/tools/schedsim/shell/shared/main_semobtain.c
+++ b/tools/schedsim/shell/shared/main_semobtain.c
@@ -36,6 +36,8 @@ int rtems_shell_main_semaphore_obtain(
/* XXX for now, do not support polling */
+ CHECK_RTEMS_IS_UP();
+
if (argc != 3) {
fprintf( stderr, "%s: Usage name|id timeout\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_semrelease.c b/tools/schedsim/shell/shared/main_semrelease.c
index 26a97abe00..1cfd632bd6 100644
--- a/tools/schedsim/shell/shared/main_semrelease.c
+++ b/tools/schedsim/shell/shared/main_semrelease.c
@@ -31,6 +31,8 @@ int rtems_shell_main_semaphore_release(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_taskcreate.c b/tools/schedsim/shell/shared/main_taskcreate.c
index 5d9eff3277..b4fb505ff9 100644
--- a/tools/schedsim/shell/shared/main_taskcreate.c
+++ b/tools/schedsim/shell/shared/main_taskcreate.c
@@ -39,6 +39,8 @@ int rtems_shell_main_task_create(
rtems_status_code status;
long priority;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 3) {
fprintf( stderr, "%s: Usage name priority\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_taskdelete.c b/tools/schedsim/shell/shared/main_taskdelete.c
index 7eb55e0124..8ba68cced4 100644
--- a/tools/schedsim/shell/shared/main_taskdelete.c
+++ b/tools/schedsim/shell/shared/main_taskdelete.c
@@ -31,6 +31,8 @@ int rtems_shell_main_task_delete(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_taskmode.c b/tools/schedsim/shell/shared/main_taskmode.c
index b3517d99d3..7b9c2638d8 100644
--- a/tools/schedsim/shell/shared/main_taskmode.c
+++ b/tools/schedsim/shell/shared/main_taskmode.c
@@ -52,6 +52,8 @@ int rtems_shell_main_task_mode(
struct getopt_data getopt_reent;
char option;
+ CHECK_RTEMS_IS_UP();
+
mode = 0;
mask = 0;
memset(&getopt_reent, 0, sizeof(getopt_data));
diff --git a/tools/schedsim/shell/shared/main_taskpriority.c b/tools/schedsim/shell/shared/main_taskpriority.c
index fbe5073fa1..fd481242c0 100644
--- a/tools/schedsim/shell/shared/main_taskpriority.c
+++ b/tools/schedsim/shell/shared/main_taskpriority.c
@@ -34,6 +34,8 @@ int rtems_shell_main_task_priority(
rtems_task_priority old;
rtems_task_priority new;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 3) {
fprintf( stderr, "%s: Usage [name|id] priority\n", argv[0] );
return -1;
@@ -42,7 +44,7 @@ int rtems_shell_main_task_priority(
if ( lookup_task( argv[1], &id ) )
return -1;
- if ( rtems_string_to_unsigned_long( argv[1], &tmp, NULL, 0) ) {
+ if ( rtems_string_to_unsigned_long( argv[2], &tmp, NULL, 0) ) {
fprintf( stderr, "Argument (%s) is not a number\n", argv[2] );
return 1;
}
@@ -63,7 +65,10 @@ int rtems_shell_main_task_priority(
return -1;
}
- printf("Task (0x%08x) Chain Priority from %d to %d\n", id, old, new );
+ if ( new != 0 )
+ printf("Task (0x%08x) Change Priority from %d to %d\n", id, old, new );
+ else
+ printf("Task (0x%08x) Current Priority is %d\n", id, new );
return 0;
}
diff --git a/tools/schedsim/shell/shared/main_taskresume.c b/tools/schedsim/shell/shared/main_taskresume.c
index 426aff8d55..a155896a85 100644
--- a/tools/schedsim/shell/shared/main_taskresume.c
+++ b/tools/schedsim/shell/shared/main_taskresume.c
@@ -31,6 +31,8 @@ int rtems_shell_main_task_resume(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_tasksuspend.c b/tools/schedsim/shell/shared/main_tasksuspend.c
index f07ebbeb98..16496394b2 100644
--- a/tools/schedsim/shell/shared/main_tasksuspend.c
+++ b/tools/schedsim/shell/shared/main_tasksuspend.c
@@ -31,6 +31,8 @@ int rtems_shell_main_task_suspend(
rtems_id id;
rtems_status_code status;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage [name|id]\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/main_taskwakeafter.c b/tools/schedsim/shell/shared/main_taskwakeafter.c
index e8e6966595..9ed343c230 100644
--- a/tools/schedsim/shell/shared/main_taskwakeafter.c
+++ b/tools/schedsim/shell/shared/main_taskwakeafter.c
@@ -33,6 +33,8 @@ int rtems_shell_main_task_wake_after(
unsigned long tmp;
rtems_id self;
+ CHECK_RTEMS_IS_UP();
+
if (argc != 2) {
fprintf( stderr, "%s: Usage ticks\n", argv[0] );
return -1;
diff --git a/tools/schedsim/shell/shared/schedsim_shell.h b/tools/schedsim/shell/shared/schedsim_shell.h
index 4b23d1c42d..f9fc0b1b0d 100644
--- a/tools/schedsim/shell/shared/schedsim_shell.h
+++ b/tools/schedsim/shell/shared/schedsim_shell.h
@@ -20,6 +20,14 @@
extern "C" {
#endif
+#define CHECK_RTEMS_IS_UP() \
+ do { \
+ if ( _System_state_Current != SYSTEM_STATE_UP ) { \
+ fprintf( stderr, "RTEMS is not initialized yet\n" ); \
+ return -1; \
+ } \
+ } while (0)
+
void PRINT_EXECUTING(void);
void PRINT_HEIR(void);