1 /*
2  * Copyright (c) 2019 Elliot Berman
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #define SIFIVE_IRQ_UART0 4
11 #define SIFIVE_IRQ_UART1 5
12 
13 #define SIFIVE_NUM_IRQS 127
14 
15 #define CLINT_BASE 0x02000000
16 #define PLIC_BASE  0x0c000000
17 #define UART0_BASE 0x10010000
18 #define UART1_BASE 0x10011000
19 #define GPIO_BASE  0x10060000
20 
21 #if RISCV_XMODE_OFFSET == RISCV_MACH_OFFSET
22 #define PLIC_HART_IDX(hart)    ((hart) ? ((2 * (hart)) - 1) : 0)
23 #elif RISCV_XMODE_OFFSET == RISCV_SUPER_OFFSET
24 #define PLIC_HART_IDX(hart)    ((hart) ? (2 * (hart)) : ~0U)
25 #endif
26