|
|
1.1 root 1: /*
2: Hatari - cycInt.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.
6: */
7:
8: #ifndef HATARI_CYCINT_H
9: #define HATARI_CYCINT_H
10:
11: /* Interrupt handlers in system */
12: typedef enum
13: {
14: INTERRUPT_NULL,
15: INTERRUPT_VIDEO_VBL,
1.1.1.2 root 16: INTERRUPT_HARDCLOCK,
1.1.1.3 ! root 17: INTERRUPT_MOUSE,
! 18: INTERRUPT_ESP,
! 19: INTERRUPT_ESP_IO,
! 20: INTERRUPT_M2R,
! 21: INTERRUPT_R2M,
! 22: INTERRUPT_MO,
! 23: INTERRUPT_MO_IO,
! 24: INTERRUPT_ECC_IO,
! 25: INTERRUPT_ENET_IO,
! 26: INTERRUPT_FLP_IO,
! 27: INTERRUPT_SND_IO,
! 28: INTERRUPT_LP_IO,
1.1 root 29: MAX_INTERRUPTS
30: } interrupt_id;
31:
32:
33: #define INT_CPU_CYCLE 1
34: #define INT_MFP_CYCLE 2
35:
1.1.1.3 ! root 36: #define INT_CPU_TO_INTERNAL 1
1.1 root 37: #define INT_MFP_TO_INTERNAL 31333
38:
39: /* Convert cpu or mfp cycles to internal cycles */
40: #define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? (cyc)*INT_CPU_TO_INTERNAL : (cyc)*INT_MFP_TO_INTERNAL )
41: /*
42: #define INT_CONVERT_TO_INTERNAL( cyc , type ) ( type == INT_CPU_CYCLE ? cyc*INT_CPU_TO_INTERNAL :\
43: ( ( (cyc*INT_MFP_TO_INTERNAL + INT_CPU_TO_INTERNAL*4 - 1) / (INT_CPU_TO_INTERNAL*4) ) * INT_CPU_TO_INTERNAL*4 ) )
44: */
45:
46: /* Convert internal cycles to real mfp or cpu cycles */
47: /* Rounding is important : for example 9500 internal is 0.98 cpu and should give 1 cpu cycle, not 0 */
48: /* so we do (9500+9600-1)/9600 to get the closest higher integer */
49: //#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 )
50: #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 )
51:
52:
53:
54: extern void (*PendingInterruptFunction)(void);
55: extern int PendingInterruptCount;
56:
57: extern void CycInt_Reset(void);
58: extern void CycInt_MemorySnapShot_Capture(bool bSave);
59: extern void CycInt_AcknowledgeInterrupt(void);
60: extern void CycInt_AddAbsoluteInterrupt(int CycleTime, int CycleType, interrupt_id Handler);
61: extern void CycInt_AddRelativeInterrupt(int CycleTime, int CycleType, interrupt_id Handler);
62: extern void CycInt_AddRelativeInterruptNoOffset(int CycleTime, int CycleType, interrupt_id Handler);
63: extern void CycInt_AddRelativeInterruptWithOffset(int CycleTime, int CycleType, interrupt_id Handler, int CycleOffset);
64: extern void CycInt_RemovePendingInterrupt(interrupt_id Handler);
65: extern void CycInt_ResumeStoppedInterrupt(interrupt_id Handler);
66: extern bool CycInt_InterruptActive(interrupt_id Handler);
67: extern int CycInt_FindCyclesPassed(interrupt_id Handler, int CycleType);
68:
69: #endif /* ifndef HATARI_CYCINT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.