From: "Florent Laudren" Newsgroups: comp.os.msdos.djgpp Subject: Re: Jump from timer interrupt? Date: Tue, 22 Jul 2003 09:54:32 +0200 Organization: Wanadoo, l'internet avec France Telecom Lines: 111 Message-ID: References: <3f16be73 DOT sandmann AT clio DOT rice DOT edu> NNTP-Posting-Host: abordeaux-103-1-14-133.w81-48.abo.wanadoo.fr X-Trace: news-reader1.wanadoo.fr 1058860476 18791 81.48.84.133 (22 Jul 2003 07:54:36 GMT) X-Complaints-To: abuse AT wanadoo DOT fr NNTP-Posting-Date: 22 Jul 2003 07:54:36 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Charles Sandmann" 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 :-)