summaryrefslogtreecommitdiff
path: root/bsp/coreip-e21-arty
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/coreip-e21-arty')
-rw-r--r--bsp/coreip-e21-arty/metal-platform.h99
-rw-r--r--bsp/coreip-e21-arty/metal.h28
2 files changed, 114 insertions, 13 deletions
diff --git a/bsp/coreip-e21-arty/metal-platform.h b/bsp/coreip-e21-arty/metal-platform.h
new file mode 100644
index 0000000..3daf97d
--- /dev/null
+++ b/bsp/coreip-e21-arty/metal-platform.h
@@ -0,0 +1,99 @@
+#ifndef COREIP_E21_ARTY__METAL_PLATFORM_H
+#define COREIP_E21_ARTY__METAL_PLATFORM_H
+
+/* From clock@0 */
+#define METAL_FIXED_CLOCK_0_CLOCK_FREQUENCY 32500000UL
+
+#define METAL_FIXED_CLOCK
+
+/* From pmp@0 */
+#define METAL_RISCV_PMP_0_NUM_REGIONS 4UL
+
+#define METAL_RISCV_PMP
+
+/* From interrupt_controller@2000000 */
+#define METAL_SIFIVE_CLIC0_2000000_BASE_ADDRESS 33554432UL
+#define METAL_SIFIVE_CLIC0_2000000_SIZE 16777216UL
+#define METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMINTS 153UL
+#define METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMLEVELS 16UL
+#define METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMINTBITS 2UL
+
+#define METAL_SIFIVE_CLIC0
+#define METAL_SIFIVE_CLIC0_MSIP_BASE 0UL
+#define METAL_SIFIVE_CLIC0_MTIMECMP_BASE 16384UL
+#define METAL_SIFIVE_CLIC0_MTIME 49144UL
+#define METAL_SIFIVE_CLIC0_CLICINTIP_BASE 0UL
+#define METAL_SIFIVE_CLIC0_CLICINTIE_BASE 1024UL
+#define METAL_SIFIVE_CLIC0_CLICINTCTL_BASE 2048UL
+#define METAL_SIFIVE_CLIC0_CLICCFG 3072UL
+#define METAL_SIFIVE_CLIC0_MMODE_APERTURE 8388608UL
+#define METAL_SIFIVE_CLIC0_HSMODE_APERTURE 10485760UL
+#define METAL_SIFIVE_CLIC0_SMODE_APERTURE 12582912UL
+#define METAL_SIFIVE_CLIC0_UMODE_APERTURE 14680064UL
+
+/* From gpio@20002000 */
+#define METAL_SIFIVE_GPIO0_20002000_BASE_ADDRESS 536879104UL
+#define METAL_SIFIVE_GPIO0_20002000_SIZE 4096UL
+
+#define METAL_SIFIVE_GPIO0
+#define METAL_SIFIVE_GPIO0_VALUE 0UL
+#define METAL_SIFIVE_GPIO0_INPUT_EN 4UL
+#define METAL_SIFIVE_GPIO0_OUTPUT_EN 8UL
+#define METAL_SIFIVE_GPIO0_PORT 12UL
+#define METAL_SIFIVE_GPIO0_PUE 16UL
+#define METAL_SIFIVE_GPIO0_DS 20UL
+#define METAL_SIFIVE_GPIO0_RISE_IE 24UL
+#define METAL_SIFIVE_GPIO0_RISE_IP 28UL
+#define METAL_SIFIVE_GPIO0_FALL_IE 32UL
+#define METAL_SIFIVE_GPIO0_FALL_IP 36UL
+#define METAL_SIFIVE_GPIO0_HIGH_IE 40UL
+#define METAL_SIFIVE_GPIO0_HIGH_IP 44UL
+#define METAL_SIFIVE_GPIO0_LOW_IE 48UL
+#define METAL_SIFIVE_GPIO0_LOW_IP 52UL
+#define METAL_SIFIVE_GPIO0_IOF_EN 56UL
+#define METAL_SIFIVE_GPIO0_IOF_SEL 60UL
+#define METAL_SIFIVE_GPIO0_OUT_XOR 64UL
+
+/* From spi@20004000 */
+#define METAL_SIFIVE_SPI0_20004000_BASE_ADDRESS 536887296UL
+#define METAL_SIFIVE_SPI0_20004000_SIZE 4096UL
+
+#define METAL_SIFIVE_SPI0
+#define METAL_SIFIVE_SPI0_SCKDIV 0UL
+#define METAL_SIFIVE_SPI0_SCKMODE 4UL
+#define METAL_SIFIVE_SPI0_CSID 16UL
+#define METAL_SIFIVE_SPI0_CSDEF 20UL
+#define METAL_SIFIVE_SPI0_CSMODE 24UL
+#define METAL_SIFIVE_SPI0_DELAY0 40UL
+#define METAL_SIFIVE_SPI0_DELAY1 44UL
+#define METAL_SIFIVE_SPI0_FMT 64UL
+#define METAL_SIFIVE_SPI0_TXDATA 72UL
+#define METAL_SIFIVE_SPI0_RXDATA 76UL
+#define METAL_SIFIVE_SPI0_TXMARK 80UL
+#define METAL_SIFIVE_SPI0_RXMARK 84UL
+#define METAL_SIFIVE_SPI0_FCTRL 96UL
+#define METAL_SIFIVE_SPI0_FFMT 100UL
+#define METAL_SIFIVE_SPI0_IE 112UL
+#define METAL_SIFIVE_SPI0_IP 116UL
+
+/* From teststatus@4000 */
+#define METAL_SIFIVE_TEST0_4000_BASE_ADDRESS 16384UL
+#define METAL_SIFIVE_TEST0_4000_SIZE 4096UL
+
+#define METAL_SIFIVE_TEST0
+#define METAL_SIFIVE_TEST0_FINISHER_OFFSET 0UL
+
+/* From serial@20000000 */
+#define METAL_SIFIVE_UART0_20000000_BASE_ADDRESS 536870912UL
+#define METAL_SIFIVE_UART0_20000000_SIZE 4096UL
+
+#define METAL_SIFIVE_UART0
+#define METAL_SIFIVE_UART0_TXDATA 0UL
+#define METAL_SIFIVE_UART0_RXDATA 4UL
+#define METAL_SIFIVE_UART0_TXCTRL 8UL
+#define METAL_SIFIVE_UART0_RXCTRL 12UL
+#define METAL_SIFIVE_UART0_IE 16UL
+#define METAL_SIFIVE_UART0_IP 20UL
+#define METAL_SIFIVE_UART0_DIV 24UL
+
+#endif /* COREIP_E21_ARTY__METAL_PLATFORM_H*/
diff --git a/bsp/coreip-e21-arty/metal.h b/bsp/coreip-e21-arty/metal.h
index 56e972a..30fd7ef 100644
--- a/bsp/coreip-e21-arty/metal.h
+++ b/bsp/coreip-e21-arty/metal.h
@@ -3,6 +3,8 @@
#ifndef COREIP_E21_ARTY__METAL_H
#define COREIP_E21_ARTY__METAL_H
+#include <metal/machine/platform.h>
+
#ifdef __METAL_MACHINE_MACROS
#ifndef __METAL_CLINT_NUM_PARENTS
@@ -169,7 +171,7 @@ struct __metal_driver_sifive_uart0 __metal_dt_serial_20000000;
struct __metal_driver_fixed_clock __metal_dt_clock_0 = {
.vtable = &__metal_driver_vtable_fixed_clock,
.clock.vtable = &__metal_driver_vtable_fixed_clock.clock,
- .rate = 32500000UL,
+ .rate = METAL_FIXED_CLOCK_0_CLOCK_FREQUENCY,
};
struct metal_memory __metal_dt_mem_sys_sram_0_80000000 = {
@@ -223,24 +225,24 @@ struct __metal_driver_riscv_cpu_intc __metal_dt_cpu_0_interrupt_controller = {
/* From pmp@0 */
struct metal_pmp __metal_dt_pmp_0 = {
- .num_regions = 4UL,
+ .num_regions = METAL_RISCV_PMP_0_NUM_REGIONS,
};
/* From interrupt_controller@2000000 */
struct __metal_driver_sifive_clic0 __metal_dt_interrupt_controller_2000000 = {
.vtable = &__metal_driver_vtable_sifive_clic0,
.controller.vtable = &__metal_driver_vtable_sifive_clic0.clic_vtable,
- .control_base = 33554432UL,
- .control_size = 16777216UL,
+ .control_base = METAL_SIFIVE_CLIC0_2000000_BASE_ADDRESS,
+ .control_size = METAL_SIFIVE_CLIC0_2000000_SIZE,
.init_done = 0,
.num_interrupts = METAL_MAX_CLIC_INTERRUPTS,
.interrupt_parent = &__metal_dt_cpu_0_interrupt_controller.controller,
.interrupt_lines[0] = 3,
.interrupt_lines[1] = 7,
.interrupt_lines[2] = 11,
- .num_subinterrupts = 153UL,
- .num_intbits = 2UL,
- .max_levels = 16UL,
+ .num_subinterrupts = METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMINTS,
+ .num_intbits = METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMINTBITS,
+ .max_levels = METAL_SIFIVE_CLIC0_2000000_SIFIVE_NUMLEVELS,
.interrupt_controller = 1,
};
@@ -399,8 +401,8 @@ struct __metal_driver_sifive_global_external_interrupts0 __metal_dt_global_exter
struct __metal_driver_sifive_gpio0 __metal_dt_gpio_20002000 = {
.vtable = &__metal_driver_vtable_sifive_gpio0,
.gpio.vtable = &__metal_driver_vtable_sifive_gpio0.gpio,
- .base = 536879104UL,
- .size = 4096UL,
+ .base = METAL_SIFIVE_GPIO0_20002000_BASE_ADDRESS,
+ .size = METAL_SIFIVE_GPIO0_20002000_SIZE,
/* From interrupt_controller@2000000 */
.interrupt_parent = &__metal_dt_interrupt_controller_2000000.controller,
.num_interrupts = METAL_MAX_GPIO_INTERRUPTS,
@@ -556,8 +558,8 @@ struct __metal_driver_sifive_gpio_switch __metal_dt_switch_3 = {
struct __metal_driver_sifive_spi0 __metal_dt_spi_20004000 = {
.vtable = &__metal_driver_vtable_sifive_spi0,
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
- .control_base = 536887296UL,
- .control_size = 4096UL,
+ .control_base = METAL_SIFIVE_SPI0_20004000_BASE_ADDRESS,
+ .control_size = METAL_SIFIVE_SPI0_20004000_SIZE,
.clock = NULL,
.pinmux = NULL,
};
@@ -574,8 +576,8 @@ struct __metal_driver_sifive_test0 __metal_dt_teststatus_4000 = {
struct __metal_driver_sifive_uart0 __metal_dt_serial_20000000 = {
.vtable = &__metal_driver_vtable_sifive_uart0,
.uart.vtable = &__metal_driver_vtable_sifive_uart0.uart,
- .control_base = 536870912UL,
- .control_size = 4096UL,
+ .control_base = METAL_SIFIVE_UART0_20000000_BASE_ADDRESS,
+ .control_size = METAL_SIFIVE_UART0_20000000_SIZE,
/* From clock@0 */
.clock = &__metal_dt_clock_0.clock,
.pinmux = NULL,