diff --git a/BaS_gcc/sources/exceptions.c b/BaS_gcc/sources/exceptions.c index 0c57d61..71a86e6 100644 --- a/BaS_gcc/sources/exceptions.c +++ b/BaS_gcc/sources/exceptions.c @@ -24,6 +24,9 @@ #include #include "bas_printf.h" #include "bas_string.h" +#include "startcf.h" +#include "interrupts.h" +#include "MCF5475.h" #if MACHINE_FIREBEE #include "firebee.h" @@ -39,7 +42,9 @@ #define debug_printf(format, arg...) do { ; } while (0) #endif /* DEBUG_EXC */ -inline uint32_t set_vbr(uint32_t value) +typedef void (*exception_handler)(void); + +static inline uint32_t set_vbr(uint32_t value) { extern uint32_t rt_vbr; uint32_t ret = rt_vbr; @@ -55,50 +60,62 @@ inline uint32_t set_vbr(uint32_t value) return ret; } -void __attribute__((interrupt)) std_exception_handler() +static void __attribute__((interrupt)) std_exception_handler(void) { } -void __attribute__((interrupt)) reset_exception_handler() +static void __attribute__((interrupt)) reset_exception_handler(void) { } -void __attribute__((interrupt)) access_exception_handler() +static void __attribute__((interrupt)) access_exception_handler(void) { } -void __attribute__((interrupt)) irq1_exception_handler() +static void __attribute__((interrupt)) irq1_exception_handler(void) { } -void __attribute__((interrupt)) irq2_exception_handler() +static void __attribute__((interrupt)) irq2_exception_handler(void) { } -void __attribute__((interrupt)) irq3_exception_handler() +static void __attribute__((interrupt)) irq3_exception_handler(void) { } -void __attribute__((interrupt)) irq4_exception_handler() +static void __attribute__((interrupt)) irq4_exception_handler(void) { } -void __attribute__((interrupt)) irq5_exception_handler() +static void __attribute__((interrupt)) irq5_exception_handler(void) { } -void __attribute__((interrupt)) irq6_exception_handler() +static void __attribute__((interrupt)) irq6_exception_handler(void) { } -void __attribute__((interrupt)) irq7_exception_handler() +static void __attribute__((interrupt)) irq7_exception_handler(void) { } +static void __attribute__((interrupt)) psc3_interrupt_handler(void) +{ +} + +static void __attribute__((interrupt)) gpt0_interrupt_handler(void) +{ +} + +extern void __attribute__((interrupt)) xhdi_sd_install(void); + void vec_init(void) { - extern uint32_t _RAMBAR0[]; /* defined in linker script */ - uint32_t *VBR = &_RAMBAR0[0]; + exception_handler *VBR = (exception_handler *) &_RAMBAR0[0]; + extern uint32_t _SUP_SP[]; /* supervisor stack pointer from linker script */ + exception_handler *SUP_SP = (exception_handler *) &_SUP_SP[0]; + extern uint32_t rt_mod; extern uint32_t rt_ssp; extern uint32_t rt_usp; @@ -120,7 +137,7 @@ void vec_init(void) VBR[i] = std_exception_handler; } - VBR[0] = __SUP_SP; + VBR[0] = SUP_SP; VBR[1] = reset_exception_handler; VBR[2] = access_exception_handler; @@ -133,20 +150,20 @@ void vec_init(void) } #endif /* MACHINE_FIREBEE */ - VBR[0X80] = xhdi_install; /* trap #0 exception handler for BaS driver vectors */ + VBR[0X80] = xhdi_sd_install; /* trap #0 exception handler for BaS driver vectors */ #if MACHINE_FIREBEE /* * ACP interrupts 1-7 (generated by the FPGA on the FireBee) */ - VBR[0X104] = (uint32_t) irq1_exception_handler; - VBR[0x108] = (uint32_t) irq2_exception_handler; - VBR[0x10c] = (uint32_t) irq3_exception_handler; - VBR[0x110] = (uint32_t) irq4_exception_handler; - VBR[0x114] = (uint32_t) irq5_exception_handler; - VBR[0x118] = (uint32_t) irq6_exception_handler; - VBR[0x11c] = (uint32_t) irq7_exception_handler; + VBR[0X104] = irq1_exception_handler; + VBR[0x108] = irq2_exception_handler; + VBR[0x10c] = irq3_exception_handler; + VBR[0x110] = irq4_exception_handler; + VBR[0x114] = irq5_exception_handler; + VBR[0x118] = irq6_exception_handler; + VBR[0x11c] = irq7_exception_handler; /* * install PSC vectors (used for PIC communication on the FireBee diff --git a/BaS_gcc/sources/usb_mem.c b/BaS_gcc/sources/usb_mem.c index fb771d0..edfb3ff 100644 --- a/BaS_gcc/sources/usb_mem.c +++ b/BaS_gcc/sources/usb_mem.c @@ -15,6 +15,7 @@ #include "bas_string.h" #include "bas_printf.h" #include "usb.h" +#include "exceptions.h" /* set_ipl() */ #if MACHINE_FIREBEE #include "firebee.h" @@ -37,7 +38,6 @@ #define USB_MEM_PRINTF(fmt, args...) #endif -extern int asm_set_ipl(int level); extern void *info_fvdi; extern long offscren_reserved(void); @@ -204,7 +204,7 @@ int usb_free(void *addr) MD *p, **q; MPB *mpb; mpb = &pmd; - level = asm_set_ipl(7); + level = set_ipl(7); for(p = *(q = &mpb->mp_mal); p; p = *(q = &p->m_link)) { if ((long)addr == p->m_start) @@ -212,12 +212,12 @@ int usb_free(void *addr) } if (!p) { - asm_set_ipl(level); + set_ipl(level); return(-1); } *q = p->m_link; freeit(p, mpb); - asm_set_ipl(level); + set_ipl(level); USB_MEM_PRINTF("usb_free(0x%08X)\r\n", addr); return(0); } @@ -233,11 +233,11 @@ void *usb_malloc(long amount) return(0); if ((amount & 1)) amount++; - level = asm_set_ipl(7); + level = set_ipl(7); m = ffit(amount, &pmd); if (m != NULL) ret = (void *)m->m_start; - asm_set_ipl(level); + set_ipl(level); USB_MEM_PRINTF("usb_malloc(%d) = 0x%08X\r\n", amount, ret); return(ret); }