2 ppcskel - a Free Software replacement for the Nintendo/BroadOn IOS.
5 Copyright (C) 2009 Bernhard Urban <lewurm@gmx.net>
6 Copyright (C) 2009 Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
8 # This code is licensed to you under the terms of the GNU GPL, version 2;
9 # see file COPYING or http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
33 #define IRQF_TIMER (1<<IRQ_TIMER)
34 #define IRQF_NAND (1<<IRQ_NAND)
35 #define IRQF_AES (1<<IRQ_AES)
36 #define IRQF_SDHC (1<<IRQ_SDHC)
37 #define IRQF_GPIO1B (1<<IRQ_GPIO1B)
38 #define IRQF_GPIO1 (1<<IRQ_GPIO1)
39 #define IRQF_RESET (1<<IRQ_RESET)
40 #define IRQF_IPC (1<<IRQ_IPC)
41 #define IRQF_OHCI0 (1<<IRQ_OHCI0)
42 #define IRQF_OHCI1 (1<<IRQ_OHCI1)
45 IRQF_TIMER|IRQF_NAND|IRQF_GPIO1B|IRQF_GPIO1| \
46 IRQF_RESET|IRQF_IPC|IRQF_AES|IRQF_SDHC| \
47 IRQF_OHCI0|IRQF_OHCI1 \
51 /* broadway processor interface registers */
52 #define BW_PI_IRQFLAG (0x0c003000)
53 #define BW_PI_IRQMASK (0x0c003004)
55 // http://hitmen.c02.at/files/yagcd/yagcd/chap5.html#sec5.4
56 #define BW_PI_IRQ_RESET 1
57 #define BW_PI_IRQ_DI 2
58 #define BW_PI_IRQ_SI 3
59 #define BW_PI_IRQ_EXI 4
60 #define BW_PI_IRQ_AI 5
61 #define BW_PI_IRQ_DSP 6
62 #define BW_PI_IRQ_MEM 7
63 #define BW_PI_IRQ_VI 8
64 #define BW_PI_IRQ_PE_TOKEN 9
65 #define BW_PI_IRQ_PE_FINISH 10
66 #define BW_PI_IRQ_CP 11
67 #define BW_PI_IRQ_DEBUG 12
68 #define BW_PI_IRQ_HSP 13
69 #define BW_PI_IRQ_HW 14 //hollywood pic
71 /* stolen from libogc - gc/ogc/machine/processor.h */
72 #define _CPU_ISR_Enable() \
73 { register u32 _val = 0; \
74 __asm__ __volatile__ ( \
76 "ori %0,%0,0x8000\n" \
78 : "=&r" ((_val)) : "0" ((_val)) \
82 #define _CPU_ISR_Disable( _isr_cookie ) \
83 { register u32 _disable_mask = 0; \
85 __asm__ __volatile__ ( \
87 "rlwinm %1,%0,0,17,15\n" \
90 : "=&r" ((_isr_cookie)), "=&r" ((_disable_mask)) \
91 : "0" ((_isr_cookie)), "1" ((_disable_mask)) \
95 #define _CPU_ISR_Restore( _isr_cookie ) \
96 { register u32 _enable_mask = 0; \
97 __asm__ __volatile__ ( \
101 " ori %1,%1,0x8000\n" \
104 : "=r"((_isr_cookie)),"=&r" ((_enable_mask)) \
105 : "0"((_isr_cookie)),"1" ((_enable_mask)) \
109 void irq_initialize(void);
110 void irq_shutdown(void);
112 void irq_handler(void);
114 void irq_bw_enable(u32 irq);
115 void irq_bw_disable(u32 irq);
116 void irq_hw_enable(u32 irq);
117 void irq_hw_disable(u32 irq);
120 void irq_restore(u32 cookie);
123 static inline void irq_wait(void)
126 __asm__ volatile ( "mcr\tp15, 0, %0, c7, c0, 4" : : "r" (data) );
133 // stub functions allow us to avoid sprinkling other code with ifdefs
134 static inline u32 irq_kill(void) {
138 static inline void irq_restore(u32 cookie) {