rtems_task Task_1( rtems_task_argument argument ) { rtems_status_code status; rtems_id tid; rtems_time_of_day time; uint32_t task_index; INTEGER_DECLARE; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident" ); task_index = task_number( tid ); INTEGER_LOAD( INTEGER_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] ); while( FOREVER ) { status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); put_name( Task_name[ task_number( tid ) ], FALSE ); print_time( " - rtems_clock_get_tod - ", &time, "\n" ); INTEGER_CHECK( INTEGER_factors[ task_index ] ); status = rtems_task_wake_after( ( task_number( tid ) ) * 5 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); } }
rtems_task First_FP_task( rtems_task_argument argument ) { rtems_status_code status; rtems_id tid; rtems_time_of_day time; uint32_t task_index; INTEGER_DECLARE; FP_DECLARE; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident" ); task_index = task_number( tid ); INTEGER_LOAD( INTEGER_factors[ task_index ] ); FP_LOAD( FP_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); printf( " - integer base = (0x%" PRIx32 ")\n", INTEGER_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); #if ( RTEMS_HAS_HARDWARE_FP == 1 ) printf( " - float base = (%g)\n", FP_factors[ task_index ] ); #else printf( " - float base = (NA)\n" ); #endif if ( argument == 0 ) { status = rtems_task_restart( RTEMS_SELF, 1 ); directive_failed( status, "rtems_task_restart of RTEMS_SELF" ); } else { build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); } }
rtems_task FP_task( rtems_task_argument argument ) { rtems_status_code status; rtems_id tid; rtems_time_of_day time; uint32_t task_index; uint32_t previous_seconds; INTEGER_DECLARE; FP_DECLARE; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident of self" ); task_index = task_number( tid ); INTEGER_LOAD( INTEGER_factors[ task_index ] ); FP_LOAD( FP_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); put_name( Task_name[ task_index ], FALSE ); #if ( RTEMS_HAS_HARDWARE_FP == 1 ) printf( " - float base = (%g)\n", FP_factors[ task_index ] ); #else printf( " - float base = (NA)\n" ); #endif previous_seconds = -1; while( FOREVER ) { status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); directive_failed( status, "rtems_clock_get" ); if ( time.second >= 16 ) { if ( task_number( tid ) == 4 ) { puts( "TA4 - rtems_task_delete - self" ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of TA4" ); } puts( "TA5 - rtems_task_delete - TA3" ); status = rtems_task_delete( Task_id[ 3 ] ); directive_failed( status, "rtems_task_delete of TA3" ); puts( "*** END OF TEST 19 *** " ); rtems_test_exit( 0 ); } if (previous_seconds != time.second) { put_name( Task_name[ task_index ], FALSE ); print_time( " - rtems_clock_get - ", &time, "\n" ); previous_seconds = time.second; } INTEGER_CHECK( INTEGER_factors[ task_index ] ); FP_CHECK( FP_factors[ task_index ] ); /* for the first 4 seconds we spin as fast as possible * so that we likely are interrupted * After that, we go to sleep for a second at a time */ if (time.second >= 4) { status = rtems_task_wake_after( TICKS_PER_SECOND ); directive_failed( status, "rtems_task_wake_after" ); } } }