forked from Imagelibrary/rtems
2011-07-29 Jennifer Averett <Jennifer.Averett@OARcorp.com>
* smp01/init.c, smp02/init.c, smp02/tasks.c, smp03/init.c, smp03/tasks.c, smp04/Makefile.am, smp04/init.c, smp05/init.c, smp06/init.c, smp07/init.c, smp08/init.c: Cleaned up tests and fixed some print statement problems. * smp04/tasks.c: Removed.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2011-07-29 Jennifer Averett <Jennifer.Averett@OARcorp.com>
|
||||
|
||||
* smp01/init.c, smp02/init.c, smp02/tasks.c, smp03/init.c,
|
||||
smp03/tasks.c, smp04/Makefile.am, smp04/init.c, smp05/init.c,
|
||||
smp06/init.c, smp07/init.c, smp08/init.c: Cleaned up tests and fixed
|
||||
some print statement problems.
|
||||
* smp04/tasks.c: Removed.
|
||||
|
||||
2011-06-29 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* smp01/smp01.doc, smp02/smp02.doc, smp03/smp03.doc, smp04/smp04.doc,
|
||||
|
||||
@@ -63,7 +63,7 @@ rtems_task Init(
|
||||
directive_failed( status, "task create" );
|
||||
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
(" CPU %d start task TA%c\n", cpu_num, ch);
|
||||
locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
|
||||
status = rtems_task_start( id, Test_task, i+1 );
|
||||
directive_failed( status, "task start" );
|
||||
|
||||
@@ -78,8 +78,7 @@ rtems_task Init(
|
||||
allDone = false;
|
||||
}
|
||||
if (allDone) {
|
||||
Loop();
|
||||
locked_printf( "*** END OF TEST SMP01 ***" );
|
||||
locked_printf( "*** END OF TEST SMP01 ***\n" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ rtems_task Init(
|
||||
status = rtems_semaphore_obtain( Semaphore, RTEMS_WAIT, 0);
|
||||
directive_failed( status,"rtems_semaphore_obtain of SEM1\n");
|
||||
|
||||
for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
|
||||
for ( i=1; i < rtems_smp_get_number_of_processors(); i++ ){
|
||||
|
||||
/* Create and start tasks for each CPU */
|
||||
ch = '0' + i;
|
||||
@@ -64,7 +64,6 @@ rtems_task Init(
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
|
||||
status = rtems_task_start( id, Test_task, i+1 );
|
||||
locked_printf(str, "rtems_task_start TA%d", i+1);
|
||||
directive_failed( status, str );
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Loop() {
|
||||
void Loop(void) {
|
||||
volatile int i;
|
||||
|
||||
for (i=0; i<300000; i++);
|
||||
@@ -26,8 +26,6 @@ void LogSemaphore(
|
||||
int cpu_num,
|
||||
uint32_t task_index
|
||||
){
|
||||
int i;
|
||||
|
||||
if (Log_index < LOG_SIZE) {
|
||||
/* Log the information */
|
||||
Log[ Log_index ].IsLocked = obtained;
|
||||
@@ -57,7 +55,5 @@ rtems_task Test_task(
|
||||
LogSemaphore(false, cpu_num, task_index);
|
||||
|
||||
rtems_semaphore_release( Semaphore );
|
||||
}
|
||||
|
||||
while(1);
|
||||
} while(1);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ void PrintTaskInfo(
|
||||
)
|
||||
{
|
||||
int cpu_num;
|
||||
rtems_status_code sc;
|
||||
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
|
||||
@@ -41,21 +40,21 @@ rtems_task Init(
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
char ch = '0';
|
||||
rtems_id id;
|
||||
rtems_status_code status;
|
||||
|
||||
Loop();
|
||||
locked_print_initialize();
|
||||
|
||||
locked_printf( "\n\n*** SMP03 TEST ***" );
|
||||
locked_printf( "\n\n*** SMP03 TEST ***\n" );
|
||||
|
||||
|
||||
/* Show that the init task is running on this cpu */
|
||||
PrintTaskInfo( "Init" );
|
||||
|
||||
/* for each remaining cpu create and start a task */
|
||||
for ( i=1; i < CONFIGURE_SMP_MAXIMUM_PROCESSORS; i++ ){
|
||||
for ( i=1; i < rtems_smp_get_number_of_processors(); i++ ){
|
||||
|
||||
ch = '0' + i;
|
||||
|
||||
@@ -82,13 +81,15 @@ rtems_task Init(
|
||||
&id
|
||||
);
|
||||
TestFinished = false;
|
||||
status = rtems_task_start( id, Test_task, CONFIGURE_SMP_MAXIMUM_PROCESSORS );
|
||||
status = rtems_task_start(id,Test_task,rtems_smp_get_number_of_processors());
|
||||
|
||||
/* Wait on the last task to run */
|
||||
while(!TestFinished)
|
||||
;
|
||||
|
||||
/* End the test */
|
||||
locked_printf( "*** END OF TEST SMP03 ***" );
|
||||
Loop();
|
||||
locked_printf( "*** END OF TEST SMP03 ***\n" );
|
||||
Loop();
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ rtems_task Test_task(
|
||||
/* If this is the last task created set a flag for the
|
||||
* test to end.
|
||||
*/
|
||||
if ( task_index == CONFIGURE_SMP_MAXIMUM_PROCESSORS ) {
|
||||
if ( task_index == rtems_smp_get_number_of_processors() ) {
|
||||
TestFinished = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
MANAGERS = all
|
||||
|
||||
rtems_tests_PROGRAMS = smp04
|
||||
smp04_SOURCES = init.c tasks.c system.h ../../support/src/locked_print.c
|
||||
smp04_SOURCES = init.c system.h ../../support/src/locked_print.c
|
||||
|
||||
dist_rtems_tests_DATA = smp04.scn
|
||||
dist_rtems_tests_DATA += smp04.doc
|
||||
|
||||
@@ -25,15 +25,18 @@ void Loop() {
|
||||
for (i=0; i<500000; i++);
|
||||
}
|
||||
|
||||
void PrintTaskInfo(
|
||||
const char *task_name
|
||||
rtems_task Test_task(
|
||||
rtems_task_argument task_index
|
||||
)
|
||||
{
|
||||
int cpu_num;
|
||||
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
locked_printf(" CPU %d running task TA%" PRIu32 "\n", cpu_num, task_index );
|
||||
Loop();
|
||||
TaskRan[task_index] = true;
|
||||
|
||||
locked_printf(" CPU %d running task %s\n", cpu_num, task_name );
|
||||
while(1);
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
@@ -45,17 +48,26 @@ rtems_task Init(
|
||||
rtems_id id;
|
||||
rtems_status_code status;
|
||||
bool allDone;
|
||||
int cpu_num;
|
||||
|
||||
Loop();
|
||||
locked_print_initialize();
|
||||
locked_printf( "\n\n*** SMP04 TEST ***\n" );
|
||||
|
||||
PrintTaskInfo( "Init" );
|
||||
/* Display which cpu is running this init thread. */
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
locked_printf(" CPU %d running task Init\n", cpu_num );
|
||||
|
||||
/* Set all Tasks to not ran except for the init task */
|
||||
TaskRan[0] = true;
|
||||
for ( i=1; i <= rtems_smp_get_number_of_processors() ; i++ )
|
||||
TaskRan[i] = false;
|
||||
|
||||
|
||||
/*
|
||||
* For each processor create and start a task alternating
|
||||
* between RTEMS_PREEMPT and RTEMS_NO_PREEMPT.
|
||||
*/
|
||||
for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
|
||||
|
||||
/* Create and start tasks for each CPU */
|
||||
@@ -75,20 +87,33 @@ rtems_task Init(
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&id
|
||||
);
|
||||
}
|
||||
|
||||
for ( i=1; i < rtems_smp_get_number_of_processors() ; i++ ){
|
||||
locked_printf(
|
||||
"Start TA%c a %s task\n",
|
||||
ch,
|
||||
((i%2) ? "RTEMS_PREEMPT" : "RTEMS_NO_PREEMPT" )
|
||||
);
|
||||
status = rtems_task_start( id, Test_task, i );
|
||||
|
||||
/* Force a wait on the task to run in order to synchronize on
|
||||
/*
|
||||
* Force a wait on the task to run in order to synchronize on
|
||||
* simulated systems.
|
||||
*/
|
||||
while (TaskRan[i] == false)
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and start one more task. This task
|
||||
* should preempt the longest running PREEMPTABLE
|
||||
* task and run on that cpu.
|
||||
*/
|
||||
ch = '0' + rtems_smp_get_number_of_processors() ;
|
||||
|
||||
locked_printf(
|
||||
"Create a TA%c a %s task\n",
|
||||
ch,
|
||||
"RTEMS_PREEMPT"
|
||||
);
|
||||
status = rtems_task_create(
|
||||
rtems_build_name( 'T', 'A', ch, ' ' ),
|
||||
3,
|
||||
@@ -97,13 +122,20 @@ rtems_task Init(
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&id
|
||||
);
|
||||
locked_printf(
|
||||
"Start TA%c a %s task\n",
|
||||
ch,
|
||||
"RTEMS_PREEMPT"
|
||||
);
|
||||
status = rtems_task_start(
|
||||
id,
|
||||
Test_task,
|
||||
rtems_smp_get_number_of_processors()
|
||||
);
|
||||
|
||||
/* Wait on the all tasks to run */
|
||||
/*
|
||||
* Wait on the all tasks to run
|
||||
*/
|
||||
while (1) {
|
||||
allDone = true;
|
||||
for ( i=1; i<=rtems_smp_get_number_of_processors() ; i++ ) {
|
||||
@@ -112,7 +144,7 @@ rtems_task Init(
|
||||
}
|
||||
if (allDone) {
|
||||
Loop();
|
||||
locked_printf( "*** END OF TEST SMP04 ***" );
|
||||
locked_printf( "*** END OF TEST SMP04 ***\n" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "system.h"
|
||||
|
||||
rtems_task Test_task(
|
||||
rtems_task_argument task_index
|
||||
)
|
||||
{
|
||||
char task_name[5];
|
||||
|
||||
sprintf(task_name, "TA%" PRIu32, task_index );
|
||||
PrintTaskInfo( task_name );
|
||||
|
||||
Loop();
|
||||
TaskRan[task_index] = true;
|
||||
|
||||
while(1);
|
||||
}
|
||||
@@ -17,7 +17,7 @@ rtems_task Test_task(
|
||||
)
|
||||
{
|
||||
locked_printf( "Shut down from CPU %d\n", bsp_smp_processor_id() );
|
||||
locked_printf( "*** END OF TEST SMP05 ***" );
|
||||
locked_printf( "*** END OF TEST SMP05 ***\n" );
|
||||
rtems_test_exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ rtems_task Test_task(
|
||||
Ran = true;
|
||||
|
||||
if ( do_exit ) {
|
||||
locked_printf( "*** END OF TEST SMP06 ***" );
|
||||
locked_printf( "*** END OF TEST SMP06 ***\n" );
|
||||
rtems_test_exit(0);
|
||||
}
|
||||
while(1)
|
||||
@@ -42,8 +42,6 @@ rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
int i;
|
||||
char ch;
|
||||
int cpu_num;
|
||||
rtems_id id;
|
||||
rtems_status_code status;
|
||||
@@ -115,7 +113,7 @@ rtems_task Init(
|
||||
#define CONFIGURE_MAXIMUM_TASKS 4
|
||||
|
||||
#define CONFIGURE_INIT_TASK_PRIORITY 2
|
||||
#define CONFIGURE_INIT_TASK_MODES RTEMS_PREEMPT
|
||||
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_PREEMPT
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
|
||||
@@ -44,7 +44,11 @@ rtems_task Test_task(
|
||||
TaskRan = true;
|
||||
|
||||
/* Print that the task is up and running. */
|
||||
locked_printf(" CPU %d running Task %s after semaphore release\n", cpu_num, name);
|
||||
locked_printf(
|
||||
" CPU %d running Task %s after semaphore release\n",
|
||||
cpu_num,
|
||||
name
|
||||
);
|
||||
|
||||
(void) rtems_task_delete( RTEMS_SELF );
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ void PrintTaskInfo(
|
||||
)
|
||||
{
|
||||
int cpu_num;
|
||||
rtems_status_code sc;
|
||||
|
||||
cpu_num = bsp_smp_processor_id();
|
||||
|
||||
@@ -45,7 +44,7 @@ rtems_task Init(
|
||||
rtems_status_code status;
|
||||
rtems_time_of_day time;
|
||||
int i;
|
||||
char ch;
|
||||
char ch[4];
|
||||
rtems_id id;
|
||||
|
||||
locked_print_initialize();
|
||||
@@ -77,10 +76,10 @@ rtems_task Init(
|
||||
PrintTaskInfo( "Init", &time );
|
||||
|
||||
for ( i=1; i <= rtems_smp_get_number_of_processors() *3; i++ ) {
|
||||
ch = '0' + i;
|
||||
|
||||
sprintf(ch, "%02" PRId32, i );
|
||||
status = rtems_task_create(
|
||||
rtems_build_name( 'T', 'A', ch, ' ' ),
|
||||
rtems_build_name( 'T', 'A', ch[0], ch[1] ),
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
|
||||
Reference in New Issue
Block a user