Nugget
events.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2020 PCSX-Redux authors
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 
27 #pragma once
28 
29 enum event_class {
30  EVENT_VBLANK = 0xf0000001, // IRQ0
31  EVENT_GPU = 0xf0000002, // IRQ1
32  EVENT_CDROM = 0xf0000003, // IRQ2
33  EVENT_DMA = 0xf0000004, // IRQ3
34  EVENT_RTC0 = 0xf0000005, // IRQ4 - Timer 0
35  EVENT_RTC1 = 0xf0000006, // IRQ5 - Timer 1 or 2
36  // 0xf0000007 - unused, should be Timer 2
37  EVENT_CONTROLLER = 0xf0000008, // IRQ7
38  EVENT_SPU = 0xf0000009, // IRQ9
39  EVENT_PIO = 0xf000000a, // IRQ10
40  EVENT_SIO = 0xf000000b, // IRQ8
41  EVENT_CARD = 0xf0000011,
42  EVENT_BU = 0xf4000001,
43 };
44 
45 enum event_mode {
46  EVENT_MODE_CALLBACK = 0x1000,
47  EVENT_MODE_NO_CALLBACK = 0x2000,
48 };
49 
50 enum event_flag {
51  EVENT_FLAG_FREE = 0x0000,
52  EVENT_FLAG_DISABLED = 0x1000,
53  EVENT_FLAG_ENABLED = 0x2000,
54  EVENT_FLAG_PENDING = 0x4000,
55 };