summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew Barbier <dbarbi1@gmail.com>2018-07-02 01:48:36 -0500
committerDrew Barbier <dbarbi1@gmail.com>2018-07-02 01:48:36 -0500
commit833e3fadf745dfdec6c8208f6c3b2ffd7b5a6f7f (patch)
treee062d4403c9c3fec8ddc06389e35dbb87eba0992
parentabbf5a2ef4b46218a1b24ef6afd6cf7b35a87e55 (diff)
dont use pre-empt with buttons
-rw-r--r--bsp/env/coreip-e2-arty/init.c13
-rw-r--r--software/clic_vectored/clic_vectored.c4
2 files changed, 10 insertions, 7 deletions
diff --git a/bsp/env/coreip-e2-arty/init.c b/bsp/env/coreip-e2-arty/init.c
index aaf213c..3a4c77c 100644
--- a/bsp/env/coreip-e2-arty/init.c
+++ b/bsp/env/coreip-e2-arty/init.c
@@ -46,7 +46,8 @@ static void uart_init(size_t baud_rate)
typedef void (*interrupt_function_ptr_t) (void);
interrupt_function_ptr_t localISR[CLIC_NUM_INTERRUPTS] __attribute__((aligned(64)));
-void trap_entry(void) __attribute__((interrupt("SiFive-CLIC-preemptible"), aligned(64)));
+
+void trap_entry(void) __attribute__((interrupt, aligned(64)));
void trap_entry(void)
{
unsigned long mcause = read_csr(mcause);
@@ -54,13 +55,13 @@ void trap_entry(void)
if (mcause & MCAUSE_INT) {
localISR[mcause & MCAUSE_CAUSE] ();
} else {
- while(1);
+ while(1);
}
}
#ifdef CLIC_DIRECT
#else
-void default_handler(void)__attribute__((interrupt("SiFive-CLIC-preemptible")));;
+void default_handler(void)__attribute__((interrupt));;
#endif
void default_handler(void)
{
@@ -76,9 +77,11 @@ void _init()
puts("core freq at " STR(CPU_FREQ) " Hz\n");
//initialize vector table
- for(int i=0;i++;i<CLIC_NUM_INTERRUPTS) {
- localISR[i] = &default_handler;
+ int i=0;
+ while(i<CLIC_NUM_INTERRUPTS) {
+ localISR[i++] = default_handler;
}
+
write_csr(mtvt, localISR);
#ifdef CLIC_DIRECT
diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c
index 9ae99e3..db2435d 100644
--- a/software/clic_vectored/clic_vectored.c
+++ b/software/clic_vectored/clic_vectored.c
@@ -44,14 +44,14 @@ void print_instructions() {
}
-void button_0_isr(void)__attribute__((interrupt("SiFive-CLIC-preemptible")));
+void button_0_isr(void) __attribute__((interrupt));
void button_0_isr(void) {
// Toggle Red LED
+
const char button_0_msg[] = "Button 0 was pressed. Toggle Red.\n";
write (STDOUT_FILENO, button_0_msg, strlen(button_0_msg));
GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << RED_LED_OFFSET);
clic_clear_pending(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0));
- clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0));
}
void button_0_setup(void) {