mirror of
https://github.com/drasko/codezero.git
synced 2026-04-18 01:39:05 +02:00
Some cleanup in uart fixes.
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
/* FIXME: Take this value in agreement from kernel, or from kernel only */
|
/* FIXME: Take this value in agreement from kernel, or from kernel only */
|
||||||
#define PL011_USR_BASE 0x500000
|
#define PL011_USR_BASE 0x500000
|
||||||
#define PL011_BASE PL011_USR_BASE
|
|
||||||
|
|
||||||
/* Architecture specific memory access macros */
|
/* Architecture specific memory access macros */
|
||||||
#define read(val, address) val = *((volatile unsigned int *) address)
|
#define read(val, address) val = *((volatile unsigned int *) address)
|
||||||
@@ -48,10 +47,15 @@
|
|||||||
#define PL011_BEIRQ (1 << 9)
|
#define PL011_BEIRQ (1 << 9)
|
||||||
#define PL011_OEIRQ (1 << 10)
|
#define PL011_OEIRQ (1 << 10)
|
||||||
|
|
||||||
/* FIXME: Need to define this somewhere else */
|
struct pl011_uart {
|
||||||
struct pl011_uart uart;
|
unsigned int base;
|
||||||
|
unsigned int frame_errors;
|
||||||
|
unsigned int parity_errors;
|
||||||
|
unsigned int break_errors;
|
||||||
|
unsigned int overrun_errors;
|
||||||
|
unsigned int rx_timeout_errors;
|
||||||
|
};
|
||||||
|
|
||||||
int pl011_initialise(struct pl011_uart *uart);
|
|
||||||
int pl011_tx_char(unsigned int base, char c);
|
int pl011_tx_char(unsigned int base, char c);
|
||||||
int pl011_rx_char(unsigned int base, char *c);
|
int pl011_rx_char(unsigned int base, char *c);
|
||||||
|
|
||||||
@@ -90,15 +94,6 @@ static inline void pl011_set_parity_odd(unsigned int base);
|
|||||||
static inline void pl011_enable_fifos(unsigned int base);
|
static inline void pl011_enable_fifos(unsigned int base);
|
||||||
static inline void pl011_parity_disable(unsigned int base);
|
static inline void pl011_parity_disable(unsigned int base);
|
||||||
|
|
||||||
struct pl011_uart {
|
|
||||||
unsigned int base;
|
|
||||||
unsigned int frame_errors;
|
|
||||||
unsigned int parity_errors;
|
|
||||||
unsigned int break_errors;
|
|
||||||
unsigned int overrun_errors;
|
|
||||||
unsigned int rx_timeout_errors;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define PL011_UARTEN (1 << 0)
|
#define PL011_UARTEN (1 << 0)
|
||||||
static inline void pl011_uart_enable(unsigned int base)
|
static inline void pl011_uart_enable(unsigned int base)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
#include <arch/pl011_uart.h>
|
#include <arch/pl011_uart.h>
|
||||||
|
|
||||||
/* TODO: May need to remove this */
|
/* TODO: May need to remove this */
|
||||||
struct pl011_uart uart;
|
struct pl011_uart uart = {
|
||||||
|
.base = PL011_USR_BASE,
|
||||||
void platform_init(void);
|
};
|
||||||
|
|
||||||
void platform_init(void)
|
|
||||||
{
|
|
||||||
uart.base = PL011_USR_BASE;
|
|
||||||
pl011_initialise(&uart);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialises the uart class data structures, and the device.
|
* Initialises the uart class data structures, and the device.
|
||||||
@@ -51,3 +45,9 @@ int pl011_initialise(struct pl011_uart * uart)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_init(void)
|
||||||
|
{
|
||||||
|
uart.base = PL011_USR_BASE;
|
||||||
|
pl011_initialise(&uart);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
virtual_base = %s;
|
virtual_base = %s;
|
||||||
physical_base = %s;
|
physical_base = %s;
|
||||||
|
|
||||||
__stack = (0x20000000 - 0x1000 - 8); /* First page before the env/args */
|
__stack = (virtual_base - 0x1000 - 8); /* First page before the env/args */
|
||||||
|
|
||||||
offset = virtual_base - physical_base;
|
offset = virtual_base - physical_base;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user