Mail Archives: djgpp/2004/10/25/10:35:14
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
Message-ID: | <010401c4ba9f$bedf7b20$d2b82951@josepmariaxp>
|
From: | "JM Rams" <josepmaria AT turomas DOT com>
|
To: | <djgpp AT delorie DOT com>
|
Subject: | Timer inside interrupt handler
|
Date: | Mon, 25 Oct 2004 16:34:25 +0200
|
MIME-Version: | 1.0
|
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<tics_vells)basic=3Dbasic+1;
tics_vells=3Dtics;
tics=3Dtics+(basic<<16);
return tics;
}
------=_NextPart_000_0101_01C4BAB0.7D4B6500
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2745.2800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>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.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>long long oclock()<BR>{<BR>return=20
oclock_2(0x40,2); //timer 2on<BR>//return=20
oclock_2(0x40,0); //timer 1er usat per =
uclock<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>long long oclock_2(int base,int quin)<BR>{<BR>static long long=20
basic=3D0;<BR>static long long tics=3D0,tics_vells;<BR>unsigned int =
msb,lsb;<BR>int=20
quin2;<BR>quin2=3Dquin<<6;</DIV>
<DIV> </DIV>
<DIV>if((basic=3D=3D0)&&(tics=3D=3D0)){<BR> =20
if(quin=3D=3D2){<BR> unsigned =
char=20
entr;<BR> =20
entr=3Dinportb(0x61);<BR> =20
outportb(0x61,entr|0x1);<BR> =
}<BR> =20
outportb(base+3,quin2|0x34);<BR> =20
outportb(base+quin,0x00);<BR> =20
outportb(base+quin,0x00);<BR> }</DIV>
<DIV> </DIV>
<DIV>outportb(base+3,quin2);<BR>lsb=3Dinportb(base+quin);<BR>msb=3Dinport=
b(base+quin);<BR>tics=3D((long=20
long)msb<<8)|(long=20
long)lsb;<BR>tics=3D0x10000-tics;<BR>if(tics<tics_vells)basic=3Dbasic+=
1;<BR>tics_vells=3Dtics;<BR>tics=3Dtics+(basic<<16);<BR>return=20
tics;<BR>}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></FONT> </DIV></BODY></HTML>
------=_NextPart_000_0101_01C4BAB0.7D4B6500--
- Raw text -