/* mpu_init: * Initialises the MPU-401 midi interface. */ static int mpu_init(int input, int voices) { if (!mpu_output_mode) { /* only do the hardware initialisation once */ outportb(_mpu_port+1, 0x3F); mpu_input(); LOCK_VARIABLE(midi_mpu401); LOCK_VARIABLE(_mpu_port); LOCK_VARIABLE(_mpu_irq); LOCK_FUNCTION(_mpu_poll); LOCK_FUNCTION(mpu_output); LOCK_FUNCTION(mpu_interrupt); } if (input) { /* only hook the interrupt if we have direct access to it */ if (!mpu_piggyback) { _enable_irq(_mpu_irq); _install_irq(mpu_int, mpu_interrupt); } mpu_input_mode = TRUE; } else mpu_output_mode = TRUE; return 0; }
void timer_install ( void (*handl)(void), unsigned int ticksPerSecond ) { handler = handl ; _install_irq(0,New08) ; timer_setup(0,2,ticksPerSecond<18?0:TIMER_CLOCK/ticksPerSecond) ; }