Debian Codegraph @

include/pic.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #ifndef DOSBOX_PIC_H
20 #define DOSBOX_PIC_H
21
22
23 /* CPU Cycle Timing */
24 extern Bit32s CPU_Cycles;
25 extern Bit32s CPU_CycleLeft;
26 extern Bit32s CPU_CycleMax;
27
28 typedef void (PIC_EOIHandler) (void);
29 typedef void (* PIC_EventHandler)(Bitu val);
30
31
32 #define PIC_MAXIRQ 15
33 #define PIC_NOIRQ 0xFF
34
35 extern Bitu PIC_IRQCheck;
36 extern Bitu PIC_IRQActive;
37 extern Bitu PIC_Ticks;
38
39 static INLINE float PIC_TickIndex(void) {
40 return (CPU_CycleMax-CPU_CycleLeft-CPU_Cycles)/(float)CPU_CycleMax;
41 }
42
43 static INLINE Bits PIC_TickIndexND(void) {
44 return CPU_CycleMax-CPU_CycleLeft-CPU_Cycles;
45 }
46
47 static INLINE Bits PIC_MakeCycles(double amount) {
48 return (Bits)(CPU_CycleMax*amount);
49 }
50
51 static INLINE double PIC_FullIndex(void) {
52 return PIC_Ticks+(double)PIC_TickIndex();
53 }
54
55 void PIC_ActivateIRQ(Bitu irq);
56 void PIC_DeActivateIRQ(Bitu irq);
57
58 void PIC_runIRQs(void);
59 bool PIC_RunQueue(void);
60
61 //Delay in milliseconds
62 void PIC_AddEvent(PIC_EventHandler handler,float delay,Bitu val=0);
63 void PIC_RemoveEvents(PIC_EventHandler handler);
64 void PIC_RemoveSpecificEvents(PIC_EventHandler handler, Bitu val);
65
66 void PIC_SetIRQMask(Bitu irq, bool masked);
67 #endif