aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/irq.c
blob: 6fdfe859e229f8748ff8d8b93f639614705e1757 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
 * @file irq.c
 * riscv64 implementation of irq handling.
 */

#include <apos/attrs.h>
#include <apos/debug.h>
#include <arch/irq.h>
#include "csr.h"

/** Defined in arch/riscv64/kernel/entry.S. */
extern void handle_irq();

/** Called from arch/riscv64/kernel/entry.S. */
void handle_sys_irq()
{
}

void init_irq(void *fdt)
{
	UNUSED(fdt);
	csr_write(CSR_STVEC, &handle_irq);

	long s = 0;
	csr_read(CSR_SIE, s);
	info("CSR_SIE: %lx\n", s);
}

/* very simple for now */
void enable_irq()
{
	csr_set(CSR_SSTATUS, CSR_SIE);
}

void disable_irq()
{
	csr_clear(CSR_SSTATUS, CSR_SIE);
}