forked from Imagelibrary/rtems
2003-12-16 Joel Sherrill <joel@OARcorp.com>
PR 544/tests * sp07/Makefile.am, sp07/init.c, sp07/system.h, sp07/task4.c, sp07/tcreate.c, sp07/tdelete.c, sp07/trestart.c, sp07/tstart.c, sp09/system.h, sp19/system.h, sp20/system.h: Various modifications to make tests account for resources and not print at inappropriate times. * sp07/buffered_io.c: New file.
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
2003-12-16 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
PR 544/tests
|
||||
* sp07/Makefile.am, sp07/init.c, sp07/system.h, sp07/task4.c,
|
||||
sp07/tcreate.c, sp07/tdelete.c, sp07/trestart.c, sp07/tstart.c,
|
||||
sp09/system.h, sp19/system.h, sp20/system.h: Various modifications to
|
||||
make tests account for resources and not print at inappropriate
|
||||
times.
|
||||
* sp07/buffered_io.c: New file.
|
||||
|
||||
2003-09-04 Joel Sherrill <joel@OARcorp.com>
|
||||
|
||||
* sp01/init.c, sp01/sp01.doc, sp01/system.h, sp01/task1.c, sp02/init.c,
|
||||
|
||||
@@ -7,8 +7,8 @@ TEST = sp07
|
||||
|
||||
MANAGERS = io
|
||||
|
||||
C_FILES = init.c task1.c task2.c task3.c task4.c taskexit.c tcreate.c \
|
||||
tdelete.c trestart.c tstart.c
|
||||
C_FILES = init.c buffered_io.c task1.c task2.c task3.c task4.c taskexit.c \
|
||||
tcreate.c tdelete.c trestart.c tstart.c
|
||||
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
|
||||
|
||||
H_FILES = system.h
|
||||
|
||||
38
c/src/tests/sptests/sp07/buffered_io.c
Normal file
38
c/src/tests/sptests/sp07/buffered_io.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#define RINGBUF_QUEUE_LENGTH 512
|
||||
|
||||
#include <ringbuf.h>
|
||||
|
||||
Ring_buffer_t Buffer;
|
||||
|
||||
void buffered_io_initialize( void )
|
||||
{
|
||||
Ring_buffer_Initialize( &Buffer );
|
||||
}
|
||||
|
||||
void buffered_io_flush(void)
|
||||
{
|
||||
char ch;
|
||||
|
||||
while ( !Ring_buffer_Is_empty(&Buffer) ) {
|
||||
Ring_buffer_Remove_character( &Buffer, ch );
|
||||
fprintf( stderr, "%c", ch );
|
||||
}
|
||||
FLUSH_OUTPUT();
|
||||
}
|
||||
|
||||
void buffered_io_add_string( char *s )
|
||||
{
|
||||
char *p = s;
|
||||
|
||||
while ( *s ) {
|
||||
Ring_buffer_Add_character( &Buffer, *s++ );
|
||||
}
|
||||
}
|
||||
@@ -43,6 +43,8 @@ rtems_task Init(
|
||||
|
||||
puts( "\n\n*** TEST 7 ***" );
|
||||
|
||||
buffered_io_initialize();
|
||||
|
||||
Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
|
||||
|
||||
status = rtems_extension_create(
|
||||
@@ -112,6 +114,8 @@ rtems_task Init(
|
||||
status = rtems_task_restart( Task_id[ 3 ], 0 );
|
||||
directive_failed( status, "rtems_task_restart of TA3" );
|
||||
|
||||
buffered_io_flush();
|
||||
|
||||
status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 );
|
||||
directive_failed( status, "task_set_node of TA1" );
|
||||
printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " );
|
||||
|
||||
@@ -15,6 +15,16 @@
|
||||
|
||||
#include <tmacros.h>
|
||||
|
||||
/* buffered IO */
|
||||
|
||||
void buffered_io_initialize( void );
|
||||
|
||||
void buffered_io_flush(void);
|
||||
|
||||
void buffered_io_add_string( char *s );
|
||||
|
||||
/* end of buffered IO */
|
||||
|
||||
/* functions */
|
||||
|
||||
rtems_task Init(
|
||||
|
||||
@@ -25,5 +25,7 @@ rtems_task Task_4(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
buffered_io_flush();
|
||||
|
||||
puts( "TA4 - exitting task" );
|
||||
}
|
||||
|
||||
@@ -25,10 +25,18 @@ rtems_boolean Task_create_extension(
|
||||
rtems_tcb *created_task
|
||||
)
|
||||
{
|
||||
char line[80];
|
||||
rtems_name name;
|
||||
|
||||
if ( task_number( created_task->Object.id ) > 0 ) {
|
||||
puts_nocr( "TASK_CREATE - " );
|
||||
put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE );
|
||||
puts( " - created." );
|
||||
name = Task_name[ task_number( created_task->Object.id ) ];
|
||||
sprintf( line, "TASK_CREATE - %c%c%c%c - created\n",
|
||||
(name >> 24) & 0xff,
|
||||
(name >> 16) & 0xff,
|
||||
(name >> 8) & 0xff,
|
||||
name & 0xff
|
||||
);
|
||||
buffered_io_add_string( line );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -25,12 +25,29 @@ rtems_extension Task_delete_extension(
|
||||
rtems_tcb *deleted_task
|
||||
)
|
||||
{
|
||||
char line[80];
|
||||
rtems_name name;
|
||||
|
||||
if ( task_number( running_task->Object.id ) > 0 ) {
|
||||
name = Task_name[ task_number( running_task->Object.id ) ];
|
||||
sprintf( line, "TASK_DELETE - %c%c%c%c",
|
||||
(name >> 24) & 0xff,
|
||||
(name >> 16) & 0xff,
|
||||
(name >> 8) & 0xff,
|
||||
name & 0xff
|
||||
);
|
||||
buffered_io_add_string( line );
|
||||
puts_nocr( "TASK_DELETE - " );
|
||||
put_name( Task_name[ task_number( running_task->Object.id ) ], FALSE );
|
||||
}
|
||||
if ( task_number( deleted_task->Object.id ) > 0 ) {
|
||||
puts_nocr( " deleting " );
|
||||
put_name( Task_name[ task_number( deleted_task->Object.id ) ], TRUE );
|
||||
name = Task_name[ task_number( deleted_task->Object.id ) ];
|
||||
sprintf( line, "deleting - %c%c%c%c\n",
|
||||
(name >> 24) & 0xff,
|
||||
(name >> 16) & 0xff,
|
||||
(name >> 8) & 0xff,
|
||||
name & 0xff
|
||||
);
|
||||
buffered_io_add_string( line );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,17 @@ void Task_restart_extension(
|
||||
rtems_tcb *restarted_task
|
||||
)
|
||||
{
|
||||
char line[80];
|
||||
rtems_name name;
|
||||
|
||||
if ( task_number( restarted_task->Object.id ) > 0 ) {
|
||||
puts_nocr( "TASK_RESTART - " );
|
||||
put_name( Task_name[ task_number( restarted_task->Object.id ) ], FALSE );
|
||||
puts( " - restarted." );
|
||||
name = Task_name[ task_number( restarted_task->Object.id ) ];
|
||||
sprintf( line, "TASK_RESTART - %c%c%c%c - restarted\n",
|
||||
(name >> 24) & 0xff,
|
||||
(name >> 16) & 0xff,
|
||||
(name >> 8) & 0xff,
|
||||
name & 0xff
|
||||
);
|
||||
buffered_io_add_string( line );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,17 @@ rtems_extension Task_start_extension(
|
||||
rtems_tcb *started_task
|
||||
)
|
||||
{
|
||||
char line[80];
|
||||
rtems_name name;
|
||||
|
||||
if ( task_number( started_task->Object.id ) > 0 ) {
|
||||
puts_nocr( "TASK_START - " );
|
||||
put_name( Task_name[ task_number( started_task->Object.id ) ], FALSE );
|
||||
puts( " - started." );
|
||||
name = Task_name[ task_number( started_task->Object.id ) ];
|
||||
sprintf( line, "TASK_START - %c%c%c%c - started\n",
|
||||
(name >> 24) & 0xff,
|
||||
(name >> 16) & 0xff,
|
||||
(name >> 8) & 0xff,
|
||||
name & 0xff
|
||||
);
|
||||
buffered_io_add_string( line );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void Screen14( void );
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (2 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (20 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ rtems_task Task_1(
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (18 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (24 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ void Get_all_counters( void );
|
||||
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (6 * 3 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (6 * 4 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user