未验证 提交 3365c07c 编写于 作者: lymzzyh's avatar lymzzyh 提交者: GitHub

Merge pull request #1359 from liu2guang/master

[BSP][RT1050] fix rt1050 bsp bug and update code. | 修复RT1050 BSP bug并…
......@@ -317,6 +317,7 @@ CONFIG_LWIP_NETIF_LOOPBACK=0
# CONFIG_PKG_USING_QUICKLZ is not set
# CONFIG_PKG_USING_MULTIBUTTON is not set
# CONFIG_PKG_USING_SAMPLES is not set
# CONFIG_PKG_USING_CANFESTIVAL is not set
#
# example package: hello
......@@ -343,14 +344,14 @@ CONFIG_RT_USING_UART1=y
# CONFIG_RT_USING_UART8 is not set
#
# Select spi bus drivers
# Select spi bus and dev drivers
#
CONFIG_LPSPI_CLK_SOURCE_FROM_PLL3PFD1=y
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL3PFD0 is not set
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL2 is not set
# CONFIG_LPSPI_CLK_SOURCE_FROM_PLL2PFD2 is not set
CONFIG_LPSPI_CLK_SOURCE=0
CONFIG_LPSPI_CLK_SOURCE_DIVIDER=7
CONFIG_LPSPI_CLK_SOURCE_DIVIDER=8
# CONFIG_RT_USING_SPIBUS1 is not set
# CONFIG_RT_USING_SPIBUS2 is not set
# CONFIG_RT_USING_SPIBUS3 is not set
......@@ -361,5 +362,35 @@ CONFIG_LPSPI4_SDO_GPIO_1=y
# CONFIG_LPSPI4_SDO_GPIO_2 is not set
CONFIG_LPSPI4_SDI_GPIO_1=y
# CONFIG_LPSPI4_SDI_GPIO_2 is not set
# CONFIG_RT_USING_SPI_FLASH is not set
#
# Select i2c bus drivers
#
CONFIG_LPI2C_CLOCK_SOURCE_DIVIDER=4
CONFIG_RT_USING_I2C1=y
# CONFIG_RT_USING_I2C1_BITOPS is not set
# CONFIG_RT_USING_I2C2 is not set
# CONFIG_RT_USING_I2C3 is not set
# CONFIG_RT_USING_I2C4 is not set
#
# Select lcd driver
#
#
# Notice: Evk Board para: 480*272 4 4 8 2 40 10 106 45
#
CONFIG_RT_USING_LCD=y
CONFIG_LCD_WIDTH=480
CONFIG_LCD_HEIGHT=272
CONFIG_LCD_HFP=4
CONFIG_LCD_VFP=4
CONFIG_LCD_HBP=8
CONFIG_LCD_VBP=2
CONFIG_LCD_HSW=40
CONFIG_LCD_VSW=10
CONFIG_LCD_BL_PIN=106
CONFIG_LCD_RST_PIN=45
CONFIG_RT_USING_SDRAM=y
CONFIG_RT_USING_RTC_HP=y
......@@ -70,7 +70,7 @@ menu "Select uart drivers"
default n
endmenu
menu "Select spi bus drivers"
menu "Select spi bus and dev drivers"
choice
prompt "SPI bus clock source"
default LPSPI_CLK_SOURCE_FROM_PLL3PFD1
......@@ -94,7 +94,7 @@ menu "Select spi bus drivers"
config LPSPI_CLK_SOURCE_DIVIDER
int "SPI bus clock source divider"
range 1 8
default 7
default 8
config RT_USING_SPIBUS1
bool "Using spi1 bus"
......@@ -223,67 +223,174 @@ menu "Select spi bus drivers"
config LPSPI4_SDI_GPIO_2
bool "GPIO_B1_05"
endchoice
config RT_USING_SPI_FLASH
bool "Using spi flash with sfud"
default n
select RT_USING_SPI
select RT_USING_SFUD
select RT_USING_PIN
choice
prompt "SPI flash using spibus"
default SPI_FLASH_USING_SPIBUS4
depends on RT_USING_SPI_FLASH
config SPI_FLASH_USING_SPIBUS1
bool "spi1"
select RT_USING_SPIBUS1
config SPI_FLASH_USING_SPIBUS2
bool "spi2"
select RT_USING_SPIBUS2
config SPI_FLASH_USING_SPIBUS3
bool "spi3"
select RT_USING_SPIBUS3
config SPI_FLASH_USING_SPIBUS4
bool "spi4"
select RT_USING_SPIBUS4
endchoice
config SPI_FLASH_USING_SPIBUS_NAME
string
default "spi1" if SPI_FLASH_USING_SPIBUS1
default "spi2" if SPI_FLASH_USING_SPIBUS2
default "spi3" if SPI_FLASH_USING_SPIBUS3
default "spi4" if SPI_FLASH_USING_SPIBUS4
config SPI_FLASH_NAME
string "SPI flash device name"
default "flash0"
depends on RT_USING_SPI_FLASH
config SPI_FLASH_USING_CS_PIN
int "SPI flash cs pin index"
default 79
range 1 127
depends on RT_USING_SPI_FLASH
endmenu
menu "Select iic drivers"
menu "Select i2c bus drivers"
config LPI2C_CLOCK_SOURCE_DIVIDER
int "lpi2c bus clock source divider"
range 1 64
default 4
config RT_USING_I2C1
bool "USING I2C1"
select RT_USING_I2C
default y
if RT_USING_I2C1
config RT_USING_I2C1_BITOPS
select RT_USING_I2C_BITOPS
default n
if RT_USING_I2C1
config RT_USING_I2C1_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C1"
endif
endif
config RT_USING_I2C2
bool "USING I2C2"
select RT_USING_I2C
default n
if RT_USING_I2C2
config RT_USING_I2C2_BITOPS
select RT_USING_I2C_BITOPS
default n
if RT_USING_I2C2
config RT_USING_I2C2_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C2"
endif
endif
config RT_USING_I2C3
bool "USING I2C3"
select RT_USING_I2C
default n
if RT_USING_I2C3
config RT_USING_I2C3_BITOPS
select RT_USING_I2C_BITOPS
default n
if RT_USING_I2C3
config RT_USING_I2C3_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C3"
endif
endif
config RT_USING_I2C4
bool "USING I2C4"
select RT_USING_I2C
default n
if RT_USING_I2C4
config RT_USING_I2C4_BITOPS
select RT_USING_I2C_BITOPS
default n
if RT_USING_I2C4
config RT_USING_I2C4_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C4"
endif
endif
endmenu
menu "Select lcd driver"
if RT_USING_LCD && BOARD_RT1050_EVK
comment "Notice: Evk Board para: 480*272 4 4 8 2 40 10 106 45"
endif
if RT_USING_LCD && BOARD_RT1050_FIRE
comment "Notice: Fire Board para: 800*480 4 4 8 2 40 10 58 45"
endif
config RT_USING_LCD
bool "Using lcd"
default n
config LCD_WIDTH
int "Width pixel num"
default 480 if BOARD_RT1050_EVK
default 800 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_HEIGHT
int "Height pixel num"
default 272 if BOARD_RT1050_EVK
default 480 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_HFP
int "HFP"
default 4 if BOARD_RT1050_EVK
default 4 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_VFP
int "VFP"
default 4 if BOARD_RT1050_EVK
default 4 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_HBP
int "HBP"
default 8 if BOARD_RT1050_EVK
default 8 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_VBP
int "VBP"
default 2 if BOARD_RT1050_EVK
default 2 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_HSW
int "HSW"
default 40 if BOARD_RT1050_EVK
default 40 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_VSW
int "VSW"
default 10 if BOARD_RT1050_EVK
default 10 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_BL_PIN
int "Backlight pin index"
default 106 if BOARD_RT1050_EVK
default 58 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
config LCD_RST_PIN
int "Reset pin index"
default 45 if BOARD_RT1050_EVK
default 45 if BOARD_RT1050_FIRE
depends on RT_USING_LCD
endmenu
#menu "SDRAM driver support"
#menu "Select SDRAM driver"
config RT_USING_SDRAM
bool "Using sdram"
default y
#endmenu
#menu "RTC driver support"
#menu "Select RTC driver"
config RT_USING_RTC_HP
bool "Using hp rtc"
select RT_USING_RTC
......
......@@ -5,7 +5,11 @@ Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
src = Glob('drivers/*.c')
src = Glob('drivers/*.c')
if GetDepend('BOARD_RT1050_FIRE'):
SrcRemove(src, r'drivers\fsl_enet.c')
SrcRemove(src, 'drivers/dataqueue.c')
src += Glob('common/chip/*.c')
src += [cwd + '/system_MIMXRT1052.c']
......
......@@ -2,7 +2,7 @@ Import('RTT_ROOT')
Import('rtconfig')
from building import *
cwd = os.path.join(str(Dir('#')), 'drivers')
cwd = os.path.join(str(Dir('#')), 'drivers')
# add the general drivers.
src = Split("""
......@@ -16,7 +16,7 @@ CPPDEFINES = []
# add sdram driver code
if GetDepend('RT_USING_SDRAM'):
src = src + ['./drv_sdram.c']
src = src + ['drv_sdram.c']
# add pin driver code
if GetDepend('RT_USING_PIN'):
......@@ -24,25 +24,34 @@ if GetDepend('RT_USING_PIN'):
# add rtc driver code
if GetDepend('RT_USING_RTC_HP'):
src = src + ['./drv_rtc.c']
src = src + ['drv_rtc.c']
# add spibus driver code
if GetDepend('RT_USING_SPI'):
src += ['drv_spi_bus.c']
# add spi flash driver code
if GetDepend('RT_USING_SPI_FLASH'):
src += ['drv_spi_flash.c']
# add i2cbus driver code
if GetDepend('RT_USING_I2C'):
src += ['drv_i2c.c']
# add lcd driver code
if GetDepend('RT_USING_LCD'):
src += ['drv_lcd.c']
# add sdio driver code
if GetDepend('RT_USING_SDIO'):
src += ['drv_sdio.c']
if GetDepend('BOARD_RT1050_EVK'):
src += ['hyper_flash_boot.c']
if GetDepend('RT_USING_LWIP'):
src += ['drv_eth.c', 'fsl_phy.c']
CPPDEFINES += ['FSL_FEATURE_PHYKSZ8081_USE_RMII50M_MODE']
if GetDepend('RT_USING_SDIO'):
src += ['drv_sdio.c']
if GetDepend('RT_USING_USB_DEVICE'):
src += Glob('usb/phy/*.c')
......@@ -52,9 +61,6 @@ if GetDepend('BOARD_RT1050_EVK'):
src += ['drv_usbd.c']
src += Glob('usb/device/*.c')
if GetDepend('RT_USING_RTGUI') or GetDepend('PKG_USING_GUIENGINE'):
src += ['drv_lcd.c', 'drv_ft5406.c', 'drv_i2c.c']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES=CPPDEFINES)
Return('group')
......@@ -202,24 +202,4 @@ void rt_hw_board_init()
#endif
}
#ifdef PKG_USING_GUIENGINE
#include <rtgui/driver.h>
#include "drv_lcd.h"
/* initialize for gui driver */
int rtgui_lcd_init(void)
{
rt_device_t device;
imxrt_hw_lcd_init();
device = rt_device_find("lcd");
/* set graphic device */
rtgui_graphic_set_device(device);
return 0;
}
INIT_DEVICE_EXPORT(rtgui_lcd_init);
#endif
/*@}*/
......@@ -40,7 +40,7 @@
#define BSP_TOUCH_SAMPLE_HZ 30
#define I2CBUS_NAME "i2c0"
#define I2CBUS_NAME "i2c1"
#if 0
#define FTDEBUG rt_kprintf
......
此差异已折叠。
/*
* File : drv_i2c.c
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
* File : drv_lcd2.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, 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.
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2017-12-15 Tanek the first version
* 2018-04-05 Liuguang the first version.
*/
#ifndef __DRV_LCD_H__
#define __DRV_LCD_H__
extern int imxrt_hw_lcd_init(void);
#include <rtthread.h>
#include <rtdevice.h>
int rt_hw_lcd_init(void);
#endif
......@@ -18,7 +18,8 @@
#include "fsl_iomuxc.h"
#include "fsl_lpspi.h"
#ifdef RT_USING_SPI
#if defined(RT_USING_SPIBUS1) || defined(RT_USING_SPIBUS2) || \
defined(RT_USING_SPIBUS3) || defined(RT_USING_SPIBUS4)
#if defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL
#error "Please don't define 'FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL'!"
......@@ -28,7 +29,7 @@
#define LPSPI_CLK_SOURCE (1U) /* PLL3 PFD0 */
#endif
#if !defined(LPSPI_CLK_SOURCE_DIVIDER)
#define LPSPI_CLK_SOURCE_DIVIDER (7U) /* 8div */
#define LPSPI_CLK_SOURCE_DIVIDER (8U) /* 8div */
#endif
/* LPSPI1 SCK SDO SDI IOMUX Config */
......@@ -399,14 +400,10 @@ static struct rt_spi_ops rt1050_spi_ops =
int rt_hw_spi_bus_init(void)
{
#if defined(RT_USING_SPIBUS1) || defined(RT_USING_SPIBUS2) || \
defined(RT_USING_SPIBUS3) || defined(RT_USING_SPIBUS4)
CLOCK_SetMux(kCLOCK_LpspiMux, LPSPI_CLK_SOURCE);
CLOCK_SetDiv(kCLOCK_LpspiDiv, LPSPI_CLK_SOURCE_DIVIDER);
CLOCK_SetDiv(kCLOCK_LpspiDiv, LPSPI_CLK_SOURCE_DIVIDER-1);
CLOCK_EnableClock(kCLOCK_Iomuxc);
#endif
#if defined(RT_USING_SPIBUS1)
rt_spi_bus_register(&spi1_bus, "spi1", &rt1050_spi_ops);
......
/*
* File : drv_spi_flash.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2018-04-02 Liuguang the first version.
*/
#include "drv_spi_flash.h"
#include "spi_flash.h"
#include "spi_flash_sfud.h"
#ifndef SPI_FLASH_USING_SPIBUS_NAME
#define SPI_FLASH_USING_SPIBUS_NAME "spi4"
#endif
#ifndef SPI_FLASH_NAME
#define SPI_FLASH_NAME "flash0"
#endif
#ifndef SPI_FLASH_USING_CS_PIN
#define SPI_FLASH_USING_CS_PIN (79)
#endif
int rt_hw_spi_flash_init(void)
{
rt_err_t ret;
extern rt_err_t rt1050_spi_bus_attach_device(const char *bus_name,
const char *device_name, rt_uint32_t pin);
ret = rt1050_spi_bus_attach_device(SPI_FLASH_USING_SPIBUS_NAME,
SPI_FLASH_USING_SPIBUS_NAME "0", SPI_FLASH_USING_CS_PIN);
if(ret != RT_EOK)
{
return ret;
}
if(rt_sfud_flash_probe(SPI_FLASH_NAME, SPI_FLASH_USING_SPIBUS_NAME "0") == RT_NULL)
{
return RT_ERROR;
}
return RT_EOK;
}
INIT_DEVICE_EXPORT(rt_hw_spi_flash_init);
/*
* File : drv_spi_flash.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006-2013, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2018-04-02 Liuguang the first version.
*/
#ifndef __DRV_SPI_FLASH_H_
#define __DRV_SPI_FLASH_H_
#include <rtthread.h>
#include <rtdevice.h>
int rt_hw_spi_flash_init(void);
#endif /* __DRV_SPI_FLASH_H_ */
此差异已折叠。
......@@ -200,20 +200,36 @@
#define RT_USING_UART1
/* Select spi bus drivers */
/* Select spi bus and dev drivers */
#define LPSPI_CLK_SOURCE_FROM_PLL3PFD1
#define LPSPI_CLK_SOURCE 0
#define LPSPI_CLK_SOURCE_DIVIDER 7
#define LPSPI_CLK_SOURCE_DIVIDER 8
#define RT_USING_SPIBUS4
#define LPSPI4_SCK_GPIO_1
#define LPSPI4_SDO_GPIO_1
#define LPSPI4_SDI_GPIO_1
/* Select iic drivers */
/* Select i2c bus drivers */
#define LPI2C_CLOCK_SOURCE_DIVIDER 4
#define RT_USING_I2C1
/* Select lcd driver */
/* Notice: Evk Board para: 480*272 4 4 8 2 40 10 106 45 */
#define RT_USING_LCD
#define LCD_WIDTH 480
#define LCD_HEIGHT 272
#define LCD_HFP 4
#define LCD_VFP 4
#define LCD_HBP 8
#define LCD_VBP 2
#define LCD_HSW 40
#define LCD_VSW 10
#define LCD_BL_PIN 106
#define LCD_RST_PIN 45
#define RT_USING_SDRAM
#define RT_USING_RTC_HP
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册