Mail Archives: djgpp/2003/07/22/04:12:36
"Charles Sandmann" <sandmann AT clio DOT rice DOT edu> a écrit dans le message de news:
3f16be73 DOT sandmann AT clio DOT rice DOT edu...
> > problem: Because I use my own timer interrupt,
> > the PC clock will not be updated during the time I run
> > the sequencer. Is it possible to jump from my interrupt routine
> > to the PC timer interrupt once in a while, to update the PC clock
> > at 18.2 Hz? Or is there another way to solve the problem?
instead of using the PC clock interrupt why you don't use int 70h ? this one
is 1/1024s based.
timebase can be reprogrammed if needed.
#define INT_ISR 0x0B
#define INT_EOI 0x20
#define INT_CRM 0x20
#define INT_CRS 0xA0
#define __CMOS_PORT_ADR 0x70
#define __CMOS_PORT_DATA 0x71
//CMOS component setting should not be change during pc clock update
// this proc check if CMOS is in an update cycle. if yes, it waits the cycle
end.
static void WaitEndCMOSUpdateCycle( void )
{
/* Attend debut du cycle
*/
do outp( __CMOS_PORT_ADR, 0x0a );
while( !( inp( __CMOS_PORT_DATA ) & 0x80 ) );
/* Attend fin du cycle
*/
do outp( __CMOS_PORT_ADR, 0x0a );
while( ( inp( __CMOS_PORT_DATA ) & 0x80 ) );
}
// int70h handler
void PieHandler( void )
{
register char t1, t2;
_disable();
outp( INT_CRS, INT_ISR );
if ( !( inp( INT_CRS ) & 0x01 ) )
{
_enable();
return;
}
outp( __CMOS_PORT_ADR, 0x0b );
t1 = ( char )inp( __CMOS_PORT_DATA );
outp( __CMOS_PORT_ADR, 0x0c );
t2 = ( char )inp( __CMOS_PORT_DATA );
if ( ( t1 & t2 & 0x40 ) != 0x40 )
{
_enable();
return;
}
// put your own code here
outp( INT_CRM, INT_EOI );
outp( INT_CRS, INT_EOI );
_enable();
}
void PieSetIrq( void )
{
int imr;
WaitEndCMOSUpdateCycle();
_disable();
// setup the interrupt handler here
imr = inp( INT_CRS + 1 );
restoreimr = ( imr & 1 ) != 0;
if ( restoreimr )
outp( INT_CRS+ 1, imr & 0xfe );
/* tell CMOS to generate the PIE */
outp( __CMOS_PORT_ADR, 0x0b );
t = ( char )inp( __CMOS_PORT_DATA );
outp( __CMOS_PORT_ADR, 0x0b );
outp( __CMOS_PORT_DATA, ( char )( ( t & 0x7F ) | 0x40 ) );
_enable();
}
>
> Chain to the original interrupt. You will have to write your own
> wrapper to do it; you might find the library source useful.
> Start from the V2.03 (or V2.04 CVS) sources, I think they fix some
> problems in the V2.01 routines.
>
> > Erik Berglund
> > Gothenbrug, Sweden
>
> Amazing small world - that's where I am right now too :-)
- Raw text -