Changeset 9e738b65 in rtems
- Timestamp:
- 07/20/95 19:20:31 (28 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 1690c6b
- Parents:
- 3b170f5
- Location:
- c/src/lib/libbsp/i386
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/force386/include/bsp.h
r3b170f5 r9e738b65 41 41 */ 42 42 43 #define MUST_WAIT_FOR_INTERRU TPT 043 #define MUST_WAIT_FOR_INTERRUPT 0 44 44 45 45 #define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 ) -
c/src/lib/libbsp/i386/go32/include/bsp.h
r3b170f5 r9e738b65 39 39 * Define the interrupt mechanism for Time Test 27 40 40 * 41 * NOTE: Use a software interrupt for the i386.41 * NOTE: Use a software interrupt for the i386 family. 42 42 */ 43 #define MUST_WAIT_FOR_INTERRU TPT 043 #define MUST_WAIT_FOR_INTERRUPT 0 44 44 #define Install_tm27_vector( handler ) set_vector( (handler), 0x90, 1 ) 45 45 #define Cause_tm27_intr() asm volatile( "int $0x90" : : ); 46 46 #define Clear_tm27_intr() 47 47 #define Lower_tm27_intr() 48 49 48 50 49 /* … … 106 105 #define TIMER_BCD 0x01 /* count in BCD */ 107 106 107 #define CLOCK_DISABLE() \ 108 ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask | 1 ); }) 109 #define CLOCK_ENABLE() \ 110 ({ char mask; inport_byte( 0x21, mask ); outport_byte( 0x21, mask & ~1); }) 111 108 112 /* The internal tick rate in ticks per second */ 109 113 #define TIMER_TICK 1193182 … … 155 159 /* end of include file */ 156 160 161 -
c/src/lib/libbsp/i386/go32/startup/setvec.c
r3b170f5 r9e738b65 38 38 39 39 if ( type ) { 40 rtems_interrupt_catch( handler, vector, 41 (rtems_isr_entry *) &previous_isr ); 40 rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr); 42 41 } else { 43 /* Interrupt goes straight to the supplied ISR. This code is */ 44 /* slightly different than that in _CPU_ISR_install_vector */ 45 /* (which is eventually called by the above) in that this code */ 46 /* returns the raw entry point as the old handler, while the */ 47 /* other version returns the old entry point pointed at by the */ 48 /* rtems ISR table. */ 49 _go32_dpmi_seginfo handler_info; 50 51 /* get the address of the old handler */ 52 _go32_dpmi_get_protected_mode_interrupt_vector( vector, &handler_info); 53 54 /* Notice how we're failing to save the pm_segment portion of the */ 55 /* structure here? That means we might crash the system if we */ 56 /* try to restore the ISR. Can't fix this until i386_isr is */ 57 /* redefined. XXX [BHC]. */ 58 previous_isr = (i386_isr_entry) handler_info.pm_offset; 59 60 /* install the IDT entry */ 61 handler_info.pm_offset = (u_long)handler; 62 handler_info.pm_selector = _go32_my_cs(); 63 _go32_dpmi_set_protected_mode_interrupt_vector( vector, &handler_info); 42 _CPU_ISR_install_raw_handler( vector, handler, (proc_ptr *)&previous_isr); 64 43 } 65 44 return previous_isr; -
c/src/lib/libbsp/i386/go32/timer/timer.c
r3b170f5 r9e738b65 21 21 */ 22 22 23 24 23 #include <rtems.h> 25 24 #include <bsp.h> … … 36 35 return result; 37 36 } 37 static void restore_timer( void ) 38 { 39 CLOCK_ENABLE(); 40 } 38 41 #else /* pentium */ 39 42 rtems_isr timerisr(); … … 42 45 void Timer_initialize() 43 46 { 47 static int First = 1; 44 48 #if defined(pentium) 49 if ( First ) { 50 extern int atexit( void (*)(void) ); 51 First = 0; 52 /* Disable the programmable timer. */ 53 CLOCK_DISABLE(); 54 /* Try not to hose the system on return to DOS. */ 55 atexit( restore_timer ); 56 } 45 57 Ttimer_val = rdtsc(); 46 58 #else /* pentium */ 47 static int First = 1; 59 60 #define WAIT() \ 61 { \ 62 Ttimer_val = 0; \ 63 while ( Ttimer_val == 0 ) \ 64 continue; \ 65 Ttimer_val = 0; \ 66 } 67 48 68 if ( First ) { 69 First = 0; 70 49 71 /* install ISR */ 50 72 set_vector( timerisr, 0x8, 0 ); 51 73 52 /* Wait for ISR to be called at least once */ 53 Ttimer_val = 0; 54 while ( Ttimer_val == 0 ) 55 continue; 74 /* Wait for ISR to be called at least once */ 75 WAIT(); 56 76 57 /* load timer for 250 microsecond period */ 58 outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); 59 outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 0 & 0xff); 60 outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 8 & 0xff); 77 /* load timer for 250 microsecond period */ 78 outport_byte( TIMER_MODE, TIMER_SEL0|TIMER_16BIT|TIMER_RATEGEN ); 79 outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 0 & 0xff); 80 outport_byte( TIMER_CNTR0, US_TO_TICK(250) >> 8 & 0xff); 81 } 61 82 62 First = 0; 63 } 64 Ttimer_val = 0; /* clear timer ISR count */ 83 /* Wait for ISR to be called at least once */ 84 WAIT(); 65 85 #endif /* PENTIUM */ 66 86 } … … 82 102 inport_byte( TIMER_CNTR0, msb ); 83 103 clicks = msb << 8 | lsb; 84 total = Ttimer_val + 250 - TICK_TO_US( clicks);104 total = Ttimer_val + (250 - TICK_TO_US( clicks )); 85 105 #endif /* pentium */ 86 106 … … 105 125 Timer_driver_Find_average_overhead = find_flag; 106 126 } 127 -
c/src/lib/libbsp/i386/go32/timer/timerisr.s
r3b170f5 r9e738b65 27 27 PUBLIC(timerisr) 28 28 29 SYM (timerisr): 30 31 pushedx32 pusheax33 movw$0x20,dx34 movedx,eax35 outb al,(dx)# touch interrupt controller36 popeax37 popedx38 29 SYM (timerisr): 30 addl $250,_Ttimer_val # another 250 microseconds 31 push edx 32 push eax 33 movw $0x20,dx 34 mov edx,eax 35 outb al,(dx) # touch interrupt controller 36 pop eax 37 pop edx 38 iret 39 39 40 40 END_CODE
Note: See TracChangeset
for help on using the changeset viewer.