diff options
author | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2009-12-17 20:09:11 +0000 |
---|---|---|
committer | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2009-12-17 20:09:11 +0000 |
commit | c7ee08547586d127741ed426d0deac2d378ed9d8 (patch) | |
tree | 4e566d61e1469238ba5b19fc0bdbf6e6724db0d5 /led | |
parent | 22c777424440a2fb3cdec37a07fe190cb6bf9e47 (diff) |
2009-12-17 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* delay/init.c, event_server/init.c, msg_server/init.c,
posix_cond_server/test.c, posix_delay_nanosleep/test.c,
posix_delay_sleep/test.c, posix_mutex_server/test.c, ratemon1/init.c,
ratemon2/init.c, ratemon_cond_server/test.c, sem_server/init.c,
timeout_event/init.c: Cleaned up the led examples to produce similiar
output.
* timer_server/.cvsignore: New file.
Diffstat (limited to 'led')
-rw-r--r-- | led/ChangeLog | 10 | ||||
-rw-r--r-- | led/delay/init.c | 6 | ||||
-rw-r--r-- | led/event_server/init.c | 10 | ||||
-rw-r--r-- | led/msg_server/init.c | 10 | ||||
-rw-r--r-- | led/posix_cond_server/test.c | 6 | ||||
-rw-r--r-- | led/posix_delay_nanosleep/test.c | 4 | ||||
-rw-r--r-- | led/posix_delay_sleep/test.c | 4 | ||||
-rw-r--r-- | led/posix_mutex_server/test.c | 22 | ||||
-rw-r--r-- | led/ratemon1/init.c | 11 | ||||
-rw-r--r-- | led/ratemon2/init.c | 10 | ||||
-rw-r--r-- | led/ratemon_cond_server/test.c | 4 | ||||
-rw-r--r-- | led/sem_server/init.c | 6 | ||||
-rw-r--r-- | led/timeout_event/init.c | 10 | ||||
-rw-r--r-- | led/timer_server/.cvsignore | 1 |
14 files changed, 59 insertions, 55 deletions
diff --git a/led/ChangeLog b/led/ChangeLog index 3114aa6..f00f7e3 100644 --- a/led/ChangeLog +++ b/led/ChangeLog @@ -1,3 +1,13 @@ +2009-12-17 Glenn Humphrey <glenn.humphrey@OARcorp.com> + + * delay/init.c, event_server/init.c, msg_server/init.c, + posix_cond_server/test.c, posix_delay_nanosleep/test.c, + posix_delay_sleep/test.c, posix_mutex_server/test.c, ratemon1/init.c, + ratemon2/init.c, ratemon_cond_server/test.c, sem_server/init.c, + timeout_event/init.c: Cleaned up the led examples to produce similiar + output. + * timer_server/.cvsignore: New file. + 2009-10-12 Glenn Humphrey <glenn.humphrey@OARcorp.com> * delay/init.c, event_server/init.c, msg_server/init.c, diff --git a/led/delay/init.c b/led/delay/init.c index 4b11413..7537595 100644 --- a/led/delay/init.c +++ b/led/delay/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -27,9 +27,9 @@ rtems_task Init( while (1) { (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); - LED_ON(); - (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); LED_OFF(); + (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); + LED_ON(); } diff --git a/led/event_server/init.c b/led/event_server/init.c index c726e6b..806faa6 100644 --- a/led/event_server/init.c +++ b/led/event_server/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,9 +32,9 @@ rtems_task Test_task( ); if ( events == RTEMS_EVENT_1 ) { - LED_ON(); - } else if ( events == RTEMS_EVENT_2 ) { LED_OFF(); + } else if ( events == RTEMS_EVENT_2 ) { + LED_ON(); } else { fprintf( stderr, "Incorrect event set 0x%08" PRIx32 "\n", events ); } @@ -65,9 +65,9 @@ rtems_task Init( status = rtems_task_start( task_id, Test_task, 1 ); - while (1) { + for (count=0; ; count++) { - events = ( (count++ % 2) == 0 ) ? RTEMS_EVENT_1 : RTEMS_EVENT_2; + events = ( (count % 2) == 0 ) ? RTEMS_EVENT_1 : RTEMS_EVENT_2; status = rtems_event_send( task_id, events ); if ( status != RTEMS_SUCCESSFUL ) fputs( "send did not work\n", stderr ); diff --git a/led/msg_server/init.c b/led/msg_server/init.c index 83654cf..7049efe 100644 --- a/led/msg_server/init.c +++ b/led/msg_server/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -35,9 +35,9 @@ rtems_task Test_task( ); if ( (count % 2) == 0 ) { - LED_ON(); - } else { LED_OFF(); + } else { + LED_ON(); } } } @@ -71,9 +71,9 @@ rtems_task Init( RTEMS_DEFAULT_ATTRIBUTES, &Queue_id ); - while (1) { - count++; + for (count=0; ; count++) { + /* fprintf( stderr, "send 0x%d\n", count ); */ status = rtems_message_queue_send( Queue_id, &count, sizeof(uint32_t) ); if ( status != RTEMS_SUCCESSFUL ) diff --git a/led/posix_cond_server/test.c b/led/posix_cond_server/test.c index c476ed0..61da7e2 100644 --- a/led/posix_cond_server/test.c +++ b/led/posix_cond_server/test.c @@ -27,13 +27,13 @@ void *Server( if ( status ) fprintf( stderr, "Server - lock did not work (%d)\n", status ); - for ( ; ; ) { + for (count=0; ; count++) { status = pthread_cond_wait( &Condition, &Mutex ); if ( status ) fprintf( stderr, "Server - condition wait did not work (%d)\n", status ); - if ((++count % 2) == 0) + if ((count % 2) == 0) LED_OFF(); else LED_ON(); @@ -46,7 +46,7 @@ void *POSIX_Init( ) { pthread_t thread_id; - int status; + int status; puts( "\n\n*** LED BLINKER -- sleep with pthread condition variables ***" ); diff --git a/led/posix_delay_nanosleep/test.c b/led/posix_delay_nanosleep/test.c index 7000a73..b553e2d 100644 --- a/led/posix_delay_nanosleep/test.c +++ b/led/posix_delay_nanosleep/test.c @@ -25,9 +25,9 @@ void *POSIX_Init( while (1) { (void) nanosleep( &delay, NULL ); - LED_ON(); - (void) nanosleep( &delay, NULL ); LED_OFF(); + (void) nanosleep( &delay, NULL ); + LED_ON(); } exit( 0 ); diff --git a/led/posix_delay_sleep/test.c b/led/posix_delay_sleep/test.c index 6f34a7b..2198c8b 100644 --- a/led/posix_delay_sleep/test.c +++ b/led/posix_delay_sleep/test.c @@ -21,9 +21,9 @@ void *POSIX_Init( while (1) { (void) sleep( 1 ); - LED_ON(); - (void) sleep( 1 ); LED_OFF(); + (void) sleep( 1 ); + LED_ON(); } exit( 0 ); diff --git a/led/posix_mutex_server/test.c b/led/posix_mutex_server/test.c index ce6617a..0e39cbb 100644 --- a/led/posix_mutex_server/test.c +++ b/led/posix_mutex_server/test.c @@ -21,22 +21,20 @@ void *Server( LED_INIT(); - sleep( 1 ); - for ( ; ; ) { + status = pthread_mutex_lock( &Mutex ); - if ( status ) + if (status) fprintf( stderr, "Server - lock did not work (%d)\n", status ); - LED_OFF(); + LED_ON(); status = sleep( 1 ); status = pthread_mutex_unlock( &Mutex ); - if ( status ) + if (status) fprintf( stderr, "Server - unlock did not work (%d)\n", status ); - } return NULL; } @@ -74,24 +72,20 @@ void *POSIX_Init( if (status) fprintf( stderr, "Main -- first lock did not work (%d)\n", status ); - if ( status ) - fprintf( stderr, "Main - lock did not work (%d)\n", status ); - for ( ; ; ) { - LED_ON(); + + LED_OFF(); status = sleep( 1 ); status = pthread_mutex_unlock( &Mutex ); - if ( status ) + if (status) fprintf( stderr, "Main - unlock did not work (%d)\n", status ); status = pthread_mutex_lock( &Mutex ); - if ( status ) + if (status) fprintf( stderr, "Main - lock did not work (%d)\n", status ); - - } exit( 0 ); } diff --git a/led/ratemon1/init.c b/led/ratemon1/init.c index 1df7a59..83e48f4 100644 --- a/led/ratemon1/init.c +++ b/led/ratemon1/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,15 +32,14 @@ rtems_task Init( &period_id ); - count = 0; ticks = rtems_clock_get_ticks_per_second(); - while (1) { + for (count=0; ; count++) { status = rtems_rate_monotonic_period( period_id, ticks ); - if ( (++count % 2) == 0 ) - LED_ON(); - else + if ( (count % 2) == 0 ) LED_OFF(); + else + LED_ON(); } status = rtems_task_delete( RTEMS_SELF ); diff --git a/led/ratemon2/init.c b/led/ratemon2/init.c index 1dcb95d..08adb5d 100644 --- a/led/ratemon2/init.c +++ b/led/ratemon2/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -40,18 +40,18 @@ rtems_task Init( ticks = rtems_clock_get_ticks_per_second(); status = rtems_rate_monotonic_period( period_id1, 2 * ticks ); - LED_ON(); + LED_OFF(); (void) rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); status = rtems_rate_monotonic_period( period_id2, 2 * ticks ); - LED_OFF(); + LED_ON(); while (1) { status = rtems_rate_monotonic_period( period_id1, 2 * ticks ); - LED_ON(); + LED_OFF(); status = rtems_rate_monotonic_period( period_id2, 2 * ticks ); - LED_OFF(); + LED_ON(); } status = rtems_task_delete( RTEMS_SELF ); diff --git a/led/ratemon_cond_server/test.c b/led/ratemon_cond_server/test.c index a481847..df43368 100644 --- a/led/ratemon_cond_server/test.c +++ b/led/ratemon_cond_server/test.c @@ -28,13 +28,13 @@ void *POSIX_Init( if ( status ) fprintf( stderr, "Server - lock did not work (%d)\n", status ); - for ( ; ; ) { + for (count=0; ; count++) { status = pthread_cond_wait( &Condition, &Mutex ); if ( status ) fprintf( stderr, "Server - condition wait did not work (%d)\n", status ); - if ((++count % 2) == 0) + if ((count % 2) == 0) LED_OFF(); else LED_ON(); diff --git a/led/sem_server/init.c b/led/sem_server/init.c index f59406c..fa8b337 100644 --- a/led/sem_server/init.c +++ b/led/sem_server/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -34,7 +34,7 @@ rtems_task Test_task( if ( status != RTEMS_SUCCESSFUL ) fputs( "Task - obtain did not work\n", stderr ); - LED_OFF(); + LED_ON(); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); assert( status == RTEMS_SUCCESSFUL ); @@ -80,7 +80,7 @@ rtems_task Init( while (1) { - LED_ON(); + LED_OFF(); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); assert( status == RTEMS_SUCCESSFUL ); diff --git a/led/timeout_event/init.c b/led/timeout_event/init.c index ee9fc23..4f9ef63 100644 --- a/led/timeout_event/init.c +++ b/led/timeout_event/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-2007. + * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -27,17 +27,17 @@ rtems_task Init( LED_INIT(); - while (1) { + for (count=0; ; count++) { status = rtems_event_receive( RTEMS_EVENT_1, RTEMS_DEFAULT_OPTIONS, rtems_clock_get_ticks_per_second(), &events ); if ( status != RTEMS_TIMEOUT ) fputs( "receive did not timeout\n", stderr ); - if ( (count++ % 2) == 0 ) - LED_ON(); - else + if ( (count % 2) == 0 ) LED_OFF(); + else + LED_ON(); } diff --git a/led/timer_server/.cvsignore b/led/timer_server/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/led/timer_server/.cvsignore @@ -0,0 +1 @@ +o-optimize |