forked from Imagelibrary/rtems
Patches from Chris Johns to clean up test.
This commit is contained in:
@@ -25,15 +25,13 @@
|
||||
#define TEST_INIT
|
||||
#include "System.h"
|
||||
|
||||
// make global so it lasts past the Init task's stack's life time
|
||||
Task1 task_1;
|
||||
|
||||
rtems_task Init(rtems_task_argument )
|
||||
{
|
||||
puts( "\n\n*** RTEMS++ TEST ***" );
|
||||
|
||||
rtemsEvent end_me("INIT");
|
||||
Task1 task_1;
|
||||
|
||||
task_1.set_end_event(end_me);
|
||||
|
||||
printf( "INIT - Task.create() - " );
|
||||
task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE);
|
||||
printf("%s\n", task_1.last_status_string());
|
||||
@@ -54,15 +52,7 @@ rtems_task Init(rtems_task_argument )
|
||||
task_1.start(0xDEADDEAD);
|
||||
printf("%s\n", task_1.last_status_string());
|
||||
|
||||
// block waiting for any event
|
||||
rtems_event_set out;
|
||||
|
||||
// wait for task1 to tell me to finish
|
||||
end_me.receive(RTEMS_SIGNAL_0, out);
|
||||
|
||||
task_1.destroy();
|
||||
|
||||
printf("*** END OF RTEMS++ TEST ***");
|
||||
printf("INIT - Destroy it's self\n");
|
||||
|
||||
// needs to be in C, no C++ object owns the Init task
|
||||
rtems_status_code status = rtems_task_delete( RTEMS_SELF );
|
||||
|
||||
@@ -39,6 +39,10 @@ class Task1
|
||||
{
|
||||
rtemsEvent end_init;
|
||||
|
||||
rtemsEvent end_init;
|
||||
|
||||
rtemsEvent end_init;
|
||||
|
||||
void print_mode(rtems_mode mode, rtems_mode mask);
|
||||
|
||||
void screen1(void);
|
||||
@@ -48,8 +52,10 @@ class Task1
|
||||
void screen5(void);
|
||||
void screen6(void);
|
||||
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
protected:
|
||||
virtual void body(rtems_task_argument argument);
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
|
||||
public:
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
@@ -72,6 +78,18 @@ public:
|
||||
class Task3
|
||||
: public rtemsTask
|
||||
{
|
||||
};
|
||||
|
||||
class EndTask
|
||||
: public rtemsTask
|
||||
{
|
||||
protected:
|
||||
virtual void body(rtems_task_argument argument);
|
||||
|
||||
public:
|
||||
EndTask(const char* name,
|
||||
const rtems_task_priority initial_priority,
|
||||
const rtems_unsigned32 stack_size);
|
||||
void screen6(void);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "System.h"
|
||||
|
||||
@@ -54,10 +55,20 @@ void Task1::body(rtems_task_argument argument)
|
||||
rtems_test_pause_and_screen_number(6);
|
||||
|
||||
screen6();
|
||||
rtems_test_pause_and_screen_number(7);
|
||||
|
||||
// causes init to delete me and itself
|
||||
end_init.send(RTEMS_SIGNAL_0);
|
||||
// do not call exit(0) from this thread as this object is static
|
||||
// the static destructor call delete the task which is calling exit
|
||||
// so exit never completes
|
||||
|
||||
EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6);
|
||||
end_task.start(0);
|
||||
|
||||
rtemsEvent block_me;
|
||||
rtems_event_set out;
|
||||
|
||||
block_me.receive(RTEMS_SIGNAL_0, out);
|
||||
|
||||
printf("**** TASK 1 did not block ????\n");
|
||||
}
|
||||
|
||||
void Task1::screen1(void)
|
||||
@@ -655,3 +666,17 @@ void Task1::print_mode(rtems_mode mode, rtems_mode mask)
|
||||
printf("INTMASK=%i",
|
||||
mode & RTEMS_INTERRUPT_MASK);
|
||||
}
|
||||
|
||||
EndTask::EndTask(const char* name,
|
||||
const rtems_task_priority initial_priority,
|
||||
const rtems_unsigned32 stack_size)
|
||||
: rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
|
||||
{
|
||||
}
|
||||
|
||||
void EndTask::body(rtems_task_argument )
|
||||
{
|
||||
printf("*** END OF RTEMS++ TEST ***\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void Task2::body(rtems_task_argument )
|
||||
{
|
||||
screen4();
|
||||
|
||||
printf("%s - destory itself\n", name_string());
|
||||
printf("%s - destroy itself\n", name_string());
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void Task3::body(rtems_task_argument )
|
||||
{
|
||||
screen6();
|
||||
|
||||
printf("%s - destory itself\n", name_string());
|
||||
printf("%s - destroy itself\n", name_string());
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
#define TEST_INIT
|
||||
#include "System.h"
|
||||
|
||||
// make global so it lasts past the Init task's stack's life time
|
||||
Task1 task_1;
|
||||
|
||||
rtems_task Init(rtems_task_argument )
|
||||
{
|
||||
puts( "\n\n*** RTEMS++ TEST ***" );
|
||||
|
||||
rtemsEvent end_me("INIT");
|
||||
Task1 task_1;
|
||||
|
||||
task_1.set_end_event(end_me);
|
||||
|
||||
printf( "INIT - Task.create() - " );
|
||||
task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE);
|
||||
printf("%s\n", task_1.last_status_string());
|
||||
@@ -54,15 +52,7 @@ rtems_task Init(rtems_task_argument )
|
||||
task_1.start(0xDEADDEAD);
|
||||
printf("%s\n", task_1.last_status_string());
|
||||
|
||||
// block waiting for any event
|
||||
rtems_event_set out;
|
||||
|
||||
// wait for task1 to tell me to finish
|
||||
end_me.receive(RTEMS_SIGNAL_0, out);
|
||||
|
||||
task_1.destroy();
|
||||
|
||||
printf("*** END OF RTEMS++ TEST ***");
|
||||
printf("INIT - Destroy it's self\n");
|
||||
|
||||
// needs to be in C, no C++ object owns the Init task
|
||||
rtems_status_code status = rtems_task_delete( RTEMS_SELF );
|
||||
|
||||
@@ -39,6 +39,10 @@ class Task1
|
||||
{
|
||||
rtemsEvent end_init;
|
||||
|
||||
rtemsEvent end_init;
|
||||
|
||||
rtemsEvent end_init;
|
||||
|
||||
void print_mode(rtems_mode mode, rtems_mode mask);
|
||||
|
||||
void screen1(void);
|
||||
@@ -48,8 +52,10 @@ class Task1
|
||||
void screen5(void);
|
||||
void screen6(void);
|
||||
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
protected:
|
||||
virtual void body(rtems_task_argument argument);
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
|
||||
public:
|
||||
void set_end_event(rtemsEvent& end_event) { end_init = end_event; }
|
||||
@@ -72,6 +78,18 @@ public:
|
||||
class Task3
|
||||
: public rtemsTask
|
||||
{
|
||||
};
|
||||
|
||||
class EndTask
|
||||
: public rtemsTask
|
||||
{
|
||||
protected:
|
||||
virtual void body(rtems_task_argument argument);
|
||||
|
||||
public:
|
||||
EndTask(const char* name,
|
||||
const rtems_task_priority initial_priority,
|
||||
const rtems_unsigned32 stack_size);
|
||||
void screen6(void);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "System.h"
|
||||
|
||||
@@ -54,10 +55,20 @@ void Task1::body(rtems_task_argument argument)
|
||||
rtems_test_pause_and_screen_number(6);
|
||||
|
||||
screen6();
|
||||
rtems_test_pause_and_screen_number(7);
|
||||
|
||||
// causes init to delete me and itself
|
||||
end_init.send(RTEMS_SIGNAL_0);
|
||||
// do not call exit(0) from this thread as this object is static
|
||||
// the static destructor call delete the task which is calling exit
|
||||
// so exit never completes
|
||||
|
||||
EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6);
|
||||
end_task.start(0);
|
||||
|
||||
rtemsEvent block_me;
|
||||
rtems_event_set out;
|
||||
|
||||
block_me.receive(RTEMS_SIGNAL_0, out);
|
||||
|
||||
printf("**** TASK 1 did not block ????\n");
|
||||
}
|
||||
|
||||
void Task1::screen1(void)
|
||||
@@ -655,3 +666,17 @@ void Task1::print_mode(rtems_mode mode, rtems_mode mask)
|
||||
printf("INTMASK=%i",
|
||||
mode & RTEMS_INTERRUPT_MASK);
|
||||
}
|
||||
|
||||
EndTask::EndTask(const char* name,
|
||||
const rtems_task_priority initial_priority,
|
||||
const rtems_unsigned32 stack_size)
|
||||
: rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
|
||||
{
|
||||
}
|
||||
|
||||
void EndTask::body(rtems_task_argument )
|
||||
{
|
||||
printf("*** END OF RTEMS++ TEST ***\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void Task2::body(rtems_task_argument )
|
||||
{
|
||||
screen4();
|
||||
|
||||
printf("%s - destory itself\n", name_string());
|
||||
printf("%s - destroy itself\n", name_string());
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void Task3::body(rtems_task_argument )
|
||||
{
|
||||
screen6();
|
||||
|
||||
printf("%s - destory itself\n", name_string());
|
||||
printf("%s - destroy itself\n", name_string());
|
||||
destroy();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user