static rtems_isr clockISR(rtems_vector_number vector) { Clock_driver_ticks += 1; #if CLOCK_DRIVER_USE_FAST_IDLE do { rtems_clock_tick(); } while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->is_idle ); #else rtems_clock_tick(); #endif }
static rtems_isr clockISR(rtems_vector_number vector) { Clock_driver_ticks += 1; #if CLOCK_DRIVER_USE_FAST_IDLE do { rtems_clock_tick(); } while ( _Thread_Heir == _Thread_Executing && _Thread_Executing->Start.Entry.Kinds.Idle.entry == rtems_configuration_get_idle_task() ); #else rtems_clock_tick(); #endif }
/* * Isr Handler */ static rtems_isr Clock_isr( rtems_vector_number vector ) { /* * bump the number of clock driver ticks since initialization * * determine if it is time to announce the passing of tick as configured * to RTEMS through the rtems_clock_tick directive * * perform any timer dependent tasks */ uint8_t temp; /* reset the flags of the status register */ temp = read8( ITU_TSR0) & ITU_STAT_MASK; write8( temp, ITU_TSR0); Clock_driver_ticks++ ; if( Clock_isrs == 1) { rtems_clock_tick(); Clock_isrs = Clock_isrs_const; } else { Clock_isrs-- ; } }
/****************************************************** Name: Clock_isr Input parameters: irq vector Output parameters: none Description: update # of clock ticks *****************************************************/ rtems_isr Clock_isr (rtems_vector_number vector) { /* * Announce the clock tick */ Clock_driver_ticks++; rtems_clock_tick(); }
void Clock_isr(rtems_irq_hdl_param unused) { /* enable_tracing(); */ Clock_driver_ticks += 1; if ( Clock_isrs == 1 ) { rtems_clock_tick(); Clock_isrs = Clock_initial_isr_value; /* rtems_configuration_get_microseconds_per_tick() / 1000;*/ } else Clock_isrs -= 1; }
rtems_isr Clock_isr(rtems_vector_number vector) { Clock_driver_ticks += 1; if ( Clock_isrs == 1 ) { rtems_clock_tick(); Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; } else Clock_isrs -= 1; }
rtems_isr Clock_isr(rtems_vector_number vector) { Clock_driver_ticks += 1; pcc->timer2_int_control |= 0x80; /* Acknowledge interr. */ if (Clock_isrs == 1) { rtems_clock_tick(); Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; } else Clock_isrs -= 1; }
rtems_isr Clock_isr(rtems_vector_number vector) { Clock_driver_ticks += 1; lcsr->timer_cnt_2 = 0; /* clear counter */ lcsr->intr_clear |= 0x02000000; if ( Clock_isrs == 1 ) { rtems_clock_tick(); Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; } else Clock_isrs -= 1; }
/* Clock_isr -- * This handles the timer interrupt by clearing the timer's interrupt * flag and announcing the clock tick to the system. * * PARAMETERS: * vector - timer interrupt vector number * RETURNS: * none */ rtems_isr Clock_isr (rtems_vector_number vector) { /* Clear pending interrupt... */ g_timer_regs->ter1 = MCF5272_TER_REF | MCF5272_TER_CAP; /* Announce the clock tick */ Clock_driver_ticks++; rtems_clock_tick(); if (rtems_clock_hook != NULL) { rtems_clock_hook(vector); } }
/* * Clock_isr * * Clock interrupt handling routine. */ static rtems_isr Clock_isr(rtems_vector_number vector) { uint16_t tcr; /* reset the timer underflow flag */ tcr = read16(SH7750_TCR0); write16(tcr & ~SH7750_TCR_UNF, SH7750_TCR0); /* Increment the clock interrupt counter */ Clock_driver_ticks++ ; /* Invoke rtems clock service routine */ rtems_clock_tick(); }
rtems_isr Clock_isr( rtems_vector_number vector ) { Clock_driver_ticks += 1; ((volatile struct z8036_map *) TIMER)->CT1_CMD_STATUS = RELOAD; if ( Clock_isrs == 1 ) { rtems_clock_tick(); Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; } else Clock_isrs -= 1; }
/* * Since there is no interrupt on this simulator, let's just * fake time passing. This will not let preemption from an * interrupt work but is enough for many tests. */ Thread clock_driver_sim_idle_body( uintptr_t ignored ) { for( ; ; ) { if ( clock_driver_enabled ) { _Thread_Disable_dispatch(); _ISR_Nest_level++; rtems_clock_tick(); _ISR_Nest_level--; _Thread_Enable_dispatch(); } } return 0; /* to avoid warning */ }
/* * ISR Handler */ static rtems_isr Clock_isr( rtems_vector_number vector ) { Clock_driver_ticks += 1; m302.reg.isr = RBIT_ISR_TIMER1; /* clear in-service bit */ m302.reg.ter1 = (RBIT_TER_REF | RBIT_TER_CAP); /* clear timer intr request */ if ( Clock_isrs == 1 ) { rtems_clock_tick(); Clock_isrs = rtems_configuration_get_microseconds_per_tick() / 1000; } else Clock_isrs -= 1; }
rtems_isr Clock_isr( rtems_vector_number vector ) { /* * bump the number of clock driver ticks since initialization * * determine if it is time to announce the passing of tick as configured * to RTEMS through the rtems_clock_tick directive * * perform any timer dependent tasks */ reset_wdt(); /* Reset hardware watchdog timer */ Clock_driver_ticks += 1; rtems_clock_tick(); }
rtems_isr Clock_isr( rtems_vector_number vector ) { Clock_driver_ticks += 1; /* acknowledge interrupt MC68230_TSR = 1; */ MC68230_WRITE (MC68230_TSR, 1); if ( Clock_isrs == 1 ) { rtems_clock_tick(); /* Cast to an integer so that 68EC040 IDP which doesn't have an FPU doesn't have a heart attack -- if you use newlib1.6 or greater and get libgcc.a for gcc with software floating point support, this is not a problem */ Clock_isrs = (int)(rtems_configuration_get_microseconds_per_tick() / 1000); } else Clock_isrs -= 1; }
void Clock_isr(void* handle) { Clock_driver_ticks++; rtems_clock_tick(); }
rtems_task Task_1( rtems_task_argument argument ) { rtems_name name RTEMS_GCC_NOWARN_UNUSED; uint32_t index RTEMS_GCC_NOWARN_UNUSED; rtems_id id RTEMS_GCC_NOWARN_UNUSED; rtems_task_priority in_priority RTEMS_GCC_NOWARN_UNUSED; rtems_task_priority out_priority RTEMS_GCC_NOWARN_UNUSED; rtems_mode in_mode RTEMS_GCC_NOWARN_UNUSED; rtems_mode mask RTEMS_GCC_NOWARN_UNUSED; rtems_mode out_mode RTEMS_GCC_NOWARN_UNUSED; rtems_time_of_day time RTEMS_GCC_NOWARN_UNUSED; rtems_interval timeout RTEMS_GCC_NOWARN_UNUSED; rtems_signal_set signals RTEMS_GCC_NOWARN_UNUSED; void *address_1 RTEMS_GCC_NOWARN_UNUSED; rtems_event_set events RTEMS_GCC_NOWARN_UNUSED; long buffer[ 4 ] RTEMS_GCC_NOWARN_UNUSED; uint32_t count RTEMS_GCC_NOWARN_UNUSED; rtems_device_major_number major RTEMS_GCC_NOWARN_UNUSED; rtems_device_minor_number minor RTEMS_GCC_NOWARN_UNUSED; uint32_t io_result RTEMS_GCC_NOWARN_UNUSED; uint32_t error RTEMS_GCC_NOWARN_UNUSED; rtems_clock_get_options options RTEMS_GCC_NOWARN_UNUSED; name = rtems_build_name( 'N', 'A', 'M', 'E' ); in_priority = 250; in_mode = RTEMS_NO_PREEMPT; mask = RTEMS_PREEMPT_MASK; timeout = 100; signals = RTEMS_SIGNAL_1 | RTEMS_SIGNAL_3; major = 10; minor = 0; error = 100; options = 0; /* rtems_shutdown_executive */ benchmark_timer_initialize(); for ( index=1 ; index <= OPERATION_COUNT ; index++ ) (void) rtems_shutdown_executive( error ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_shutdown_executive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_create( name, in_priority, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_start */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_start( id, Task_1, 0 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_start", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_restart */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_restart( id, 0 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_restart", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_suspend */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_suspend( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_suspend", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_resume */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_resume( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_resume", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_set_priority */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_set_priority( id, in_priority, &out_priority ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_set_priority", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_mode */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_mode( in_mode, mask, &out_mode ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_mode", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_wake_when */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_wake_when( time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_wake_when", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_task_wake_after */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_task_wake_after( timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_task_wake_after", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_interrupt_catch */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_interrupt_catch( Isr_handler, 5, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_interrupt_catch", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_get */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_get( options, time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_get", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_set */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_set( time ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_set", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_clock_tick */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_clock_tick(); end_time = benchmark_timer_read(); put_time( "overhead: rtems_clock_tick", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_timer_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_create( name, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_fire_after */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_fire_after( id, timeout, Timer_handler, NULL ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_fire_after", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_fire_when */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_fire_when( id, time, Timer_handler, NULL ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_fire_when", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_reset */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_reset( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_reset", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_timer_cancel */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_timer_cancel( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_timer_cancel", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_create( name, 128, RTEMS_DEFAULT_ATTRIBUTES, RTEMS_NO_PRIORITY, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_obtain */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_obtain", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_semaphore_release */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_semaphore_release( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_semaphore_release", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_create( name, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_send( id, (long (*)[4])buffer ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_urgent */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_urgent( id, (long (*)[4])buffer ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_urgent", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_broadcast */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_broadcast( id, (long (*)[4])buffer, &count ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_broadcast", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_receive */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_receive( id, (long (*)[4])buffer, RTEMS_DEFAULT_OPTIONS, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_receive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_message_queue_flush */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_message_queue_flush( id, &count ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_message_queue_flush", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_event_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_event_send( id, events ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_event_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_event_receive */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_event_receive( RTEMS_EVENT_16, RTEMS_DEFAULT_OPTIONS, timeout, &events ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_event_receive", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_signal_catch */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_signal_catch( Asr_handler, RTEMS_DEFAULT_MODES ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_signal_catch", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_signal_send */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_signal_send( id, signals ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_signal_send", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_create( name, Memory_area, 2048, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_ident( name, RTEMS_SEARCH_ALL_NODES, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_get_buffer */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_get_buffer( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_get_buffer", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_partition_return_buffer */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_partition_return_buffer( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_partition_return_buffer", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_create( name, Memory_area, 2048, 128, RTEMS_DEFAULT_ATTRIBUTES, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_get_segment */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_get_segment( id, 243, RTEMS_DEFAULT_OPTIONS, timeout, &address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_get_segment", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_region_return_segment */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_region_return_segment( id, address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_region_return_segment", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_create( name, Internal_port_area, External_port_area, 0xff, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_external_to_internal */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_external_to_internal( id, &External_port_area[ 7 ], address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_external_to_internal", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_port_internal_to_external */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_port_internal_to_external( id, &Internal_port_area[ 7 ], address_1 ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_port_internal_to_external", end_time, OPERATION_COUNT, overhead, 0 ); rtems_test_pause(); /* rtems_io_initialize */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_initialize( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_initialize", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_open */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_open( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_open", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_close */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_close( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_close", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_read */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_read( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_read", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_write */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_write( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_write", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_io_control */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_io_control( major, minor, address_1, &io_result ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_io_control", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_fatal_error_occurred */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_fatal_error_occurred( error ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_fatal_error_occurred", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_create */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_create( name, &id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_create", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_ident */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_ident( name, id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_ident", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_delete */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_delete( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_delete", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_cancel */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_cancel( id ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_cancel", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_rate_monotonic_period */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_rate_monotonic_period( id, timeout ); end_time = benchmark_timer_read(); put_time( "overhead: rtems_rate_monotonic_period", end_time, OPERATION_COUNT, overhead, 0 ); /* rtems_multiprocessing_announce */ benchmark_timer_initialize(); for ( index = 1 ; index <= OPERATION_COUNT ; index ++ ) (void) rtems_multiprocessing_announce(); end_time = benchmark_timer_read(); put_time( "overhead: rtems_multiprocessing_announce", end_time, OPERATION_COUNT, overhead, 0 ); TEST_END(); rtems_test_exit( 0 ); }
void Clock_isr(int vector) { Clock_driver_ticks++; rtems_clock_tick(); }
rtems_task Init( rtems_task_argument argument ) { int cpu_num; rtems_id id; rtems_status_code status; locked_print_initialize(); locked_printf( "\n\n*** TEST SMP06 ***\n" ); locked_printf( "rtems_clock_tick - so this task has run longer\n" ); status = rtems_clock_tick(); directive_failed( status, "clock tick" ); rtems_test_assert( rtems_smp_get_number_of_processors() > 1 ); cpu_num = bsp_smp_processor_id(); /* * Create a task at equal priority. */ Ran = false; status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), 2, RTEMS_MINIMUM_STACK_SIZE, RTEMS_PREEMPT, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "task create" ); locked_printf(" CPU %d start task TA1\n", cpu_num ); status = rtems_task_start( id, Test_task, 0 ); directive_failed( status, "task start" ); while ( Ran == false ) ; /* * Create a task at greater priority. */ Ran = false; status = rtems_task_create( rtems_build_name( 'T', 'A', '2', ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_PREEMPT, RTEMS_DEFAULT_ATTRIBUTES, &id ); directive_failed( status, "task create" ); cpu_num = bsp_smp_processor_id(); locked_printf(" CPU %d start task TA2\n", cpu_num ); status = rtems_task_start( id, Test_task, 1 ); directive_failed( status, "task start" ); while ( 1 ) ; }
rtems_task Init( rtems_task_argument argument ) { rtems_time_of_day time; rtems_status_code status; rtems_interrupt_level level; rtems_mode level_mode_body; rtems_mode level_mode_macro; bool in_isr; rtems_id timer; int i; puts( "\n\n*** TEST 37 ***" ); test_isr_level(); test_isr_locks(); test_interrupt_locks(); build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); status = rtems_clock_set( &time ); directive_failed( status, "rtems_clock_set" ); /* * Timer used in multiple ways */ status = rtems_timer_create( 1, &timer ); directive_failed( status, "rtems_timer_create" ); /* * Test clock tick from outside ISR */ status = rtems_clock_tick(); directive_failed( status, "rtems_clock_tick" ); puts( "clock_tick from task level" ); /* * Now do a dispatch directly out of a clock tick that is * called from a task. We need to create a task that will * block so we have one to unblock. Then we schedule a TSR * to run in the clock tick but it has to be careful to * make sure it is not called from an ISR and that the * dispatching critical section is managed properly to * make the dispatch happen. */ blocked_task_status = -1; status = rtems_task_create( rtems_build_name( 'T', 'A', '1', ' ' ), 1, RTEMS_MINIMUM_STACK_SIZE, RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &blocked_task_id ); directive_failed( status, "rtems_task_create" ); status = rtems_task_start( blocked_task_id, blocked_task, 0 ); directive_failed( status, "rtems_task_start" ); status = rtems_task_wake_after( 10 ); directive_failed( status, "rtems_task_wake_after" ); status = rtems_timer_fire_after( timer, 1, test_unblock_task, NULL ); directive_failed( status, "timer_fire_after failed" ); /* we expect to be preempted from this call */ for ( i=0 ; i<100 && blocked_task_status != 3 ; i++ ) { status = rtems_clock_tick(); directive_failed( status, "rtems_clock_tick" ); } switch ( blocked_task_status ) { case -1: puts( "clock_tick with task preempt -- task blocked, timer did not fire" ); rtems_test_exit(0); break; case 1: puts( "clock_tick with task preempt -- timer fired case 1" ); rtems_test_exit(0); break; case 2: puts( "clock_tick with task preempt -- timer fired case 2" ); rtems_test_exit(0); break; case 3: puts( "clock_tick from task level with preempt -- OK" ); break; } /* * Test interrupt inline versions */ test_interrupt_inline(); /* * Test interrupt bodies */ puts( "interrupt is in progress (use body)" ); in_isr = rtems_interrupt_is_in_progress(); if ( in_isr ) { puts( "interrupt reported to be is in progress (body)" ); rtems_test_exit( 0 ); } puts( "interrupt disable (use body)" ); _Thread_Disable_dispatch(); level = rtems_interrupt_disable(); _Thread_Enable_dispatch(); puts( "interrupt disable (use body)" ); _Thread_Disable_dispatch(); level = rtems_interrupt_disable(); _Thread_Enable_dispatch(); puts( "interrupt flash (use body)" ); _Thread_Disable_dispatch(); rtems_interrupt_flash( level ); _Thread_Enable_dispatch(); puts( "interrupt enable (use body)" ); _Thread_Disable_dispatch(); rtems_interrupt_enable( level ); _Thread_Enable_dispatch(); puts( "interrupt level mode (use body)" ); level_mode_body = rtems_interrupt_level_body( level ); level_mode_macro = RTEMS_INTERRUPT_LEVEL(level); if ( level_mode_macro == level_mode_body ) { puts("test seems to work"); } /* * Test ISR in progress from actual ISR */ isr_in_progress_body = -1; isr_in_progress_inline = -1; status = rtems_timer_fire_after( timer, 10, test_isr_in_progress, NULL ); directive_failed( status, "timer_fire_after failed" ); status = rtems_task_wake_after( 100 ); directive_failed( status, "wake_after failed" ); check_isr_worked( "inline", isr_in_progress_body ); check_isr_worked( "body", isr_in_progress_body ); puts( "*** END OF TEST 37 ***" ); rtems_test_exit( 0 ); }
/* * ISR Handler */ rtems_isr Clock_isr(rtems_vector_number vector) { m821.piscr |= M821_PISCR_PS; Clock_driver_ticks++; rtems_clock_tick(); }