Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
774dd42a
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
774dd42a
编写于
12月 21, 2018
作者:
H
Hao Zhu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp] [stm32] 修改f7系列DMA时钟 添加SD卡适配
上级
42d232aa
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
104 addition
and
18 deletion
+104
-18
bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h
bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h
+1
-1
bsp/stm32/libraries/HAL_Drivers/drv_sdio.c
bsp/stm32/libraries/HAL_Drivers/drv_sdio.c
+9
-3
bsp/stm32/libraries/HAL_Drivers/drv_sdio.h
bsp/stm32/libraries/HAL_Drivers/drv_sdio.h
+7
-1
bsp/stm32/libraries/HAL_Drivers/drv_spi.c
bsp/stm32/libraries/HAL_Drivers/drv_spi.c
+2
-6
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
+1
-5
bsp/stm32/stm32f767-fire-challenger/README.md
bsp/stm32/stm32f767-fire-challenger/README.md
+2
-2
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
+6
-0
bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c
...stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c
+76
-0
未找到文件。
bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h
浏览文件 @
774dd42a
...
...
@@ -17,7 +17,7 @@
#ifdef BSP_USING_SDIO
#define SDIO_BUS_CONFIG \
{ \
.Instance = SD
IO,
\
.Instance = SD
MMC1,
\
.dma_rx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
.dma_tx.dma_rcc = RCC_AHB1ENR_DMA2EN, \
.dma_rx.Instance = DMA2_Stream3, \
...
...
bsp/stm32/libraries/HAL_Drivers/drv_sdio.c
浏览文件 @
774dd42a
...
...
@@ -19,6 +19,12 @@
#define LOG_TAG "drv.sdio"
#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_class
sdio_obj
;
static
struct
rt_mmcsd_host
*
host
;
...
...
@@ -809,14 +815,14 @@ int rt_hw_sdio_init(void)
{
struct
stm32_sdio_des
sdio_des
;
SD_HandleTypeDef
hsd
;
hsd
.
Instance
=
SD
IO
;
hsd
.
Instance
=
SD
CARD_INSTANCE
;
{
rt_uint32_t
tmpreg
=
0x00U
;
#if defined(SOC_SERIES_STM32F1)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_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_STM32
F7) || defined(SOC_SERIES_STM32
L4)
SET_BIT
(
RCC
->
AHB1ENR
,
sdio_config
.
dma_rx
.
dma_rcc
);
/* Delay after an RCC peripheral clock enabling */
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
);
sdio_des
.
clk_get
=
stm32_sdio_clock_get
;
sdio_des
.
hw_sdio
=
(
struct
stm32_sdio
*
)
SD
IO
;
sdio_des
.
hw_sdio
=
(
struct
stm32_sdio
*
)
SD
CARD_INSTANCE
;
sdio_des
.
rxconfig
=
DMA_RxConfig
;
sdio_des
.
txconfig
=
DMA_TxConfig
;
...
...
bsp/stm32/libraries/HAL_Drivers/drv_sdio.h
浏览文件 @
774dd42a
...
...
@@ -19,6 +19,12 @@
#include <drivers/mmcsd_core.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_MAX_FREQ 2000000
#define SDIO_ALIGN_LEN 32
...
...
@@ -158,7 +164,7 @@ struct stm32_sdio_des
struct
stm32_sdio_config
{
SD
IO_TypeDef
*
Instance
;
SD
CARD_INSTANCE_TYPE
*
Instance
;
struct
dma_config
dma_rx
,
dma_tx
;
};
...
...
bsp/stm32/libraries/HAL_Drivers/drv_spi.c
浏览文件 @
774dd42a
...
...
@@ -484,14 +484,10 @@ static int rt_hw_spi_bus_init(void)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_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_STM32
F7) || defined(SOC_SERIES_STM32
L4)
SET_BIT
(
RCC
->
AHB1ENR
,
spi_config
[
i
].
dma_rx
.
dma_rcc
);
/* Delay after an RCC peripheral clock enabling */
tmpreg
=
READ_BIT
(
RCC
->
AHB1ENR
,
spi_config
[
i
].
dma_rx
.
dma_rcc
);
#elif defined(SOC_SERIES_STM32F7)
SET_BIT
(
RCC
->
APB2ENR
,
RCC_APB2ENR_SPI1EN
);
\
/* Delay after an RCC peripheral clock enabling */
\
tmpreg
=
READ_BIT
(
RCC
->
APB2ENR
,
RCC_APB2ENR_SPI1EN
);
\
#endif
UNUSED
(
tmpreg
);
/* To avoid compiler warnings */
}
...
...
@@ -761,5 +757,5 @@ int rt_hw_spi_init(void)
}
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 */
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
浏览文件 @
774dd42a
...
...
@@ -492,11 +492,7 @@ static void stm32_dma_config(struct rt_serial_device *serial)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_BIT
(
RCC
->
AHBENR
,
uart
->
config
->
dma_rcc
);
tmpreg
=
READ_BIT
(
RCC
->
AHBENR
,
uart
->
config
->
dma_rcc
);
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32L4)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_BIT
(
RCC
->
AHB1ENR
,
uart
->
config
->
dma_rcc
);
tmpreg
=
READ_BIT
(
RCC
->
AHB1ENR
,
uart
->
config
->
dma_rcc
);
#elif defined(SOC_SERIES_STM32F7)
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_BIT
(
RCC
->
AHB1ENR
,
uart
->
config
->
dma_rcc
);
tmpreg
=
READ_BIT
(
RCC
->
AHB1ENR
,
uart
->
config
->
dma_rcc
);
...
...
bsp/stm32/stm32f767-fire-challenger/README.md
浏览文件 @
774dd42a
...
...
@@ -44,7 +44,7 @@
| QSPI Flash | 支持 | |
| 电位器 | 支持 | 使用 ADC1 |
| 以太网 | 暂不支持 | 移植中 |
| MPU6050六轴传感器 | 支持 | |
| MPU6050六轴传感器 | 支持 |
|
| SDRAM | 支持 | |
| SD卡 | 即将支持 | |
| CAN | 即将支持 | |
...
...
@@ -58,7 +58,7 @@
| RTC | 支持 | |
| WDT | 支持 | |
| FLASH | 支持 | 已适配
[
FAL
](
https://github.com/RT-Thread-packages/fal
)
|
| SDIO |
暂不支持 | 即将支持
|
| SDIO |
支持 |
|
| PWM | 暂不支持 | 即将支持 |
| USB Device | 暂不支持 | 即将支持 |
| USB Host | 暂不支持 | 即将支持 |
...
...
bsp/stm32/stm32f767-fire-challenger/board/Kconfig
浏览文件 @
774dd42a
...
...
@@ -231,6 +231,12 @@ menu "On-chip Peripheral Drivers"
select RT_USING_WDT
default n
config BSP_USING_SDIO
bool "Enable SDIO"
select RT_USING_SDIO
select RT_USING_DFS
default n
endmenu
menu "Board extended module Drivers"
...
...
bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c
0 → 100644
浏览文件 @
774dd42a
/*
* 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 */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录