Skip to content

Commit 59f3207

Browse files
authored
Merge pull request #4286 from Michael0066/ls1b-dev
ls1b: fix the count of GPIO IRQ
2 parents b42a43c + 4de8848 commit 59f3207

File tree

8 files changed

+46
-14
lines changed

8 files changed

+46
-14
lines changed

bsp/ls1cdev/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig"
1919
source "$RTT_DIR/libcpu/mips/common/Kconfig"
2020
source "$PKGS_DIR/Kconfig"
2121

22-
config SOC_1C300
22+
config SOC_LS1C300
2323
bool
2424
select RT_USING_COMPONENTS_INIT
2525
select RT_USING_USER_MAIN

bsp/ls1cdev/rtconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161

162162
/* samples: kernel and components samples */
163163

164-
#define SOC_1C300
164+
#define SOC_LS1C300
165165
#define RT_LS1C_BAICAIBOARD
166166
#define RT_USING_SELF_BOOT
167167
#define RT_SELF_BOOT_DEBUG

bsp/ls2kdev/Kconfig

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,13 @@ config SOC_LS2K1000
2929
select RT_USING_USER_MAIN
3030
select RT_USING_DEVICE
3131
default y
32-
32+
33+
if RT_USING_SERIAL
34+
config RT_USING_UART0
35+
bool "Using RT_USING_UART0"
36+
default y
37+
38+
config RT_USING_UART4
39+
bool "Using RT_USING_UART4"
40+
default y
41+
endif

bsp/ls2kdev/drivers/drv_uart.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,26 +156,32 @@ struct rt_serial_device serial, serial4;
156156

157157
void rt_hw_uart_init(void)
158158
{
159-
struct rt_uart_ls2k *uart, *uart4;
160159
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
161160

162-
uart = &uart_dev0;
163-
uart4 = &uart_dev4;
161+
#ifdef RT_USING_UART0
162+
struct rt_uart_ls2k *uart0;
163+
uart0 = &uart_dev0;
164164
serial.ops = &ls2k_uart_ops;
165165
serial.config = config_uart0;
166-
serial4.ops = &ls2k_uart_ops;
167-
serial4.config = config;
168166

169-
rt_hw_interrupt_install(uart->IRQ, uart_irq_handler, &serial, "UART0");
170-
rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
167+
rt_hw_interrupt_install(uart0->IRQ, uart_irq_handler, &serial, "UART0");
171168
/* register UART device */
172169
rt_hw_serial_register(&serial,
173170
"uart0",
174171
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
175-
uart);
172+
uart0);
173+
#endif
174+
175+
#ifdef RT_USING_UART4
176+
struct rt_uart_ls2k *uart4;
177+
uart4 = &uart_dev4;
178+
serial4.ops = &ls2k_uart_ops;
179+
serial4.config = config;
180+
rt_hw_interrupt_install(uart4->IRQ, uart_irq_handler, &serial4, "UART4");
176181
rt_hw_serial_register(&serial4,
177182
"uart4",
178183
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
179184
&uart_dev4);
185+
#endif
180186
}
181187
/*@}*/

bsp/ls2kdev/rtconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,7 @@
232232
/* samples: kernel and components samples */
233233

234234
#define SOC_LS2K1000
235+
#define RT_USING_UART0
236+
#define RT_USING_UART4
235237

236238
#endif

libcpu/mips/gs232/gs232.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717

1818
#define INTC_BASE 0xBFD01040
1919

20+
#ifdef SOC_LS1B
21+
#define GS232_INTC_CELLS 4
22+
#endif
23+
24+
#ifdef SOC_LS1C300
2025
#define GS232_INTC_CELLS 5
26+
#endif
27+
2128
#define GS232_NR_IRQS (32 * GS232_INTC_CELLS)
2229

2330
#define GMAC0_BASE 0xBFE10000
@@ -64,4 +71,4 @@ extern void rt_hw_timer_init(void);
6471

6572
#endif
6673

67-
#endif
74+
#endif

libcpu/mips/gs232/interrupt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define MAX_INTR (GS232_NR_IRQS)
2323

2424
static struct rt_irq_desc irq_handle_table[MAX_INTR];
25-
void rt_interrupt_dispatch(void *ptreg);
2625
void rt_hw_timer_handler();
2726

2827
static struct gs232_intc_regs volatile *gs232_hw0_icregs

libcpu/mips/gs232/ls1b.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
#define LS1B_UART1_IRQ 3
2020
#define LS1B_UART2_IRQ 4
2121
#define LS1B_UART3_IRQ 5
22+
#define LS1B_UART4_IRQ 29
23+
#define LS1B_UART5_IRQ 30
24+
#define LS1B_UART6_IRQ 2 //共享LS1B_UART0_IRQ
25+
#define LS1B_UART7_IRQ 2
26+
#define LS1B_UART8_IRQ 2
27+
#define LS1B_UART9_IRQ 3 //共享LS1B_UART1_IRQ
28+
#define LS1B_UART10_IRQ 3
29+
#define LS1B_UART11_IRQ 3
30+
2231
#define LS1B_CAN0_IRQ 6
2332
#define LS1B_CAN1_IRQ 7
2433
#define LS1B_SPI0_IRQ 8
@@ -49,7 +58,7 @@
4958

5059
#define LS1B_GPIO_IRQ 64
5160
#define LS1B_GPIO_FIRST_IRQ 64
52-
#define LS1B_GPIO_IRQ_COUNT 96
61+
#define LS1B_GPIO_IRQ_COUNT 64
5362
#define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1)
5463

5564
#define INT_PCI_INTA (1<<6)

0 commit comments

Comments
 (0)