RetroArch
irq.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------
2 
3 irq.h -- Interrupt subsystem
4 
5 Copyright (C) 2004
6 Michael Wiedenbauer (shagkur)
7 Dave Murphy (WinterMute)
8 
9 This software is provided 'as-is', without any express or implied
10 warranty. In no event will the authors be held liable for any
11 damages arising from the use of this software.
12 
13 Permission is granted to anyone to use this software for any
14 purpose, including commercial applications, and to alter it and
15 redistribute it freely, subject to the following restrictions:
16 
17 1. The origin of this software must not be misrepresented; you
18 must not claim that you wrote the original software. If you use
19 this software in a product, an acknowledgment in the product
20 documentation would be appreciated but is not required.
21 
22 2. Altered source versions must be plainly marked as such, and
23 must not be misrepresented as being the original software.
24 
25 3. This notice may not be removed or altered from any source
26 distribution.
27 
28 
29 -------------------------------------------------------------*/
30 
31 
32 #ifndef __IRQ_H__
33 #define __IRQ_H__
34 
40 #include <gctypes.h>
41 #include "context.h"
42 
43 #define IM_NONE (0xffffffff)
44 #define IRQ_MEM0 0
45 #define IRQ_MEM1 1
46 #define IRQ_MEM2 2
47 #define IRQ_MEM3 3
48 #define IRQ_MEMADDRESS 4
49 #define IRQ_DSP_AI 5
50 #define IRQ_DSP_ARAM 6
51 #define IRQ_DSP_DSP 7
52 #define IRQ_AI 8
53 #define IRQ_EXI0_EXI 9
54 #define IRQ_EXI0_TC 10
55 #define IRQ_EXI0_EXT 11
56 #define IRQ_EXI1_EXI 12
57 #define IRQ_EXI1_TC 13
58 #define IRQ_EXI1_EXT 14
59 #define IRQ_EXI2_EXI 15
60 #define IRQ_EXI2_TC 16
61 #define IRQ_PI_CP 17
62 #define IRQ_PI_PETOKEN 18
63 #define IRQ_PI_PEFINISH 19
64 #define IRQ_PI_SI 20
65 #define IRQ_PI_DI 21
66 #define IRQ_PI_RSW 22
67 #define IRQ_PI_ERROR 23
68 #define IRQ_PI_VI 24
69 #define IRQ_PI_DEBUG 25
70 #define IRQ_PI_HSP 26
71 #if defined(HW_RVL)
72 #define IRQ_PI_ACR 27
73 #endif
74 #define IRQ_MAX 32
75 
76 #define IRQMASK(irq) (0x80000000u>>irq)
77 
78 #define IM_MEM0 IRQMASK(IRQ_MEM0)
79 #define IM_MEM1 IRQMASK(IRQ_MEM1)
80 #define IM_MEM2 IRQMASK(IRQ_MEM2)
81 #define IM_MEM3 IRQMASK(IRQ_MEM3)
82 #define IM_MEMADDRESS IRQMASK(IRQ_MEMADDRESS)
83 #define IM_MEM (IM_MEM0|IM_MEM1|IM_MEM2|IM_MEM3|IM_MEMADDRESS)
84 
85 #define IM_DSP_AI IRQMASK(IRQ_DSP_AI)
86 #define IM_DSP_ARAM IRQMASK(IRQ_DSP_ARAM)
87 #define IM_DSP_DSP IRQMASK(IRQ_DSP_DSP)
88 #define IM_DSP (IM_DSP_AI|IM_DSP_ARAM|IM_DSP_DSP)
89 
90 #define IM_AI IRQMASK(IRQ_AI)
91 
92 #define IM_EXI0_EXI IRQMASK(IRQ_EXI0_EXI)
93 #define IM_EXI0_TC IRQMASK(IRQ_EXI0_TC)
94 #define IM_EXI0_EXT IRQMASK(IRQ_EXI0_EXT)
95 #define IM_EXI0 (IM_EXI0_EXI|IM_EXI0_TC|IM_EXI0_EXT)
96 
97 #define IM_EXI1_EXI IRQMASK(IRQ_EXI1_EXI)
98 #define IM_EXI1_TC IRQMASK(IRQ_EXI1_TC)
99 #define IM_EXI1_EXT IRQMASK(IRQ_EXI1_EXT)
100 #define IM_EXI1 (IM_EXI1_EXI|IM_EXI1_TC|IM_EXI1_EXT)
101 
102 #define IM_EXI2_EXI IRQMASK(IRQ_EXI2_EXI)
103 #define IM_EXI2_TC IRQMASK(IRQ_EXI2_TC)
104 #define IM_EXI2 (IM_EXI2_EXI|IM_EXI2_TC)
105 #define IM_EXI (IM_EXI0|IM_EXI1|IM_EXI2)
106 
107 #define IM_PI_CP IRQMASK(IRQ_PI_CP)
108 #define IM_PI_PETOKEN IRQMASK(IRQ_PI_PETOKEN)
109 #define IM_PI_PEFINISH IRQMASK(IRQ_PI_PEFINISH)
110 #define IM_PI_SI IRQMASK(IRQ_PI_SI)
111 #define IM_PI_DI IRQMASK(IRQ_PI_DI)
112 #define IM_PI_RSW IRQMASK(IRQ_PI_RSW)
113 #define IM_PI_ERROR IRQMASK(IRQ_PI_ERROR)
114 #define IM_PI_VI IRQMASK(IRQ_PI_VI)
115 #define IM_PI_DEBUG IRQMASK(IRQ_PI_DEBUG)
116 #define IM_PI_HSP IRQMASK(IRQ_PI_HSP)
117 #if defined(HW_DOL)
118 #define IM_PI (IM_PI_CP|IM_PI_PETOKEN|IM_PI_PEFINISH|IM_PI_SI|IM_PI_DI|IM_PI_RSW|IM_PI_ERROR|IM_PI_VI|IM_PI_DEBUG|IM_PI_HSP)
119 #elif defined(HW_RVL)
120 #define IM_PI_ACR IRQMASK(IRQ_PI_ACR)
121 #define IM_PI (IM_PI_CP|IM_PI_PETOKEN|IM_PI_PEFINISH|IM_PI_SI|IM_PI_DI|IM_PI_RSW|IM_PI_ERROR|IM_PI_VI|IM_PI_DEBUG|IM_PI_HSP|IM_PI_ACR)
122 #endif
123 
124 #ifdef __cplusplus
125  extern "C" {
126 #endif /* __cplusplus */
127 
128 
134 typedef void (*raw_irq_handler_t)(u32 irq,void *ctx);
135 
136 
145 raw_irq_handler_t IRQ_Request(u32 nIrq,raw_irq_handler_t pHndl,void *pCtx);
146 
147 
155 
156 
164 
165 
171 u32 IRQ_Disable(void);
172 
173 
180 void IRQ_Restore(u32 level);
181 
182 void __MaskIrq(u32 nMask);
183 void __UnmaskIrq(u32 nMask);
184 
185 #ifdef __cplusplus
186  }
187 #endif /* __cplusplus */
188 
189 #endif
u32 IRQ_Disable(void)
Disable the complete IRQ subsystem. No interrupts will be served. Multithreading kernel fully disable...
Definition: irq.c:411
Data type definitions.
void __UnmaskIrq(u32 nMask)
Definition: irq.c:324
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
raw_irq_handler_t IRQ_Free(u32 nIrq)
Free an interrupt handler.
Definition: irq.c:399
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
GLint level
Definition: glext.h:6293
void IRQ_Restore(u32 level)
Restore the IRQ subsystem with the given level. This is function should be used together with IRQ_Dis...
Definition: irq.c:418
void __MaskIrq(u32 nMask)
Definition: irq.c:337
raw_irq_handler_t IRQ_Request(u32 nIrq, raw_irq_handler_t pHndl, void *pCtx)
Register an interrupt handler.
Definition: irq.c:376
void(* raw_irq_handler_t)(u32 irq, void *ctx)
function pointer typedef for the interrupt handler callback
Definition: irq.h:134
raw_irq_handler_t IRQ_GetHandler(u32 nIrq)
Get the handler from interrupt number.
Definition: irq.c:388
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19