/* Now actually update the port. Only the specified bit is affected */
outportb(port,temp);
}
/*===========================================================================
* SET_BIT
*
*
* This function takes a single argument :
*
* bit_number : The bit number to set.
*
* This function sets the specified bit.
*
*===========================================================================*/
void set_bit(int bit_number)
{
write_bit(bit_number,1);
}
/*===========================================================================
* CLR_BIT
*
*
* This function takes a single argument :
*
* bit_number : The bit number to clear.
*
* This function clears the specified bit.
*
*===========================================================================*/
void clr_bit(int bit_number)
{
write_bit(bit_number,0);
}
/*===========================================================================
*
* ENAB_INT
*
* This function takes two arguments :
*
* bit_number : The bit number to enable intterups for. Range from 1 to 48.
*
* polarity : This specifies the polarity of the interrupt. A non-zero
* argument enables rising-edge interrupt. A zero argument
* enables the interrupt on the flling edge.
*
* This function enables within the 16C48 an interrupt for the specified bit
* at the specified polarity. This function does not setup the interrupt
* controller, nor does it supply an interrupr handler.
*
*============================================================================*/
void enab_int(int bit_number, int polarity)
{
unsigned port;
unsigned temp;
unsigned mask;
/* Adjust for 0 based numbering */
--bit_number;
/* Calculate the I/O address based uppon the bit number */
port = (bit_number / 8) + bas 8;
/* Calculate a bit mask based on the specified bit number */
mask = (1 << (bit_number % 8));
/* Turn on page 2 access */
outportb(ba7,0x80);
/* Get the current state of the interrupt enable register */
temp = inportb(port);
/* Set the enable bit for our bit number */
temp = temp | mask;
/* Now update the interrupt enable register */
outportb(port,temp);
/* Turn on access to page 1 for polarity control */
outportb(ba7,0x40);
/* Get the current state of the polarity register */