diff --git a/src/Makefile b/src/Makefile index 1f1d6ca..cfad722 100644 --- a/src/Makefile +++ b/src/Makefile @@ -5,7 +5,7 @@ include ../make/mips_app.mk PROG-ml402 = $(addprefix $(BUILD_DIR)/, hello.elf testbench.elf test_irq.elf dhry.elf queens.elf stanford.elf paranoia.elf rmd160_test.elf Bessel.elf whet.elf phrasen.elf dttl.elf richards_benchmark.elf test_exception.elf life.elf r3.elf gunzip.elf basic_math.elf jman_patches.elf jman_patchmeshes.elf jman_polys.elf test_hpi.elf test_vga.elf test_fft.elf) PROG-denano = $(addprefix $(BUILD_DIR)/, hello.elf dhry.elf queens.elf stanford.elf paranoia.elf rmd160_test.elf Bessel.elf whet.elf phrasen.elf dttl.elf richards_benchmark.elf test_exception.elf testbench_denano.elf) -PROG-sim = $(addprefix $(BUILD_DIR)/, hello.elf) +PROG-sim = $(addprefix $(BUILD_DIR)/, hello.elf test_exception_sim.elf) all: $(PROG-$(BOARD)) @@ -299,7 +299,7 @@ $(BUILD_DIR)/lwl.elf: $(BUILD_DIR) lwl.c $(OBJCOPY) -O ihex -I binary $@.flash.bin $@.hex $(BUILD_DIR)/ucb.elf: $(BUILD_DIR) ucb.c - $(CC) $(CFLAGS) -O2 -o $@ ucb.c -lsys_sim >$@.map + $(CC) $(CFLAGS) -O2 -o $@ ucb.c $(LIBS) >$@.map $(OBJDUMP) -d $@ > $@.dis $(OBJCOPY) $@ -O binary $@.bin $(OBJCOPY) -O srec $@ $@.srec @@ -308,7 +308,7 @@ $(BUILD_DIR)/ucb.elf: $(BUILD_DIR) ucb.c $(OBJCOPY) -O ihex -I binary $@.flash.bin $@.hex $(BUILD_DIR)/test_timer.elf: $(BUILD_DIR) test_timer.c - $(CC) $(CFLAGS) -O2 -o $@ test_timer.c -lsys_sim >$@.map + $(CC) $(CFLAGS) -O2 -o $@ test_timer.c $(LIBS) >$@.map $(OBJDUMP) -d $@ > $@.dis $(OBJCOPY) $@ -O binary $@.bin $(OBJCOPY) -O srec $@ $@.srec @@ -317,7 +317,7 @@ $(BUILD_DIR)/test_timer.elf: $(BUILD_DIR) test_timer.c $(OBJCOPY) -O ihex -I binary $@.flash.bin $@.hex $(BUILD_DIR)/test_exception_sim.elf: $(BUILD_DIR) test_exception_sim.c - $(CC) $(CFLAGS) -O2 -o $@ test_exception_sim.c -lsys_sim >$@.map + $(CC) $(CFLAGS) -o $@ test_exception_sim.c $(LIBS) >$@.map $(OBJDUMP) -d $@ > $@.dis $(OBJCOPY) $@ -O binary $@.bin $(OBJCOPY) -O srec $@ $@.srec @@ -326,7 +326,7 @@ $(BUILD_DIR)/test_exception_sim.elf: $(BUILD_DIR) test_exception_sim.c $(OBJCOPY) -O ihex -I binary $@.flash.bin $@.hex $(BUILD_DIR)/test_tlb_sim.elf: $(BUILD_DIR) test_tlb_sim.c - $(CC) $(CFLAGS) -O2 -o $@ test_tlb_sim.c -lsys_sim >$@.map + $(CC) $(CFLAGS) -O2 -o $@ test_tlb_sim.c $(LIBS) >$@.map $(OBJDUMP) -d $@ > $@.dis $(OBJCOPY) $@ -O binary $@.bin $(OBJCOPY) -O srec $@ $@.srec @@ -335,7 +335,7 @@ $(BUILD_DIR)/test_tlb_sim.elf: $(BUILD_DIR) test_tlb_sim.c $(OBJCOPY) -O ihex -I binary $@.flash.bin $@.hex $(BUILD_DIR)/test_dcache_sim.elf: $(BUILD_DIR) test_dcache.c - $(CC) $(CFLAGS) -O0 -o $@ test_dcache.c -lsys_sim >$@.map + $(CC) $(CFLAGS) -O0 -o $@ test_dcache.c $(LIBS) >$@.map $(OBJDUMP) -d $@ > $@.dis $(OBJCOPY) $@ -O binary $@.bin $(OBJCOPY) -O srec $@ $@.srec diff --git a/src/libsys/irq.h b/src/libsys/irq.h index d6a1d2e..2ddba26 100644 --- a/src/libsys/irq.h +++ b/src/libsys/irq.h @@ -14,5 +14,7 @@ void interrupt_enable(int irq_num); void interrupt_disable(int irq_num); void interrupt_global_enable(); void interrupt_global_disable(); +void interrupt_set(int irq_num); +void interrupt_clr(int irq_num); #endif // IRQ_H diff --git a/src/test_exception_sim.c b/src/test_exception_sim.c index c065ec8..57a2dc7 100644 --- a/src/test_exception_sim.c +++ b/src/test_exception_sim.c @@ -1,9 +1,10 @@ #include #include -#include "libsys.h" +#include +#include #include "xcpt.h" - #define MAX_NUM_EXCEPTIONS 10 + void *g_fp_badsubs[MAX_NUM_EXCEPTIONS]; void _exc_break(void) @@ -17,7 +18,7 @@ void _exc_break(void) ); } -void _exc_syscall(UINT32 code, UINT32 arg) +void _exc_syscall(uint32_t code, uint32_t arg) { __asm ( @@ -212,13 +213,13 @@ void _exc_dbe(void) } -void handler0(void) +void handler0(struct xcptcontext *xcp) { sputs("Interrupt 0\n"); interrupt_clr(0); } -void handler1(void) +void handler1(struct xcptcontext *xcp) { sputs("Interrupt 1\n"); interrupt_clr(1); @@ -234,8 +235,8 @@ int xcp_handler(struct xcptcontext * xcp) if (xcpt_get_type(xcp) == EXC_INT) { - interrupt_clr(0); - interrupt_clr(1); + interrupt_disable(0); + interrupt_disable(1); } else { @@ -274,9 +275,9 @@ int main(void) interrupt_set(1); sputs(" 4 : Syscall\n"); - _exc_syscall(4, (UINT32)((char*)"Hallo Syscall (")); + _exc_syscall(4, (uint32_t)((char*)"Hallo Syscall (")); _exc_syscall(1, 12345678); - _exc_syscall(4, (UINT32)((char*)")\n")); + _exc_syscall(4, (uint32_t)((char*)")\n")); sputs(" 5 : Breakpoint\n"); _exc_break();