Example #1
0
File: i8259.c Project: B-Rich/simh
t_stat i8259_io(IOHANDLER* ioh,uint32* value,uint32 rw,uint32 mask)
{
    int port = ioh->offset;
    I8259* chip = (I8259*)ioh->ctxt;
    if (rw==MEM_WRITE) {
        return chip->write ? chip->write(chip,port,*value) : i8259_write(chip,port,*value);
    } else {
        return chip->read ? chip->read(chip,port,value) : i8259_read(chip,port,value);
    }
}
/*
 *	i8259_disable() - disable the specified interrupts
 *
 *	This routine disables the interrupts specified by the bits in the
 *	mask parameter: 1 = disable, 0 = do not change.
 *
 *	The old value is returned.
*/
uint8_t i8259_disable(memaddr_t i8259, uint8_t mask)
{
    uint8_t old = i8259_read(i8259, i8259_ocw1);
    i8259_write(i8259, i8259_ocw1, old | mask);
    return old;
}
/*
 *	i8259_get_mask() - read the mask register
*/
uint8_t i8259_get_mask(memaddr_t i8259)
{
    return i8259_read(i8259, i8259_ocw1);
}
/*
 *	i8259_set_mask() - set the mask register
 *
 * 	Sets the interrupt mask register to the specified value,
 *	returns the old value.
*/
uint8_t i8259_set_mask(memaddr_t i8259, uint8_t mask)
{
    uint8_t old = i8259_read(i8259, i8259_ocw1);
    i8259_write(i8259, i8259_ocw1, mask);
    return old;
}