rtems_task Init( rtems_task_argument ignored ) { rtems_status_code sc = RTEMS_SUCCESSFUL; size_t i = 0; puts("\n\n*** TEST INTERRUPT CRITICAL SECTION 17 ***"); build_time(&tod, 4, 12, 2009, 9, 34, 11, 0); sc = rtems_clock_set(&tod); directive_failed(sc, "rtems_clock_set"); ++tod.year; for (i = 0; i < TIMER_COUNT; ++i) { sc = rtems_timer_create( rtems_build_name('T', 'I', 'M', '0' + i), &timer [i] ); directive_failed(sc, "rtems_timer_create"); } sc = rtems_timer_initiate_server( RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed(sc, "rtems_timer_initiate_server"); sc = rtems_timer_server_fire_after( timer [TIMER_NEVER_INTERVAL], 2, never_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); reset_tod_timer(); sc = rtems_timer_fire_after( timer [TIMER_RESET], 1, reset_callback, NULL ); directive_failed(sc, "rtems_timer_fire_after"); sc = rtems_timer_server_fire_after( timer [TIMER_TRIGGER], 1, trigger_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); interrupt_critical_section_test_support_initialize(NULL); rtems_task_delete(RTEMS_SELF); }
static void interrupt_callback(rtems_id timer_id, void *arg) { rtems_status_code sc = RTEMS_SUCCESSFUL; assert_time(T2); rtems_test_assert( obtain_try && !obtain_done && !release_happened && !delayed_happened && !interrupt_triggered_happened && !server_triggered_happened ); sc = rtems_timer_server_fire_after( timer [INTERRUPT_TRIGGERED], T3 - T2, interrupt_triggered_callback, NULL ); directive_failed_with_level(sc, "rtems_timer_server_fire_after", -1); interrupt_happened = true; }
rtems_task Task_1_through_3( rtems_task_argument argument ) { rtems_id tid; rtems_time_of_day time; rtems_status_code status; status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); directive_failed( status, "rtems_task_ident of self" ); while ( FOREVER ) { status = rtems_timer_server_fire_after( Timer_id[ argument ], (task_number( tid ) - 1) * 5 * rtems_clock_get_ticks_per_second(), Resume_task, (void *) &tid ); directive_failed( status, "rtems_timer_server_fire_after failed" ); status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod failed" ); if ( time.second >= 35 ) { puts( "*** END OF TEST 30 ***" ); rtems_test_exit( 0 ); } put_name( Task_name[ task_number( tid ) - 1 ], FALSE ); print_time( " - rtems_clock_get_tod - ", &time, "\n" ); status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); } }
rtems_timer_service_routine Timer_Routine( rtems_id id, void *ignored ) { rtems_status_code status; if ( id == Timer1 ) LED_OFF(); else LED_ON(); status = rtems_timer_server_fire_after( id, 2 * rtems_clock_get_ticks_per_second(), Timer_Routine, NULL ); }
rtems_timer_service_routine Timer_Routine(rtems_id id, void *ignored) { rtems_status_code status; Fired++; timerRan = true; status = rtems_timer_server_fire_after( id, rtems_clock_get_ticks_per_second(), Timer_Routine, NULL ); directive_failed( status, "fire after" ); }
static void delayed_callback(rtems_id timer_id, void *arg) { rtems_status_code sc = RTEMS_SUCCESSFUL; assert_time(T4); rtems_test_assert( obtain_done && release_happened && interrupt_happened && !server_triggered_happened ); sc = rtems_timer_server_fire_after( timer [SERVER_TRIGGERED], T5 - T4, server_triggered_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); delayed_happened = true; }
rtems_task Task_1( rtems_task_argument argument ) { rtems_id tmid; rtems_id tmid2; rtems_time_of_day time; rtems_status_code status; rtems_timer_information info; /* Get id */ puts( "TA1 - rtems_timer_ident - identing timer 1" ); status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); directive_failed( status, "rtems_timer_ident" ); printf( "TA1 - timer 1 has id (0x%" PRIxrtems_id ")\n", tmid ); puts( "TA1 - rtems_timer_ident - identing timer 2" ); status = rtems_timer_ident( Timer_name[ 2 ], &tmid2 ); directive_failed( status, "rtems_timer_ident" ); printf( "TA1 - timer 2 has id (0x%" PRIxrtems_id ")\n", tmid2 ); /* make sure insertion does not unintentionally fire a timer per PR147 */ TSR_fired = 0; puts( "TA1 - rtems_timer_server_fire_after - 1 second" ); status = rtems_timer_server_fire_after( tmid, rtems_clock_get_ticks_per_second(), Should_not_fire_TSR, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_task_wake_after - 1/2 second" ); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() / 2 ); directive_failed( status, "rtems_timer_server_fire_after" ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second" ); status = rtems_timer_server_fire_after( tmid2, rtems_clock_get_ticks_per_second() / 2, Should_not_fire_TSR, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); if ( TSR_fired ) { puts( "TA1 - TSR fired and should not have!" ); rtems_test_exit(1); } puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); puts( "TA1 - rtems_timer_cancel - timer 2" ); status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); /* now check that rescheduling an active timer works OK. */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" ); status = rtems_timer_server_fire_after( tmid, 30 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", info.start_time + info.initial ); printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", schedule_time() ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_timer_wake_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); directive_failed( status, "rtems_timer_get_information" ); printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", info.start_time + info.initial ); printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", schedule_time() ); rtems_test_assert( (info.start_time + info.initial) == schedule_time() ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_timer_wake_after" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" ); status = rtems_timer_server_fire_after( tmid2, 60 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_get_information( tmid, &info ); directive_failed( status, "rtems_timer_get_information" ); printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", info.start_time + info.initial ); printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n", schedule_time() ); rtems_test_assert( (info.start_time + info.initial) == schedule_time() ); puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); puts( "TA1 - rtems_timer_cancel - timer 2" ); status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); /* after which is allowed to fire */ Print_time(); puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_after( tmid, 3 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); Print_time(); /* after which is reset and allowed to fire */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_after( tmid, 3 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); Print_time(); puts( "TA1 - rtems_timer_reset - timer 1" ); status = rtems_timer_reset( tmid ); directive_failed( status, "rtems_timer_reset" ); puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); Print_time(); rtems_test_pause(); /* * Reset the time since we do not know how long the user waited * before pressing <cr> at the pause. This insures that the * actual output matches the screen. */ build_time( &time, 12, 31, 1988, 9, 0, 7, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); /* after which is canceled */ puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_after( tmid, 3 * rtems_clock_get_ticks_per_second(), Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); /* when which is allowed to fire */ Print_time(); status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); time.second += 3; puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); status = rtems_task_suspend( RTEMS_SELF ); directive_failed( status, "rtems_task_suspend" ); Print_time(); /* when which is canceled */ status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); time.second += 3; puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_when( tmid, &time, Delayed_resume, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); Print_time(); puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); /* TOD timer insert with non empty TOD timer chain */ status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); time.second += 3; puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" ); status = rtems_timer_server_fire_when( tmid, &time, Do_nothing, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); puts( "TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds" ); status = rtems_timer_server_fire_when( tmid2, &time, Do_nothing, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); puts( "TA1 - rtems_task_wake_after - 1 second" ); status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds" ); status = rtems_timer_server_fire_when( tmid2, &time, Do_nothing, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); puts( "TA1 - rtems_timer_cancel - timer 2" ); status = rtems_timer_cancel( tmid2 ); directive_failed( status, "rtems_timer_cancel" ); /* TOD chain processing with time wrap */ time.second = 30; status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); time.second = 31; puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 1 seconds" ); status = rtems_timer_server_fire_when( tmid, &time, Do_nothing, NULL ); directive_failed( status, "rtems_timer_server_fire_when" ); time.second = 29; status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1 tick" ); status = rtems_timer_server_fire_after( tmid2, 1, Do_nothing, NULL ); directive_failed( status, "rtems_timer_server_fire_after" ); puts( "TA1 - rtems_task_wake_after - 1 tick" ); status = rtems_task_wake_after( 1 ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - rtems_timer_cancel - timer 1" ); status = rtems_timer_cancel( tmid ); directive_failed( status, "rtems_timer_cancel" ); /* delete */ puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" ); status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); directive_failed( status, "rtems_task_wake_after" ); puts( "TA1 - timer_deleting - timer 1" ); status = rtems_timer_delete( tmid ); directive_failed( status, "rtems_timer_delete" ); puts( "*** END OF TEST 31 *** " ); rtems_test_exit( 0 ); }
static void test_case(enum resource_type rt) { rtems_status_code sc = RTEMS_SUCCESSFUL; printf("test case: %s\n", resource_type_desc [rt]); resource_type = rt; test_reset(); sc = rtems_timer_server_fire_after( timer [OBTAIN], T1 - T0, obtain_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); sc = rtems_timer_fire_after( timer [INTERRUPT], T2 - T0, interrupt_callback, NULL ); directive_failed(sc, "rtems_timer_fire_after"); sc = rtems_timer_server_fire_after( timer [DELAYED], T3 - T0, delayed_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); if (resource_type != REGION) { sc = rtems_timer_fire_after( timer [RELEASE], T4 - T0, release_callback, NULL ); directive_failed(sc, "rtems_timer_fire_after"); assert_time(T0); sc = rtems_task_wake_after(T6 - T0); directive_failed(sc, "task_wake_after"); } else { sc = rtems_task_wake_after(T4 - T0); directive_failed(sc, "task_wake_after"); assert_time(T4); rtems_test_assert( obtain_try && interrupt_happened && !delayed_happened && !interrupt_triggered_happened && !server_triggered_happened ); sc = rtems_region_return_segment(region, region_item); directive_failed(sc, "rtems_region_return_segment"); release_happened = true; sc = rtems_task_wake_after(T6 - T4); directive_failed(sc, "task_wake_after"); } assert_time(T6); rtems_test_assert( obtain_done && interrupt_happened && release_happened && delayed_happened && interrupt_triggered_happened && server_triggered_happened ); }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code status; rtems_id timer1; rtems_id timer2; puts( "\n\n*** TEST 67 ***" ); /* build timer name*/ /* create Timer */ puts( "Init - create timer 1" ); status = rtems_timer_create( rtems_build_name('T', 'M', '1', ' '), &timer1 ); directive_failed( status, "rtems_timer_create #1" ); puts( "Init - create timer 2" ); status = rtems_timer_create( rtems_build_name('T', 'M', '2', ' '), &timer2 ); directive_failed( status, "rtems_timer_create #1" ); /* Manipulate the time */ _Watchdog_Ticks_since_boot = (Watchdog_Interval) -15; /* initiate timer server */ puts( "Init - Initiate the timer server" ); status = rtems_timer_initiate_server( RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( status, "rtems_timer_initiate_server" ); /* Give the timer server some time to initialize */ status = rtems_task_wake_after( 10 ); directive_failed( status, "task wake_after" ); status = rtems_timer_server_fire_after( timer1, 10, TIMER_service_routine, (void*) &_timer_passage_1 ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_timer_server_fire_after( timer2, 20, TIMER_service_routine, (void*) &_timer_passage_2 ); directive_failed( status, "rtems_timer_server_fire_after" ); status = rtems_task_wake_after( 15 ); directive_failed( status, "task wake_after" ); if (!_timer_passage_1) { puts( "Timer 1 FAILED to fire after wrapping time"); rtems_test_exit(0); } puts( "Server Timer 1 fired after wrapping ticks since boot-- OK"); if (_timer_passage_2) { puts( "Timer 2 fired and should not have after wrapping time"); rtems_test_exit(0); } puts( "*** END OF TEST 67 ***" ); rtems_test_exit(0); }
void Screen14() { rtems_status_code status; rtems_time_of_day time; rtems_timer_information timer_info; bool skipUnsatisfied; /* NULL Id */ status = rtems_timer_create( Timer_name[ 1 ], NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_create NULL param" ); puts( "TA1 - rtems_timer_create - RTEMS_INVALID_ADDRESS" ); /* bad name */ status = rtems_timer_create( 0, &Junk_id ); fatal_directive_status( status, RTEMS_INVALID_NAME, "rtems_timer_create with illegal name" ); puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" ); /* OK */ status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_create" ); puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" ); status = rtems_timer_create( 2, &Junk_id ); fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_timer_create for too many" ); puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" ); status = rtems_timer_delete( 100 ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_delete with illegal id" ); puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" ); status = rtems_timer_delete( rtems_build_id( 1, 1, 1, 256 ) ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_delete with illegal id" ); puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" ); status = rtems_timer_ident( 0, &Junk_id ); fatal_directive_status( status, RTEMS_INVALID_NAME, "rtems_timer_ident with illegal name" ); puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" ); status = rtems_timer_cancel( rtems_build_id( 1, 1, 1, 256 ) ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_cancel with illegal id" ); puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" ); status = rtems_timer_reset( rtems_build_id( 1, 1, 1, 256 ) ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_reset with illegal id" ); puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" ); status = rtems_timer_reset( Timer_id[ 1 ] ); fatal_directive_status( status, RTEMS_NOT_DEFINED, "rtems_timer_reset before initiated" ); puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" ); /* bad id */ status = rtems_timer_fire_after( rtems_build_id( 1, 1, 1, 256 ), 5 * rtems_clock_get_ticks_per_second(), Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_fire_after illegal id" ); puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" ); /* bad id */ build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); status = rtems_timer_fire_when( rtems_build_id( 1, 1, 1, 256 ), &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_fire_when with illegal id" ); puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" ); /* NULL routine */ status = rtems_timer_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_fire_after with NULL handler" ); puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ADDRESS" ); /* 0 ticks */ status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_timer_fire_after with 0 ticks" ); puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" ); /* NULL routine */ status = rtems_timer_fire_when( Timer_id[ 1 ], &time, NULL, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_fire_when with NULL handler" ); puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ADDRESS" ); /* invalid time -- before RTEMS epoch */ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_timer_fire_when with illegal time" ); print_time( "TA1 - rtems_timer_fire_when - ", &time, " - RTEMS_INVALID_CLOCK\n" ); status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" ); build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_timer_fire_when before current time" ); print_time( "TA1 - rtems_timer_fire_when - ", &time, " - before RTEMS_INVALID_CLOCK\n" ); /* null param */ status = rtems_timer_get_information( Timer_id[ 1 ], NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_get_information with NULL param" ); puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ADDRESS" ); /* invalid id */ status = rtems_timer_get_information( 100, &timer_info ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_get_information with illegal id" ); puts( "TA1 - rtems_timer_get_information - RTEMS_INVALID_ID" ); /* timer server interface routines */ /* incorrect state */ status = rtems_timer_server_fire_after( 0, 5, NULL, NULL ); fatal_directive_status( status, RTEMS_INCORRECT_STATE, "rtems_timer_server_fire_after incorrect state" ); puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INCORRECT_STATE" ); /* incorrect state */ status = rtems_timer_server_fire_when( 0, &time, NULL, NULL ); fatal_directive_status( status, RTEMS_INCORRECT_STATE, "rtems_timer_server_fire_when incorrect state" ); puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INCORRECT_STATE" ); /* invalid priority */ status = rtems_timer_initiate_server( 0, 0, 0 ); fatal_directive_status( status, RTEMS_INVALID_PRIORITY, "rtems_timer_initiate_server invalid priority" ); puts( "TA1 - rtems_timer_initiate_server - RTEMS_INVALID_PRIORITY" ); skipUnsatisfied = false; #if defined(__m32c__) skipUnsatisfied = true; #endif if (skipUnsatisfied) { puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED -- SKIPPED" ); } else { status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0x10000000, 0 ); fatal_directive_status( status, RTEMS_UNSATISFIED, "rtems_timer_initiate_server too much stack " ); puts( "TA1 - rtems_timer_initiate_server - RTEMS_UNSATISFIED" ); } status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, 0, 0 ); directive_failed( status, "rtems_timer_initiate_server" ); puts( "TA1 - rtems_timer_initiate_server - SUCCESSFUL" ); /* NULL routine */ status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_server_fire_after NULL routine" ); puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" ); /* bad Id */ status = rtems_timer_server_fire_after( rtems_build_id( 1, 1, 1, 256 ), 5 * rtems_clock_get_ticks_per_second(), Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_server_fire_after illegal id" ); puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ID" ); /* bad id */ build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); status = rtems_timer_server_fire_when( rtems_build_id( 1, 1, 1, 256 ), &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_ID, "rtems_timer_server_fire_when with illegal id" ); puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ID" ); /* NULL routine */ status = rtems_timer_server_fire_after( Timer_id[ 1 ], 1, NULL, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_server_fire_after NULL routine" ); puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_ADDRESS" ); /* 0 ticks */ status = rtems_timer_server_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_NUMBER, "rtems_timer_server_fire_after with 0 ticks" ); puts( "TA1 - rtems_timer_server_fire_after - RTEMS_INVALID_NUMBER" ); /* illegal time */ build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_timer_server_fire_when with illegal time" ); print_time( "TA1 - rtems_timer_server_fire_when - ", &time, " - RTEMS_INVALID_CLOCK\n" ); status = rtems_clock_get_tod( &time ); directive_failed( status, "rtems_clock_get_tod" ); print_time( "TA1 - rtems_clock_get_tod - ", &time, "\n" ); /* when NULL routine */ status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, NULL, NULL ); fatal_directive_status( status, RTEMS_INVALID_ADDRESS, "rtems_timer_server_fire_when NULL routine" ); puts( "TA1 - rtems_timer_server_fire_when - RTEMS_INVALID_ADDRESS" ); /* before current time */ build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); status = rtems_timer_server_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); fatal_directive_status( status, RTEMS_INVALID_CLOCK, "rtems_timer_server_fire_when before current time" ); print_time( "TA1 - rtems_timer_server_fire_when - ", &time, " - before RTEMS_INVALID_CLOCK\n" ); }