Mail Archives: djgpp/2010/03/04/10:34:25
I have the same problem, it is caused by bios processes. I could solve =
this
trouble doing that:
1. I had to disable USB in bios.
2. Disable HDD IDE block mode.
3. In some cards the problem persist, in this case you have to put some =
code
to reprogram chipset.
Test if you can solve your problem with 2 first points
-----Mensaje original-----
De: philippe [mailto:philippe DOT meynard AT vendeeconcept DOT com]=20
Enviado el: dimecres, 3 / mar=E7 / 2010 11:26
Para: djgpp AT delorie DOT com
Asunto: jitter between 2 hardware interrupt
Hi, everybody.
I have a problem with the jitter between hardware interrupt. I use the
real time clock interrupt at 1024 interrupt by second. But I have
jitter between 2 interrupt. Normaly I must have 976us betwwen and i
have 310us to 1641 us occasionally. I have test on multiple PC but its
the same problem. My PC is a Celeron M at 1.6Ghz under FreeDOS without
driver launch at boot.
See my program to test it:
"
#include <dpmi.h>
#include <sys/nearptr.h>
#include <sys/farptr.h>
#include <go32.h>
#include <crt0.h>
#include <io.h>
#include <pc.h>
#include "irq.h"
typedef unsigned long long uint64;
short *ptrbasevid;
uint64
tpsinterclock,tpsinterclockmemo,tpsinterclockmin,tpsinterclockmax,passtps=
int
erclock;
uint64 debclock_precis,finclock_precis;
long interbcleexpl=3D0;
long valitexploit=3D0;
int testtempsbcleit(void);
int proginter0(void);
int proginter1(void);
void miseenplace(void);
int proginteritgen1ms(void);
DECL_END_OF_FUNCTION(proginteritgen1ms);
short affchaine(const char *chaine,short positvid);
short affchaine_2(const char *chaine,short positvid);
short affchiffre2(long chiff,short positvid);
short affchiffre2inch(long chiff,short positch,char *ptrch);
uint64 get_rdtsc (void);
int _crt0_startup_flags=3D_CRT0_FLAG_LOCK_MEMORY |
_CRT0_FLAG_NONMOVE_SBRK;
int proginter0(void)
{
outportb(0x20,0x20);
return(0);
}
static END_OF_FUNCTION(proginter0);
__dpmi_paddr addr_proginter1;
int proginter1(void)
{
return(0);
}
static END_OF_FUNCTION(proginter1);
int main(void)
{
__djgpp_nearptr_enable();
ptrbasevid=3D(short *)(0x0b8000 + __djgpp_conventional_base);
affchaine("depart",80);
miseenplace();
return(0);
}
void miseenplace(void)
{
int i;
outportb(0x21,0xFF);
outportb(0xA1,0xFF);
LOCK_FUNCTION(proginter0);
LOCK_FUNCTION(proginter1);
addr_proginter1.selector =3D _my_cs();
addr_proginter1.offset32 =3D (long)proginter1;
for(i=3D0x00;i<=3D0x07;i++){
__dpmi_set_protected_mode_interrupt_vector(i,
&addr_proginter1);
}
_install_irq(0x08,proginter0);
_install_irq(0x09,proginter0);
_install_irq(0x0A,proginter0);
_install_irq(0x0B,proginter0);
_install_irq(0x0C,proginter0);
_install_irq(0x0D,proginter0);
_install_irq(0x0E,proginter0);
_install_irq(0x0F,proginter0);
LOCK_FUNCTION(proginteritgen1ms);
_install_irq(0x70,proginteritgen1ms);
LOCK_VARIABLE(interbcleexpl) ;
outportb(0x70,0x0b);
outportb(0x71,0x42);
outportb(0x70,0x0c);
inportb(0x71);
_install_irq(0x71,proginter0);
_install_irq(0x72,proginter0);
_install_irq(0x73,proginter0);
_install_irq(0x74,proginter0);
_install_irq(0x75,proginter0);
_install_irq(0x76,proginter0);
_install_irq(0x77,proginter0);
for(i=3D0x10;i<=3D0x30;i++){
__dpmi_set_protected_mode_interrupt_vector(i,
&addr_proginter1);
}
for(i=3D0x32;i<=3D0x6F;i++){
__dpmi_set_protected_mode_interrupt_vector(i,
&addr_proginter1);
}
for(i=3D0x78;i<=3D0xFF;i++){
__dpmi_set_protected_mode_interrupt_vector(i,
&addr_proginter1);
}
__dpmi_set_protected_mode_interrupt_vector(0x31, &addr_proginter1);
outportb(0x21,0xFB);//irq 2 valide
outportb(0xA1,0xFE);
testtempsbcleit();
}
int testtempsbcleit(void)
{
tpsinterclockmin=3D0;
tpsinterclockmax=3D0;
interbcleexpl=3D0;
valitexploit=3D1;
passtpsinterclock=3D0;
while(1){
if(interbcleexpl>=3D500){
affchaine(" ",80);
affchiffre2((long)tpsinterclockmin/1000,80);
affchiffre2((long)tpsinterclockmax/1000,160);
interbcleexpl=3D0;
}
}
return(1);
}
int proginteritgen1ms(void)
{
if(valitexploit){
interbcleexpl++;
debclock_precis=3Dget_rdtsc();
passtpsinterclock++;
if(passtpsinterclock<10000){
tpsinterclockmemo=3Ddebclock_precis;
}
else{
tpsinterclock=3Ddebclock_precis-tpsinterclockmemo;
tpsinterclockmemo=3Ddebclock_precis;
if(!tpsinterclockmin)
tpsinterclockmin=3Dtpsinterclock;
if(!tpsinterclockmax)
tpsinterclockmax=3Dtpsinterclock;
if(tpsinterclock<tpsinterclockmin)
tpsinterclockmin=3Dtpsinterclock;
if(tpsinterclock>tpsinterclockmax)
tpsinterclockmax=3Dtpsinterclock;
}
}
outportb(0x70,0x0c);
inportb(0x71);
outportb(0x20,0x20);
outportb(0xA0,0x20);
return 0;
}
END_OF_FUNCTION(proginteritgen1ms);
uint64 get_rdtsc (void)
{
register unsigned long long tsc;
__asm__ __volatile__ (
".byte 0x0F, 0x31;" // rdtsc opcode
: "=3DA" (tsc) );
return (tsc);
}
short affchaine(const char *chaine,short positvid)
{
return(affchaine_2(chaine,positvid));
}
short affchaine_2(const char *chaine,short positvid)
{
short *ptrvideo;
char att;
ptrvideo=3Dptrbasevid;
while((att=3D*chaine)!=3D0){
*(ptrvideo+positvid)=3D(unsigned char)att+7*256;
positvid++;
chaine++;
}
return(positvid);
}
short affchiffre2(long chiff,short positvid)
{
char chchiff[10];
short lgchiff;
lgchiff=3Daffchiffre2inch(chiff,0,chchiff);
chchiff[lgchiff]=3D0;
affchaine_2(chchiff,positvid);
return(lgchiff+positvid);
}
short affchiffre2inch(long chiff,short positch,char *ptrch)
/* position |xx'''''''|*//*or position |-xx''''''|*/
{
short unite,pass;
short positchdep;
int i;
long testdiz=3D100000000L;
positchdep=3Dpositch;
if(chiff<0L){
chiff=3D-chiff;
*(ptrch+positch)=3D'-';
positch++;
}
pass=3D0;
for(i=3D0;i<8;i++){
if(chiff>=3Dtestdiz){
unite=3D(short)(chiff/testdiz);
*(ptrch+positch)=3Dunite+48;
positch++;
chiff-=3Dunite*testdiz;
pass=3D1;
}
else{
if(pass){
*(ptrch+positch)=3D48;
positch++;
}
}
testdiz/=3D10L;
}
*(ptrch+positch)=3Dchiff+48;
positch++;
return(positch-positchdep);
}
"
compile :
gcc -c testit.c -o testit.o
gcc -c irq.c -o irq.o
gcc -Wall -x assembler-with-cpp -O0 -mpentium -c irqwrap.s -o
irqwrap.o
gcc -o calibreu.exe testit.o irq.o irqwrap.o
irq.c and irq.h are the function found with allegro
gcc version 3.4.1
djgpp version 2.03
Why I have this big jitter? I expected to have 10 us maximum !
especially with a processeur to 1.6 Ghz !
suggestions?
__________ Informaci=F3n de NOD32, revisi=F3n 4912 (20100303) __________
Este mensaje ha sido analizado con NOD32 antivirus system
http://www.nod32.com
- Raw text -