From 7c1e69429a28adf03216c755bc1b4504c6e735b2 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 5 May 2011 16:45:40 +0000 Subject: 2011-05-05 Joel Sherrill * base_sp/apptask.c, base_sp/init.c, fileio/init.c, fileio/system.h, nsecs/init.c, ticker/init.c, ticker/system.h, ticker/tasks.c: Remove warnings. --- testsuites/samples/ChangeLog | 6 ++++ testsuites/samples/base_sp/apptask.c | 9 ++++-- testsuites/samples/base_sp/init.c | 6 +++- testsuites/samples/fileio/init.c | 5 +++- testsuites/samples/fileio/system.h | 53 +----------------------------------- testsuites/samples/nsecs/init.c | 5 ++-- testsuites/samples/ticker/init.c | 14 +++++++++- testsuites/samples/ticker/system.h | 37 +------------------------ testsuites/samples/ticker/tasks.c | 8 ++++-- 9 files changed, 45 insertions(+), 98 deletions(-) (limited to 'testsuites') diff --git a/testsuites/samples/ChangeLog b/testsuites/samples/ChangeLog index d9b4cbbd3f..16cf6799d2 100644 --- a/testsuites/samples/ChangeLog +++ b/testsuites/samples/ChangeLog @@ -1,3 +1,9 @@ +2011-05-05 Joel Sherrill + + * base_sp/apptask.c, base_sp/init.c, fileio/init.c, fileio/system.h, + nsecs/init.c, ticker/init.c, ticker/system.h, ticker/tasks.c: Remove + warnings. + 2011-02-22 Ralf Corsépius * configure.ac: Add AC_CONFIG_HEADER(config.h). diff --git a/testsuites/samples/base_sp/apptask.c b/testsuites/samples/base_sp/apptask.c index 7ea6acd740..a2bcd82f9d 100644 --- a/testsuites/samples/base_sp/apptask.c +++ b/testsuites/samples/base_sp/apptask.c @@ -8,7 +8,7 @@ * * Output parameters: NONE * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -36,9 +36,12 @@ rtems_task Application_task( rtems_status_code status; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "ident" ); - printf( "Application task was invoked with argument (%" PRIdrtems_task_argument ") " - "and has id of 0x%" PRIxrtems_id "\n", argument, tid ); + printf( + "Application task was invoked with argument (%" PRIdrtems_task_argument ") " + "and has id of 0x%" PRIxrtems_id "\n", argument, tid + ); printf( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***\n" ); exit( 0 ); diff --git a/testsuites/samples/base_sp/init.c b/testsuites/samples/base_sp/init.c index 3d30d16d3f..6bc12237ef 100644 --- a/testsuites/samples/base_sp/init.c +++ b/testsuites/samples/base_sp/init.c @@ -10,7 +10,7 @@ * * Output parameters: NONE * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -26,6 +26,7 @@ #define CONFIGURE_INIT #include "system.h" +#include "tmacros.h" #include #define ARGUMENT 0 @@ -45,8 +46,11 @@ rtems_task Init( 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" ); status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "delete" ); } diff --git a/testsuites/samples/fileio/init.c b/testsuites/samples/fileio/init.c index 5a09f217d6..229baab08c 100644 --- a/testsuites/samples/fileio/init.c +++ b/testsuites/samples/fileio/init.c @@ -10,7 +10,7 @@ * * Output parameters: NONE * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -707,10 +707,13 @@ Init (rtems_task_argument ignored) RTEMS_DEFAULT_MODES , RTEMS_FLOATING_POINT | RTEMS_DEFAULT_ATTRIBUTES, &Task_id ); + directive_failed( status, "create" ); status = rtems_task_start( Task_id, fileio_task, 1 ); + directive_failed( status, "start" ); status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "delete" ); } #if defined(USE_SHELL) diff --git a/testsuites/samples/fileio/system.h b/testsuites/samples/fileio/system.h index f6663d8fd5..07044238a3 100644 --- a/testsuites/samples/fileio/system.h +++ b/testsuites/samples/fileio/system.h @@ -14,6 +14,7 @@ */ #include +#include "tmacros.h" /* functions */ @@ -63,56 +64,4 @@ rtems_task Init( #define CONFIGURE_UNIFIED_WORK_AREAS #include -/* - * Handy macros and static inline functions - */ - -/* - * Macro to hide the ugliness of printing the time. - */ - -#define print_time(_s1, _tb, _s2) \ - do { \ - printf( "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ - _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \ - (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \ - fflush(stdout); \ - } while ( 0 ) - -/* - * Macro to print an task name that is composed of ASCII characters. - * - */ - -#define put_name( _name, _crlf ) \ - do { \ - uint32_t c0, c1, c2, c3; \ - \ - c0 = ((_name) >> 24) & 0xff; \ - c1 = ((_name) >> 16) & 0xff; \ - c2 = ((_name) >> 8) & 0xff; \ - c3 = (_name) & 0xff; \ - putchar( (char)c0 ); \ - if ( c1 ) putchar( (char)c1 ); \ - if ( c2 ) putchar( (char)c2 ); \ - if ( c3 ) putchar( (char)c3 ); \ - if ( (_crlf) ) \ - putchar( '\n' ); \ - } while (0) - -/* - * This allows us to view the "Test_task" instantiations as a set - * of numbered tasks by eliminating the number of application - * tasks created. - * - * In reality, this is too complex for the purposes of this - * example. It would have been easier to pass a task argument. :) - * 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 ) - /* end of include file */ diff --git a/testsuites/samples/nsecs/init.c b/testsuites/samples/nsecs/init.c index 35b96d8a7b..08ac91f635 100644 --- a/testsuites/samples/nsecs/init.c +++ b/testsuites/samples/nsecs/init.c @@ -2,7 +2,7 @@ * Nanoseconds accuracy timestamp test */ -/* COPYRIGHT (c) 1989-2007. +/* COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -69,6 +69,7 @@ rtems_task Init( time.ticks = 0; status = rtems_clock_set( &time ); + directive_failed( status, "clock set" ); /* * Iterate 10 times showing difference in TOD @@ -91,7 +92,7 @@ rtems_task Init( my_ctime(stop.tv_sec), stop.tv_nsec ); - printf( " --> %" PRItime_t ":%ld\n", diff.tv_sec, diff.tv_nsec ); + printf( " --> %" PRItime_t ":%ld\n", diff.tv_sec, diff.tv_nsec ); } /* diff --git a/testsuites/samples/ticker/init.c b/testsuites/samples/ticker/init.c index 55f5e2ea13..05ab25802a 100644 --- a/testsuites/samples/ticker/init.c +++ b/testsuites/samples/ticker/init.c @@ -10,7 +10,7 @@ * * Output parameters: NONE * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -52,6 +52,7 @@ rtems_task Init( time.ticks = 0; status = rtems_clock_set( &time ); + directive_failed( status, "clock get" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); @@ -61,18 +62,29 @@ rtems_task Init( Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 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 ] ); + 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 ] ); + directive_failed( status, "create 3" ); status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); + directive_failed( status, "start 1" ); + status = rtems_task_start( Task_id[ 2 ], Test_task, 2 ); + directive_failed( status, "start 2" ); + status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); + directive_failed( status, "start 3" ); status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "delete" ); } diff --git a/testsuites/samples/ticker/system.h b/testsuites/samples/ticker/system.h index ec17872b87..94b8d9f4ef 100644 --- a/testsuites/samples/ticker/system.h +++ b/testsuites/samples/ticker/system.h @@ -16,6 +16,7 @@ #include #include #include "../../support/include/buffer_test_io.h" +#include "tmacros.h" /* functions */ @@ -52,42 +53,6 @@ extern rtems_name Task_name[ 4 ]; /* array of task names */ #include -/* - * Handy macros and static inline functions - */ - -/* - * Macro to hide the ugliness of printing the time. - */ - -#define print_time(_s1, _tb, _s2) \ - do { \ - printf( "%s%02" PRId32 ":%02" PRId32 ":%02" PRId32 " %02" PRId32 "/%02" PRId32 "/%04" PRId32 "%s", \ - _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \ - (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \ - } while ( 0 ) - -/* - * Macro to print an task name that is composed of ASCII characters. - * - */ - -#define put_name( _name, _crlf ) \ - do { \ - uint32_t c0, c1, c2, c3; \ - \ - c0 = ((_name) >> 24) & 0xff; \ - c1 = ((_name) >> 16) & 0xff; \ - c2 = ((_name) >> 8) & 0xff; \ - c3 = (_name) & 0xff; \ - putchar( (char)c0 ); \ - if ( c1 ) putchar( (char)c1 ); \ - if ( c2 ) putchar( (char)c2 ); \ - if ( c3 ) putchar( (char)c3 ); \ - if ( (_crlf) ) \ - putchar( '\n' ); \ - } while (0) - /* * This allows us to view the "Test_task" instantiations as a set * of numbered tasks by eliminating the number of application diff --git a/testsuites/samples/ticker/tasks.c b/testsuites/samples/ticker/tasks.c index a1f6d34584..3b16a8ed01 100644 --- a/testsuites/samples/ticker/tasks.c +++ b/testsuites/samples/ticker/tasks.c @@ -29,10 +29,12 @@ rtems_task Test_task( { rtems_id tid; rtems_time_of_day time; - uint32_t task_index; + uint32_t task_index; rtems_status_code status; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "task ident" ); + task_index = task_number( tid ); for ( ; ; ) { status = rtems_clock_get_tod( &time ); @@ -43,6 +45,8 @@ rtems_task Test_task( put_name( Task_name[ task_index ], FALSE ); print_time( " - rtems_clock_get_tod - ", &time, "\n" ); status = rtems_task_wake_after( - task_index * 5 * rtems_clock_get_ticks_per_second() ); + task_index * 5 * rtems_clock_get_ticks_per_second() + ); + directive_failed( status, "wake after" ); } } -- cgit v1.2.3