mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-10-16 12:53:21 +08:00
testsuites/samples: reformat with clang-format
Updates #3860. Updates #5358.
This commit is contained in:
committed by
Kinsey Moore
parent
f2b17295cb
commit
57ea3fe79f
@@ -44,17 +44,19 @@
|
||||
|
||||
#include "tmacros.h"
|
||||
|
||||
rtems_task Application_task(
|
||||
rtems_task_argument node
|
||||
)
|
||||
rtems_task Application_task( rtems_task_argument node )
|
||||
{
|
||||
rtems_id tid;
|
||||
rtems_status_code status;
|
||||
|
||||
rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
|
||||
(void) status;
|
||||
printf( "This task was invoked with the node argument (%" PRIdrtems_task_argument ")\n", node );
|
||||
printf( "This task has the id of 0x%" PRIxrtems_id "\n", tid );
|
||||
printf(
|
||||
"This task was invoked with the node argument (%" PRIdrtems_task_argument
|
||||
")\n",
|
||||
node
|
||||
);
|
||||
printf( "This task has the id of 0x%" PRIxrtems_id "\n", tid );
|
||||
TEST_END();
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
@@ -37,13 +37,11 @@
|
||||
#include "tmacros.h"
|
||||
|
||||
/* forward declarations to avoid warnings */
|
||||
rtems_task Init(rtems_task_argument argument);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
const char rtems_test_name[] = "SAMPLE MULTIPROCESSOR APPLICATION";
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
rtems_task Init( rtems_task_argument argument )
|
||||
{
|
||||
(void) argument;
|
||||
|
||||
@@ -54,16 +52,22 @@ rtems_task Init(
|
||||
TEST_BEGIN();
|
||||
printf( "Creating and starting an application task\n" );
|
||||
task_name = rtems_build_name( 'T', 'A', '1', ' ' );
|
||||
status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
|
||||
rtems_test_assert(status == RTEMS_SUCCESSFUL);
|
||||
status = rtems_task_create(
|
||||
task_name,
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_INTERRUPT_LEVEL( 0 ),
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&tid
|
||||
);
|
||||
rtems_test_assert( status == RTEMS_SUCCESSFUL );
|
||||
|
||||
status = rtems_task_start(
|
||||
tid,
|
||||
Application_task,
|
||||
rtems_object_get_local_node()
|
||||
);
|
||||
rtems_test_assert(status == RTEMS_SUCCESSFUL);
|
||||
rtems_test_assert( status == RTEMS_SUCCESSFUL );
|
||||
|
||||
rtems_task_exit();
|
||||
}
|
||||
|
||||
@@ -35,13 +35,9 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
rtems_task Application_task(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Application_task( rtems_task_argument argument );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -52,7 +48,7 @@ rtems_task Application_task(
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
rtems_task Application_task(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
rtems_task Application_task( rtems_task_argument argument )
|
||||
{
|
||||
rtems_id tid;
|
||||
rtems_status_code status;
|
||||
@@ -58,7 +56,9 @@ rtems_task Application_task(
|
||||
|
||||
printf(
|
||||
"Application task was invoked with argument (%d) "
|
||||
"and has id of 0x%" PRIxrtems_id "\n", a, tid
|
||||
"and has id of 0x%" PRIxrtems_id "\n",
|
||||
a,
|
||||
tid
|
||||
);
|
||||
|
||||
TEST_END();
|
||||
|
||||
@@ -36,15 +36,13 @@
|
||||
#include <stdio.h>
|
||||
|
||||
/* forward declarations to avoid warnings */
|
||||
rtems_task Init(rtems_task_argument argument);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
const char rtems_test_name[] = "SAMPLE SINGLE PROCESSOR APPLICATION";
|
||||
|
||||
#define ARGUMENT 0
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
rtems_task Init( rtems_task_argument argument )
|
||||
{
|
||||
(void) argument;
|
||||
|
||||
@@ -57,12 +55,18 @@ rtems_task Init(
|
||||
|
||||
task_name = rtems_build_name( 'T', 'A', '1', ' ' );
|
||||
|
||||
status = rtems_task_create( task_name, 1, RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_INTERRUPT_LEVEL(0), RTEMS_DEFAULT_ATTRIBUTES, &tid );
|
||||
directive_failed( status, "create" );
|
||||
status = rtems_task_create(
|
||||
task_name,
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_INTERRUPT_LEVEL( 0 ),
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&tid
|
||||
);
|
||||
directive_failed( status, "create" );
|
||||
|
||||
status = rtems_task_start( tid, Application_task, ARGUMENT );
|
||||
directive_failed( status, "start" );
|
||||
directive_failed( status, "start" );
|
||||
|
||||
rtems_task_exit();
|
||||
}
|
||||
|
||||
@@ -35,13 +35,9 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
rtems_task Application_task(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Application_task( rtems_task_argument argument );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -50,7 +46,7 @@ rtems_task Application_task(
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
@@ -44,7 +44,7 @@ const char rtems_test_name[] = "CAPTURE ENGINE";
|
||||
|
||||
volatile int can_proceed = 1;
|
||||
|
||||
static void notification(int fd, int seconds_remaining, void *arg)
|
||||
static void notification( int fd, int seconds_remaining, void *arg )
|
||||
{
|
||||
(void) fd;
|
||||
(void) arg;
|
||||
@@ -55,9 +55,7 @@ static void notification(int fd, int seconds_remaining, void *arg)
|
||||
);
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
rtems_task Init( rtems_task_argument ignored )
|
||||
{
|
||||
(void) ignored;
|
||||
|
||||
@@ -65,31 +63,25 @@ rtems_task Init(
|
||||
rtems_task_priority old_priority;
|
||||
rtems_mode old_mode;
|
||||
|
||||
rtems_print_printer_fprintf_putc(&rtems_test_printer);
|
||||
rtems_print_printer_fprintf_putc( &rtems_test_printer );
|
||||
TEST_BEGIN();
|
||||
|
||||
status = rtems_shell_wait_for_input(
|
||||
STDIN_FILENO,
|
||||
20,
|
||||
notification,
|
||||
NULL
|
||||
);
|
||||
if (status == RTEMS_SUCCESSFUL) {
|
||||
status = rtems_shell_wait_for_input( STDIN_FILENO, 20, notification, NULL );
|
||||
if ( status == RTEMS_SUCCESSFUL ) {
|
||||
/* lower the task priority to allow created tasks to execute */
|
||||
|
||||
rtems_task_set_priority(RTEMS_SELF, 20, &old_priority);
|
||||
rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode);
|
||||
rtems_task_set_priority( RTEMS_SELF, 20, &old_priority );
|
||||
rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
|
||||
|
||||
while (!can_proceed)
|
||||
{
|
||||
printf ("Sleeping\n");
|
||||
usleep (1000000);
|
||||
while ( !can_proceed ) {
|
||||
printf( "Sleeping\n" );
|
||||
usleep( 1000000 );
|
||||
}
|
||||
|
||||
rtems_monitor_init (0);
|
||||
rtems_capture_cli_init (0);
|
||||
rtems_monitor_init( 0 );
|
||||
rtems_capture_cli_init( 0 );
|
||||
|
||||
setup_tasks_to_watch ();
|
||||
setup_tasks_to_watch();
|
||||
|
||||
rtems_task_exit();
|
||||
} else {
|
||||
|
||||
@@ -35,24 +35,15 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
rtems_task test_task(
|
||||
rtems_task_argument my_number
|
||||
);
|
||||
rtems_task test_task( rtems_task_argument my_number );
|
||||
|
||||
void
|
||||
destory_all_tasks(
|
||||
const char *who
|
||||
);
|
||||
void destory_all_tasks( const char *who );
|
||||
|
||||
bool status_code_bad(
|
||||
rtems_status_code status_code
|
||||
);
|
||||
bool status_code_bad( rtems_status_code status_code );
|
||||
|
||||
extern void setup_tasks_to_watch(void);
|
||||
extern void setup_tasks_to_watch( void );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -68,7 +59,7 @@ extern void setup_tasks_to_watch(void);
|
||||
#define CONFIGURE_UNIFIED_WORK_AREAS
|
||||
#define CONFIGURE_UNLIMITED_OBJECTS
|
||||
|
||||
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS (5)
|
||||
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS ( 5 )
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
@@ -78,34 +69,32 @@ extern void setup_tasks_to_watch(void);
|
||||
* Keep track of the task id's created, use a large array.
|
||||
*/
|
||||
|
||||
#define MAX_TASKS (1000)
|
||||
#define TASK_INDEX_OFFSET (1)
|
||||
#define MAX_TASKS ( 1000 )
|
||||
#define TASK_INDEX_OFFSET ( 1 )
|
||||
|
||||
extern rtems_id task_id[MAX_TASKS];
|
||||
extern rtems_id task_id[ MAX_TASKS ];
|
||||
|
||||
/*
|
||||
* Increment the task name.
|
||||
*/
|
||||
|
||||
#define NEXT_TASK_NAME(c1, c2, c3, c4) \
|
||||
if (c4 == '9') { \
|
||||
if (c3 == '9') { \
|
||||
if (c2 == 'z') { \
|
||||
if (c1 == 'z') { \
|
||||
printf("not enough task letters for names !!!\n"); \
|
||||
exit( 1 ); \
|
||||
} else \
|
||||
c1++; \
|
||||
c2 = 'a'; \
|
||||
} else \
|
||||
c2++; \
|
||||
c3 = '0'; \
|
||||
} else \
|
||||
c3++; \
|
||||
c4 = '0'; \
|
||||
} \
|
||||
else \
|
||||
c4++ \
|
||||
|
||||
#define NEXT_TASK_NAME( c1, c2, c3, c4 ) \
|
||||
if ( c4 == '9' ) { \
|
||||
if ( c3 == '9' ) { \
|
||||
if ( c2 == 'z' ) { \
|
||||
if ( c1 == 'z' ) { \
|
||||
printf( "not enough task letters for names !!!\n" ); \
|
||||
exit( 1 ); \
|
||||
} else \
|
||||
c1++; \
|
||||
c2 = 'a'; \
|
||||
} else \
|
||||
c2++; \
|
||||
c3 = '0'; \
|
||||
} else \
|
||||
c3++; \
|
||||
c4 = '0'; \
|
||||
} else \
|
||||
c4++
|
||||
|
||||
/* end of include file */
|
||||
|
||||
+136
-108
File diff suppressed because it is too large
Load Diff
@@ -35,9 +35,7 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task main_task(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task main_task( rtems_task_argument argument );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -46,16 +44,16 @@ rtems_task main_task(
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES 5
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES 5
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
|
||||
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' )
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_INIT_TASK_ENTRY_POINT main_task
|
||||
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'C', 'T', 'O', 'R' )
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
|
||||
/* On some platforms _Unwind_RaiseException() needs a lot of stack space */
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (4 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE ( 4 * RTEMS_MINIMUM_STACK_SIZE )
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
|
||||
+627
-594
File diff suppressed because it is too large
Load Diff
@@ -36,21 +36,18 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
/* global variables */
|
||||
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#include <bsp.h> /* for device driver prototypes */
|
||||
|
||||
#define FILEIO_BUILD 1
|
||||
|
||||
#if defined(RTEMS_BSP_HAS_IDE_DRIVER)
|
||||
#include <libchip/ata.h> /* for ata driver prototype */
|
||||
#if defined( RTEMS_BSP_HAS_IDE_DRIVER )
|
||||
#include <libchip/ata.h> /* for ata driver prototype */
|
||||
#include <libchip/ide_ctrl.h> /* for general ide driver prototype */
|
||||
#endif
|
||||
|
||||
@@ -59,14 +56,14 @@ rtems_task Init(
|
||||
#ifdef RTEMS_BSP_HAS_IDE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
|
||||
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY 14
|
||||
#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY 14
|
||||
#endif
|
||||
|
||||
#if FILEIO_BUILD
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS 2
|
||||
#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS 8
|
||||
#define CONFIGURE_SWAPOUT_TASK_PRIORITY 15
|
||||
#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS 2
|
||||
#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS 8
|
||||
#define CONFIGURE_SWAPOUT_TASK_PRIORITY 15
|
||||
#define CONFIGURE_FILESYSTEM_RFS
|
||||
#define CONFIGURE_FILESYSTEM_DOSFS
|
||||
#endif
|
||||
|
||||
@@ -35,25 +35,22 @@
|
||||
|
||||
const char rtems_test_name[] = "HELLO WORLD";
|
||||
|
||||
static rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
static rtems_task Init( rtems_task_argument ignored )
|
||||
{
|
||||
(void) ignored;
|
||||
|
||||
rtems_print_printer_fprintf_putc(&rtems_test_printer);
|
||||
rtems_print_printer_fprintf_putc( &rtems_test_printer );
|
||||
TEST_BEGIN();
|
||||
printf( "Hello World\n" );
|
||||
TEST_END();
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
/* NOTICE: the clock driver is explicitly disabled */
|
||||
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES 5
|
||||
#define CONFIGURE_MAXIMUM_SEMAPHORES 5
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS RTEMS_MINIMUM_STACK_SIZE
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 )
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS RTEMS_MINIMUM_STACK_SIZE
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ static void *Init( uintptr_t ignored )
|
||||
*/
|
||||
#ifdef RTEMS_GCOV_COVERAGE
|
||||
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE \
|
||||
(CPU_STACK_MINIMUM_SIZE - CPU_STACK_ALIGNMENT)
|
||||
( CPU_STACK_MINIMUM_SIZE - CPU_STACK_ALIGNMENT )
|
||||
#else
|
||||
#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512
|
||||
#endif
|
||||
|
||||
@@ -32,5 +32,4 @@
|
||||
#include "system.h"
|
||||
|
||||
/* put here hoping it won't get inlined */
|
||||
void dummy_function_empty_body_to_force_call(void) {}
|
||||
|
||||
void dummy_function_empty_body_to_force_call( void ) {}
|
||||
|
||||
@@ -57,9 +57,9 @@ const char rtems_test_name[] = "NANOSECOND CLOCK";
|
||||
|
||||
static char *my_ctime( time_t t )
|
||||
{
|
||||
static char b[32];
|
||||
ctime_r(&t, b);
|
||||
b[ strlen(b) - 1] = '\0';
|
||||
static char b[ 32 ];
|
||||
ctime_r( &t, b );
|
||||
b[ strlen( b ) - 1 ] = '\0';
|
||||
return b;
|
||||
}
|
||||
|
||||
@@ -74,35 +74,32 @@ static void subtract_em(
|
||||
_Timespec_Subtract( start, stop, t );
|
||||
}
|
||||
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
rtems_task Init( rtems_task_argument argument )
|
||||
{
|
||||
(void) argument;
|
||||
|
||||
rtems_status_code status;
|
||||
rtems_time_of_day time;
|
||||
int index;
|
||||
int index;
|
||||
|
||||
TEST_BEGIN();
|
||||
|
||||
time.year = 2007;
|
||||
time.month = 03;
|
||||
time.day = 24;
|
||||
time.hour = 11;
|
||||
time.year = 2007;
|
||||
time.month = 03;
|
||||
time.day = 24;
|
||||
time.hour = 11;
|
||||
time.minute = 15;
|
||||
time.second = 0;
|
||||
time.ticks = 0;
|
||||
time.ticks = 0;
|
||||
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "clock set" );
|
||||
directive_failed( status, "clock set" );
|
||||
|
||||
/*
|
||||
* Iterate 10 times showing difference in TOD
|
||||
*/
|
||||
printf( "10 iterations of getting TOD\n" );
|
||||
for (index=0 ; index <10 ; index++ ) {
|
||||
for ( index = 0; index < 10; index++ ) {
|
||||
struct timespec start, stop;
|
||||
struct timespec diff;
|
||||
|
||||
@@ -110,9 +107,12 @@ rtems_task Init(
|
||||
clock_gettime( CLOCK_REALTIME, &stop );
|
||||
|
||||
subtract_em( &start, &stop, &diff );
|
||||
printf( "Start: %s:%ld\nStop : %s:%ld",
|
||||
my_ctime(start.tv_sec), start.tv_nsec,
|
||||
my_ctime(stop.tv_sec), stop.tv_nsec
|
||||
printf(
|
||||
"Start: %s:%ld\nStop : %s:%ld",
|
||||
my_ctime( start.tv_sec ),
|
||||
start.tv_nsec,
|
||||
my_ctime( stop.tv_sec ),
|
||||
stop.tv_nsec
|
||||
);
|
||||
|
||||
printf( " --> %" PRIdtime_t ":%ld\n", diff.tv_sec, diff.tv_nsec );
|
||||
@@ -122,46 +122,54 @@ rtems_task Init(
|
||||
* Iterate 10 times showing difference in Uptime
|
||||
*/
|
||||
printf( "\n10 iterations of getting Uptime\n" );
|
||||
for (index=0 ; index <10 ; index++ ) {
|
||||
for ( index = 0; index < 10; index++ ) {
|
||||
struct timespec start, stop;
|
||||
struct timespec diff;
|
||||
rtems_clock_get_uptime( &start );
|
||||
rtems_clock_get_uptime( &stop );
|
||||
|
||||
subtract_em( &start, &stop, &diff );
|
||||
printf( "%" PRIdtime_t ":%ld %" PRIdtime_t ":%ld --> %" PRIdtime_t ":%ld\n",
|
||||
start.tv_sec, start.tv_nsec,
|
||||
stop.tv_sec, stop.tv_nsec,
|
||||
diff.tv_sec, diff.tv_nsec
|
||||
);
|
||||
printf(
|
||||
"%" PRIdtime_t ":%ld %" PRIdtime_t ":%ld --> %" PRIdtime_t ":%ld\n",
|
||||
start.tv_sec,
|
||||
start.tv_nsec,
|
||||
stop.tv_sec,
|
||||
stop.tv_nsec,
|
||||
diff.tv_sec,
|
||||
diff.tv_nsec
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate 10 times showing difference in Uptime with different counts
|
||||
*/
|
||||
printf( "\n10 iterations of getting Uptime with different loop values\n" );
|
||||
for (index=1 ; index <=10 ; index++ ) {
|
||||
for ( index = 1; index <= 10; index++ ) {
|
||||
struct timespec start, stop;
|
||||
struct timespec diff;
|
||||
long j, max = (index * 10000L);
|
||||
long j, max = ( index * 10000L );
|
||||
rtems_clock_get_uptime( &start );
|
||||
for (j=0 ; j<max ; j++ )
|
||||
dummy_function_empty_body_to_force_call();
|
||||
for ( j = 0; j < max; j++ ) {
|
||||
dummy_function_empty_body_to_force_call();
|
||||
}
|
||||
rtems_clock_get_uptime( &stop );
|
||||
|
||||
subtract_em( &start, &stop, &diff );
|
||||
printf( "loop of %ld %" PRIdtime_t
|
||||
":%ld %" PRIdtime_t ":%ld --> %" PRIdtime_t ":%ld\n",
|
||||
printf(
|
||||
"loop of %ld %" PRIdtime_t ":%ld %" PRIdtime_t ":%ld --> %" PRIdtime_t
|
||||
":%ld\n",
|
||||
max,
|
||||
start.tv_sec, start.tv_nsec,
|
||||
stop.tv_sec, stop.tv_nsec,
|
||||
diff.tv_sec, diff.tv_nsec
|
||||
);
|
||||
start.tv_sec,
|
||||
start.tv_nsec,
|
||||
stop.tv_sec,
|
||||
stop.tv_nsec,
|
||||
diff.tv_sec,
|
||||
diff.tv_nsec
|
||||
);
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
sleep( 1 );
|
||||
|
||||
TEST_END();
|
||||
exit(0);
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@
|
||||
|
||||
#include <bsp.h> /* for device driver prototypes */
|
||||
|
||||
extern void dummy_function_empty_body_to_force_call(void);
|
||||
extern void dummy_function_empty_body_to_force_call( void );
|
||||
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
@@ -35,15 +35,13 @@
|
||||
#include <stdio.h>
|
||||
#include <tmacros.h>
|
||||
|
||||
extern int paranoia(int, char **);
|
||||
extern int paranoia( int, char ** );
|
||||
|
||||
const char rtems_test_name[] = "PARANOIA";
|
||||
|
||||
char *args[2] = { "paranoia", 0 };
|
||||
char *args[ 2 ] = { "paranoia", 0 };
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
rtems_task Init( rtems_task_argument ignored )
|
||||
{
|
||||
(void) ignored;
|
||||
|
||||
@@ -52,13 +50,13 @@ rtems_task Init(
|
||||
* is required by this CPU.
|
||||
*/
|
||||
|
||||
#if (defined (m68040))
|
||||
M68KFPSPInstallExceptionHandlers ();
|
||||
#if ( defined( m68040 ) )
|
||||
M68KFPSPInstallExceptionHandlers();
|
||||
#endif
|
||||
|
||||
rtems_print_printer_fprintf_putc(&rtems_test_printer);
|
||||
rtems_print_printer_fprintf_putc( &rtems_test_printer );
|
||||
TEST_BEGIN();
|
||||
paranoia(1, args);
|
||||
paranoia( 1, args );
|
||||
TEST_END();
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
+2032
-1915
File diff suppressed because it is too large
Load Diff
@@ -35,9 +35,7 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -46,13 +44,13 @@ rtems_task Init(
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE * 2)
|
||||
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE ( RTEMS_MINIMUM_STACK_SIZE * 2 )
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS ( 1 * RTEMS_MINIMUM_STACK_SIZE )
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
|
||||
@@ -39,12 +39,10 @@ const char rtems_test_name[] = "CLOCK TICK";
|
||||
* Keep the names and IDs in global variables so another task can use them.
|
||||
*/
|
||||
|
||||
rtems_id Task_id[ 4 ]; /* array of task ids */
|
||||
rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
rtems_id Task_id[ 4 ]; /* array of task ids */
|
||||
rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
rtems_task Init( rtems_task_argument argument )
|
||||
{
|
||||
(void) argument;
|
||||
|
||||
@@ -53,13 +51,13 @@ rtems_task Init(
|
||||
|
||||
TEST_BEGIN();
|
||||
|
||||
time.year = 1988;
|
||||
time.month = 12;
|
||||
time.day = 31;
|
||||
time.hour = 9;
|
||||
time.year = 1988;
|
||||
time.month = 12;
|
||||
time.day = 31;
|
||||
time.hour = 9;
|
||||
time.minute = 0;
|
||||
time.second = 0;
|
||||
time.ticks = 0;
|
||||
time.ticks = 0;
|
||||
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "clock set" );
|
||||
@@ -69,31 +67,43 @@ rtems_task Init(
|
||||
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ]
|
||||
Task_name[ 1 ],
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE * 2,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Task_id[ 1 ]
|
||||
);
|
||||
directive_failed( status, "create 1" );
|
||||
directive_failed( status, "create 1" );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ]
|
||||
Task_name[ 2 ],
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE * 2,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Task_id[ 2 ]
|
||||
);
|
||||
directive_failed( status, "create 2" );
|
||||
directive_failed( status, "create 2" );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ]
|
||||
Task_name[ 3 ],
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE * 2,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Task_id[ 3 ]
|
||||
);
|
||||
directive_failed( status, "create 3" );
|
||||
directive_failed( status, "create 3" );
|
||||
|
||||
status = rtems_task_start( Task_id[ 1 ], Test_task, 1 );
|
||||
directive_failed( status, "start 1" );
|
||||
directive_failed( status, "start 1" );
|
||||
|
||||
status = rtems_task_start( Task_id[ 2 ], Test_task, 2 );
|
||||
directive_failed( status, "start 2" );
|
||||
directive_failed( status, "start 2" );
|
||||
|
||||
status = rtems_task_start( Task_id[ 3 ], Test_task, 3 );
|
||||
directive_failed( status, "start 3" );
|
||||
directive_failed( status, "start 3" );
|
||||
|
||||
rtems_task_exit();
|
||||
}
|
||||
|
||||
@@ -37,13 +37,9 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
rtems_task Test_task(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Test_task( rtems_task_argument argument );
|
||||
|
||||
/* global variables */
|
||||
|
||||
@@ -51,9 +47,8 @@ rtems_task Test_task(
|
||||
* Keep the names and IDs in global variables so another task can use them.
|
||||
*/
|
||||
|
||||
extern rtems_id Task_id[ 4 ]; /* array of task ids */
|
||||
extern rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
|
||||
extern rtems_id Task_id[ 4 ]; /* array of task ids */
|
||||
extern rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -62,11 +57,11 @@ extern rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||
#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 4
|
||||
#define CONFIGURE_MAXIMUM_TASKS 4
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS ( 3 * RTEMS_MINIMUM_STACK_SIZE )
|
||||
|
||||
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
|
||||
|
||||
@@ -82,9 +77,9 @@ extern rtems_name Task_name[ 4 ]; /* array of task names */
|
||||
* But it shows how rtems_id's can sometimes be used.
|
||||
*/
|
||||
|
||||
#define task_number( tid ) \
|
||||
( rtems_object_id_get_index( tid ) - \
|
||||
rtems_configuration_get_rtems_api_configuration()-> \
|
||||
number_of_initialization_tasks )
|
||||
#define task_number( tid ) \
|
||||
( rtems_object_id_get_index( tid ) - \
|
||||
rtems_configuration_get_rtems_api_configuration() \
|
||||
->number_of_initialization_tasks )
|
||||
|
||||
/* end of include file */
|
||||
|
||||
@@ -40,9 +40,7 @@
|
||||
|
||||
#include "system.h"
|
||||
|
||||
rtems_task Test_task(
|
||||
rtems_task_argument unused
|
||||
)
|
||||
rtems_task Test_task( rtems_task_argument unused )
|
||||
{
|
||||
(void) unused;
|
||||
|
||||
@@ -52,10 +50,10 @@ rtems_task Test_task(
|
||||
rtems_status_code status;
|
||||
|
||||
status = rtems_task_ident( RTEMS_WHO_AM_I, RTEMS_SEARCH_ALL_NODES, &tid );
|
||||
directive_failed( status, "task ident" );
|
||||
directive_failed( status, "task ident" );
|
||||
|
||||
task_index = task_number( tid );
|
||||
for ( ; ; ) {
|
||||
for ( ;; ) {
|
||||
status = rtems_clock_get_tod( &time );
|
||||
if ( time.second >= 35 ) {
|
||||
TEST_END();
|
||||
@@ -66,6 +64,6 @@ rtems_task Test_task(
|
||||
status = rtems_task_wake_after(
|
||||
task_index * 5 * rtems_clock_get_ticks_per_second()
|
||||
);
|
||||
directive_failed( status, "wake after" );
|
||||
directive_failed( status, "wake after" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
|
||||
const char rtems_test_name[] = "UNLIMITED TASK";
|
||||
|
||||
rtems_id task_id[MAX_TASKS];
|
||||
rtems_id task_id[ MAX_TASKS ];
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
rtems_task Init( rtems_task_argument ignored )
|
||||
{
|
||||
(void) ignored;
|
||||
|
||||
@@ -56,15 +54,19 @@ rtems_task Init(
|
||||
/* lower the task priority to allow created tasks to execute */
|
||||
|
||||
rtems_task_set_priority(
|
||||
RTEMS_SELF, RTEMS_MAXIMUM_PRIORITY - 1, &old_priority);
|
||||
rtems_task_mode(RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode);
|
||||
RTEMS_SELF,
|
||||
RTEMS_MAXIMUM_PRIORITY - 1,
|
||||
&old_priority
|
||||
);
|
||||
rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &old_mode );
|
||||
|
||||
/*
|
||||
* Invalid state if the task id is 0
|
||||
*/
|
||||
|
||||
for (task = 0; task < MAX_TASKS; task++)
|
||||
task_id[task] = 0;
|
||||
for ( task = 0; task < MAX_TASKS; task++ ) {
|
||||
task_id[ task ] = 0;
|
||||
}
|
||||
|
||||
test1();
|
||||
test2();
|
||||
@@ -74,66 +76,57 @@ rtems_task Init(
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
rtems_task test_task(
|
||||
rtems_task_argument my_number
|
||||
)
|
||||
rtems_task test_task( rtems_task_argument my_number )
|
||||
{
|
||||
rtems_event_set out;
|
||||
unsigned int my_n = (unsigned int) my_number;
|
||||
|
||||
printf( "task %u has started.\n", my_n);
|
||||
printf( "task %u has started.\n", my_n );
|
||||
|
||||
rtems_event_receive(1, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &out);
|
||||
rtems_event_receive( 1, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &out );
|
||||
|
||||
printf( "task %u ending.\n", my_n);
|
||||
printf( "task %u ending.\n", my_n );
|
||||
|
||||
rtems_task_exit();
|
||||
}
|
||||
|
||||
void destroy_all_tasks(
|
||||
const char *who
|
||||
)
|
||||
void destroy_all_tasks( const char *who )
|
||||
{
|
||||
uint32_t task;
|
||||
uint32_t task;
|
||||
|
||||
/*
|
||||
* If the id is not zero, signal the task to delete.
|
||||
*/
|
||||
|
||||
for (task = 0; task < MAX_TASKS; task++) {
|
||||
if (task_id[task]) {
|
||||
for ( task = 0; task < MAX_TASKS; task++ ) {
|
||||
if ( task_id[ task ] ) {
|
||||
printf(
|
||||
" %s : signal task %08" PRIxrtems_id " to delete, ",
|
||||
who,
|
||||
task_id[task]
|
||||
who,
|
||||
task_id[ task ]
|
||||
);
|
||||
fflush(stdout);
|
||||
rtems_event_send(task_id[task], 1);
|
||||
task_id[task] = 0;
|
||||
fflush( stdout );
|
||||
rtems_event_send( task_id[ task ], 1 );
|
||||
task_id[ task ] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool status_code_bad(
|
||||
rtems_status_code status_code
|
||||
)
|
||||
bool status_code_bad( rtems_status_code status_code )
|
||||
{
|
||||
if (status_code != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
printf("failure, ");
|
||||
if ( status_code != RTEMS_SUCCESSFUL ) {
|
||||
printf( "failure, " );
|
||||
|
||||
if (status_code == RTEMS_TOO_MANY)
|
||||
{
|
||||
printf("too many.\n");
|
||||
if ( status_code == RTEMS_TOO_MANY ) {
|
||||
printf( "too many.\n" );
|
||||
return TRUE;
|
||||
}
|
||||
if (status_code == RTEMS_UNSATISFIED)
|
||||
{
|
||||
printf("unsatisfied.\n");
|
||||
if ( status_code == RTEMS_UNSATISFIED ) {
|
||||
printf( "unsatisfied.\n" );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
printf("error code = %i\n", status_code);
|
||||
printf( "error code = %i\n", status_code );
|
||||
exit( 1 );
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
@@ -34,26 +34,17 @@
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
);
|
||||
rtems_task Init( rtems_task_argument argument );
|
||||
|
||||
rtems_task test_task(
|
||||
rtems_task_argument my_number
|
||||
);
|
||||
rtems_task test_task( rtems_task_argument my_number );
|
||||
|
||||
void
|
||||
destroy_all_tasks(
|
||||
const char *who
|
||||
);
|
||||
void destroy_all_tasks( const char *who );
|
||||
|
||||
bool status_code_bad(
|
||||
rtems_status_code status_code
|
||||
);
|
||||
bool status_code_bad( rtems_status_code status_code );
|
||||
|
||||
extern void test1(void);
|
||||
extern void test2(void);
|
||||
extern void test3(void);
|
||||
extern void test1( void );
|
||||
extern void test2( void );
|
||||
extern void test3( void );
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -66,45 +57,42 @@ extern void test3(void);
|
||||
#define CONFIGURE_UNIFIED_WORK_AREAS
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define TASK_ALLOCATION_SIZE (5)
|
||||
#define TASK_ALLOCATION_SIZE ( 5 )
|
||||
#define CONFIGURE_UNLIMITED_OBJECTS
|
||||
#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE TASK_ALLOCATION_SIZE
|
||||
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/*
|
||||
* Keep track of the task id's created, use a large array.
|
||||
*/
|
||||
|
||||
#define MAX_TASKS (1000)
|
||||
#define TASK_INDEX_OFFSET (1)
|
||||
#define MAX_TASKS ( 1000 )
|
||||
#define TASK_INDEX_OFFSET ( 1 )
|
||||
|
||||
extern rtems_id task_id[MAX_TASKS];
|
||||
extern rtems_id task_id[ MAX_TASKS ];
|
||||
|
||||
/*
|
||||
* Increment the task name.
|
||||
*/
|
||||
|
||||
#define NEXT_TASK_NAME(c1, c2, c3, c4) \
|
||||
if (c4 == '9') { \
|
||||
if (c3 == '9') { \
|
||||
if (c2 == 'z') { \
|
||||
if (c1 == 'z') { \
|
||||
printf("not enough task letters for names !!!\n"); \
|
||||
exit( 1 ); \
|
||||
} else \
|
||||
c1++; \
|
||||
c2 = 'a'; \
|
||||
} else \
|
||||
c2++; \
|
||||
c3 = '0'; \
|
||||
} else \
|
||||
c3++; \
|
||||
c4 = '0'; \
|
||||
} \
|
||||
else \
|
||||
c4++ \
|
||||
|
||||
#define NEXT_TASK_NAME( c1, c2, c3, c4 ) \
|
||||
if ( c4 == '9' ) { \
|
||||
if ( c3 == '9' ) { \
|
||||
if ( c2 == 'z' ) { \
|
||||
if ( c1 == 'z' ) { \
|
||||
printf( "not enough task letters for names !!!\n" ); \
|
||||
exit( 1 ); \
|
||||
} else \
|
||||
c1++; \
|
||||
c2 = 'a'; \
|
||||
} else \
|
||||
c2++; \
|
||||
c3 = '0'; \
|
||||
} else \
|
||||
c3++; \
|
||||
c4 = '0'; \
|
||||
} else \
|
||||
c4++
|
||||
|
||||
/* end of include file */
|
||||
|
||||
@@ -54,10 +54,10 @@ void test1()
|
||||
uint32_t task_count = 0;
|
||||
Objects_Information *the_information;
|
||||
|
||||
char c1 = 'a';
|
||||
char c2 = 'a';
|
||||
char c3 = '0';
|
||||
char c4 = '0';
|
||||
char c1 = 'a';
|
||||
char c2 = 'a';
|
||||
char c3 = '0';
|
||||
char c4 = '0';
|
||||
|
||||
printf( "\n TEST1 : auto-extend disabled.\n" );
|
||||
|
||||
@@ -66,60 +66,75 @@ void test1()
|
||||
* saves having another test.
|
||||
*/
|
||||
|
||||
the_information =
|
||||
_Objects_Information_table[OBJECTS_CLASSIC_API][OBJECTS_RTEMS_TASKS];
|
||||
the_information = _Objects_Information_table[ OBJECTS_CLASSIC_API ]
|
||||
[ OBJECTS_RTEMS_TASKS ];
|
||||
objects_per_block = the_information->objects_per_block;
|
||||
the_information->objects_per_block = 0;
|
||||
the_information->allocate = _Objects_Allocate_static;
|
||||
|
||||
while (task_count < MAX_TASKS)
|
||||
{
|
||||
while ( task_count < MAX_TASKS ) {
|
||||
rtems_name name;
|
||||
|
||||
printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
|
||||
printf( " TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4 );
|
||||
|
||||
name = rtems_build_name(c1, c2, c3, c4);
|
||||
name = rtems_build_name( c1, c2, c3, c4 );
|
||||
|
||||
result = rtems_task_create(name,
|
||||
10,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_LOCAL,
|
||||
&task_id[task_count]);
|
||||
result = rtems_task_create(
|
||||
name,
|
||||
10,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_LOCAL,
|
||||
&task_id[ task_count ]
|
||||
);
|
||||
|
||||
if (status_code_bad(result))
|
||||
if ( status_code_bad( result ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", task_count, task_id[task_count]);
|
||||
printf(
|
||||
"number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ",
|
||||
task_count,
|
||||
task_id[ task_count ]
|
||||
);
|
||||
|
||||
fflush(stdout);
|
||||
result = rtems_task_start(task_id[task_count],
|
||||
test_task,
|
||||
(rtems_task_argument) task_count);
|
||||
fflush( stdout );
|
||||
result = rtems_task_start(
|
||||
task_id[ task_count ],
|
||||
test_task,
|
||||
(rtems_task_argument) task_count
|
||||
);
|
||||
|
||||
if (status_code_bad(result))
|
||||
if ( status_code_bad( result ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the name.
|
||||
*/
|
||||
|
||||
NEXT_TASK_NAME(c1, c2, c3, c4);
|
||||
NEXT_TASK_NAME( c1, c2, c3, c4 );
|
||||
|
||||
task_count++;
|
||||
}
|
||||
|
||||
if (task_count >= MAX_TASKS)
|
||||
printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" );
|
||||
if ( task_count >= MAX_TASKS ) {
|
||||
printf(
|
||||
"\nMAX_TASKS too small for work-space size, please make larger !!\n\n"
|
||||
);
|
||||
}
|
||||
|
||||
if (task_count != (TASK_ALLOCATION_SIZE - 1)) {
|
||||
printf( " FAIL1 : the number of tasks does not equal the expected size -\n"
|
||||
" task created = %" PRIi32 ", required number = %i\n",
|
||||
task_count, TASK_ALLOCATION_SIZE);
|
||||
if ( task_count != ( TASK_ALLOCATION_SIZE - 1 ) ) {
|
||||
printf(
|
||||
" FAIL1 : the number of tasks does not equal the expected size -\n"
|
||||
" task created = %" PRIi32 ", required number = %i\n",
|
||||
task_count,
|
||||
TASK_ALLOCATION_SIZE
|
||||
);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
destroy_all_tasks("TEST1");
|
||||
destroy_all_tasks( "TEST1" );
|
||||
|
||||
the_information->objects_per_block = objects_per_block;
|
||||
the_information->allocate = _Thread_Allocate_unlimited;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -49,66 +49,76 @@
|
||||
|
||||
void test3()
|
||||
{
|
||||
rtems_status_code result;
|
||||
uint32_t remove_task;
|
||||
uint32_t block;
|
||||
uint32_t task_count = 0;
|
||||
rtems_status_code result;
|
||||
uint32_t remove_task;
|
||||
uint32_t block;
|
||||
uint32_t task_count = 0;
|
||||
|
||||
char c1 = 'a';
|
||||
char c2 = 'a';
|
||||
char c3 = '0';
|
||||
char c4 = '0';
|
||||
char c1 = 'a';
|
||||
char c2 = 'a';
|
||||
char c3 = '0';
|
||||
char c4 = '0';
|
||||
|
||||
printf( "\n TEST3 : free more than 3 x allocation size, but not the same block,\n"
|
||||
" then free a block\n");
|
||||
printf(
|
||||
"\n TEST3 : free more than 3 x allocation size, but not the same block,\n"
|
||||
" then free a block\n"
|
||||
);
|
||||
|
||||
/*
|
||||
* Check the value of the allocation unit
|
||||
*/
|
||||
|
||||
if (TASK_ALLOCATION_SIZE < 4)
|
||||
{
|
||||
printf( " FAIL3 : task allocation size must be greater than 4.\n");
|
||||
if ( TASK_ALLOCATION_SIZE < 4 ) {
|
||||
printf( " FAIL3 : task allocation size must be greater than 4.\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Allocate as many tasks as possible.
|
||||
*/
|
||||
|
||||
while (task_count < MAX_TASKS)
|
||||
{
|
||||
while ( task_count < MAX_TASKS ) {
|
||||
rtems_name name;
|
||||
|
||||
printf(" TEST3 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
|
||||
printf( " TEST3 : creating task '%c%c%c%c', ", c1, c2, c3, c4 );
|
||||
|
||||
name = rtems_build_name(c1, c2, c3, c4);
|
||||
name = rtems_build_name( c1, c2, c3, c4 );
|
||||
|
||||
result = rtems_task_create(name,
|
||||
10,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_LOCAL,
|
||||
&task_id[task_count]);
|
||||
result = rtems_task_create(
|
||||
name,
|
||||
10,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
RTEMS_LOCAL,
|
||||
&task_id[ task_count ]
|
||||
);
|
||||
|
||||
if (status_code_bad(result))
|
||||
if ( status_code_bad( result ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ", task_count, task_id[task_count]);
|
||||
fflush(stdout);
|
||||
printf(
|
||||
"number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ",
|
||||
task_count,
|
||||
task_id[ task_count ]
|
||||
);
|
||||
fflush( stdout );
|
||||
|
||||
result = rtems_task_start(task_id[task_count],
|
||||
test_task,
|
||||
(rtems_task_argument) task_count);
|
||||
result = rtems_task_start(
|
||||
task_id[ task_count ],
|
||||
test_task,
|
||||
(rtems_task_argument) task_count
|
||||
);
|
||||
|
||||
if (status_code_bad(result))
|
||||
if ( status_code_bad( result ) ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the name.
|
||||
*/
|
||||
|
||||
NEXT_TASK_NAME(c1, c2, c3, c4);
|
||||
NEXT_TASK_NAME( c1, c2, c3, c4 );
|
||||
|
||||
task_count++;
|
||||
}
|
||||
@@ -118,31 +128,38 @@ void test3()
|
||||
* allocation size number of blocks.
|
||||
*/
|
||||
|
||||
if (task_count < (TASK_ALLOCATION_SIZE * 11))
|
||||
{
|
||||
printf( " FAIL3 : not enough tasks created -\n"
|
||||
" task created = %" PRIi32 ", required number = %i\n",
|
||||
task_count, (TASK_ALLOCATION_SIZE * 11));
|
||||
if ( task_count < ( TASK_ALLOCATION_SIZE * 11 ) ) {
|
||||
printf(
|
||||
" FAIL3 : not enough tasks created -\n"
|
||||
" task created = %" PRIi32 ", required number = %i\n",
|
||||
task_count,
|
||||
( TASK_ALLOCATION_SIZE * 11 )
|
||||
);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
for (block = 0; block < TASK_ALLOCATION_SIZE; block++)
|
||||
{
|
||||
for (remove_task = ((block * TASK_ALLOCATION_SIZE) - TASK_INDEX_OFFSET);
|
||||
remove_task < (((block * TASK_ALLOCATION_SIZE) + 3) - TASK_INDEX_OFFSET);
|
||||
remove_task++)
|
||||
{
|
||||
if (!task_id[remove_task])
|
||||
{
|
||||
printf( " FAIL3 : remove task has a 0 id -\n"
|
||||
" task number = %" PRIi32 "\n",
|
||||
remove_task);
|
||||
for ( block = 0; block < TASK_ALLOCATION_SIZE; block++ ) {
|
||||
for (
|
||||
remove_task = ( ( block * TASK_ALLOCATION_SIZE ) - TASK_INDEX_OFFSET );
|
||||
remove_task <
|
||||
( ( ( block * TASK_ALLOCATION_SIZE ) + 3 ) - TASK_INDEX_OFFSET );
|
||||
remove_task++
|
||||
) {
|
||||
if ( !task_id[ remove_task ] ) {
|
||||
printf(
|
||||
" FAIL3 : remove task has a 0 id -\n"
|
||||
" task number = %" PRIi32 "\n",
|
||||
remove_task
|
||||
);
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
printf(" TEST3 : remove, signal task %08" PRIxrtems_id ", ", task_id[remove_task]);
|
||||
rtems_event_send(task_id[remove_task], 1);
|
||||
task_id[remove_task] = 0;
|
||||
printf(
|
||||
" TEST3 : remove, signal task %08" PRIxrtems_id ", ",
|
||||
task_id[ remove_task ]
|
||||
);
|
||||
rtems_event_send( task_id[ remove_task ], 1 );
|
||||
task_id[ remove_task ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,19 +168,22 @@ void test3()
|
||||
* allocator's free routine
|
||||
*/
|
||||
|
||||
for (remove_task = (TASK_ALLOCATION_SIZE - TASK_INDEX_OFFSET);
|
||||
remove_task < ((TASK_ALLOCATION_SIZE * 2) - - TASK_INDEX_OFFSET);
|
||||
remove_task++)
|
||||
{
|
||||
if (task_id[remove_task])
|
||||
{
|
||||
printf(" TEST3 : remove, signal task %08" PRIxrtems_id ", ", task_id[remove_task]);
|
||||
rtems_event_send(task_id[remove_task], 1);
|
||||
task_id[remove_task] = 0;
|
||||
for (
|
||||
remove_task = ( TASK_ALLOCATION_SIZE - TASK_INDEX_OFFSET );
|
||||
remove_task < ( ( TASK_ALLOCATION_SIZE * 2 ) - -TASK_INDEX_OFFSET );
|
||||
remove_task++
|
||||
) {
|
||||
if ( task_id[ remove_task ] ) {
|
||||
printf(
|
||||
" TEST3 : remove, signal task %08" PRIxrtems_id ", ",
|
||||
task_id[ remove_task ]
|
||||
);
|
||||
rtems_event_send( task_id[ remove_task ], 1 );
|
||||
task_id[ remove_task ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
destroy_all_tasks("TEST3");
|
||||
destroy_all_tasks( "TEST3" );
|
||||
|
||||
printf( " TEST3 : completed\n" );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user