Merge pull request #2095 from greedyhao/master
[bsp] [stm32] 修改f7系列DMA时钟 添加SD卡适配
This commit is contained in:
commit
d592b41dfd
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2018-12-13 zylx first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PWM_CONFIG_H__
|
||||||
|
#define __PWM_CONFIG_H__
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#ifdef BSP_USING_PWM2
|
||||||
|
#ifndef PWM2_CONFIG
|
||||||
|
#define PWM2_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM2, \
|
||||||
|
.name = "pwm2", \
|
||||||
|
.channel = 0 \
|
||||||
|
}
|
||||||
|
#endif /* PWM2_CONFIG */
|
||||||
|
#endif /* BSP_USING_PWM2 */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_PWM3
|
||||||
|
#ifndef PWM3_CONFIG
|
||||||
|
#define PWM3_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM3, \
|
||||||
|
.name = "pwm3", \
|
||||||
|
.channel = 0 \
|
||||||
|
}
|
||||||
|
#endif /* PWM3_CONFIG */
|
||||||
|
#endif /* BSP_USING_PWM3 */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_PWM4
|
||||||
|
#ifndef PWM4_CONFIG
|
||||||
|
#define PWM4_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM4, \
|
||||||
|
.name = "pwm4", \
|
||||||
|
.channel = 0 \
|
||||||
|
}
|
||||||
|
#endif /* PWM4_CONFIG */
|
||||||
|
#endif /* BSP_USING_PWM4 */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_PWM5
|
||||||
|
#ifndef PWM5_CONFIG
|
||||||
|
#define PWM5_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM5, \
|
||||||
|
.name = "pwm5", \
|
||||||
|
.channel = 0 \
|
||||||
|
}
|
||||||
|
#endif /* PWM5_CONFIG */
|
||||||
|
#endif /* BSP_USING_PWM5 */
|
||||||
|
|
||||||
|
#endif /* __PWM_CONFIG_H__ */
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2018-12-13 BalanceTWK first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SDIO_CONFIG_H__
|
||||||
|
#define __SDIO_CONFIG_H__
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
#include "stm32f7xx_hal.h"
|
||||||
|
|
||||||
|
#ifdef BSP_USING_SDIO
|
||||||
|
#define SDIO_BUS_CONFIG \
|
||||||
|
{ \
|
||||||
|
.Instance = SDMMC1, \
|
||||||
|
.dma_rx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
|
||||||
|
.dma_tx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
|
||||||
|
.dma_rx.Instance = DMA2_Stream3, \
|
||||||
|
.dma_rx.channel = DMA_CHANNEL_4, \
|
||||||
|
.dma_rx.dma_irq = DMA2_Stream3_IRQn, \
|
||||||
|
.dma_tx.Instance = DMA2_Stream6, \
|
||||||
|
.dma_tx.channel = DMA_CHANNEL_4, \
|
||||||
|
.dma_tx.dma_irq = DMA2_Stream6_IRQn, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SPI1_DMA_RX_IRQHandler DMA2_Stream3_IRQHandler
|
||||||
|
#define SPI1_DMA_TX_IRQHandler DMA2_Stream6_IRQHandler
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*__SDIO_CONFIG_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2018-12-11 zylx first version
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __TIM_CONFIG_H__
|
||||||
|
#define __TIM_CONFIG_H__
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#ifndef TIM_DEV_INFO_CONFIG
|
||||||
|
#define TIM_DEV_INFO_CONFIG \
|
||||||
|
{ \
|
||||||
|
.maxfreq = 1000000, \
|
||||||
|
.minfreq = 3000, \
|
||||||
|
.maxcnt = 0xFFFF, \
|
||||||
|
.cntmode = HWTIMER_CNTMODE_UP, \
|
||||||
|
}
|
||||||
|
#endif /* TIM_DEV_INFO_CONFIG */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_TIM11
|
||||||
|
#ifndef TIM11_CONFIG
|
||||||
|
#define TIM11_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM11, \
|
||||||
|
.tim_irqn = TIM1_TRG_COM_TIM11_IRQn, \
|
||||||
|
.name = "timer11", \
|
||||||
|
}
|
||||||
|
#endif /* TIM11_CONFIG */
|
||||||
|
#endif /* BSP_USING_TIM11 */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_TIM13
|
||||||
|
#ifndef TIM13_CONFIG
|
||||||
|
#define TIM13_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM13, \
|
||||||
|
.tim_irqn = TIM8_UP_TIM13_IRQn, \
|
||||||
|
.name = "timer13", \
|
||||||
|
}
|
||||||
|
#endif /* TIM13_CONFIG */
|
||||||
|
#endif /* BSP_USING_TIM13 */
|
||||||
|
|
||||||
|
#ifdef BSP_USING_TIM14
|
||||||
|
#ifndef TIM14_CONFIG
|
||||||
|
#define TIM14_CONFIG \
|
||||||
|
{ \
|
||||||
|
.tim_handle.Instance = TIM14, \
|
||||||
|
.tim_irqn = TIM8_TRG_COM_TIM14_IRQn, \
|
||||||
|
.name = "timer14", \
|
||||||
|
}
|
||||||
|
#endif /* TIM14_CONFIG */
|
||||||
|
#endif /* BSP_USING_TIM14 */
|
||||||
|
|
||||||
|
#endif /* __TIM_CONFIG_H__ */
|
|
@ -32,6 +32,9 @@
|
||||||
#include "f7/uart_config.h"
|
#include "f7/uart_config.h"
|
||||||
#include "f7/spi_config.h"
|
#include "f7/spi_config.h"
|
||||||
#include "f7/adc_config.h"
|
#include "f7/adc_config.h"
|
||||||
|
#include "f7/tim_config.h"
|
||||||
|
#include "f7/sdio_config.h"
|
||||||
|
#include "f7/pwm_config.h"
|
||||||
#elif defined(SOC_SERIES_STM32L4)
|
#elif defined(SOC_SERIES_STM32L4)
|
||||||
#include "l4/uart_config.h"
|
#include "l4/uart_config.h"
|
||||||
#include "l4/spi_config.h"
|
#include "l4/spi_config.h"
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
#define LOG_TAG "drv.sdio"
|
#define LOG_TAG "drv.sdio"
|
||||||
#include <drv_log.h>
|
#include <drv_log.h>
|
||||||
|
|
||||||
|
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4)
|
||||||
|
#define SDCARD_INSTANCE SDIO
|
||||||
|
#elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7)
|
||||||
|
#define SDCARD_INSTANCE SDMMC1
|
||||||
|
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4) */
|
||||||
|
|
||||||
static struct stm32_sdio_config sdio_config = SDIO_BUS_CONFIG;
|
static struct stm32_sdio_config sdio_config = SDIO_BUS_CONFIG;
|
||||||
static struct stm32_sdio_class sdio_obj;
|
static struct stm32_sdio_class sdio_obj;
|
||||||
static struct rt_mmcsd_host *host;
|
static struct rt_mmcsd_host *host;
|
||||||
|
@ -809,14 +815,14 @@ int rt_hw_sdio_init(void)
|
||||||
{
|
{
|
||||||
struct stm32_sdio_des sdio_des;
|
struct stm32_sdio_des sdio_des;
|
||||||
SD_HandleTypeDef hsd;
|
SD_HandleTypeDef hsd;
|
||||||
hsd.Instance = SDIO;
|
hsd.Instance = SDCARD_INSTANCE;
|
||||||
{
|
{
|
||||||
rt_uint32_t tmpreg = 0x00U;
|
rt_uint32_t tmpreg = 0x00U;
|
||||||
#if defined(SOC_SERIES_STM32F1)
|
#if defined(SOC_SERIES_STM32F1)
|
||||||
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
|
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
|
||||||
SET_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc);
|
SET_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc);
|
||||||
tmpreg = READ_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc);
|
tmpreg = READ_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc);
|
||||||
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L4)
|
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4)
|
||||||
SET_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc);
|
SET_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc);
|
||||||
/* Delay after an RCC peripheral clock enabling */
|
/* Delay after an RCC peripheral clock enabling */
|
||||||
tmpreg = READ_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc);
|
tmpreg = READ_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc);
|
||||||
|
@ -828,7 +834,7 @@ int rt_hw_sdio_init(void)
|
||||||
HAL_SD_MspInit(&hsd);
|
HAL_SD_MspInit(&hsd);
|
||||||
|
|
||||||
sdio_des.clk_get = stm32_sdio_clock_get;
|
sdio_des.clk_get = stm32_sdio_clock_get;
|
||||||
sdio_des.hw_sdio = (struct stm32_sdio *)SDIO;
|
sdio_des.hw_sdio = (struct stm32_sdio *)SDCARD_INSTANCE;
|
||||||
sdio_des.rxconfig = DMA_RxConfig;
|
sdio_des.rxconfig = DMA_RxConfig;
|
||||||
sdio_des.txconfig = DMA_TxConfig;
|
sdio_des.txconfig = DMA_TxConfig;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@
|
||||||
#include <drivers/mmcsd_core.h>
|
#include <drivers/mmcsd_core.h>
|
||||||
#include <drivers/sdio.h>
|
#include <drivers/sdio.h>
|
||||||
|
|
||||||
|
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4)
|
||||||
|
#define SDCARD_INSTANCE_TYPE SDIO_TypeDef
|
||||||
|
#elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7)
|
||||||
|
#define SDCARD_INSTANCE_TYPE SDMMC_TypeDef
|
||||||
|
#endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F4) */
|
||||||
|
|
||||||
#define SDIO_BUFF_SIZE 4096
|
#define SDIO_BUFF_SIZE 4096
|
||||||
#define SDIO_MAX_FREQ 2000000
|
#define SDIO_MAX_FREQ 2000000
|
||||||
#define SDIO_ALIGN_LEN 32
|
#define SDIO_ALIGN_LEN 32
|
||||||
|
@ -158,7 +164,7 @@ struct stm32_sdio_des
|
||||||
|
|
||||||
struct stm32_sdio_config
|
struct stm32_sdio_config
|
||||||
{
|
{
|
||||||
SDIO_TypeDef *Instance;
|
SDCARD_INSTANCE_TYPE *Instance;
|
||||||
struct dma_config dma_rx, dma_tx;
|
struct dma_config dma_rx, dma_tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ static int rt_hw_spi_bus_init(void)
|
||||||
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
|
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
|
||||||
SET_BIT(RCC->AHBENR, spi_config[i].dma_rx.dma_rcc);
|
SET_BIT(RCC->AHBENR, spi_config[i].dma_rx.dma_rcc);
|
||||||
tmpreg = READ_BIT(RCC->AHBENR, spi_config[i].dma_rx.dma_rcc);
|
tmpreg = READ_BIT(RCC->AHBENR, spi_config[i].dma_rx.dma_rcc);
|
||||||
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L4)
|
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4)
|
||||||
SET_BIT(RCC->AHB1ENR, spi_config[i].dma_rx.dma_rcc);
|
SET_BIT(RCC->AHB1ENR, spi_config[i].dma_rx.dma_rcc);
|
||||||
/* Delay after an RCC peripheral clock enabling */
|
/* Delay after an RCC peripheral clock enabling */
|
||||||
tmpreg = READ_BIT(RCC->AHB1ENR, spi_config[i].dma_rx.dma_rcc);
|
tmpreg = READ_BIT(RCC->AHB1ENR, spi_config[i].dma_rx.dma_rcc);
|
||||||
|
@ -757,5 +757,5 @@ int rt_hw_spi_init(void)
|
||||||
}
|
}
|
||||||
INIT_BOARD_EXPORT(rt_hw_spi_init);
|
INIT_BOARD_EXPORT(rt_hw_spi_init);
|
||||||
|
|
||||||
#endif /* BSP_USING_SPI1 || BSP_USING_SPI2 || BSP_USING_SPI3 || BSP_USING_SPI4 || BSP_USING_SPI5 */
|
#endif /* BSP_USING_SPI1 || BSP_USING_SPI2 || BSP_USING_SPI3 || BSP_USING_SPI4 || BSP_USING_SPI5 || BSP_USING_SPI6 */
|
||||||
#endif /* RT_USING_SPI */
|
#endif /* RT_USING_SPI */
|
||||||
|
|
|
@ -6,11 +6,95 @@ cwd = GetCurrentDir()
|
||||||
|
|
||||||
# The set of source files associated with this SConscript file.
|
# The set of source files associated with this SConscript file.
|
||||||
|
|
||||||
src = Glob('STM32F7xx_HAL_Driver/Src/*.c')
|
src = Split('''
|
||||||
src += Split('''
|
|
||||||
CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c
|
CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cec.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cortex.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_crc.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cryp.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_cryp_ex.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_dma_ex.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pwr_ex.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rcc_ex.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rng.c
|
||||||
|
STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sram.c
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_PIN']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_gpio.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_SERIAL']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_usart.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_I2C']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2c_ex.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_SPI']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_spi.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_qspi.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_USB_HOST']) or GetDepend(['RT_USING_USB_DEVICE']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pccard.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_pcd_ex.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hcd.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_usb.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_CAN']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_can.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_HWTIMER']) or GetDepend(['RT_USING_PWM']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_tim_ex.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_lptim.c']
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_ETH']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_eth.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_ADC']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_adc.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_adc_ex.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_RTC']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rtc.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_rtc_ex.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_WDT']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_iwdg.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_wwdg.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_SDIO']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_sdmmc.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sd.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_AUDIO']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2s.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_i2s_ex.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sai.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sai_ex.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_MTD_NOR']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_nor.c']
|
||||||
|
|
||||||
|
if GetDepend(['RT_USING_MTD_NAND']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_nand.c']
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_SDRAM']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_fmc.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_ll_fsmc.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_sdram.c']
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_ON_CHIP_FLASH']):
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ex.c']
|
||||||
|
src += ['STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_flash_ramfunc.c']
|
||||||
|
|
||||||
path = [cwd + '/STM32F7xx_HAL_Driver/Inc',
|
path = [cwd + '/STM32F7xx_HAL_Driver/Inc',
|
||||||
cwd + '/CMSIS/Device/ST/STM32F7xx/Include',
|
cwd + '/CMSIS/Device/ST/STM32F7xx/Include',
|
||||||
cwd + '/CMSIS/Include']
|
cwd + '/CMSIS/Include']
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
| QSPI Flash | 支持 | |
|
| QSPI Flash | 支持 | |
|
||||||
| 电位器 | 支持 | 使用 ADC1 |
|
| 电位器 | 支持 | 使用 ADC1 |
|
||||||
| 以太网 | 暂不支持 | 移植中 |
|
| 以太网 | 暂不支持 | 移植中 |
|
||||||
| MPU6050六轴传感器 | 支持 | |
|
| MPU6050六轴传感器 | 支持 | |
|
||||||
| SDRAM | 支持 | |
|
| SDRAM | 支持 | |
|
||||||
| SD卡 | 即将支持 | |
|
| SD卡 | 即将支持 | |
|
||||||
| CAN | 即将支持 | |
|
| CAN | 即将支持 | |
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
| RTC | 支持 | |
|
| RTC | 支持 | |
|
||||||
| WDT | 支持 | |
|
| WDT | 支持 | |
|
||||||
| FLASH | 支持 | 已适配 [FAL](https://github.com/RT-Thread-packages/fal) |
|
| FLASH | 支持 | 已适配 [FAL](https://github.com/RT-Thread-packages/fal) |
|
||||||
| SDIO | 暂不支持 | 即将支持 |
|
| SDIO | 支持 | |
|
||||||
| PWM | 暂不支持 | 即将支持 |
|
| PWM | 暂不支持 | 即将支持 |
|
||||||
| USB Device | 暂不支持 | 即将支持 |
|
| USB Device | 暂不支持 | 即将支持 |
|
||||||
| USB Host | 暂不支持 | 即将支持 |
|
| USB Host | 暂不支持 | 即将支持 |
|
||||||
|
|
|
@ -34,6 +34,40 @@ menu "Onboard Peripheral Drivers"
|
||||||
select PKG_USING_MPU6XXX
|
select PKG_USING_MPU6XXX
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_ETH
|
||||||
|
bool "Enable Ethernet"
|
||||||
|
default n
|
||||||
|
select RT_USING_LWIP
|
||||||
|
if BSP_USING_ETH
|
||||||
|
config EXTERNAL_PHY_ADDRESS
|
||||||
|
hex
|
||||||
|
default 0x00
|
||||||
|
endif
|
||||||
|
|
||||||
|
config BSP_USING_RGB
|
||||||
|
bool "Enable RGB LED (timer5 channel1 - 3)"
|
||||||
|
select RT_USING_PWM
|
||||||
|
select BSP_USING_PWM
|
||||||
|
select BSP_USING_PWM5
|
||||||
|
select BSP_USING_PWM5_CH1
|
||||||
|
select BSP_USING_PWM5_CH2
|
||||||
|
select BSP_USING_PWM5_CH3
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_POT
|
||||||
|
bool "Enable potentiometer"
|
||||||
|
select BSP_USING_ADC
|
||||||
|
select BSP_USING_ADC1
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_SDCARD
|
||||||
|
bool "Enable SDCARD (sdio)"
|
||||||
|
select BSP_USING_SDIO
|
||||||
|
select RT_USING_DFS
|
||||||
|
select RT_USING_DFS_ELMFAT
|
||||||
|
select RT_USING_PIN
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "On-chip Peripheral Drivers"
|
menu "On-chip Peripheral Drivers"
|
||||||
|
@ -90,6 +124,47 @@ menu "On-chip Peripheral Drivers"
|
||||||
select RT_USING_QSPI
|
select RT_USING_QSPI
|
||||||
select RT_USING_SPI
|
select RT_USING_SPI
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
menuconfig BSP_USING_TIM
|
||||||
|
bool "Enable timer"
|
||||||
|
default n
|
||||||
|
select RT_USING_HWTIMER
|
||||||
|
if BSP_USING_TIM
|
||||||
|
config BSP_USING_TIM11
|
||||||
|
bool "Enable TIM11"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_TIM13
|
||||||
|
bool "Enable TIM13"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_TIM14
|
||||||
|
bool "Enable TIM14"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
|
||||||
|
menuconfig BSP_USING_PWM
|
||||||
|
bool "Enable pwm"
|
||||||
|
default n
|
||||||
|
select RT_USING_PWM
|
||||||
|
if BSP_USING_PWM
|
||||||
|
menuconfig BSP_USING_PWM5
|
||||||
|
bool "Enable timer5 output pwm"
|
||||||
|
default n
|
||||||
|
if BSP_USING_PWM5
|
||||||
|
config BSP_USING_PWM5_CH1
|
||||||
|
bool "Enable PWM5 channel1"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_PWM5_CH2
|
||||||
|
bool "Enable PWM5 channel2"
|
||||||
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_PWM5_CH3
|
||||||
|
bool "Enable PWM5 channel3"
|
||||||
|
default n
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_ADC
|
menuconfig BSP_USING_ADC
|
||||||
bool "Enable ADC"
|
bool "Enable ADC"
|
||||||
|
@ -109,24 +184,6 @@ menu "On-chip Peripheral Drivers"
|
||||||
default n
|
default n
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C1
|
|
||||||
bool "Enable I2C1 BUS (software simulation)"
|
|
||||||
default n
|
|
||||||
select RT_USING_I2C
|
|
||||||
select RT_USING_I2C_BITOPS
|
|
||||||
select RT_USING_PIN
|
|
||||||
if BSP_USING_I2C1
|
|
||||||
comment "Notice: PB6 --> 22; PB7 --> 23"
|
|
||||||
config BSP_I2C1_SCL_PIN
|
|
||||||
int "I2C1 scl pin number"
|
|
||||||
range 1 176
|
|
||||||
default 22
|
|
||||||
config BSP_I2C1_SDA_PIN
|
|
||||||
int "I2C1 sda pin number"
|
|
||||||
range 1 176
|
|
||||||
default 23
|
|
||||||
endif
|
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C2
|
menuconfig BSP_USING_I2C2
|
||||||
bool "Enable I2C2 BUS (software simulation)"
|
bool "Enable I2C2 BUS (software simulation)"
|
||||||
default n
|
default n
|
||||||
|
@ -134,33 +191,15 @@ menu "On-chip Peripheral Drivers"
|
||||||
select RT_USING_I2C_BITOPS
|
select RT_USING_I2C_BITOPS
|
||||||
select RT_USING_PIN
|
select RT_USING_PIN
|
||||||
if BSP_USING_I2C2
|
if BSP_USING_I2C2
|
||||||
comment "Notice: PC15 --> 47; PD0 --> 48"
|
comment "Notice: PH4 --> 116; PH5 --> 117"
|
||||||
config BSP_I2C2_SCL_PIN
|
config BSP_I2C2_SCL_PIN
|
||||||
int "i2c2 scl pin number"
|
int "i2c2 scl pin number"
|
||||||
range 1 176
|
range 1 176
|
||||||
default 47
|
default 116
|
||||||
config BSP_I2C2_SDA_PIN
|
config BSP_I2C2_SDA_PIN
|
||||||
int "I2C2 sda pin number"
|
int "I2C2 sda pin number"
|
||||||
range 1 176
|
range 1 176
|
||||||
default 48
|
default 117
|
||||||
endif
|
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C3
|
|
||||||
bool "Enable I2C3 BUS (software simulation)"
|
|
||||||
default n
|
|
||||||
select RT_USING_I2C
|
|
||||||
select RT_USING_I2C_BITOPS
|
|
||||||
select RT_USING_PIN
|
|
||||||
if BSP_USING_I2C3
|
|
||||||
comment "Notice: PF12 --> 92; PF13 --> 93"
|
|
||||||
config BSP_I2C3_SCL_PIN
|
|
||||||
int "i2c3 scl pin number"
|
|
||||||
range 1 176
|
|
||||||
default 92
|
|
||||||
config BSP_I2C3_SDA_PIN
|
|
||||||
int "I2C3 sda pin number"
|
|
||||||
range 1 176
|
|
||||||
default 93
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
menuconfig BSP_USING_I2C4
|
menuconfig BSP_USING_I2C4
|
||||||
|
@ -192,6 +231,12 @@ menu "On-chip Peripheral Drivers"
|
||||||
select RT_USING_WDT
|
select RT_USING_WDT
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config BSP_USING_SDIO
|
||||||
|
bool "Enable SDIO"
|
||||||
|
select RT_USING_SDIO
|
||||||
|
select RT_USING_DFS
|
||||||
|
default n
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "Board extended module Drivers"
|
menu "Board extended module Drivers"
|
||||||
|
|
|
@ -18,6 +18,9 @@ if GetDepend(['BSP_USING_ETH']):
|
||||||
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
if GetDepend(['BSP_USING_QSPI_FLASH']):
|
||||||
src += Glob('ports/drv_qspi_flash.c')
|
src += Glob('ports/drv_qspi_flash.c')
|
||||||
|
|
||||||
|
if GetDepend(['BSP_USING_SDCARD']):
|
||||||
|
src += Glob('ports/sdcard_port.c')
|
||||||
|
|
||||||
path = [cwd]
|
path = [cwd]
|
||||||
path += [cwd + '/CubeMX_Config/Inc']
|
path += [cwd + '/CubeMX_Config/Inc']
|
||||||
path += [cwd + '/ports']
|
path += [cwd + '/ports']
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
* 2018-12-13 balanceTWK add sdcard port file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <rtthread.h>
|
||||||
|
|
||||||
|
#ifdef BSP_USING_SDCARD
|
||||||
|
|
||||||
|
#include <dfs_elm.h>
|
||||||
|
#include <dfs_fs.h>
|
||||||
|
#include <dfs_posix.h>
|
||||||
|
#include "drv_gpio.h"
|
||||||
|
|
||||||
|
#define DBG_ENABLE
|
||||||
|
#define DBG_SECTION_NAME "app.card"
|
||||||
|
#define DBG_COLOR
|
||||||
|
|
||||||
|
#define DBG_LEVEL DBG_INFO
|
||||||
|
#include <rtdbg.h>
|
||||||
|
|
||||||
|
#define WIFI_RESET_PIN GET_PIN(G, 9)
|
||||||
|
|
||||||
|
int ewm1062_disable(void)
|
||||||
|
{
|
||||||
|
rt_pin_mode(WIFI_RESET_PIN, PIN_MODE_OUTPUT);
|
||||||
|
rt_pin_write(WIFI_RESET_PIN,PIN_LOW);
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
INIT_BOARD_EXPORT(ewm1062_disable);
|
||||||
|
|
||||||
|
void sd_mount(void *parameter)
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
rt_thread_mdelay(500);
|
||||||
|
if(rt_device_find("sd0") != RT_NULL)
|
||||||
|
{
|
||||||
|
if (dfs_mount("sd0", "/", "elm", 0, 0) == RT_EOK)
|
||||||
|
{
|
||||||
|
LOG_I("sd card mount to '/'");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_W("sd card mount to '/' failed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int stm32_sdcard_mount(void)
|
||||||
|
{
|
||||||
|
rt_thread_t tid;
|
||||||
|
|
||||||
|
tid = rt_thread_create("sd_mount", sd_mount, RT_NULL,
|
||||||
|
1024, RT_THREAD_PRIORITY_MAX - 2, 20);
|
||||||
|
if (tid != RT_NULL)
|
||||||
|
{
|
||||||
|
rt_thread_startup(tid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG_E("create sd_mount thread err!");
|
||||||
|
}
|
||||||
|
return RT_EOK;
|
||||||
|
}
|
||||||
|
INIT_APP_EXPORT(stm32_sdcard_mount);
|
||||||
|
|
||||||
|
#endif /* BSP_USING_SDCARD */
|
||||||
|
|
Loading…
Reference in New Issue