modifies initcode and libwrap for new mnrs/ehrenberg vp
This commit is contained in:
parent
98760929c6
commit
96fa7db587
7
env/ehrenberg/init.c
vendored
7
env/ehrenberg/init.c
vendored
@ -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) {
|
||||
|
23
env/ehrenberg/platform.h
vendored
23
env/ehrenberg/platform.h
vendored
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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++;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user