Browse Source

Merge pull request #2496 from Ingenic-community/master

X1000:drv_uart.c:修复引脚路由中的问题/Fix bugs in pin routing
Bernard Xiong 6 years ago
parent
commit
1b0f7db7c3
2 changed files with 7 additions and 17 deletions
  1. 3 16
      bsp/x1000/drivers/drv_gpio.h
  2. 4 1
      bsp/x1000/drivers/drv_uart.c

+ 3 - 16
bsp/x1000/drivers/drv_gpio.h

@@ -1,21 +1,7 @@
 /*
- * File      : board_gpio.h
- * This file is part of RT-Thread RTOS
- * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team
+ * Copyright (c) 2006-2018, RT-Thread Development Team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: Apache-2.0
  *
  * Change Logs:
  * Date           Author       Notes
@@ -115,6 +101,7 @@ enum gpio_function
     GPIO_INT_HI     = 0x09,  //1001, High Level trigger interrupt
     GPIO_INT_FE     = 0x0a,  //1010, Fall Edge trigger interrupt
     GPIO_INT_RE     = 0x0b,  //1011, Rise Edge trigger interrupt
+    GPIO_PULL       = 0x10,  //0001 0000, GPIO enable pull
     GPIO_INPUT_PULL = 0x16,  //0001 0110, GPIO as input and enable pull
 };
 

+ 4 - 1
bsp/x1000/drivers/drv_uart.c

@@ -285,11 +285,14 @@ void rt_hw_uart_init(void)
         strcpy(uart->name, "uart2");
 
 #ifdef CONFIG_SYS_UART2_PD
+        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_INPUT | GPIO_PULL);
         gpio_set_func(GPIO_PORT_D,GPIO_Pin_4,GPIO_FUNC_0);
         gpio_set_func(GPIO_PORT_D,GPIO_Pin_5,GPIO_FUNC_0);
 #else
         //USE JTAG IO for UART2
-        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_FUNC_1);
+        gpio_set_func(GPIO_PORT_D,GPIO_Pin_4,GPIO_INPUT | GPIO_PULL);
+        gpio_set_func(GPIO_PORT_D,GPIO_Pin_5,GPIO_INPUT | GPIO_PULL);
+        gpio_set_func(GPIO_PORT_C,GPIO_Pin_31,GPIO_FUNC_1 | GPIO_PULL);
 #endif
 
         serial->ops              = &_uart_ops;