sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
intrman.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16
17#ifndef __INTRMAN_H__
18#define __INTRMAN_H__
19
20#include <types.h>
21#include <irx.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
28 IOP_IRQ_VBLANK = 0,
29 IOP_IRQ_SBUS,
30 IOP_IRQ_CDVD,
33 IOP_IRQ_RTC0,
34 IOP_IRQ_RTC1,
35 IOP_IRQ_RTC2,
36 IOP_IRQ_SIO0,
37 IOP_IRQ_SIO1,
38 IOP_IRQ_SPU,
39 IOP_IRQ_PIO,
40 IOP_IRQ_EVBLANK,
43 IOP_IRQ_DEV9,
44 IOP_IRQ_RTC3,
45 IOP_IRQ_RTC4,
46 IOP_IRQ_RTC5,
47 IOP_IRQ_SIO2,
48 IOP_IRQ_HTR0,
49 IOP_IRQ_HTR1,
50 IOP_IRQ_HTR2,
51 IOP_IRQ_HTR3,
52 IOP_IRQ_USB,
55 IOP_IRQ_ILINK,
58
59 IOP_IRQ_DMA_MDEC_IN = 0x20,
60 IOP_IRQ_DMA_MDEC_OUT,
61 IOP_IRQ_DMA_SIF2,
62 IOP_IRQ_DMA_CDVD,
63 IOP_IRQ_DMA_SPU,
64 IOP_IRQ_DMA_PIO,
65 IOP_IRQ_DMA_GPU_OTC,
68 IOP_IRQ_DMA_SPU2,
69 IOP_IRQ_DMA_DEV9,
70 IOP_IRQ_DMA_SIF0,
71 IOP_IRQ_DMA_SIF1,
72 IOP_IRQ_DMA_SIO2_IN,
73 IOP_IRQ_DMA_SIO2_OUT,
74
79};
80
82{
83 int (*handler)(void *userdata);
84 void *userdata;
85} intrman_intr_handler_data_t;
86
87typedef struct intrman_internals_
88{
89 intrman_intr_handler_data_t *interrupt_handler_table;
90 int masked_icr_1;
91 int masked_icr_2;
92 int dmac2_interrupt_handler_mask;
93} intrman_internals_t;
94
95extern intrman_internals_t *GetIntrmanInternalData(void);
96
108extern int RegisterIntrHandler(int irq, int mode, int (*handler)(void *arg), void *arg);
109
115extern int ReleaseIntrHandler(int irq);
116
122extern int EnableIntr(int irq);
123
130extern int DisableIntr(int irq, int *res);
131
138extern int CpuDisableIntr();
145extern int CpuEnableIntr();
146
155extern int CpuSuspendIntr(int *state);
156
165extern int CpuResumeIntr(int state);
166
172extern int CpuInvokeInKmode(void *function, ...);
173
179extern void DisableDispatchIntr(int irq);
185extern void EnableDispatchIntr(int irq);
186
191extern int QueryIntrContext(void);
192
198extern int QueryIntrStack(void *sp);
199
200extern int iCatchMultiIntr(void);
201
206extern void SetNewCtxCb(void *cb);
207extern void ResetNewCtxCb(void);
208extern void SetShouldPreemptCb(void *cb);
209extern void ResetShouldPreemptCb(void);
210
211#define intrman_IMPORTS_start DECLARE_IMPORT_TABLE(intrman, 1, 2)
212#define intrman_IMPORTS_end END_IMPORT_TABLE
213
214#define I_GetIntrmanInternalData DECLARE_IMPORT(3, GetIntrmanInternalData)
215#define I_RegisterIntrHandler DECLARE_IMPORT(4, RegisterIntrHandler)
216#define I_ReleaseIntrHandler DECLARE_IMPORT(5, ReleaseIntrHandler)
217#define I_EnableIntr DECLARE_IMPORT(6, EnableIntr)
218#define I_DisableIntr DECLARE_IMPORT(7, DisableIntr)
219#define I_CpuDisableIntr DECLARE_IMPORT(8, CpuDisableIntr)
220#define I_CpuEnableIntr DECLARE_IMPORT(9, CpuEnableIntr)
221#define I_CpuInvokeInKmode DECLARE_IMPORT(14, CpuInvokeInKmode);
222#define I_DisableDispatchIntr DECLARE_IMPORT(15, DisableDispatchIntr);
223#define I_EnableDispatchIntr DECLARE_IMPORT(16, EnableDispatchIntr);
224#define I_CpuSuspendIntr DECLARE_IMPORT(17, CpuSuspendIntr)
225#define I_CpuResumeIntr DECLARE_IMPORT(18, CpuResumeIntr)
226#define I_QueryIntrContext DECLARE_IMPORT(23, QueryIntrContext)
227#define I_QueryIntrStack DECLARE_IMPORT(24, QueryIntrStack)
228#define I_iCatchMultiIntr DECLARE_IMPORT(25, iCatchMultiIntr)
229#define I_SetNewCtxCb DECLARE_IMPORT(28, SetNewCtxCb)
230#define I_SetShouldPreemptCb DECLARE_IMPORT(30, SetShouldPreemptCb)
231
232/* For compatibility purposes */
233#define INUM_VBLANK IOP_IRQ_VBLANK
234#define INUM_GM IOP_IRQ_SBUS
235#define INUM_CDROM IOP_IRQ_CDVD
236#define INUM_DMA IOP_IRQ_DMA
237#define INUM_RTC0 IOP_IRQ_RTC0
238#define INUM_RTC1 IOP_IRQ_RTC1
239#define INUM_RTC2 IOP_IRQ_RTC2
240#define INUM_SIO0 IOP_IRQ_SIO0
241#define INUM_SIO1 IOP_IRQ_SIO1
242#define INUM_SPU IOP_IRQ_SPU
243#define INUM_PIO IOP_IRQ_PIO
244#define INUM_EVBLANK IOP_IRQ_EVBLANK
245#define INUM_DVD IOP_IRQ_DVD
246#define INUM_PCMCIA IOP_IRQ_DEV9
247#define INUM_RTC3 IOP_IRQ_RTC3
248#define INUM_RTC4 IOP_IRQ_RTC4
249#define INUM_RTC5 IOP_IRQ_RTC5
250#define INUM_SIO2 IOP_IRQ_SIO2
251#define INUM_HTR0 IOP_IRQ_HTR0
252#define INUM_HTR1 IOP_IRQ_HTR1
253#define INUM_HTR2 IOP_IRQ_HTR2
254#define INUM_HTR3 IOP_IRQ_HTR3
255#define INUM_USB IOP_IRQ_USB
256#define INUM_EXTR IOP_IRQ_EXTR
257#define INUM_FWRE IOP_IRQ_ILINK
258#define INUM_FDMA IOP_IRQ_FDMA
259#define INUM_DMA_0 IOP_IRQ_DMA_MDEC_IN
260#define INUM_DMA_1 IOP_IRQ_DMA_MDEC_OUT
261#define INUM_DMA_2 IOP_IRQ_DMA_SIF2
262#define INUM_DMA_3 IOP_IRQ_DMA_CDVD
263#define INUM_DMA_4 IOP_IRQ_DMA_SPU
264#define INUM_DMA_5 IOP_IRQ_DMA_PIO
265#define INUM_DMA_6 IOP_IRQ_DMA_GPU_OTC
266#define INUM_DMA_BERR IOP_IRQ_DMA_BERR
267#define INUM_DMA_7 IOP_IRQ_DMA_SPU2
268#define INUM_DMA_8 IOP_IRQ_DMA_DEV9
269#define INUM_DMA_9 IOP_IRQ_DMA_SIF0
270#define INUM_DMA_10 IOP_IRQ_DMA_SIF1
271#define INUM_DMA_11 IOP_IRQ_DMA_SIO2_IN
272#define INUM_DMA_12 IOP_IRQ_DMA_SIO2_OUT
273
274#define SetCtxSwitchHandler(...) SetNewCtxCb(__VA_ARGS__)
275#define ResetCtxSwitchHandler(...) ResetNewCtxCb(__VA_ARGS__)
276#define SetCtxSwitchReqHandler(...) SetShouldPreemptCb(__VA_ARGS__)
277#define ResetCtxSwitchReqHandler(...) ResetShouldPreemptCb(__VA_ARGS__)
278
279#ifdef __cplusplus
280}
281#endif
282
283#endif /* __INTRMAN_H__ */
int CpuEnableIntr()
Definition intrman.c:240
int CpuResumeIntr(int state)
Definition intrman.c:217
int CpuInvokeInKmode(void *function,...)
void DisableDispatchIntr(int irq)
Definition intrman.c:484
int ReleaseIntrHandler(int irq)
Definition intrman.c:157
void SetNewCtxCb(void *cb)
Definition intrman.c:703
int CpuDisableIntr()
Definition intrman.c:228
void EnableDispatchIntr(int irq)
Definition intrman.c:458
int QueryIntrContext(void)
int DisableIntr(int irq, int *res)
Definition intrman.c:385
int CpuSuspendIntr(int *state)
Definition intrman.c:195
int RegisterIntrHandler(int irq, int mode, int(*handler)(void *arg), void *arg)
Definition intrman.c:115
int QueryIntrStack(void *sp)
iop_irq_list
Definition intrman.h:27
@ IOP_IRQ_EXTR
Definition intrman.h:54
@ IOP_IRQ_DMA
Definition intrman.h:32
@ IOP_IRQ_SW1
Definition intrman.h:76
@ IOP_IRQ_FDMA
Definition intrman.h:57
@ IOP_IRQ_SW2
Definition intrman.h:78
@ IOP_IRQ_DVD
Definition intrman.h:42
@ IOP_IRQ_DMA_BERR
Definition intrman.h:67
int EnableIntr(int irq)
Definition intrman.c:336