PowerBlocks SDK
 
Loading...
Searching...
No Matches
exceptions.h
Go to the documentation of this file.
1
12
13#pragma once
14
15#include <stdint.h>
16
22#define EXCEPTION_IRQ_COUNT 15
23
32#define EXCEPTION_PPC_IRQ (*(volatile uint32_t*)0xcd000030)
33#define EXCEPTION_PPC_IRQ_MASK (*(volatile uint32_t*)0xcd000034)
34
43typedef struct {
44 uint32_t stack_frame;
45
46 // Stack pointer gets excluded
47 uint32_t r0, r2, r3, r4, r5, r6, r7;
48 uint32_t r8, r9, r10, r11, r12, r13, r14, r15;
49 uint32_t r16, r17, r18, r19, r20, r21, r22, r23;
50 uint32_t r24, r25, r26, r27, r28, r29, r30, r31;
51
52 uint32_t sprg3;
53
54 uint32_t cr, lr, ctr, xer, dar;
55 uint32_t srr1, srr0;
56
57 uint32_t gqr0, gqr1, gqr2, gqr3;
58 uint32_t gqr4, gqr5, gqr6, gqr7;
59
60 double f[32];
61 uint64_t ffs;
63
71typedef enum {
72 EXCEPTION_IRQ_TYPE_GP_RUNTIME,
73 EXCEPTION_IRQ_TYPE_RESET_SWITCH,
74 EXCEPTION_IRQ_TYPE_DVD,
75 EXCEPTION_IRQ_TYPE_SERIAL,
76 EXCEPTION_IRQ_TYPE_EXI,
77 EXCEPTION_IRQ_TYPE_STREAMING,
78 EXCEPTION_IRQ_TYPE_DSP,
79 EXCEPTION_IRQ_TYPE_MEMORY,
80 EXCEPTION_IRQ_TYPE_VIDEO,
81 EXCEPTION_IRQ_TYPE_PE_TOKEN,
82 EXCEPTION_IRQ_TYPE_PE_FINISH,
83 EXCEPTION_IRQ_TYPE_FIFO,
84 EXCEPTION_IRQ_TYPE_DEBUGGER,
85 EXCEPTION_IRQ_TYPE_HSP,
86 EXCEPTION_IRQ_TYPE_IPC
88
97
108
117extern void exceptions_install_vector();
118
125
126// Exception handlers called from exceptions_asm.s
127extern void exception_reset(exception_context_t* context);
128extern void exception_machine_check(exception_context_t* context);
129extern void exception_dsi(exception_context_t* context);
130extern void exception_isi(exception_context_t* context);
131extern void exception_external(exception_context_t* context);
132extern void exception_alignment(exception_context_t* context);
133extern void exception_program(exception_context_t* context);
134extern void exception_fpu_unavailable(exception_context_t* context);
135extern void exception_decrementer(exception_context_t* context);
136extern void exception_syscall(exception_context_t* context);
137
138// Used as just the tail end of a exception for jumping to the first task
139extern void exceptions_start_first_task();
int32_t exception_isr_context_switch_needed
Call the context switch at the end of the ISR if true.
Definition exceptions.c:42
void exceptions_install_irq(exception_irq_handler_t handler, exception_irq_type_t type)
Registers an interrupt handler for an IRQ.
Definition exceptions.c:87
void(* exception_irq_handler_t)(exception_irq_type_t irq)
Function pointer to handle irq exceptions.
Definition exceptions.h:107
exception_irq_type_t
Types of IRQs during external exceptions.
Definition exceptions.h:71
void exceptions_install_vector()
Installs the exception vector into the CPU.
Definition exceptions.c:63
Pointer to the stack frame of the saved context during interrupts.
Definition exceptions.h:43