#include "./pcl812.h"
#include <asm/io.h>
int pcl_read_polled(
int channel,
unsigned char *higher,
unsigned char *lower
)
{
if ( channel < 16)
{
/* Read analog input */
// Select input channel.
outb(channel,BASE+10);
/* Start an ADC conversion
and wait for ready */
/* Any value causes trigger */
outb(5,BASE+12);
/* Wait until data is ready */
while((inb(BASE+5)&0x10) != 0)
{};
if((*higher=(inb(BASE+5)))>=16)
/* Nothing readen */
return (-EINVAL);
*lower=inb(BASE+4);
}
else if (channel==18)
{
/* read LSB */
*lower=inb(BASE+6);
/* and add the MSB */
*higher=inb(BASE+7);
}
else return(-ENODEV);
return 0;
}
//used to adapt the driver code to LINUX. #define outportb(a,b) outb(b,a) #define inportb(a) inb(a)
//used to adapt the driver code to LINUX. #define outpw(a,b) outw(b,a) #define inpw(a) inw(a) #include <asm/io.h>