cores/cpu/gowin_emcu: Switch to LiteX's UART.

A UART does not cost that much ressources and this avoid specific code/allow simplifying support.
This commit is contained in:
Florent Kermarrec 2024-01-11 13:53:15 +01:00
parent 8aa5958fb7
commit 6b79644108
3 changed files with 0 additions and 63 deletions

View File

@ -251,14 +251,6 @@ class GowinEMCU(CPU):
# ---------------------------------
self.submodules += ahb.AHB2Wishbone(ahb_targexp0, self.pbus)
def connect_uart(self, pads, n=0):
assert n in (0, 1), "this CPU has 2 built-in UARTs, 0 and 1"
self.cpu_params.update({
f"i_UART{n}RXDI" : pads.rx,
f"o_UART{n}TXDO" : pads.tx,
f"o_UART{n}BAUDTICK" : Signal()
})
def connect_jtag(self, pads):
self.cpu_params.update(
i_DAPSWDITMS = pads.tms,

View File

@ -19,9 +19,6 @@ void _start(void) {
for (uint32_t *x = &_fbss; x < &_ebss; x ++)
*x = 0;
UART0->ctrl = 0b11; // set rx and tx enable bits
UART0->baud_div = CONFIG_CLOCK_FREQUENCY / 115200; // FIXME
__asm__("bl main");
while(1);
}

View File

@ -12,58 +12,6 @@ void flush_l2_cache(void);
void busy_wait(unsigned int ms);
void busy_wait_us(unsigned int us);
#include <stdint.h>
// FIXME
#define CSR_UART_BASE
struct EMCU_UART
{
volatile uint32_t data;
volatile uint32_t state;
volatile uint32_t ctrl;
volatile uint32_t int_ctrl;
volatile uint32_t baud_div;
};
#define PERIPHERALS_BASE 0x40000000
#define UART0 ((struct EMCU_UART *) (PERIPHERALS_BASE + 0x4000))
static inline char uart_txfull_read(void);
static inline char uart_rxempty_read(void);
static inline void uart_ev_enable_write(char c);
static inline void uart_rxtx_write(char c);
static inline char uart_rxtx_read(void);
static inline void uart_ev_pending_write(char);
static inline char uart_ev_pending_read(void);
static inline char uart_txfull_read(void) {
return UART0->state & 0b01;
}
static inline char uart_rxempty_read(void) {
return !(UART0->state & 0b10);
}
static inline void uart_ev_enable_write(char c) {
// FIXME
}
static inline void uart_rxtx_write(char c) {
UART0->data = (uint32_t) c;
}
static inline char uart_rxtx_read(void)
{
return (char)(UART0->data);
}
static inline void uart_ev_pending_write(char x) {}
static inline char uart_ev_pending_read(void) {
return 0;
}
#ifdef __cplusplus
}
#endif