1 /*
2  * Copyright (c) 2021 Henrik Brix Andersen <henrik@brixandersen.dk>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef RISCV_NEORV32_SOC_H
8 #define RISCV_NEORV32_SOC_H
9 
10 #include <soc_common.h>
11 
12 /* System information (SYSINFO) register offsets */
13 #define NEORV32_SYSINFO_CLK         0x00U
14 #define NEORV32_SYSINFO_CPU         0x04U
15 #define NEORV32_SYSINFO_FEATURES    0x08U
16 #define NEORV32_SYSINFO_CACHE       0x0cU
17 #define NEORV32_SYSINFO_ISPACE_BASE 0xf0U
18 #define NEORV32_SYSINFO_IMEM_SIZE   0xf4U
19 #define NEORV32_SYSINFO_DSPACE_BASE 0xf8U
20 #define NEORV32_SYSINFO_DMEM_SIZE   0xfcU
21 
22 /* System information (SYSINFO) CPU register bits */
23 #define NEORV32_SYSINFO_CPU_ZICSR     BIT(0)
24 #define NEORV32_SYSINFO_CPU_ZIFENCEI  BIT(1)
25 #define NEORV32_SYSINFO_CPU_ZMMUL     BIT(2)
26 #define NEORV32_SYSINFO_CPU_ZBB       BIT(3)
27 #define NEORV32_SYSINFO_CPU_ZFINX     BIT(5)
28 #define NEORV32_SYSINFO_CPU_ZXSCNT    BIT(6)
29 #define NEORV32_SYSINFO_CPU_ZXNOCNT   BIT(7)
30 #define NEORV32_SYSINFO_CPU_PMP       BIT(8)
31 #define NEORV32_SYSINFO_CPU_HPM       BIT(9)
32 #define NEORV32_SYSINFO_CPU_DEBUGMODE BIT(10)
33 #define NEORV32_SYSINFO_CPU_FASTMUL   BIT(30)
34 #define NEORV32_SYSINFO_CPU_FASTSHIFT BIT(31)
35 
36 /* System information (SYSINFO) FEATURES register bits */
37 #define NEORV32_SYSINFO_FEATURES_BOOTLOADER     BIT(0)
38 #define NEORV32_SYSINFO_FEATURES_MEM_EXT        BIT(1)
39 #define NEORV32_SYSINFO_FEATURES_MEM_INT_IMEM   BIT(2)
40 #define NEORV32_SYSINFO_FEATURES_MEM_INT_DMEM   BIT(3)
41 #define NEORV32_SYSINFO_FEATURES_MEM_EXT_ENDIAN BIT(4)
42 #define NEORV32_SYSINFO_FEATURES_ICACHE         BIT(5)
43 #define NEORV32_SYSINFO_FEATURES_OCD            BIT(14)
44 #define NEORV32_SYSINFO_FEATURES_HW_RESET       BIT(15)
45 #define NEORV32_SYSINFO_FEATURES_IO_GPIO        BIT(16)
46 #define NEORV32_SYSINFO_FEATURES_IO_MTIME       BIT(17)
47 #define NEORV32_SYSINFO_FEATURES_IO_UART0       BIT(18)
48 #define NEORV32_SYSINFO_FEATURES_IO_SPI         BIT(19)
49 #define NEORV32_SYSINFO_FEATURES_IO_TWI         BIT(20)
50 #define NEORV32_SYSINFO_FEATURES_IO_PWM         BIT(21)
51 #define NEORV32_SYSINFO_FEATURES_IO_WDT         BIT(22)
52 #define NEORV32_SYSINFO_FEATURES_IO_CFS         BIT(23)
53 #define NEORV32_SYSINFO_FEATURES_IO_TRNG        BIT(24)
54 #define NEORV32_SYSINFO_FEATURES_IO_SLINK       BIT(25)
55 #define NEORV32_SYSINFO_FEATURES_IO_UART1       BIT(26)
56 #define NEORV32_SYSINFO_FEATURES_IO_NEOLED      BIT(27)
57 
58 #endif /* RISCV_NEORV32_SOC_H */
59