39 lines
772 B
C
39 lines
772 B
C
#ifndef __SOC_PERIPHERALS_H
|
|
#define __SOC_PERIPHERALS_H
|
|
|
|
#include "drivers/xilinx_uartlite.h"
|
|
#include "drivers/xilinx_gpio.h"
|
|
#include "drivers/xilinx_timer.h"
|
|
|
|
#include "flute_system.h"
|
|
|
|
// Peripheral defines
|
|
#define UART0_BASE 0x40000000
|
|
#define GPIO0_BASE 0x40010000
|
|
#define TIMER0_BASE 0x40020000
|
|
|
|
#define CLINT_BASE 0x02000000
|
|
|
|
// SoC config
|
|
#define SYS_CLK_FREQ 32000000
|
|
#define SYS_TICK_RATE 1000
|
|
|
|
#define SYS_TICK_STEP (SYS_CLK_FREQ / SYS_TICK_RATE)
|
|
|
|
// Peripherals
|
|
extern __IO xilinx_uartlite_t *UART0;
|
|
extern __IO xilinx_gpio_t *GPIO0;
|
|
extern __IO xilinx_timer_t *TIMER0;
|
|
|
|
// SysTick
|
|
extern volatile uint64_t SysTick;
|
|
|
|
static inline uint32_t GetTick() {
|
|
return SysTick;
|
|
}
|
|
|
|
static inline uint32_t GetCoreClock() {
|
|
return SYS_CLK_FREQ;
|
|
}
|
|
|
|
#endif |