110425
OPERATIONS MANUAL PCM-UIO48B
14
* This function initializes all I/O pins for input, disables all interrupt
* sensing, and sets the image values.
*
*=================================================================
==========*/
void init_io(unsigned io_address)
{
int x;
/* Save the specified address for later use */
base_port = io_address;
/* Clear all of the I/O ports. This also makes them inputs */
for(x=0; x < 7; x++)
outportb(bax, 0);
/* Clear our image values as well */
for(x=0; x < 6; x++)
port_images[x] = 0;
/* Set page 2 access, for interrupt enables */
outportb(ba7,0x80);
/* Clear all interrupt enables */
outportb(ba8,0);
outportb(ba9,0);
outportb(ba0x0a,0);
/* Restore normal page 0 register access */
outportb(ba7,0);
}
/*================================================================
===========
*
* READ_BIT
*
*
* This function takes a single argument :
*
*
* bit_number : The integer argument specifies the bit number to read.
* Valid arguments are from 1 to 48.
*
* return value : The current state of the specified bit, 1 or 0.
*
* This function returns the state of the current I/O pin specified by
* the argument bit_number.
*
*=================================================================
==========*/
int read_bit(int bit_number)
{
unsigned port;
int val;