MNRS-BM-BSP/env/ehrenberg/platform.h

45 lines
1.1 KiB
C

// See LICENSE for license details.
#ifndef _ISS_PLATFORM_H
#define _ISS_PLATFORM_H
#if __riscv_xlen == 32
#define MCAUSE_INT 0x80000000UL
#define MCAUSE_CAUSE 0x000003FFUL
#else
#define MCAUSE_INT 0x8000000000000000UL
#define MCAUSE_CAUSE 0x00000000000003FFUL
#endif
#define APB_BUS
#include "ehrenberg/devices/gpio.h"
#include "ehrenberg/devices/uart.h"
#include "ehrenberg/devices/timer.h"
#include "ehrenberg/devices/aclint.h"
#include "ehrenberg/devices/interrupt.h"
#include "ehrenberg/devices/qspi.h"
#define PERIPH(TYPE, ADDR) ((volatile TYPE*) (ADDR))
#define APB_BASE 0xF0000000
#define gpio PERIPH(gpio_t, APB_BASE+0x0000)
#define uart PERIPH(uart_t, APB_BASE+0x1000)
#define timer PERIPH(timer_t, APB_BASE+0x20000)
#define aclint PERIPH(aclint_t, APB_BASE+0x30000)
#define irq PERIPH(irq_t, APB_BASE+0x40000)
#define qspi PERIPH(qspi_t, APB_BASE+0x50000)
#define XIP_START_LOC 0xE0040000
// Misc
#include <stdint.h>
void init_pll(void);
unsigned long get_cpu_freq(void);
unsigned long get_timer_freq(void);
#endif /* _ISS_PLATFORM_H */