Mail Archives: djgpp/1995/08/17/05:33:23
I have some kind of wierd optimization bug in V2. When reading an I/O status
port on my A2D card, the BUSY bit seems to get stuck on after the first read
of this port. The code is :-
short get_A2D(char channel)
{
channel = channel % 8;
outportb(CONTROL_REG, channel); /** select A2D channel to convert **/
while( (inportb(STATUS_REG) & BUSY_BIT) ); /** wait for not busy **/
outportb(START_CONVERSION, 0xff); /** start A2D conversion **/
while( (inportb(STATUS_REG) & BUSY_BIT) ); /** wait for not busy **/
return( inportw(A2D_DATA) );
}
With any of the optimizations selected, the 2nd while loop never terminates
as the busy bit always appears high. With no optimization the code works
as expected.
Any ideas. Is it a bug or is it a silly mistake somewhere???
Brendan Simon
brendan AT rdt DOT monash DOT edu DOT au
- Raw text -