diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-08-05 16:51:39 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-08-05 16:51:39 +0000 |
commit | bd8c8b2a855f3219e3c4c73c9e67eb4bd6d473d7 (patch) | |
tree | d9f1b7bf8ee4865c1e485e2b161c5709e2b6b75d /c/src/lib/libbsp/i386/i386ex/timer | |
parent | changed load address (diff) | |
download | rtems-bd8c8b2a855f3219e3c4c73c9e67eb4bd6d473d7.tar.bz2 |
Patch from Eric Valette <valette@crf.canon.fr> which brings the i386ex BSP
inline with the new IRQ structure.
Diffstat (limited to 'c/src/lib/libbsp/i386/i386ex/timer')
-rw-r--r-- | c/src/lib/libbsp/i386/i386ex/timer/timer.c | 60 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/i386ex/timer/timerisr.s | 6 |
2 files changed, 61 insertions, 5 deletions
diff --git a/c/src/lib/libbsp/i386/i386ex/timer/timer.c b/c/src/lib/libbsp/i386/i386ex/timer/timer.c index af0217ef8d..4c29d6c57f 100644 --- a/c/src/lib/libbsp/i386/i386ex/timer/timer.c +++ b/c/src/lib/libbsp/i386/i386ex/timer/timer.c @@ -27,11 +27,13 @@ #include <rtems.h> #include <bsp.h> +#include <stdlib.h> int Ttimer_val; rtems_boolean Timer_driver_Find_average_overhead; -rtems_isr timerisr(); +extern void timerisr(); +extern int ClockIsOn(const rtems_raw_irq_connect_data*); #define TMR0 0xF040 #define TMR1 0xF041 @@ -39,11 +41,9 @@ rtems_isr timerisr(); #define TMRCON 0xF043 #define TMRCFG 0xF834 -void Timer_initialize() +void TimerOn(const rtems_raw_irq_connect_data* used) { - (void) set_vector( timerisr, 0x2a, 0 ); /* install ISR ( IR2 ) was 0x38*/ - Ttimer_val = 0; /* clear timer ISR count */ outport_byte ( TMRCON , 0xb0 ); /* select tmr2, stay in mode 0 */ @@ -51,8 +51,58 @@ void Timer_initialize() outport_byte ( TMR1 , 0x00 ); outport_byte ( TMRCON , 0x64 ); /* change to mode 2 ( starts timer ) */ /* interrupts ARE enabled */ -/* outport_byte( IERA, 0x41 ); enable interrupt */ + /* outport_byte( IERA, 0x41 ); enable interrupt */ + /* + * enable interrrupt at i8259 level + */ + pc386_irq_enable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE); +} + +void TimerOff(const rtems_raw_irq_connect_data* used) +{ + /* + * disable interrrupt at i8259 level + */ + pc386_irq_disable_at_i8259s(used->idtIndex - PC386_IRQ_VECTOR_BASE); + /* reset timer mode to standard (DOS) value */ +} + +static rtems_raw_irq_connect_data timer_raw_irq_data = { + PC_386_RT_TIMER3 + PC386_IRQ_VECTOR_BASE, + timerisr, + TimerOn, + TimerOff, + ClockIsOn +}; + +void Timer_exit() +{ + if (!i386_delete_idt_entry(&timer_raw_irq_data)) { + printk("Timer raw handler deconnexion failed\n"); + rtems_fatal_error_occurred(1); + } +} + +void Timer_initialize() +{ + + static rtems_boolean First = TRUE; + if (First) + { + First = FALSE; + + atexit(Timer_exit); /* Try not to hose the system at exit. */ + if (!i386_set_idt_entry (&timer_raw_irq_data)) { + printk("raw handler connexion failed\n"); + rtems_fatal_error_occurred(1); + } + } + /* wait for ISR to be called at least once */ + Ttimer_val = 0; + while (Ttimer_val == 0) + continue; + Ttimer_val = 0; } #define AVG_OVERHEAD 3 /* It typically takes 3.0 microseconds */ diff --git a/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s b/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s index 3264248b05..53463e1e70 100644 --- a/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s +++ b/c/src/lib/libbsp/i386/i386ex/timer/timerisr.s @@ -28,6 +28,12 @@ PUBLIC (timerisr) SYM (timerisr): addl $250, SYM (Ttimer_val) # another 250 microseconds + pushl eax + movb 0xa0,al /* signal generic End Of Interrupt (EOI) to slave PIC */ + outb al, $0x20 + movb $0x20, al + outb al, $0x20 /* signal generic EOI to Master PIC */ + popl eax iret END_CODE |