2000-09-29 Stephan Merker <merker@decrc.abb.de>

* sp20/getall.c, sp20/init.c, sp20/system.h, sp20/task1.c:
	Added new task to test sequence of altering a period's length
	while it is still active.
This commit is contained in:
Joel Sherrill
2000-09-29 14:51:16 +00:00
parent bebf0438d6
commit cf42c54cfa
10 changed files with 128 additions and 26 deletions

View File

@@ -1,3 +1,9 @@
2000-09-29 Stephan Merker <merker@decrc.abb.de>
* sp20/getall.c, sp20/init.c, sp20/system.h, sp20/task1.c:
Added new task to test sequence of altering a period's length
while it is still active.
2000-09-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* sp01/Makefile.am, sp02/Makefile.am, sp03/Makefile.am,

View File

@@ -36,6 +36,7 @@ void Get_all_counters()
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
Count.count[ 6 ] = 0;
status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode );
directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" );

View File

@@ -38,8 +38,9 @@ rtems_task Init(
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' );
for ( index = 1 ; index <= 5 ; index++ ) {
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
@@ -51,8 +52,8 @@ rtems_task Init(
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_6, index );
directive_failed( status, "rtems_task_start loop" );
}
@@ -61,6 +62,7 @@ rtems_task Init(
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
Count.count[ 6 ] = 0;
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );

View File

@@ -13,12 +13,16 @@
* $Id$
*/
/* StM:
One test added for verifying rtems_rate_monotonic_period() with changing period lengths.
*/
#include <tmacros.h>
/* types */
struct counters {
rtems_unsigned32 count[6];
rtems_unsigned32 count[7];
};
/* functions */
@@ -27,7 +31,7 @@ rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_5(
rtems_task Task_1_through_6(
rtems_task_argument argument
);
@@ -38,7 +42,7 @@ void Get_all_counters( void );
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 6
#define CONFIGURE_MAXIMUM_TASKS 7
#define CONFIGURE_MAXIMUM_PERIODS 10
#define CONFIGURE_INIT_TASK_PRIORITY 10
@@ -51,11 +55,11 @@ void Get_all_counters( void );
/* global variables */
TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */
TEST_EXTERN struct counters Count; /* iteration counters */
TEST_EXTERN struct counters Temporary_count;
extern rtems_task_priority Priorities[ 6 ];
extern rtems_task_priority Priorities[ 7 ];
/* end of include file */

View File

@@ -20,11 +20,17 @@
#include "system.h"
rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 };
rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 };
rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
/*
runtime of TA6 should be shorter than TA5
*/
#define TA6_ITERATIONS 10
#define TA6_PERIOD_FACTOR 10
rtems_task Task_1_through_5(
rtems_unsigned32 Periods[7] = { 0, 2, 2, 2, 2, 100, 0 };
rtems_unsigned32 Iterations[7] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS };
rtems_task_priority Priorities[7] = { 0, 1, 1, 3, 4, 5, 1 };
rtems_task Task_1_through_6(
rtems_unsigned32 argument
)
{
@@ -111,5 +117,37 @@ rtems_task Task_1_through_5(
}
break;
case 6:
/* test changing periods */
{
unsigned32 time[TA6_ITERATIONS+1];
rtems_interval period;
period = 1*TA6_PERIOD_FACTOR;
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[0] = _Watchdog_Ticks_since_boot; /* timestamp */
/*printf("%d - %d\n", period, time[0]);*/
for (index = 1; index <= TA6_ITERATIONS; index++)
{
period = (index+1)*TA6_PERIOD_FACTOR;
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[index] = _Watchdog_Ticks_since_boot; /* timestamp */
/*printf("%d - %d\n", period, time[index]);*/
}
for (index = 1; index <= TA6_ITERATIONS; index++)
{
rtems_interval meas = time[index] - time[index-1];
period = index*TA6_PERIOD_FACTOR;
printf("TA6 - Actual: %d Expected: %d", meas, period);
if (period == meas) printf(" - OK\n");
else printf(" - FAILED\n");
}
}
rtems_task_suspend(RTEMS_SELF);
break;
}
}

View File

@@ -1,3 +1,9 @@
2000-09-29 Stephan Merker <merker@decrc.abb.de>
* sp20/getall.c, sp20/init.c, sp20/system.h, sp20/task1.c:
Added new task to test sequence of altering a period's length
while it is still active.
2000-09-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* sp01/Makefile.am, sp02/Makefile.am, sp03/Makefile.am,

View File

@@ -36,6 +36,7 @@ void Get_all_counters()
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
Count.count[ 6 ] = 0;
status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode );
directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" );

View File

@@ -38,8 +38,9 @@ rtems_task Init(
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' );
for ( index = 1 ; index <= 5 ; index++ ) {
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
@@ -51,8 +52,8 @@ rtems_task Init(
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_6, index );
directive_failed( status, "rtems_task_start loop" );
}
@@ -61,6 +62,7 @@ rtems_task Init(
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
Count.count[ 6 ] = 0;
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );

View File

@@ -13,12 +13,16 @@
* $Id$
*/
/* StM:
One test added for verifying rtems_rate_monotonic_period() with changing period lengths.
*/
#include <tmacros.h>
/* types */
struct counters {
rtems_unsigned32 count[6];
rtems_unsigned32 count[7];
};
/* functions */
@@ -27,7 +31,7 @@ rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_5(
rtems_task Task_1_through_6(
rtems_task_argument argument
);
@@ -38,7 +42,7 @@ void Get_all_counters( void );
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 6
#define CONFIGURE_MAXIMUM_TASKS 7
#define CONFIGURE_MAXIMUM_PERIODS 10
#define CONFIGURE_INIT_TASK_PRIORITY 10
@@ -51,11 +55,11 @@ void Get_all_counters( void );
/* global variables */
TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
TEST_EXTERN rtems_id Task_id[ 7 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 7 ]; /* array of task names */
TEST_EXTERN struct counters Count; /* iteration counters */
TEST_EXTERN struct counters Temporary_count;
extern rtems_task_priority Priorities[ 6 ];
extern rtems_task_priority Priorities[ 7 ];
/* end of include file */

View File

@@ -20,11 +20,17 @@
#include "system.h"
rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 };
rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 };
rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
/*
runtime of TA6 should be shorter than TA5
*/
#define TA6_ITERATIONS 10
#define TA6_PERIOD_FACTOR 10
rtems_task Task_1_through_5(
rtems_unsigned32 Periods[7] = { 0, 2, 2, 2, 2, 100, 0 };
rtems_unsigned32 Iterations[7] = { 0, 50, 50, 50, 50, 1, TA6_ITERATIONS };
rtems_task_priority Priorities[7] = { 0, 1, 1, 3, 4, 5, 1 };
rtems_task Task_1_through_6(
rtems_unsigned32 argument
)
{
@@ -111,5 +117,37 @@ rtems_task Task_1_through_5(
}
break;
case 6:
/* test changing periods */
{
unsigned32 time[TA6_ITERATIONS+1];
rtems_interval period;
period = 1*TA6_PERIOD_FACTOR;
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[0] = _Watchdog_Ticks_since_boot; /* timestamp */
/*printf("%d - %d\n", period, time[0]);*/
for (index = 1; index <= TA6_ITERATIONS; index++)
{
period = (index+1)*TA6_PERIOD_FACTOR;
status = rtems_rate_monotonic_period( rmid, period);
directive_failed( status, "rtems_rate_monotonic_period of TA6" );
time[index] = _Watchdog_Ticks_since_boot; /* timestamp */
/*printf("%d - %d\n", period, time[index]);*/
}
for (index = 1; index <= TA6_ITERATIONS; index++)
{
rtems_interval meas = time[index] - time[index-1];
period = index*TA6_PERIOD_FACTOR;
printf("TA6 - Actual: %d Expected: %d", meas, period);
if (period == meas) printf(" - OK\n");
else printf(" - FAILED\n");
}
}
rtems_task_suspend(RTEMS_SELF);
break;
}
}