From abbf5a2ef4b46218a1b24ef6afd6cf7b35a87e55 Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Mon, 2 Jul 2018 00:40:06 -0500 Subject: e2 and clic start --- software/clic_vectored/Makefile | 10 ++++ software/clic_vectored/clic_vectored | Bin 0 -> 73836 bytes software/clic_vectored/clic_vectored.c | 95 +++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 software/clic_vectored/Makefile create mode 100755 software/clic_vectored/clic_vectored create mode 100644 software/clic_vectored/clic_vectored.c (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/Makefile b/software/clic_vectored/Makefile new file mode 100644 index 0000000..d6e2342 --- /dev/null +++ b/software/clic_vectored/Makefile @@ -0,0 +1,10 @@ +TARGET = clic_vectored +CFLAGS += -Og -fno-builtin-printf + +BSP_BASE = ../../bsp + +C_SRCS += clic_vectored.c + +C_SRCS += $(BSP_BASE)/drivers/clic/clic_driver.c + +include $(BSP_BASE)/env/common.mk diff --git a/software/clic_vectored/clic_vectored b/software/clic_vectored/clic_vectored new file mode 100755 index 0000000..df33c93 Binary files /dev/null and b/software/clic_vectored/clic_vectored differ diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c new file mode 100644 index 0000000..9ae99e3 --- /dev/null +++ b/software/clic_vectored/clic_vectored.c @@ -0,0 +1,95 @@ +// See LICENSE for license details. + +#include +#include +#include "platform.h" +#include +#include "encoding.h" +#include +#include "sifive/devices/clic.h" +#include "clic/clic_driver.h" + +#ifndef _SIFIVE_COREPLEXIP_ARTY_H +#error 'local_interrupts' demo only supported for Core IP Eval Kits +#endif + +// Global Variable used to show +// software interrupts. +volatile uint32_t g_debouncing; + +// vector table defined in init.c +typedef void (*interrupt_function_ptr_t) (void); +extern interrupt_function_ptr_t localISR[CLIC_NUM_INTERRUPTS]; +extern void default_handler(void); + +//clic data structure +clic_instance_t clic; + +const char * instructions_msg = " \ +\n\ + SiFive, Inc\n\ + E21 Core IP Eval Kit 'clic_interrupts' demo.\n\ +\n\ +The Buttons 0-3 and Switch 3 are enabled as local\n\ +interrupts sources. A .5 s 'debounce' timer is used \n\ +between these interrupts. Software interrupts are\n\ +used to print a message while debouncing.\n\ +Note the priority of the interrupts sources.\n\ +\n"; + +void print_instructions() { + + //write (STDERR_FILENO, instructions_msg, strlen(instructions_msg)); + printf(instructions_msg); + +} + +void button_0_isr(void)__attribute__((interrupt("SiFive-CLIC-preemptible"))); +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) { + clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), button_0_isr); + clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); +} + +void config_gpio() { + // Configure LEDs as outputs. + GPIO_REG(GPIO_INPUT_EN) &= ~((0x1<< RED_LED_OFFSET) | (0x1<< GREEN_LED_OFFSET) | (0x1 << BLUE_LED_OFFSET)) ; + GPIO_REG(GPIO_OUTPUT_EN) |= ((0x1<< RED_LED_OFFSET)| (0x1<< GREEN_LED_OFFSET) | (0x1 << BLUE_LED_OFFSET)) ; + GPIO_REG(GPIO_OUTPUT_VAL) &= ((0x1<< RED_LED_OFFSET) | (0x1<< GREEN_LED_OFFSET)| (0x1 << BLUE_LED_OFFSET)) ; +} + +int main(int argc, char **argv) +{ + clear_csr(mstatus, MSTATUS_MIE); + clear_csr(mie, IRQ_M_SOFT); + clear_csr(mie, IRQ_M_TIMER); + + + clic_init(&clic, CLIC_HART0_ADDR, + (interrupt_function_ptr_t*)localISR, + default_handler, + CLIC_NUM_INTERRUPTS, + CLIC_NUM_CONFIG_BITS); + + + config_gpio(); + button_0_setup(); + + // Enable all global interrupts + set_csr(mstatus, MSTATUS_MIE); + + + print_instructions(); + while(1); + + return 0; + +} -- cgit v1.2.3 From 833e3fadf745dfdec6c8208f6c3b2ffd7b5a6f7f Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Mon, 2 Jul 2018 01:48:36 -0500 Subject: dont use pre-empt with buttons --- software/clic_vectored/clic_vectored.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'software/clic_vectored') 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) { -- cgit v1.2.3 From 482cb468dd680cd268e483a9b160acb222d1cc3f Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Mon, 2 Jul 2018 01:55:06 -0500 Subject: Delete clic_vectored --- software/clic_vectored/clic_vectored | Bin 73836 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 software/clic_vectored/clic_vectored (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored b/software/clic_vectored/clic_vectored deleted file mode 100755 index df33c93..0000000 Binary files a/software/clic_vectored/clic_vectored and /dev/null differ -- cgit v1.2.3 From ff3a78a64798c8cce7f2a10256a26a3e91c0351c Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Mon, 2 Jul 2018 15:23:10 -0500 Subject: add busy wait and extra buttons/irq --- software/clic_vectored/clic_vectored.c | 68 ++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 16 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index db2435d..38a564e 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -1,5 +1,4 @@ // See LICENSE for license details. - #include #include #include "platform.h" @@ -8,6 +7,7 @@ #include #include "sifive/devices/clic.h" #include "clic/clic_driver.h" +#include "sifive/devices/clint.h" #ifndef _SIFIVE_COREPLEXIP_ARTY_H #error 'local_interrupts' demo only supported for Core IP Eval Kits @@ -27,31 +27,34 @@ clic_instance_t clic; const char * instructions_msg = " \ \n\ - SiFive, Inc\n\ - E21 Core IP Eval Kit 'clic_interrupts' demo.\n\ + SiFive, Inc\n\ + E21 Core IP Eval Kit 'clic_vectored' demo.\n\ + This demo uses buttons 0, 1, and 2 on the\n\ + Arty board to trigger vectored clic interrupts.\n\ \n\ -The Buttons 0-3 and Switch 3 are enabled as local\n\ -interrupts sources. A .5 s 'debounce' timer is used \n\ -between these interrupts. Software interrupts are\n\ -used to print a message while debouncing.\n\ -Note the priority of the interrupts sources.\n\ \n"; void print_instructions() { + write (STDERR_FILENO, instructions_msg, strlen(instructions_msg)); +} - //write (STDERR_FILENO, instructions_msg, strlen(instructions_msg)); - printf(instructions_msg); +//busy wait for the specified time +void wait_ms(uint64_t ms) { + static const uint64_t ms_tick = RTC_FREQ/1000; + volatile uint64_t * mtime = (uint64_t*) (CLINT_CTRL_ADDR + CLINT_MTIME); + uint64_t then = (ms_tick * ms) + *mtime; + while(*mtime Date: Mon, 2 Jul 2018 16:04:45 -0500 Subject: update description --- software/clic_vectored/clic_vectored.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index 38a564e..a20b1f2 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -31,6 +31,9 @@ const char * instructions_msg = " \ E21 Core IP Eval Kit 'clic_vectored' demo.\n\ This demo uses buttons 0, 1, and 2 on the\n\ Arty board to trigger vectored clic interrupts.\n\ + The higher the button number, the higher the\n\ + interupt priority. Hold two buttons down at\n\ + the same time to see priorities in action.\n\ \n\ \n"; @@ -59,6 +62,7 @@ void button_0_isr(void) { void button_0_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), button_0_isr); + clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), 1<<4); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); } @@ -74,6 +78,7 @@ void button_1_isr(void) { void button_1_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1), button_1_isr); + clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1), 2<<4); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1)); } @@ -89,6 +94,7 @@ void button_2_isr(void) { void button_2_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2), button_2_isr); + clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2), 3<<4); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); } @@ -110,7 +116,10 @@ int main(int argc, char **argv) (interrupt_function_ptr_t*)localISR, default_handler, CLIC_NUM_INTERRUPTS, - CLIC_NUM_CONFIG_BITS); + CLIC_CONFIG_BITS); + + //use all 4 config bits for levels + clic_set_cliccfg(&clic, CLIC_CONFIG_BITS); //initialize gpio and buttons. //each button registers an interrupt handler -- cgit v1.2.3 From 9d58b2120c5a9b9dbc95c0ea90b16280e36dc9ca Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Mon, 2 Jul 2018 22:48:21 -0500 Subject: short msi handler --- software/clic_vectored/clic_vectored.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index a20b1f2..cbc104e 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -98,6 +98,21 @@ void button_2_setup(void) { clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); } +/*Entry Point for Machine Software Interrupt Handler*/ +uint32_t COUNT; +void msi_isr()__attribute((interrupt)); +void msi_isr() { + //clear the SW interrupt + CLINT_REG(CLINT_MSIP) = 0; + COUNT++; +} + +void msi_setup(void) { + clic_install_handler(&clic, MSIPID, msi_isr); + clic_set_intcfg(&clic, MSIPID, 1<<4); + clic_enable_interrupt(&clic, MSIPID); +} + void config_gpio() { // Configure LEDs as outputs. GPIO_REG(GPIO_INPUT_EN) &= ~((0x1<< RED_LED_OFFSET) | (0x1<< GREEN_LED_OFFSET) | (0x1 << BLUE_LED_OFFSET)) ; @@ -127,13 +142,18 @@ int main(int argc, char **argv) button_0_setup(); button_1_setup(); button_2_setup(); + msi_setup(); // Enable all global interrupts set_csr(mstatus, MSTATUS_MIE); - - print_instructions(); - while(1); + + while(1) { + wait_ms(10000); + printf("Count=%d\n", COUNT); + //Trigger a SW interrupt + CLINT_REG(CLINT_MSIP) = 1; + } return 0; -- cgit v1.2.3 From 962b23a3797ba659577056ed3fc57c2d0a77df62 Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Wed, 4 Jul 2018 18:48:19 -0500 Subject: clic driver level and priority functions --- software/clic_vectored/clic_vectored.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index cbc104e..872aba3 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -53,7 +53,8 @@ void wait_ms(uint64_t ms) { void button_0_isr(void) __attribute__((interrupt)); void button_0_isr(void) { // Toggle Red LED - printf("Button 0 was pressed. Toggle Red.\n"); + uint8_t level = clic_get_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); + printf("Button 0 was pressed, interrupt level %d. Toggle Red.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << RED_LED_OFFSET); wait_ms(500); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); @@ -62,14 +63,15 @@ void button_0_isr(void) { void button_0_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), button_0_isr); - clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), 1<<4); + clic_set_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0), 1); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); } void button_1_isr(void) __attribute__((interrupt)); void button_1_isr(void) { // Toggle Red LED - printf("Button 1 was pressed. Toggle Blue.\n"); + uint8_t level = clic_get_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1)); + printf("Button 1 was pressed, interrupt level %d. Toggle Blue.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << BLUE_LED_OFFSET); wait_ms(500); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1)); @@ -78,14 +80,15 @@ void button_1_isr(void) { void button_1_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1), button_1_isr); - clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1), 2<<4); + clic_set_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1), 2); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1)); } void button_2_isr(void) __attribute__((interrupt)); void button_2_isr(void) { // Toggle Red LED - printf("Button 2 was pressed. Toggle Green.\n"); + uint8_t level = clic_get_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); + printf("Button 2 was pressed, interrupt level %d. Toggle Green.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << GREEN_LED_OFFSET); wait_ms(500); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); @@ -94,7 +97,7 @@ void button_2_isr(void) { void button_2_setup(void) { clic_install_handler(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2), button_2_isr); - clic_set_intcfg(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2), 3<<4); + clic_set_int_level(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2), 3); clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); } @@ -104,12 +107,12 @@ void msi_isr()__attribute((interrupt)); void msi_isr() { //clear the SW interrupt CLINT_REG(CLINT_MSIP) = 0; - COUNT++; + COUNT++; } void msi_setup(void) { clic_install_handler(&clic, MSIPID, msi_isr); - clic_set_intcfg(&clic, MSIPID, 1<<4); + clic_set_int_level(&clic, MSIPID, 1); clic_enable_interrupt(&clic, MSIPID); } @@ -133,8 +136,8 @@ int main(int argc, char **argv) CLIC_NUM_INTERRUPTS, CLIC_CONFIG_BITS); - //use all 4 config bits for levels - clic_set_cliccfg(&clic, CLIC_CONFIG_BITS); + //use all 4 config bits for levels, no shv + clic_set_cliccfg(&clic, ((CLIC_CONFIG_BITS<<1)|0)); //initialize gpio and buttons. //each button registers an interrupt handler -- cgit v1.2.3 From 24010b53cdc225cea7de8662d0b54425f86f8b61 Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Thu, 5 Jul 2018 14:14:04 -0500 Subject: fix level calculation --- software/clic_vectored/clic_vectored.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index 872aba3..3f632df 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -57,7 +57,6 @@ void button_0_isr(void) { printf("Button 0 was pressed, interrupt level %d. Toggle Red.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << RED_LED_OFFSET); wait_ms(500); - clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_0)); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << RED_LED_OFFSET); } @@ -74,7 +73,6 @@ void button_1_isr(void) { printf("Button 1 was pressed, interrupt level %d. Toggle Blue.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << BLUE_LED_OFFSET); wait_ms(500); - clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_1)); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << BLUE_LED_OFFSET); } @@ -91,7 +89,6 @@ void button_2_isr(void) { printf("Button 2 was pressed, interrupt level %d. Toggle Green.\n", level); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << GREEN_LED_OFFSET); wait_ms(500); - clic_enable_interrupt(&clic, (LOCALINTIDBASE + LOCAL_INT_BTN_2)); GPIO_REG(GPIO_OUTPUT_VAL) = GPIO_REG(GPIO_OUTPUT_VAL) ^ (0x1 << GREEN_LED_OFFSET); } @@ -137,7 +134,7 @@ int main(int argc, char **argv) CLIC_CONFIG_BITS); //use all 4 config bits for levels, no shv - clic_set_cliccfg(&clic, ((CLIC_CONFIG_BITS<<1)|0)); + clic_set_cliccfg(&clic, (CLIC_CONFIG_BITS<<1)); //initialize gpio and buttons. //each button registers an interrupt handler -- cgit v1.2.3 From 4967d4690674e553942b7cfe9465de1fc3287faa Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Thu, 5 Jul 2018 16:41:42 -0500 Subject: use new cspid instead of msip --- software/clic_vectored/clic_vectored.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index 3f632df..6f19fa3 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -100,17 +100,17 @@ void button_2_setup(void) { /*Entry Point for Machine Software Interrupt Handler*/ uint32_t COUNT; -void msi_isr()__attribute((interrupt)); -void msi_isr() { +void csip_isr()__attribute((interrupt)); +void csip_isr() { //clear the SW interrupt - CLINT_REG(CLINT_MSIP) = 0; + clic_clear_pending(&clic, CSIPID); COUNT++; } -void msi_setup(void) { - clic_install_handler(&clic, MSIPID, msi_isr); - clic_set_int_level(&clic, MSIPID, 1); - clic_enable_interrupt(&clic, MSIPID); +void csip_setup(void) { + clic_install_handler(&clic, CSIPID, csip_isr); + clic_set_int_level(&clic, CSIPID, 1); + clic_enable_interrupt(&clic, CSIPID); } void config_gpio() { @@ -142,7 +142,7 @@ int main(int argc, char **argv) button_0_setup(); button_1_setup(); button_2_setup(); - msi_setup(); + csip_setup(); // Enable all global interrupts set_csr(mstatus, MSTATUS_MIE); @@ -152,7 +152,7 @@ int main(int argc, char **argv) wait_ms(10000); printf("Count=%d\n", COUNT); //Trigger a SW interrupt - CLINT_REG(CLINT_MSIP) = 1; + clic_set_pending(&clic, CSIPID); } return 0; -- cgit v1.2.3 From b5f83a89d41dc2bd0307694ffca4cb4136f32f86 Mon Sep 17 00:00:00 2001 From: Drew Barbier Date: Thu, 5 Jul 2018 22:32:36 -0500 Subject: preemption support, csipid from button 2 --- software/clic_vectored/clic_vectored.c | 65 ++++++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 14 deletions(-) (limited to 'software/clic_vectored') diff --git a/software/clic_vectored/clic_vectored.c b/software/clic_vectored/clic_vectored.c index 6f19fa3..37ea723 100644 --- a/software/clic_vectored/clic_vectored.c +++ b/software/clic_vectored/clic_vectored.c @@ -28,13 +28,48 @@ clic_instance_t clic; const char * instructions_msg = " \ \n\ SiFive, Inc\n\ - E21 Core IP Eval Kit 'clic_vectored' demo.\n\ - This demo uses buttons 0, 1, and 2 on the\n\ - Arty board to trigger vectored clic interrupts.\n\ - The higher the button number, the higher the\n\ - interupt priority. Hold two buttons down at\n\ - the same time to see priorities in action.\n\ \n\ + 5555555555555555555555555\n\ + 5555 5555\n\ + 5555 5555\n\ + 5555 5555\n\ + 5555 5555555555555555555555\n\ + 5555 555555555555555555555555\n\ + 5555 5555\n\ + 5555 5555\n\ + 5555 5555\n\ +5555555555555555555555555555 55555\n\ + 55555 555555555 55555\n\ + 55555 55555 55555\n\ + 55555 5 55555\n\ + 55555 55555\n\ + 55555 55555\n\ + 55555 55555\n\ + 55555 55555\n\ + 55555 55555\n\ + 555555555\n\ + 55555\n\ + 5\n\ +\n\ +E2 Core IP Eval Kit 'clic_vectored' demo.\n\ +This demo uses buttons 0, 1, and 2 on the\n\ +Arty board to trigger vectored clic interrupts.\n\ +The higher the button number, the higher the\n\ +interupt priority. Button 0's handler runs for\n\ +10 seconds, button 1's for 5, and button 2's for 1.\n\ +Preemption is enabled so that higher priority\n\ +interrupts can be triggered while in low priority\n\ +handlers. The demo also uses the CLIC's software\n\ +interrupt to pend a lower priority interrupt from\n\ +button 2's handler.\n\ +\n\ +Note the buttons are wired directly into the local\n\ +interrupts, so a given interrupt will stay asserted\n\ +as long as the button is being pushed.\n\ +\n\ +This demo works for both the E20 and E21 FPGA\n\ +as long as CLIC_CONFIG_BITS matches the desired\n\ +core.\n\ \n"; void print_instructions() { @@ -50,13 +85,13 @@ void wait_ms(uint64_t ms) { while(*mtime