X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <010401c4ba9f$bedf7b20$d2b82951@josepmariaxp> From: "JM Rams" To: Subject: Timer inside interrupt handler Date: Mon, 25 Oct 2004 16:34:25 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0101_01C4BAB0.7D4B6500" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2741.2600 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2742.200 X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. ------=_NextPart_000_0101_01C4BAB0.7D4B6500 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have use uclock to see the latency of my 0,5 ms interrupt. But I have = problems because I use uclock outside of the interrupt. I have made a = copy of uclock to use 2ond timer of 8253. Now it works fine inside = interrupt. long long oclock() { return oclock_2(0x40,2); //timer 2on //return oclock_2(0x40,0); //timer 1er usat per uclock } long long oclock_2(int base,int quin) { static long long basic=3D0; static long long tics=3D0,tics_vells; unsigned int msb,lsb; int quin2; quin2=3Dquin<<6; if((basic=3D=3D0)&&(tics=3D=3D0)){ if(quin=3D=3D2){ unsigned char entr; entr=3Dinportb(0x61); outportb(0x61,entr|0x1); } outportb(base+3,quin2|0x34); outportb(base+quin,0x00); outportb(base+quin,0x00); } outportb(base+3,quin2); lsb=3Dinportb(base+quin); msb=3Dinportb(base+quin); tics=3D((long long)msb<<8)|(long long)lsb; tics=3D0x10000-tics; if(tics
 
I have use uclock to see the latency of = my 0,5 ms=20 interrupt. But I have problems because I use uclock outside of the = interrupt. I=20 have made a copy of uclock to use 2ond timer of 8253. Now it works fine = inside=20 interrupt.
 
 
 
 
 
 
 
 
long long oclock()
{
return=20 oclock_2(0x40,2);     //timer 2on
//return=20 oclock_2(0x40,0);  //timer 1er usat per = uclock
}
 

long long oclock_2(int base,int quin)
{
static long long=20 basic=3D0;
static long long tics=3D0,tics_vells;
unsigned int = msb,lsb;
int=20 quin2;
quin2=3Dquin<<6;
 
if((basic=3D=3D0)&&(tics=3D=3D0)){
   =20 if(quin=3D=3D2){
        unsigned = char=20 entr;
       =20 entr=3Dinportb(0x61);
       =20 outportb(0x61,entr|0x1);
    =  }
   =20 outportb(base+3,quin2|0x34);
   =20 outportb(base+quin,0x00);
   =20 outportb(base+quin,0x00);
 }
 
outportb(base+3,quin2);
lsb=3Dinportb(base+quin);
msb=3Dinport= b(base+quin);
tics=3D((long=20 long)msb<<8)|(long=20 long)lsb;
tics=3D0x10000-tics;
if(tics<tics_vells)basic=3Dbasic+= 1;
tics_vells=3Dtics;
tics=3Dtics+(basic<<16);
return=20 tics;
}
 
 
 
 
------=_NextPart_000_0101_01C4BAB0.7D4B6500--