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 53 14 15 #define CLINT_BASE 0x02000000 16 #define PLIC_BASE 0x0c000000 17 #define PRCI_BASE 0x10000000 18 #define UART0_BASE 0x10010000 19 #define UART1_BASE 0x10011000 20 #define PWM0_BASE 0x10020000 21 #define PWM1_BASE 0x10021000 22 #define GPIO_BASE 0x10060000 23 24 #if RISCV_XMODE_OFFSET == RISCV_MACH_OFFSET 25 #define PLIC_HART_IDX(hart) ((hart) ? ((2 * (hart)) - 1) : 0) 26 #elif RISCV_XMODE_OFFSET == RISCV_SUPER_OFFSET 27 #define PLIC_HART_IDX(hart) ((hart) ? (2 * (hart)) : ~0U) 28 #endif 29