/***************************************************************************** * MODULE: IOD48FCT.C * * * * The purpose of this module is to provide direct software interface to * * the IOD-48s digital board. * * * * LAST MODIFICATION: JULY 31, 1992 * * * *****************************************************************************/ #include #include #include /* these are the port address offsets for reading and control of the IOD48 */ #define PORT0A 0x0000 #define PORT0B 0x0001 #define PORT0C 0x0002 #define PORT0CONTROL 0x0003 #define PORT1A 0x0004 #define PORT1B 0x0005 #define PORT1C 0x0006 #define PORT1CONTROL 0x0007 #define COSENABLE 0x000B #define CLRCOSINT 0x000F /***************************************************************************** * FUNCTION: IOD48_cos_enable -- export routine * * * * PURPOSE: To write the enable word passed to it to the IOD48 board. See * * IOD48 board manual for more information. * * * * INPUT: unsigned port: contains the board port address. * * char value: control value to write. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************/ void IOD48_cos_enable(unsigned port,char value) { outportb(port + COSENABLE,value); /* send the byte */ } /* end IOD48_cos_enable */ /***************************************************************************** * FUNCTION: IOD48_clr_cos_int -- export routine * * * * PURPOSE: To write anything to this board address, clears any interrupts * * caused by change of state. * * * * INPUT: unsigned port: contains the board port address. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************/ void IOD48_clr_cos_int(unsigned port) { outportb(port + CLRCOSINT,0); /* send anything */ } /* end IOD48_clr_cos_int */ /***************************************************************************** * FUNCTION: IOD48_read_port -- export routine * * * * PURPOSE: Reads the value contained at one of the 6 ports contained on * * the IOD48 board. * * * * INPUT: unsigned port: contains the board port address. * * unsigned offset: determines which port to read. * * * * OUTPUT: Returns the value read in from the board. * * * * CALLS: None. * * * *****************************************************************************/ unsigned IOD48_read_port(unsigned port,unsigned offset) { unsigned value; value = inportb(port + offset); return(value); } /* end IOD48_read_port */ /***************************************************************************** * FUNCTION: IOD48_port_control -- export routine * * * * PURPOSE: Writes the control word to the PPI indicated by offset. This * * word determines the direction of digital I/O as well mode. * * See IOD48 manual for more information. * * * * INPUT: unsigned port: contains the board port address. * * unsigned offset: determines which PPI to write to. * * char value: control word to write. * * * * OUTPUT: None. * * * * CALLS: None. * * * *****************************************************************************/ void IOD48_port_control(unsigned port,unsigned offset,char value) { outportb(port + offset,value); /* send the byte */ } /* end IOD48_port_control */