summaryrefslogtreecommitdiff
path: root/software/clic_vectored
diff options
context:
space:
mode:
authorDrew Barbier <dbarbi1@gmail.com>2018-07-02 22:48:21 -0500
committerDrew Barbier <dbarbi1@gmail.com>2018-07-02 22:48:21 -0500
commit9d58b2120c5a9b9dbc95c0ea90b16280e36dc9ca (patch)
treec63c3acf5d7cad4b0b2b79b9c80f8282f03c0acf /software/clic_vectored
parent835b33318a3b350051ef153d382a5980efe19ed6 (diff)
short msi handler
Diffstat (limited to 'software/clic_vectored')
-rw-r--r--software/clic_vectored/clic_vectored.c26
1 files changed, 23 insertions, 3 deletions
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;