Line 202... |
Line 202... |
// ------------------------------------------------
|
// ------------------------------------------------
|
|
|
// get clock speed (in Hz)
|
// get clock speed (in Hz)
|
uint32_t clock_speed = SYSINFO_CLK;
|
uint32_t clock_speed = SYSINFO_CLK;
|
|
|
// init SPI for 8-bit, clock-mode 0, no interrupt
|
// init SPI for 8-bit, clock-mode 0
|
if (clock_speed < 40000000) {
|
if (clock_speed < 40000000) {
|
neorv32_spi_setup(SPI_FLASH_CLK_PRSC, 0, 0, 0);
|
neorv32_spi_setup(SPI_FLASH_CLK_PRSC, 0, 0);
|
}
|
}
|
else {
|
else {
|
neorv32_spi_setup(CLK_PRSC_128, 0, 0, 0);
|
neorv32_spi_setup(CLK_PRSC_128, 0, 0);
|
}
|
}
|
|
|
if (STATUS_LED_EN == 1) {
|
if (STATUS_LED_EN == 1) {
|
// activate status LED, clear all others
|
// activate status LED, clear all others
|
neorv32_gpio_port_set(1 << STATUS_LED);
|
neorv32_gpio_port_set(1 << STATUS_LED);
|
}
|
}
|
|
|
// init UART (no parity bit, no interrupts)
|
// init UART (no parity bit)
|
neorv32_uart_setup(BAUD_RATE, 0, 0, 0);
|
neorv32_uart_setup(BAUD_RATE, 0);
|
|
|
// Configure machine system timer interrupt for ~2Hz
|
// Configure machine system timer interrupt for ~2Hz
|
neorv32_mtime_set_timecmp(neorv32_mtime_get_time() + (clock_speed/4));
|
neorv32_mtime_set_timecmp(neorv32_mtime_get_time() + (clock_speed/4));
|
|
|
// confiure trap handler (bare-metal, no neorv32 rte available)
|
// confiure trap handler (bare-metal, no neorv32 rte available)
|