testsuites/samples: reformat with clang-format

Updates #3860.

Updates #5358.
This commit is contained in:
Gedare Bloom
2026-02-02 14:35:59 -06:00
committed by Kinsey Moore
parent f2b17295cb
commit 57ea3fe79f
29 changed files with 3328 additions and 3117 deletions
+7 -5
View File
@@ -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 );
}
+12 -8
View File
@@ -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();
}
+3 -7
View File
@@ -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
+4 -4
View File
@@ -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();
+12 -8
View File
@@ -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();
}
+3 -7
View File
@@ -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
+13 -21
View File
@@ -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 {
+27 -38
View File
@@ -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
View File
@@ -49,10 +49,9 @@ static volatile int capture_CT1a_deleted;
static volatile int capture_CT1b_deleted;
static volatile int capture_CT1c_deleted;
static void
capture_wait (uint32_t period)
static void capture_wait( uint32_t period )
{
rtems_task_wake_after (RTEMS_MICROSECONDS_TO_TICKS (period * 1000));
rtems_task_wake_after( RTEMS_MICROSECONDS_TO_TICKS( period * 1000 ) );
}
/*
@@ -65,72 +64,75 @@ capture_wait (uint32_t period)
* releases the mutex. This will allow us to capture the
* action of priority inversion.
*/
static void
capture_CT1a (rtems_task_argument arg)
static void capture_CT1a( rtems_task_argument arg )
{
rtems_id mutex = (rtems_id) arg;
rtems_id mutex = (rtems_id) arg;
rtems_status_code sc;
sc = rtems_semaphore_obtain (mutex, RTEMS_WAIT, 0);
sc = rtems_semaphore_obtain( mutex, RTEMS_WAIT, 0 );
if (sc != RTEMS_SUCCESSFUL)
printf ("error: CT1a: mutex obtain: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf( "error: CT1a: mutex obtain: %s\n", rtems_status_text( sc ) );
}
capture_wait (2500);
capture_wait( 2500 );
sc = rtems_semaphore_release (mutex);
sc = rtems_semaphore_release( mutex );
if (sc != RTEMS_SUCCESSFUL)
printf ("error: CT1a: mutex release: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf( "error: CT1a: mutex release: %s\n", rtems_status_text( sc ) );
}
capture_CT1a_deleted = 1;
rtems_task_exit();
}
static void
capture_CT1b (rtems_task_argument arg)
static void capture_CT1b( rtems_task_argument arg )
{
(void) arg;
volatile int i;
while (!capture_CT1c_deleted)
while ( !capture_CT1c_deleted ) {
i++;
}
capture_CT1b_deleted = 1;
rtems_task_exit();
}
static void
capture_CT1c (rtems_task_argument arg)
static void capture_CT1c( rtems_task_argument arg )
{
rtems_id mutex = (rtems_id) arg;
rtems_status_code sc;
sc = rtems_semaphore_obtain (mutex, RTEMS_WAIT, 0);
sc = rtems_semaphore_obtain( mutex, RTEMS_WAIT, 0 );
if (sc != RTEMS_SUCCESSFUL)
printf ("error: CT1c: mutex obtain: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf( "error: CT1c: mutex obtain: %s\n", rtems_status_text( sc ) );
}
capture_wait (500);
capture_wait( 500 );
sc = rtems_semaphore_release (mutex);
sc = rtems_semaphore_release( mutex );
if (sc != RTEMS_SUCCESSFUL)
printf ("error: CT1c: mutex release: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf( "error: CT1c: mutex release: %s\n", rtems_status_text( sc ) );
}
capture_CT1c_deleted = 1;
rtems_task_exit();
}
static void
capture_test_1 (int argc,
char** argv,
const rtems_monitor_command_arg_t* command_arg,
bool verbose)
static void capture_test_1(
int argc,
char **argv,
const rtems_monitor_command_arg_t *command_arg,
bool verbose
)
{
(void) argc;
(void) argv;
@@ -139,7 +141,7 @@ capture_test_1 (int argc,
rtems_status_code sc;
rtems_name name;
rtems_id id[3];
rtems_id id[ 3 ];
rtems_id mutex;
int loops;
@@ -147,140 +149,166 @@ capture_test_1 (int argc,
capture_CT1b_deleted = 0;
capture_CT1c_deleted = 0;
name = rtems_build_name('C', 'T', 'm', '1');
name = rtems_build_name( 'C', 'T', 'm', '1' );
sc = rtems_semaphore_create (name, 1,
RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE |
RTEMS_INHERIT_PRIORITY,
0, &mutex);
sc = rtems_semaphore_create(
name,
1,
RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY,
0,
&mutex
);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot mutex: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf( "error: Test 1: cannot mutex: %s\n", rtems_status_text( sc ) );
return;
}
name = rtems_build_name('C', 'T', '1', 'a');
name = rtems_build_name( 'C', 'T', '1', 'a' );
sc = rtems_task_create (name, 102, 2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[0]);
sc = rtems_task_create(
name,
102,
2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[ 0 ]
);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot create CT1a: %s\n", rtems_status_text (sc));
rtems_semaphore_delete (mutex);
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot create CT1a: %s\n",
rtems_status_text( sc )
);
rtems_semaphore_delete( mutex );
return;
}
sc = rtems_task_start (id[0], capture_CT1a, (rtems_task_argument) mutex);
sc = rtems_task_start( id[ 0 ], capture_CT1a, (rtems_task_argument) mutex );
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot start CT1a: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot start CT1a: %s\n",
rtems_status_text( sc )
);
rtems_task_exit();
rtems_semaphore_delete (mutex);
rtems_semaphore_delete( mutex );
return;
}
capture_wait (1000);
capture_wait( 1000 );
name = rtems_build_name('C', 'T', '1', 'b');
name = rtems_build_name( 'C', 'T', '1', 'b' );
sc = rtems_task_create (name, 101, 2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[1]);
sc = rtems_task_create(
name,
101,
2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[ 1 ]
);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot create CT1b: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot create CT1b: %s\n",
rtems_status_text( sc )
);
rtems_task_exit();
rtems_semaphore_delete (mutex);
rtems_semaphore_delete( mutex );
return;
}
sc = rtems_task_start (id[1], capture_CT1b, 0);
sc = rtems_task_start( id[ 1 ], capture_CT1b, 0 );
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot start CT1b: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot start CT1b: %s\n",
rtems_status_text( sc )
);
rtems_task_exit();
rtems_task_exit();
rtems_semaphore_delete (mutex);
rtems_semaphore_delete( mutex );
return;
}
capture_wait (1000);
capture_wait( 1000 );
name = rtems_build_name('C', 'T', '1', 'c');
name = rtems_build_name( 'C', 'T', '1', 'c' );
sc = rtems_task_create (name, 100, 2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[2]);
sc = rtems_task_create(
name,
100,
2 * 1024,
RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL,
RTEMS_PREEMPT | RTEMS_TIMESLICE | RTEMS_NO_ASR,
&id[ 2 ]
);
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot create CT1c: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot create CT1c: %s\n",
rtems_status_text( sc )
);
rtems_task_exit();
rtems_task_exit();
rtems_semaphore_delete (mutex);
rtems_semaphore_delete( mutex );
return;
}
sc = rtems_task_start (id[2], capture_CT1c, (rtems_task_argument) mutex);
sc = rtems_task_start( id[ 2 ], capture_CT1c, (rtems_task_argument) mutex );
if (sc != RTEMS_SUCCESSFUL)
{
printf ("error: Test 1: cannot start CT1c: %s\n", rtems_status_text (sc));
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: cannot start CT1c: %s\n",
rtems_status_text( sc )
);
rtems_task_exit();
rtems_task_exit();
rtems_task_exit();
rtems_semaphore_delete (mutex);
rtems_semaphore_delete( mutex );
return;
}
loops = 15;
while (!(capture_CT1a_deleted || capture_CT1b_deleted ||
capture_CT1c_deleted) && loops)
{
while (
!( capture_CT1a_deleted || capture_CT1b_deleted ||
capture_CT1c_deleted ) &&
loops
) {
loops--;
capture_wait (1000);
capture_wait( 1000 );
}
if (!loops)
{
printf ("error: Test 1: test tasks did not delete\n");
if ( !loops ) {
printf( "error: Test 1: test tasks did not delete\n" );
rtems_task_exit();
rtems_task_exit();
rtems_task_exit();
}
sc = rtems_semaphore_delete (mutex);
if (sc != RTEMS_SUCCESSFUL)
printf ("error: Test 1: deleting the mutex: %s\n", rtems_status_text (sc));
sc = rtems_semaphore_delete( mutex );
if ( sc != RTEMS_SUCCESSFUL ) {
printf(
"error: Test 1: deleting the mutex: %s\n",
rtems_status_text( sc )
);
}
}
static rtems_monitor_command_entry_t capture_cmds[] =
{
{
"test1",
"usage: \n",
0,
capture_test_1,
{ 0 },
0
}
static rtems_monitor_command_entry_t capture_cmds[] = {
{ "test1", "usage: \n", 0, capture_test_1, { 0 }, 0 }
};
void setup_tasks_to_watch (void)
void setup_tasks_to_watch( void )
{
size_t cmd;
for (cmd = 0;
cmd < sizeof (capture_cmds) / sizeof (rtems_monitor_command_entry_t);
cmd++)
rtems_monitor_insert_cmd (&capture_cmds[cmd]);
for (
cmd = 0;
cmd < sizeof( capture_cmds ) / sizeof( rtems_monitor_command_entry_t );
cmd++
) {
rtems_monitor_insert_cmd( &capture_cmds[ cmd ] );
}
}
+7 -9
View File
@@ -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
File diff suppressed because it is too large Load Diff
+7 -10
View File
@@ -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
+3 -6
View File
@@ -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
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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
+1 -2
View File
@@ -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 ) {}
+45 -37
View File
@@ -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 );
}
+2 -2
View File
@@ -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
+7 -9
View File
@@ -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 );
}
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -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
+32 -22
View File
@@ -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();
}
+10 -15
View File
@@ -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 */
+4 -6
View 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" );
}
}
+31 -38
View File
@@ -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;
+29 -41
View File
@@ -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 */
+46 -31
View 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;
+137 -101
View File
@@ -50,58 +50,69 @@
void test2()
{
rtems_status_code result;
uint32_t remove_task;
uint32_t task;
uint32_t block;
uint32_t task_count = 0;
rtems_id removed_ids[TASK_ALLOCATION_SIZE * 2];
rtems_status_code result;
uint32_t remove_task;
uint32_t task;
uint32_t block;
uint32_t task_count = 0;
rtems_id removed_ids[ TASK_ALLOCATION_SIZE * 2 ];
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 TEST2 : re-allocate of index numbers, and a block free'ed and one inactive\n" );
printf(
"\n TEST2 : re-allocate of index numbers, and a block free'ed and one inactive\n"
);
/*
* Allocate enought tasks so the Inactive list is empty. Remember
* to count the Init task, ie ... - 1.
*/
while (task_count < ((TASK_ALLOCATION_SIZE * 5) - TASK_INDEX_OFFSET))
{
while ( task_count < ( ( TASK_ALLOCATION_SIZE * 5 ) - TASK_INDEX_OFFSET ) ) {
rtems_name name;
printf(" TEST2 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
printf( " TEST2 : 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++;
}
@@ -110,28 +121,33 @@ void test2()
* Take out the second and fourth allocation size block of tasks
*/
if (task_count != ((TASK_ALLOCATION_SIZE * 5) - TASK_INDEX_OFFSET)) {
printf( " FAIL2 : not enough tasks created -\n"
" task created = %" PRIi32 ", required number = %i\n",
task_count, (TASK_ALLOCATION_SIZE * 5) - TASK_INDEX_OFFSET);
destroy_all_tasks("TEST2");
if ( task_count != ( ( TASK_ALLOCATION_SIZE * 5 ) - TASK_INDEX_OFFSET ) ) {
printf(
" FAIL2 : not enough tasks created -\n"
" task created = %" PRIi32 ", required number = %i\n",
task_count,
( TASK_ALLOCATION_SIZE * 5 ) - TASK_INDEX_OFFSET
);
destroy_all_tasks( "TEST2" );
exit( 1 );
}
task = 0;
for (block = 1; block < 4; block += 2)
{
for (remove_task = (block * TASK_ALLOCATION_SIZE) - TASK_INDEX_OFFSET;
remove_task < (((block + 1) * TASK_ALLOCATION_SIZE) - TASK_INDEX_OFFSET);
remove_task++)
{
if (!task_id[remove_task])
{
printf( " FAIL2 : remove task has a 0 id -\n"
" task number = %" PRIi32 "\n",
remove_task);
destroy_all_tasks("TEST2");
for ( block = 1; block < 4; block += 2 ) {
for (
remove_task = ( block * TASK_ALLOCATION_SIZE ) - TASK_INDEX_OFFSET;
remove_task <
( ( ( block + 1 ) * TASK_ALLOCATION_SIZE ) - TASK_INDEX_OFFSET );
remove_task++
) {
if ( !task_id[ remove_task ] ) {
printf(
" FAIL2 : remove task has a 0 id -\n"
" task number = %" PRIi32 "\n",
remove_task
);
destroy_all_tasks( "TEST2" );
exit( 1 );
}
@@ -139,68 +155,80 @@ void test2()
* Save the id's to match them against the reallocated ids
*/
removed_ids[task++] = task_id[remove_task];
removed_ids[ task++ ] = task_id[ remove_task ];
printf(" TEST2 : block %" PRIi32 " remove, signal task %08"
PRIxrtems_id ", ", block, task_id[remove_task]);
rtems_event_send(task_id[remove_task], 1);
task_id[remove_task] = 0;
printf(
" TEST2 : block %" PRIi32 " remove, signal task %08" PRIxrtems_id ", ",
block,
task_id[ remove_task ]
);
rtems_event_send( task_id[ remove_task ], 1 );
task_id[ remove_task ] = 0;
}
}
for (task = 0; task < (TASK_ALLOCATION_SIZE * 2); task++)
{
rtems_name name;
for ( task = 0; task < ( TASK_ALLOCATION_SIZE * 2 ); task++ ) {
rtems_name name;
uint32_t id_slot;
/*
* Find a free slot in the task id table.
*/
for (id_slot = 0; id_slot < MAX_TASKS; id_slot++)
if (!task_id[id_slot])
for ( id_slot = 0; id_slot < MAX_TASKS; id_slot++ ) {
if ( !task_id[ id_slot ] ) {
break;
}
}
if (id_slot == MAX_TASKS)
{
printf( " FAIL2 : no free task id slot.\n");
destroy_all_tasks("TEST2");
if ( id_slot == MAX_TASKS ) {
printf( " FAIL2 : no free task id slot.\n" );
destroy_all_tasks( "TEST2" );
exit( 1 );
}
printf(" TEST2 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
printf( " TEST2 : 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[id_slot]);
result = rtems_task_create(
name,
10,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_ATTRIBUTES,
RTEMS_LOCAL,
&task_id[ id_slot ]
);
if (status_code_bad(result))
{
printf( " FAIL2 : re-creating a task -\n"
" task number = %" PRIi32 "\n",
id_slot);
destroy_all_tasks("TEST2");
if ( status_code_bad( result ) ) {
printf(
" FAIL2 : re-creating a task -\n"
" task number = %" PRIi32 "\n",
id_slot
);
destroy_all_tasks( "TEST2" );
exit( 1 );
}
printf("number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ",
task_count, task_id[id_slot]);
printf(
"number = %3" PRIi32 ", id = %08" PRIxrtems_id ", starting, ",
task_count,
task_id[ id_slot ]
);
result = rtems_task_start(task_id[id_slot],
test_task,
(rtems_task_argument) task_count);
result = rtems_task_start(
task_id[ id_slot ],
test_task,
(rtems_task_argument) task_count
);
if (status_code_bad(result))
{
printf( " FAIL : re-starting a task -\n"
" task number = %" PRIi32 "\n",
id_slot);
destroy_all_tasks("TEST2");
if ( status_code_bad( result ) ) {
printf(
" FAIL : re-starting a task -\n"
" task number = %" PRIi32 "\n",
id_slot
);
destroy_all_tasks( "TEST2" );
exit( 1 );
}
@@ -208,49 +236,57 @@ void test2()
* Update the name.
*/
NEXT_TASK_NAME(c1, c2, c3, c4);
NEXT_TASK_NAME( c1, c2, c3, c4 );
/*
* Search the removed ids to see if it existed, clear the removed id
* when found
*/
for (remove_task = 0; remove_task < (TASK_ALLOCATION_SIZE * 2); remove_task++)
if (removed_ids[remove_task] == task_id[id_slot])
{
removed_ids[remove_task] = 0;
for (
remove_task = 0; remove_task < ( TASK_ALLOCATION_SIZE * 2 );
remove_task++
) {
if ( removed_ids[ remove_task ] == task_id[ id_slot ] ) {
removed_ids[ remove_task ] = 0;
break;
}
}
/*
* If not located in the removed id table, check and make sure it is not
* already allocated
*/
if (remove_task == (TASK_ALLOCATION_SIZE * 2))
{
uint32_t allocated_id;
if ( remove_task == ( TASK_ALLOCATION_SIZE * 2 ) ) {
uint32_t allocated_id;
for (allocated_id = 0; allocated_id < MAX_TASKS; allocated_id++)
if ((task_id[id_slot] == task_id[allocated_id]) && (id_slot != allocated_id))
{
for ( allocated_id = 0; allocated_id < MAX_TASKS; allocated_id++ ) {
if (
( task_id[ id_slot ] == task_id[ allocated_id ] ) &&
( id_slot != allocated_id )
) {
printf(
" FAIL2 : the new id is the same as an id already allocated -\n"
" task id = %08" PRIxrtems_id "\n",
task_id[id_slot]);
task_id[ id_slot ]
);
exit( 1 );
}
}
printf( " FAIL2 : could not find the task id in the removed table -\n"
" task id = %08" PRIxrtems_id "\n",
task_id[id_slot]);
printf(
" FAIL2 : could not find the task id in the removed table -\n"
" task id = %08" PRIxrtems_id "\n",
task_id[ id_slot ]
);
exit( 1 );
}
task_count++;
}
destroy_all_tasks("TEST2");
destroy_all_tasks( "TEST2" );
printf( " TEST2 : completed\n" );
}
+81 -61
View File
@@ -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" );
}