PS2SDK
PS2 Homebrew Libraries
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#ifndef __INTRMAN_H__
17#define __INTRMAN_H__
18
19#include <types.h>
20#include <irx.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27 IOP_IRQ_VBLANK = 0,
28 IOP_IRQ_SBUS,
29 IOP_IRQ_CDVD,
32 IOP_IRQ_RTC0,
33 IOP_IRQ_RTC1,
34 IOP_IRQ_RTC2,
35 IOP_IRQ_SIO0,
36 IOP_IRQ_SIO1,
37 IOP_IRQ_SPU,
38 IOP_IRQ_PIO,
39 IOP_IRQ_EVBLANK,
42 IOP_IRQ_DEV9,
43 IOP_IRQ_RTC3,
44 IOP_IRQ_RTC4,
45 IOP_IRQ_RTC5,
46 IOP_IRQ_SIO2,
47 IOP_IRQ_HTR0,
48 IOP_IRQ_HTR1,
49 IOP_IRQ_HTR2,
50 IOP_IRQ_HTR3,
51 IOP_IRQ_USB,
54 IOP_IRQ_ILINK,
57
58 IOP_IRQ_DMA_MDEC_IN = 0x20,
59 IOP_IRQ_DMA_MDEC_OUT,
60 IOP_IRQ_DMA_SIF2,
61 IOP_IRQ_DMA_CDVD,
62 IOP_IRQ_DMA_SPU,
63 IOP_IRQ_DMA_PIO,
64 IOP_IRQ_DMA_GPU_OTC,
67 IOP_IRQ_DMA_SPU2,
68 IOP_IRQ_DMA_DEV9,
69 IOP_IRQ_DMA_SIF0,
70 IOP_IRQ_DMA_SIF1,
71 IOP_IRQ_DMA_SIO2_IN,
72 IOP_IRQ_DMA_SIO2_OUT,
73
78};
79
81{
82 int (*handler)(void *userdata);
83 void *userdata;
85
86typedef struct intrman_internals_
87{
88 intrman_intr_handler_data_t *interrupt_handler_table;
89 int masked_icr_1;
90 int masked_icr_2;
91 int dmac2_interrupt_handler_mask;
93
94intrman_internals_t *GetIntrmanInternalData(void);
95
107int RegisterIntrHandler(int irq, int mode, int (*handler)(void *), void *arg);
108
114int ReleaseIntrHandler(int irq);
115
121int EnableIntr(int irq);
122
129int DisableIntr(int irq, int *res);
130
137int CpuDisableIntr();
144int CpuEnableIntr();
145
154int CpuSuspendIntr(int *state);
155
164int CpuResumeIntr(int state);
165
171int CpuInvokeInKmode(void *function, ...);
172
178void DisableDispatchIntr(int irq);
184void EnableDispatchIntr(int irq);
185
191
197int QueryIntrStack(void *sp);
198
199int iCatchMultiIntr(void);
200
205void SetNewCtxCb(void *cb);
206void ResetNewCtxCb(void);
207void SetShouldPreemptCb(void *cb);
208void ResetShouldPreemptCb(void);
209
210#define intrman_IMPORTS_start DECLARE_IMPORT_TABLE(intrman, 1, 2)
211#define intrman_IMPORTS_end END_IMPORT_TABLE
212
213#define I_RegisterIntrHandler DECLARE_IMPORT(4, RegisterIntrHandler)
214#define I_ReleaseIntrHandler DECLARE_IMPORT(5, ReleaseIntrHandler)
215#define I_EnableIntr DECLARE_IMPORT(6, EnableIntr)
216#define I_DisableIntr DECLARE_IMPORT(7, DisableIntr)
217#define I_CpuDisableIntr DECLARE_IMPORT(8, CpuDisableIntr)
218#define I_CpuEnableIntr DECLARE_IMPORT(9, CpuEnableIntr)
219#define I_CpuInvokeInKmode DECLARE_IMPORT(14, CpuInvokeInKmode);
220#define I_DisableDispatchIntr DECLARE_IMPORT(15, DisableDispatchIntr);
221#define I_EnableDispatchIntr DECLARE_IMPORT(16, EnableDispatchIntr);
222#define I_CpuSuspendIntr DECLARE_IMPORT(17, CpuSuspendIntr)
223#define I_CpuResumeIntr DECLARE_IMPORT(18, CpuResumeIntr)
224#define I_QueryIntrContext DECLARE_IMPORT(23, QueryIntrContext)
225#define I_QueryIntrStack DECLARE_IMPORT(24, QueryIntrStack)
226#define I_iCatchMultiIntr DECLARE_IMPORT(25, iCatchMultiIntr)
227#define I_SetNewCtxCb DECLARE_IMPORT(28, SetNewCtxCb)
228#define I_SetShouldPreemptCb DECLARE_IMPORT(30, SetShouldPreemptCb)
229
230/* For compatibility purposes */
231#define INUM_VBLANK IOP_IRQ_VBLANK
232#define INUM_GM IOP_IRQ_SBUS
233#define INUM_CDROM IOP_IRQ_CDVD
234#define INUM_DMA IOP_IRQ_DMA
235#define INUM_RTC0 IOP_IRQ_RTC0
236#define INUM_RTC1 IOP_IRQ_RTC1
237#define INUM_RTC2 IOP_IRQ_RTC2
238#define INUM_SIO0 IOP_IRQ_SIO0
239#define INUM_SIO1 IOP_IRQ_SIO1
240#define INUM_SPU IOP_IRQ_SPU
241#define INUM_PIO IOP_IRQ_PIO
242#define INUM_EVBLANK IOP_IRQ_EVBLANK
243#define INUM_DVD IOP_IRQ_DVD
244#define INUM_PCMCIA IOP_IRQ_DEV9
245#define INUM_RTC3 IOP_IRQ_RTC3
246#define INUM_RTC4 IOP_IRQ_RTC4
247#define INUM_RTC5 IOP_IRQ_RTC5
248#define INUM_SIO2 IOP_IRQ_SIO2
249#define INUM_HTR0 IOP_IRQ_HTR0
250#define INUM_HTR1 IOP_IRQ_HTR1
251#define INUM_HTR2 IOP_IRQ_HTR2
252#define INUM_HTR3 IOP_IRQ_HTR3
253#define INUM_USB IOP_IRQ_USB
254#define INUM_EXTR IOP_IRQ_EXTR
255#define INUM_FWRE IOP_IRQ_ILINK
256#define INUM_FDMA IOP_IRQ_FDMA
257#define INUM_DMA_0 IOP_IRQ_DMA_MDEC_IN
258#define INUM_DMA_1 IOP_IRQ_DMA_MDEC_OUT
259#define INUM_DMA_2 IOP_IRQ_DMA_SIF2
260#define INUM_DMA_3 IOP_IRQ_DMA_CDVD
261#define INUM_DMA_4 IOP_IRQ_DMA_SPU
262#define INUM_DMA_5 IOP_IRQ_DMA_PIO
263#define INUM_DMA_6 IOP_IRQ_DMA_GPU_OTC
264#define INUM_DMA_BERR IOP_IRQ_DMA_BERR
265#define INUM_DMA_7 IOP_IRQ_DMA_SPU2
266#define INUM_DMA_8 IOP_IRQ_DMA_DEV9
267#define INUM_DMA_9 IOP_IRQ_DMA_SIF0
268#define INUM_DMA_10 IOP_IRQ_DMA_SIF1
269#define INUM_DMA_11 IOP_IRQ_DMA_SIO2_IN
270#define INUM_DMA_12 IOP_IRQ_DMA_SIO2_OUT
271
272#define SetCtxSwitchHandler(...) SetNewCtxCb(__VA_ARGS__)
273#define ResetCtxSwitchHandler(...) ResetNewCtxCb(__VA_ARGS__)
274#define SetCtxSwitchReqHandler(...) SetShouldPreemptCb(__VA_ARGS__)
275#define ResetCtxSwitchReqHandler(...) ResetShouldPreemptCb(__VA_ARGS__)
276
277#ifdef __cplusplus
278}
279#endif
280
281#endif /* __INTRMAN_H__ */
int CpuEnableIntr()
Definition intrman.c:250
int CpuResumeIntr(int state)
Definition intrman.c:227
int CpuInvokeInKmode(void *function,...)
int RegisterIntrHandler(int irq, int mode, int(*handler)(void *), void *arg)
Definition intrman.c:125
void DisableDispatchIntr(int irq)
Definition intrman.c:494
int ReleaseIntrHandler(int irq)
Definition intrman.c:167
void SetNewCtxCb(void *cb)
Definition intrman.c:713
int CpuDisableIntr()
Definition intrman.c:238
void EnableDispatchIntr(int irq)
Definition intrman.c:468
int QueryIntrContext(void)
int DisableIntr(int irq, int *res)
Definition intrman.c:395
int CpuSuspendIntr(int *state)
Definition intrman.c:205
int QueryIntrStack(void *sp)
iop_irq_list
Definition intrman.h:26
@ IOP_IRQ_EXTR
Definition intrman.h:53
@ IOP_IRQ_DMA
Definition intrman.h:31
@ IOP_IRQ_SW1
Definition intrman.h:75
@ IOP_IRQ_FDMA
Definition intrman.h:56
@ IOP_IRQ_SW2
Definition intrman.h:77
@ IOP_IRQ_DVD
Definition intrman.h:41
@ IOP_IRQ_DMA_BERR
Definition intrman.h:66
int EnableIntr(int irq)
Definition intrman.c:346