// 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" #include "sifive/devices/clint.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_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"; void print_instructions() { write (STDERR_FILENO, instructions_msg, strlen(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