delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/26/21:14:49

Date: Wed, 26 Jul 1995 21:08:40 GMT-03:00
From: goncalves AT if DOT usp DOT br
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: interrupt-like interferences due to the memory manager?

Hi,

I have developed a program that basically counts the time intervals 
between events, by reading an external port with the "inportb" function
(an "unsigned long int" counter is incremented as long as the value at the
port presents a given value).

For preventing interferences in this process, I have disabled interrupts
by using "disable()". The countings are stored in an "unsigned long int"
vector. This vector must store around 1.500.000 values.

At first, I was using "Borland-C++" compiler, but for memory limitations in
its "Phar-lap's memory manager", I am presently using gcc. Unhappifuly,
the same routine, adapted for gcc, is now presenting fluctuations in the 
counting values as if there were a kind of interrupt still active.

I was wandering if this interference is due to the gcc's memory manager or
perhaps I have allocated memory in a wrong way. It follows a fragment of
the program:

  .
  .
  .
  #define LASER (!(inportb(0x279) & 0x08))
  unsigned long int buffer[1500000];

  void main(void)
  {
        unsigned long int i,c=0;
        disable();
        for(i=0;i<1500000;i++) {
          while(LASER) c++;
          while(!LASER) c++;
          buffer[i]=c;
          c=0;
        }
        enable();
  }

Thank you very much for any help.

Whilk.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019