Ver Fonte

Merge pull request #4286 from Michael0066/ls1b-dev

ls1b: fix the count of GPIO IRQ
Bernard Xiong há 4 anos atrás
pai
commit
59f320783f

+ 1 - 1
bsp/ls1cdev/Kconfig

@@ -19,7 +19,7 @@ source "$RTT_DIR/Kconfig"
 source "$RTT_DIR/libcpu/mips/common/Kconfig"
 source "$PKGS_DIR/Kconfig"
 
-config SOC_1C300
+config SOC_LS1C300
     bool
     select RT_USING_COMPONENTS_INIT
     select RT_USING_USER_MAIN

+ 1 - 1
bsp/ls1cdev/rtconfig.h

@@ -161,7 +161,7 @@
 
 /* samples: kernel and components samples */
 
-#define SOC_1C300
+#define SOC_LS1C300
 #define RT_LS1C_BAICAIBOARD
 #define RT_USING_SELF_BOOT
 #define RT_SELF_BOOT_DEBUG

+ 10 - 1
bsp/ls2kdev/Kconfig

@@ -29,4 +29,13 @@ config SOC_LS2K1000
     select RT_USING_USER_MAIN
     select RT_USING_DEVICE
     default y
-    
+
+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

+ 14 - 8
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
 }
 /*@}*/

+ 2 - 0
bsp/ls2kdev/rtconfig.h

@@ -232,5 +232,7 @@
 /* samples: kernel and components samples */
 
 #define SOC_LS2K1000
+#define RT_USING_UART0
+#define RT_USING_UART4
 
 #endif

+ 8 - 1
libcpu/mips/gs232/gs232.h

@@ -17,7 +17,14 @@
 
 #define INTC_BASE			0xBFD01040
 
+#ifdef SOC_LS1B
+#define GS232_INTC_CELLS		4
+#endif
+
+#ifdef SOC_LS1C300
 #define GS232_INTC_CELLS		5
+#endif
+
 #define GS232_NR_IRQS			(32 * GS232_INTC_CELLS)
 
 #define GMAC0_BASE			0xBFE10000
@@ -64,4 +71,4 @@ extern void rt_hw_timer_init(void);
 
 #endif
 
-#endif
+#endif

+ 0 - 1
libcpu/mips/gs232/interrupt.c

@@ -22,7 +22,6 @@
 #define MAX_INTR            (GS232_NR_IRQS)
 
 static struct rt_irq_desc irq_handle_table[MAX_INTR];
-void rt_interrupt_dispatch(void *ptreg);
 void rt_hw_timer_handler();
 
 static struct gs232_intc_regs volatile *gs232_hw0_icregs

+ 10 - 1
libcpu/mips/gs232/ls1b.h

@@ -19,6 +19,15 @@
 #define LS1B_UART1_IRQ	3
 #define LS1B_UART2_IRQ	4
 #define LS1B_UART3_IRQ	5
+#define LS1B_UART4_IRQ	29
+#define LS1B_UART5_IRQ	30
+#define LS1B_UART6_IRQ	2	//共享LS1B_UART0_IRQ
+#define LS1B_UART7_IRQ	2
+#define LS1B_UART8_IRQ	2
+#define LS1B_UART9_IRQ	3	//共享LS1B_UART1_IRQ
+#define LS1B_UART10_IRQ	3
+#define LS1B_UART11_IRQ	3
+
 #define LS1B_CAN0_IRQ	6
 #define LS1B_CAN1_IRQ	7
 #define LS1B_SPI0_IRQ	8
@@ -49,7 +58,7 @@
 
 #define LS1B_GPIO_IRQ 64
 #define LS1B_GPIO_FIRST_IRQ 64
-#define LS1B_GPIO_IRQ_COUNT 96
+#define LS1B_GPIO_IRQ_COUNT 64
 #define LS1B_GPIO_LAST_IRQ  (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1)
 
 #define INT_PCI_INTA	(1<<6)