2024-01-13 23:06:01 +01:00
|
|
|
// See LICENSE for license details.
|
|
|
|
|
|
|
|
#ifndef _ISS_PLATFORM_H
|
|
|
|
#define _ISS_PLATFORM_H
|
|
|
|
|
|
|
|
// Some things missing from the official encoding.h
|
|
|
|
#define MCAUSE_INT 0x80000000
|
|
|
|
#define MCAUSE_CAUSE 0x7FFFFFFF
|
|
|
|
|
2024-01-14 08:14:57 +01:00
|
|
|
#define APB_BUS
|
2024-01-13 23:06:01 +01:00
|
|
|
|
2024-01-14 20:35:05 +01:00
|
|
|
#include "ehrenberg/devices/gpio.h"
|
|
|
|
#include "ehrenberg/devices/interrupt.h"
|
|
|
|
#include "ehrenberg/devices/timer.h"
|
|
|
|
#include "ehrenberg/devices/uart.h"
|
|
|
|
#include "ehrenberg/devices/qspi.h"
|
2024-01-13 23:06:01 +01:00
|
|
|
|
2024-01-14 08:14:57 +01:00
|
|
|
#define PERIPH(TYPE, ADDR) ((volatile TYPE*) (ADDR))
|
2024-01-13 23:06:01 +01:00
|
|
|
|
2024-01-14 08:14:57 +01:00
|
|
|
#define APB_BASE 0xF0000000
|
|
|
|
#define TIMER_BASE (APB_BASE+0x30000)
|
2024-01-13 23:06:01 +01:00
|
|
|
|
2024-01-14 08:14:57 +01:00
|
|
|
#define gpio_a PERIPH(gpio_t, APB_BASE+0x00000)
|
|
|
|
//#define gpio_b PERIPH(gpio_t, APB_BASE+0x10000)
|
|
|
|
#define uart PERIPH(uart_t, APB_BASE+0x10000)
|
|
|
|
#define prescaler PERIPH(uart_t, TIMER_BASE+0x0)
|
|
|
|
#define timer_a PERIPH(uart_t, TIMER_BASE+0x10)
|
|
|
|
#define timer_b PERIPH(uart_t, TIMER_BASE+0x20)
|
|
|
|
#define mtimer PERIPH(mtimer_t, APB_BASE+0x30000)
|
|
|
|
#define irq PERIPH(irq_t, APB_BASE+0x40000)
|
|
|
|
#define qspi PERIPH(qspi_t, APB_BASE+0x50000)
|
|
|
|
//volatile qspi_t* const qspi = (qspi_t*)(APB_BASE+0x50000);
|
2024-01-13 23:06:01 +01:00
|
|
|
|
2024-01-14 08:14:57 +01:00
|
|
|
#define XIP_START_LOC 0xE0040000
|
2024-01-13 23:06:01 +01:00
|
|
|
|
|
|
|
// Misc
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
void init_pll(void);
|
|
|
|
unsigned long get_cpu_freq(void);
|
|
|
|
unsigned long get_timer_freq(void);
|
|
|
|
uint64_t get_timer_value(void);
|
|
|
|
|
|
|
|
#endif /* _ISS_PLATFORM_H */
|