summaryrefslogtreecommitdiff
path: root/bsp/ls2kdev
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/ls2kdev')
-rw-r--r--bsp/ls2kdev/Kconfig11
-rw-r--r--bsp/ls2kdev/drivers/board.c2
-rw-r--r--bsp/ls2kdev/drivers/drv_spi.c5
-rw-r--r--bsp/ls2kdev/drivers/drv_uart.c22
-rw-r--r--bsp/ls2kdev/rtconfig.h13
5 files changed, 34 insertions, 19 deletions
diff --git a/bsp/ls2kdev/Kconfig b/bsp/ls2kdev/Kconfig
index 5cfb6892ff..fc2dfe1328 100644
--- a/bsp/ls2kdev/Kconfig
+++ b/bsp/ls2kdev/Kconfig
@@ -29,4 +29,13 @@ config SOC_LS2K1000
select RT_USING_USER_MAIN
select RT_USING_DEVICE
default y
- \ No newline at end of file
+
+if RT_USING_SERIAL
+config RT_USING_UART0
+ bool "Using RT_USING_UART0"
+ default y
+
+config RT_USING_UART4
+ bool "Using RT_USING_UART4"
+ default y
+endif
diff --git a/bsp/ls2kdev/drivers/board.c b/bsp/ls2kdev/drivers/board.c
index 1d165cf5ef..9b79902c41 100644
--- a/bsp/ls2kdev/drivers/board.c
+++ b/bsp/ls2kdev/drivers/board.c
@@ -90,7 +90,7 @@ void rt_hw_board_init(void)
/* init hardware UART device */
rt_hw_uart_init();
/* set console device */
- rt_console_set_device("uart0");
+ rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_HEAP
diff --git a/bsp/ls2kdev/drivers/drv_spi.c b/bsp/ls2kdev/drivers/drv_spi.c
index 3f3ad90802..5a42acbee8 100644
--- a/bsp/ls2kdev/drivers/drv_spi.c
+++ b/bsp/ls2kdev/drivers/drv_spi.c
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2020-10-28 0xcccccccccccc Initial Version
+ * 2021-01-17 0xcccccccccccc Bug Fixed : clock division cannot been adjusted as expected due to wrong register configuration.
*/
/**
* @addtogroup ls2k
@@ -21,11 +22,11 @@
#ifdef RT_USING_SPI
static void spi_init(uint8_t spre_spr, uint8_t copl, uint8_t cpha)
{
- SET_SPI(SPSR, 0xc0 | (spre_spr & 0b00000011));
+ SET_SPI(SPSR, 0xc0);
SET_SPI(PARAM, 0x40);
SET_SPI(PARAM2, 0x01);
SET_SPI(SPER, (spre_spr & 0b00001100) >> 2);
- SET_SPI(SPCR, 0x50 | copl << 3 | cpha << 2);
+ SET_SPI(SPCR, 0x50 | copl << 3 | cpha << 2 | (spre_spr & 0b00000011));
SET_SPI(SOFTCS, 0xff);
}
diff --git a/bsp/ls2kdev/drivers/drv_uart.c b/bsp/ls2kdev/drivers/drv_uart.c
index 9421078769..5b5c39c595 100644
--- a/bsp/ls2kdev/drivers/drv_uart.c
+++ b/bsp/ls2kdev/drivers/drv_uart.c
@@ -156,26 +156,32 @@ struct rt_serial_device serial, serial4;
void rt_hw_uart_init(void)
{
- struct rt_uart_ls2k *uart, *uart4;
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
- uart = &uart_dev0;
- uart4 = &uart_dev4;
+#ifdef RT_USING_UART0
+ struct rt_uart_ls2k *uart0;
+ uart0 = &uart_dev0;
serial.ops = &ls2k_uart_ops;
serial.config = config_uart0;
- serial4.ops = &ls2k_uart_ops;
- serial4.config = config;
- rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial, "UART0");
- rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
+ rt_hw_interrupt_install(uart0->IRQ, uart_irq_handler, &serial, "UART0");
/* register UART device */
rt_hw_serial_register(&serial,
"uart0",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
- uart);
+ uart0);
+#endif
+
+#ifdef RT_USING_UART4
+ struct rt_uart_ls2k *uart4;
+ uart4 = &uart_dev4;
+ serial4.ops = &ls2k_uart_ops;
+ serial4.config = config;
+ rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
rt_hw_serial_register(&serial4,
"uart4",
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
&uart_dev4);
+#endif
}
/*@}*/
diff --git a/bsp/ls2kdev/rtconfig.h b/bsp/ls2kdev/rtconfig.h
index dfaa45a009..4fd46f8874 100644
--- a/bsp/ls2kdev/rtconfig.h
+++ b/bsp/ls2kdev/rtconfig.h
@@ -37,7 +37,7 @@
#define RT_USING_DEVICE
#define RT_USING_CONSOLE
#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart"
+#define RT_CONSOLE_DEVICE_NAME "uart0"
#define RT_VER_NUM 0x40003
#define ARCH_CPU_64BIT
#define ARCH_MIPS64
@@ -82,6 +82,8 @@
#define RT_DFS_ELM_WORD_ACCESS
#define RT_DFS_ELM_USE_LFN_3
#define RT_DFS_ELM_USE_LFN 3
+#define RT_DFS_ELM_LFN_UNICODE_0
+#define RT_DFS_ELM_LFN_UNICODE 0
#define RT_DFS_ELM_MAX_LFN 255
#define RT_DFS_ELM_DRIVES 9
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
@@ -114,6 +116,7 @@
/* Socket abstraction layer */
#define RT_USING_SAL
+#define SAL_INTERNET_CHECK
/* protocol stack implement */
@@ -220,9 +223,6 @@
/* system packages */
-/* Micrium: Micrium software products porting for RT-Thread */
-
-
/* peripheral libraries and drivers */
@@ -231,9 +231,8 @@
/* samples: kernel and components samples */
-
-/* games: games run on RT-Thread console */
-
#define SOC_LS2K1000
+#define RT_USING_UART0
+#define RT_USING_UART4
#endif