|
|
1.1 root 1: /*
1.1.1.2 root 2: Hatari - int.h
3:
4: This file is distributed under the GNU Public License, version 2 or at
5: your option any later version. Read the file gpl.txt for details.
1.1 root 6: */
7:
1.1.1.2 root 8: #ifndef HATARI_INT_H
9: #define HATARI_INT_H
10:
11: /* Interrupt handlers in system */
1.1.1.6 root 12: typedef enum
1.1.1.2 root 13: {
1.1 root 14: INTERRUPT_NULL,
15: INTERRUPT_VIDEO_VBL,
16: INTERRUPT_VIDEO_HBL,
17: INTERRUPT_VIDEO_ENDLINE,
18: INTERRUPT_MFP_TIMERA,
19: INTERRUPT_MFP_TIMERB,
20: INTERRUPT_MFP_TIMERC,
21: INTERRUPT_MFP_TIMERD,
22: INTERRUPT_IKBD_RESETTIMER,
23: INTERRUPT_IKBD_ACIA,
1.1.1.7 ! root 24: INTERRUPT_IKBD_MFP,
1.1.1.4 root 25: INTERRUPT_DMASOUND,
1.1.1.7 ! root 26: INTERRUPT_DMASOUND_MICROWIRE,
1.1.1.6 root 27: INTERRUPT_FDC,
1.1.1.7 ! root 28: INTERRUPT_BLITTER,
1.1.1.4 root 29:
1.1 root 30: MAX_INTERRUPTS
1.1.1.6 root 31: } interrupt_id;
1.1 root 32:
1.1.1.6 root 33:
34: #define INT_CPU_CYCLE 1
35: #define INT_MFP_CYCLE 2
36:
37: #define INT_CPU_TO_INTERNAL 9600
38: #define INT_MFP_TO_INTERNAL 31333
39:
40: /* Convert cpu or mfp cycles to internal cycles */
41: #define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : (cyc)*INT_MFP_TO_INTERNAL )
42: /*
43: #define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? cyc*INT_CPU_TO_INTERNAL :\
44: ( ( (cyc*INT_MFP_TO_INTERNAL + INT_CPU_TO_INTERNAL*4 - 1) / (INT_CPU_TO_INTERNAL*4) ) * INT_CPU_TO_INTERNAL*4 ) )
45: */
46:
47: /* Convert internal cycles to real mfp or cpu cycles */
48: /* Rounding is important : for example 9500 internal is 0.98 cpu and should give 1 cpu cycle, not 0 */
49: /* so we do (9500+9600-1)/9600 to get the closest higher integer */
50: //#define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc+INT_CPU_TO_INTERNAL-1)/INT_CPU_TO_INTERNAL : (cyc+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL )
51: #define INT_CONVERT_FROM_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)/INT_CPU_TO_INTERNAL : ((cyc)+INT_MFP_TO_INTERNAL-1)/INT_MFP_TO_INTERNAL )
52:
53:
54:
55: extern void (*PendingInterruptFunction)(void);
56: extern int PendingInterruptCount;
1.1 root 57:
58: extern void Int_Reset(void);
1.1.1.7 ! root 59: extern void Int_MemorySnapShot_Capture(bool bSave);
1.1 root 60: extern void Int_AcknowledgeInterrupt(void);
1.1.1.6 root 61: extern void Int_AddAbsoluteInterrupt(int CycleTime, int CycleType, interrupt_id Handler);
1.1.1.7 ! root 62: extern void Int_AddRelativeInterrupt(int CycleTime, int CycleType, interrupt_id Handler);
1.1.1.6 root 63: extern void Int_AddRelativeInterruptNoOffset(int CycleTime, int CycleType, interrupt_id Handler);
64: extern void Int_AddRelativeInterruptWithOffset(int CycleTime, int CycleType, interrupt_id Handler, int CycleOffset);
65: extern void Int_RemovePendingInterrupt(interrupt_id Handler);
66: extern void Int_ResumeStoppedInterrupt(interrupt_id Handler);
1.1.1.7 ! root 67: extern bool Int_InterruptActive(interrupt_id Handler);
1.1.1.6 root 68: extern int Int_FindCyclesPassed(interrupt_id Handler, int CycleType);
1.1.1.2 root 69:
70: #endif /* ifndef HATARI_INT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.