1 2 3 #ifndef __INTERRUPT_H__ 4 #define __INTERRUPT_H__ 5 6 typedef void (*isr_t)(void); 7 8 // TODO: These should go away and be intrinsics 9 #define M_PRESERVE_INDEX __asm__("push\tiy\npush\tix\n") 10 #define M_RESTORE_INDEX __asm__("pop\tix\npop\tiy\n") 11 12 #define M_PRESERVE_MAIN __asm__("push\taf\npush\tbc\npush\tde\npush\thl\n") 13 #define M_RESTORE_MAIN __asm__("pop\thl\npop\tde\npop\tbc\npop\taf\n") 14 15 #define M_PRESERVE_ALL __asm__("push\taf\npush\tbc\npush\tde\npush\thl\nex\taf,af\nexx\npush\taf\npush\tbc\npush\tde\npush\thl\npush\tix\npush\tiy\n") 16 #define M_RESTORE_ALL __asm__("pop\tiy\npop\tix\npop\thl\npop\tde\npop\tbc\npop\taf\nexx\nex\taf,af\npop\thl\npop\tde\npop\tbc\npop\taf\n") 17 18 // Initialise the interrupt subsystem if needed 19 extern int __LIB__ im1_init(void); 20 // Register an im1 ISR 21 extern int __LIB__ im1_install_isr(isr_t handler) ; 22 // Deregister an im1 ISR 23 extern int __LIB__ im1_uninstall_isr(isr_t handler) ; 24 25 // Initialise the NMI subsystem if required 26 extern int __LIB__ nmi_init(void); 27 // Register an NMI ISR 28 extern int __LIB__ nmi_install_isr(isr_t handler) ; 29 // Deegister an NMI ISR 30 extern int __LIB__ nmi_uninstall_isr(isr_t handler) ; 31 32 33 // Simple timer tick handler 34 extern void __LIB__ tick_count_isr(void); 35 extern long __LIB__ tick_count; 36 #endif 37 38