Listing 3. Conversion Error

/* Send the control word to the card, this is always
 * 0x92 for the pc30at, which sets ports A and B as
 * input and port C as output.
 */

outb(0x92,PC30AT_BASE+CONTROL30AT);

/* Check that the card is there. First start a
 * conversion. For the pc30at conversion is started
 * with a downward edge trigger. The three commands
 * below correspond to 010 or  _-_ so there is a
 * downward edge between the last two and conversion
 * is triggered.
 */

outb(0x2,PC30AT_BASE+PORT_C30AT);
outb(0x3,PC30AT_BASE+PORT_C30AT);
outb(0x2,PC30AT_BASE+PORT_C30AT);

/* Then wait for the end of conversion, which is
 * marked by a flag in the register PORT_B30AT.
 * If no end return an error.
 */

ii=0;
while ((((inb(PC30AT_BASE+PORT_B30AT))& (0x20))==0)
 &&(ii<30000)) {
 ii++;
 if (ii>=30000) return -1;
}