summaryrefslogtreecommitdiff
path: root/bsp/ls1cdev/drivers/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/ls1cdev/drivers/board.c')
-rw-r--r--bsp/ls1cdev/drivers/board.c70
1 files changed, 32 insertions, 38 deletions
diff --git a/bsp/ls1cdev/drivers/board.c b/bsp/ls1cdev/drivers/board.c
index 1b22741140..64f0db56ab 100644
--- a/bsp/ls1cdev/drivers/board.c
+++ b/bsp/ls1cdev/drivers/board.c
@@ -18,9 +18,22 @@
#include <rthw.h>
#include "board.h"
-#include "uart.h"
+#include "drv_uart.h"
#include "ls1c.h"
+#define A_K0BASE 0x80000000
+
+extern unsigned char __bss_end;
+
+
+extern void tlb_refill_exception(void);
+extern void general_exception(void);
+extern void irq_exception(void);
+extern void rt_hw_cache_init(void);
+extern void invalidate_writeback_dcache_all(void);
+extern void invalidate_icache_all(void);
+
+
/**
* @addtogroup Loongson LS1B
*/
@@ -81,6 +94,24 @@ void rt_hw_fpu_init(void)
*/
void rt_hw_board_init(void)
{
+ /* init cache */
+ rt_hw_cache_init();
+
+ /* init hardware interrupt */
+ rt_hw_interrupt_init();
+
+ /* copy vector */
+ rt_memcpy((void *)A_K0BASE, tlb_refill_exception, 0x80);
+ rt_memcpy((void *)(A_K0BASE + 0x180), general_exception, 0x80);
+ rt_memcpy((void *)(A_K0BASE + 0x200), irq_exception, 0x80);
+
+ invalidate_writeback_dcache_all();
+ invalidate_icache_all();
+
+#ifdef RT_USING_HEAP
+ rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
+#endif
+
#ifdef RT_USING_SERIAL
/* init hardware UART device */
rt_hw_uart_init();
@@ -105,41 +136,4 @@ void rt_hw_board_init(void)
rt_kprintf("current sr: 0x%08x\n", read_c0_status());
}
-#define __raw_out_put(unr) \
- while (*ptr) \
- { \
- if (*ptr == '\n') \
- { \
- /* FIFO status, contain valid data */ \
- while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
- /* write data */ \
- UART_DAT(UART##unr##_BASE) = '\r'; \
- } \
- /* FIFO status, contain valid data */ \
- while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
- /* write data */ \
- UART_DAT(UART##unr##_BASE) = *ptr; \
- ptr ++; \
- }
-
-/* UART line status register value */
-#define UARTLSR_ERROR (1 << 7)
-#define UARTLSR_TE (1 << 6)
-#define UARTLSR_TFE (1 << 5)
-#define UARTLSR_BI (1 << 4)
-#define UARTLSR_FE (1 << 3)
-#define UARTLSR_PE (1 << 2)
-#define UARTLSR_OE (1 << 1)
-#define UARTLSR_DR (1 << 0)
-void rt_hw_console_output(const char *ptr)
-{
-#if defined(RT_USING_UART0)
- __raw_out_put(0);
-#elif defined(RT_USING_UART2)
- __raw_out_put(2);
-#elif defined(RT_USING_UART3)
- __raw_out_put(3);
-#endif
-}
-
/*@}*/