summaryrefslogtreecommitdiff
path: root/code/fe310/eos/interrupt.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2020-08-05 03:39:22 +0200
committerUros Majstorovic <majstor@majstor.org>2020-08-05 03:39:22 +0200
commitcf7c06297d04bade9cd04c056f9ed510e64dd7bd (patch)
treea3b8cc23574b98e10874b51d33c9fe1bfc012663 /code/fe310/eos/interrupt.c
parent5cd610a07468137066ea4daa5176c3e7045113b0 (diff)
code -> fw
Diffstat (limited to 'code/fe310/eos/interrupt.c')
-rw-r--r--code/fe310/eos/interrupt.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/code/fe310/eos/interrupt.c b/code/fe310/eos/interrupt.c
deleted file mode 100644
index 820d1fa..0000000
--- a/code/fe310/eos/interrupt.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdlib.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#include "encoding.h"
-#include "platform.h"
-#include "plic_driver.h"
-
-#include "interrupt.h"
-
-// Global Instance data for the PLIC
-// for use by the PLIC Driver.
-static plic_instance_t plic;
-
-static eos_intr_handler_t ext_interrupt_handler[PLIC_NUM_INTERRUPTS];
-
-uintptr_t eos_intr_handle(uintptr_t int_num) {
- if ((int_num >=1) && (int_num <= PLIC_NUM_INTERRUPTS) && (ext_interrupt_handler[int_num-1])) {
- ext_interrupt_handler[int_num-1]();
- } else {
- printf("error:%d\n", int_num);
- exit(int_num);
- }
- return int_num;
-}
-
-void eos_intr_init(void) {
- for (int i = 0; i < PLIC_NUM_INTERRUPTS; i++){
- ext_interrupt_handler[i] = NULL;
- }
-
- /**************************************************************************
- * Set up the PLIC
- **************************************************************************/
- PLIC_init(&plic,
- PLIC_CTRL_ADDR,
- PLIC_NUM_INTERRUPTS,
- PLIC_NUM_PRIORITIES);
-
- // Enable Global (PLIC) interrupts.
- set_csr(mie, MIP_MEIP);
-
- // Enable all interrupts
- set_csr(mstatus, MSTATUS_MIE);
-}
-
-void eos_intr_set(uint8_t int_num, uint8_t priority, eos_intr_handler_t handler) {
- ext_interrupt_handler[int_num-1] = handler;
- PLIC_set_priority(&plic, int_num, priority);
- PLIC_enable_interrupt(&plic, int_num);
-}
-
-void eos_intr_set_handler(uint8_t int_num, eos_intr_handler_t handler) {
- ext_interrupt_handler[int_num-1] = handler;
-}
-
-void eos_intr_set_priority(uint8_t int_num, uint8_t priority) {
- PLIC_set_priority(&plic, int_num, priority);
-}
-
-void eos_intr_enable(uint8_t int_num) {
- PLIC_enable_interrupt(&plic, int_num);
-}
-
-void eos_intr_disable(uint8_t int_num) {
- PLIC_disable_interrupt(&plic, int_num);
-}
-
-void eos_intr_mask(uint8_t priority) {
- PLIC_set_threshold(&plic, priority);
-}