diff --git a/env/ehrenberg/init.c b/env/ehrenberg/init.c index 2ae1f7a..5015ea4 100644 --- a/env/ehrenberg/init.c +++ b/env/ehrenberg/init.c @@ -90,10 +90,9 @@ void __attribute__((weak)) handle_m_ext_interrupt(){ } void __attribute__((weak)) handle_m_time_interrupt(){ - uint64_t time = ((uint64_t)mtimer->mtimeh)<<32 || mtimer->mtime; - time+=MTIMER_NEXT_TICK_INC; - mtimer->mtimecmph = time>>32; - mtimer->mtimecmp = time; + uint64_t time = get_aclint_mtime(aclint); + time+=MTIMER_NEXT_TICK_INC; + set_aclint_mtime(aclint, time); } void __attribute__((weak)) default_handler(void) { diff --git a/env/ehrenberg/platform.h b/env/ehrenberg/platform.h index fb0005c..c28544d 100644 --- a/env/ehrenberg/platform.h +++ b/env/ehrenberg/platform.h @@ -10,26 +10,22 @@ #define APB_BUS #include "ehrenberg/devices/gpio.h" -#include "ehrenberg/devices/interrupt.h" -#include "ehrenberg/devices/timer.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 TIMER_BASE (APB_BASE+0x20000) -#define gpio_a PERIPH(gpio_t, APB_BASE+0x0000) -//#define gpio_b PERIPH(gpio_t, APB_BASE+0x10000) -#define uart PERIPH(uart_t, APB_BASE+0x1000) -#define prescaler PERIPH(uart_t, TIMER_BASE+0x0) -#define timer_a PERIPH(uart_t, TIMER_BASE+0x4) -#define timer_b PERIPH(uart_t, TIMER_BASE+0x10) -#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); +#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 @@ -40,6 +36,5 @@ 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 */ diff --git a/libwrap/sys/puts.c b/libwrap/sys/puts.c index fd82e4f..4df45c2 100644 --- a/libwrap/sys/puts.c +++ b/libwrap/sys/puts.c @@ -13,7 +13,7 @@ int __wrap_puts(const char *s) { while (*s != '\0') { #if defined(BOARD_ehrenberg) - while (uart_get_tx_free(uart)==0) ; + while (get_uart_rx_tx_reg_tx_free(uart)==0) ; uart_write(uart, *s); #elif defined(BOARD_iss) *((uint32_t*) 0xFFFF0000) = *s; diff --git a/libwrap/sys/read.c b/libwrap/sys/read.c index c6e1a0d..2701799 100644 --- a/libwrap/sys/read.c +++ b/libwrap/sys/read.c @@ -29,7 +29,7 @@ ssize_t __wrap_read(int fd, void* ptr, size_t len) if (isatty(fd)) { #if defined(BOARD_ehrenberg) for (current = (uint8_t *)ptr; - (current < ((uint8_t *)ptr) + len) && (uart_get_rx_avail(uart) > 0); + (current < ((uint8_t *)ptr) + len) && (get_uart_rx_tx_reg_rx_avail(uart) > 0); current ++) { *current = uart_read(uart); result++; diff --git a/libwrap/sys/write.c b/libwrap/sys/write.c index 46e0788..254b2fd 100644 --- a/libwrap/sys/write.c +++ b/libwrap/sys/write.c @@ -8,17 +8,16 @@ #include "platform.h" #include "stub.h" #include "weak_under_alias.h" - ssize_t __wrap_write(int fd, const void* ptr, size_t len) { const uint8_t * current = (const uint8_t *)ptr; if (isatty(fd)) { for (size_t jj = 0; jj < len; jj++) { #if defined(BOARD_ehrenberg) - while (uart_get_tx_free(uart)==0) ; + while (get_uart_rx_tx_reg_tx_free(uart)==0) ; uart_write(uart, current[jj]); if (current[jj] == '\n') { - while (uart_get_tx_free(uart)==0) ; + while (get_uart_rx_tx_reg_tx_free(uart)==0) ; uart_write(uart, '\r'); } #elif defined(BOARD_iss)