rtems_status_code rtems_bsd_initialize(void) { rtems_status_code sc = RTEMS_SUCCESSFUL; hz = (int) rtems_clock_get_ticks_per_second(); tick = 1000000 / hz; maxusers = 1; gettimeofday(&boottime, NULL); timeval2bintime(&boottime, &boottimebin); mkdir("/etc", S_IRWXU | S_IRWXG | S_IRWXO); sc = rtems_timer_initiate_server( BSD_TASK_PRIORITY_TIMER, BSD_MINIMUM_TASK_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); if (sc != RTEMS_SUCCESSFUL) { return RTEMS_UNSATISFIED; } mutex_init(); mi_startup(); return RTEMS_SUCCESSFUL; }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code status; puts( "\n\n*** LED BLINKER -- timer_server ***" ); LED_INIT(); status = rtems_timer_initiate_server( 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_ATTRIBUTES ); if ( status != RTEMS_SUCCESSFUL ) fputs( "timer create server failed\n", stderr ); status = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &Timer1); if ( status != RTEMS_SUCCESSFUL ) fputs( "Timer1 create failed\n", stderr ); status = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '2' ), &Timer2); if ( status != RTEMS_SUCCESSFUL ) fputs( "Timer2 create failed\n", stderr ); Timer_Routine(Timer1, NULL); status = rtems_task_wake_after( rtems_clock_get_ticks_per_second() ); Timer_Routine(Timer2, NULL); status = rtems_task_delete( RTEMS_SELF ); }
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); }
rtems_task Init( rtems_task_argument argument ) { rtems_time_of_day time; uint32_t index; rtems_status_code status; puts( "\n\n*** TEST 30 ***" ); build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( status, "rtems_timer_initiate_server" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); for ( index = 1 ; index <= 3 ; index++ ) { status = rtems_task_create( Task_name[ index ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); status = rtems_timer_create( Timer_name[ index ], &Timer_id[ index ] ); directive_failed( status, "rtems_timer_create loop" ); } for ( index = 1 ; index <= 3 ; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); directive_failed( status, "rtems_task_start loop" ); } status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Init( rtems_task_argument argument ) { rtems_time_of_day time; rtems_status_code status; puts( "\n\n*** TEST 31 ***" ); build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( status, "rtems_timer_initiate_server" ); Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); status = rtems_task_create( Task_name[ 1 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] ); directive_failed( status, "rtems_task_create of TA1" ); status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); directive_failed( status, "rtems_task_start of TA1" ); puts( "INIT - rtems_timer_create - creating timer 1" ); status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); directive_failed( status, "rtems_timer_create" ); printf( "INIT - timer 1 has id (0x%" PRIxrtems_id ")\n", Timer_id[ 1 ] ); puts( "INIT - rtems_timer_create - creating timer 2" ); status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] ); directive_failed( status, "rtems_timer_create" ); printf( "INIT - timer 2 has id (0x%" PRIxrtems_id ")\n", Timer_id[ 2 ] ); status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code sc; rtems_id timer1; struct timespec uptime; TEST_BEGIN(); sc = rtems_timer_initiate_server( 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( sc, "rtems_timer_initiate_server" ); sc = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &timer1); directive_failed( sc, "rtems_timer_create" ); Fired = 0; timerRan = false; Timer_Routine(timer1, NULL); while (1) { sc = rtems_task_wake_after( 10 ); directive_failed( sc, "rtems_task_wake_after" ); if ( timerRan == true ) { timerRan = false; sc = rtems_clock_get_uptime( &uptime ); directive_failed( sc, "rtems_clock_get_uptime" ); printf( "Timer fired at %" PRIdtime_t "\n", uptime.tv_sec ); } if ( Fired >= 10 ) { TEST_END(); rtems_test_exit( 0 ); } /* technically the following is a critical section */ } }
rtems_task Init( rtems_task_argument ignored ) { rtems_status_code sc; int resets; puts( "\n\n*** TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" ); puts( "Init - Trying to generate timer fire from ISR while firing" ); puts( "Init - Variation is: " TEST_STRING ); puts( "Init - There is no way for the test to know if it hits the case" ); #if defined(SERVER_FIRE_AFTER) /* initiate timer server */ sc = rtems_timer_initiate_server( RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( sc, "rtems_timer_initiate_server" ); #endif puts( "Init - rtems_timer_create - OK" ); sc = rtems_timer_create( rtems_build_name( 'P', 'E', 'R', '1' ), &Timer); directive_failed( sc, "rtems_timer_create" ); Main_task = rtems_task_self(); interrupt_critical_section_test_support_initialize( test_release_from_isr ); for (resets=0 ; resets<10 ;) { if ( interrupt_critical_section_test_support_delay() ) resets++; sc = TEST_DIRECTIVE( Timer, 10, TimerMethod, NULL ); directive_failed( sc, "rtems_timer_fire_after"); } puts( "*** END OF TEST INTERRUPT CRITICAL SECTION " TEST_NAME " ***" ); rtems_test_exit(0); }
rtems_status_code rtems_bsd_initialize(void) { rtems_status_code sc = RTEMS_SUCCESSFUL; hz = (int) rtems_clock_get_ticks_per_second(); tick = 1000000 / hz; maxusers = 1; sc = rtems_timer_initiate_server( BSD_TASK_PRIORITY_TIMER, BSD_MINIMUM_TASK_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); if (sc != RTEMS_SUCCESSFUL) { return RTEMS_UNSATISFIED; } mutex_init(); mi_startup(); return RTEMS_SUCCESSFUL; }
rtems_task Init( rtems_task_argument argument ) { rtems_time_of_day time; uint32_t index; rtems_status_code status; puts( "\n\n*** TEST 30 ***" ); build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); /* initiate with bad priority */ puts( "timer_initiate_server -- INVALID_PRIORITY" ); status = rtems_timer_initiate_server( 1000, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); fatal_directive_status( status, RTEMS_INVALID_PRIORITY, "rtems_timer_initiate_server bad priority" ); puts( "timer_initiate_server -- OK" ); status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( status, "rtems_timer_initiate_server" ); puts( "timer_initiate_server -- already started" ); status = rtems_timer_initiate_server( RTEMS_TIMER_SERVER_DEFAULT_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); fatal_directive_status( status, RTEMS_INCORRECT_STATE, "rtems_timer_initiate_server already started" ); /* * Create test tasks */ Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); for ( index = 1 ; index <= 3 ; index++ ) { status = rtems_task_create( Task_name[ index ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ index ] ); directive_failed( status, "rtems_task_create loop" ); status = rtems_timer_create( Timer_name[ index ], &Timer_id[ index ] ); directive_failed( status, "rtems_timer_create loop" ); } for ( index = 1 ; index <= 3 ; index++ ) { status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); directive_failed( status, "rtems_task_start loop" ); } status = rtems_task_delete( RTEMS_SELF ); directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); }
rtems_task Init(rtems_task_argument argument) { rtems_status_code sc = RTEMS_SUCCESSFUL; char region_area [256]; enum resource_type rt = SEMAPHORE; void *new_region_item = NULL; size_t i = 0; puts("\n\n*** TEST 68 ***"); 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_semaphore_create( rtems_build_name('S', 'E', 'M', 'A'), 0, RTEMS_LOCAL | RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE, 0, &semaphore ); directive_failed(sc, "rtems_semaphore_create"); sc = rtems_semaphore_create( rtems_build_name('M', 'U', 'T', 'X'), 0, RTEMS_LOCAL | RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE, 0, &mutex ); directive_failed(sc, "rtems_semaphore_create"); sc = rtems_message_queue_create( rtems_build_name('M', 'S', 'G', 'Q'), 1, 1, RTEMS_LOCAL | RTEMS_FIFO, &message_queue ); directive_failed(sc, "rtems_message_queue_create"); sc = rtems_region_create( rtems_build_name('R', 'E', 'G', 'I'), region_area, sizeof(region_area), 1, RTEMS_LOCAL | RTEMS_FIFO, ®ion ); directive_failed(sc, "rtems_region_create"); do { region_item = new_region_item; sc = rtems_region_get_segment( region, 1, RTEMS_NO_WAIT, 0, &new_region_item); } while (sc == RTEMS_SUCCESSFUL); sc = rtems_barrier_create( rtems_build_name('B', 'A', 'R', 'R'), RTEMS_LOCAL | RTEMS_FIFO, 2, &barrier ); directive_failed(sc, "rtems_barrier_create"); while (rt <= TASK_WAKE_AFTER) { test_case(rt); ++rt; } puts("*** END OF TEST 68 ***"); rtems_test_exit(0); }
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); }
rtems_task Init( rtems_task_argument argument ) { rtems_status_code status; rtems_id timer_id; rtems_name timer_name; rtems_time_of_day global_time; rtems_time_of_day time_to_fire; puts( "\n\n*** TEST " TEST_NUMBER " ***" ); /* build timer name*/ timer_name = rtems_build_name('T', 'M', '1', ' '); /* create Timer */ status = rtems_timer_create(timer_name, &timer_id); directive_failed( status, "rtems_timer_create" ); #if defined(USE_TIMER_SERVER) /* initiate timer server */ status = rtems_timer_initiate_server( RTEMS_MINIMUM_PRIORITY, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_ATTRIBUTES ); directive_failed( status, "rtems_timer_initiate_server" ); #endif /* Set system clock */ build_time(&global_time, 6, 8, 2009, 16, 5, INITIAL_SECOND, 0); status = rtems_clock_set(&global_time); directive_failed( status, "rtems_clock_set" ); /* Set Timer to Fire */ /* build fire times */ time_to_fire = global_time; /* only diferent second */ time_to_fire.second = INITIAL_SECOND + 5; status = FIRE_WHEN( timer_id, &time_to_fire, TIMER_service_routine, (void*) NULL ); directive_failed( status, FIRE_WHEN_STRING ); /* Set system clock FORWARD */ global_time.second = INITIAL_SECOND + 10; status = rtems_clock_set(&global_time); if (!_timer_passage) { puts( TSR_MODE " Timer FAILED to fire after setting time forward"); rtems_test_exit(0); } puts( TSR_MODE " Timer fired after setting time forward -- OK"); puts( "*** END OF TEST " TEST_NUMBER " ***" ); 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" ); }