Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
aec43da2
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aec43da2
编写于
1月 27, 2019
作者:
baozitai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bsp][stm32] modify HAL_Drivers for stm32l0
上级
806c9781
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
128 addition
and
10 deletion
+128
-10
bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h
bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h
+45
-0
bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h
bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h
+68
-0
bsp/stm32/libraries/HAL_Drivers/drv_config.h
bsp/stm32/libraries/HAL_Drivers/drv_config.h
+3
-0
bsp/stm32/libraries/HAL_Drivers/drv_dma.h
bsp/stm32/libraries/HAL_Drivers/drv_dma.h
+2
-2
bsp/stm32/libraries/HAL_Drivers/drv_gpio.c
bsp/stm32/libraries/HAL_Drivers/drv_gpio.c
+1
-1
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
+7
-5
bsp/stm32/libraries/HAL_Drivers/drv_usart.h
bsp/stm32/libraries/HAL_Drivers/drv_usart.h
+2
-2
未找到文件。
bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h
0 → 100644
浏览文件 @
aec43da2
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-01-05 zylx first version
* 2019-01-08 SummerGift clean up the code
*/
#ifndef __DMA_CONFIG_H__
#define __DMA_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern
"C"
{
#endif
/* DMA1 channel1 */
/* DMA1 channel5 */
#if defined(BSP_UART1_RX_USING_DMA) && !defined(UART1_RX_DMA_INSTANCE)
#define UART1_DMA_RX_IRQHandler DMA1_Channel4_5_6_7_IRQHandler
#define UART1_RX_DMA_RCC RCC_AHBENR_DMA1EN
#define UART1_RX_DMA_INSTANCE DMA1_Channel5
#define UART1_RX_DMA_IRQ DMA1_Channel4_5_6_7_IRQn
#endif
/* DMA1 channel5 */
/* DMA1 channel6 */
#if defined(BSP_UART2_RX_USING_DMA) && !defined(UART2_RX_DMA_INSTANCE)
#define UART2_DMA_RX_IRQHandler DMA1_Channel4_5_6_7_IRQHandler
#define UART2_RX_DMA_RCC RCC_AHBENR_DMA1EN
#define UART2_RX_DMA_INSTANCE DMA1_Channel6
#define UART2_RX_DMA_IRQ DMA1_Channel4_5_6_7_IRQn
#endif
/* DMA1 channel6 */
#ifdef __cplusplus
}
#endif
#endif
/* __DMA_CONFIG_H__ */
bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h
0 → 100644
浏览文件 @
aec43da2
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-10-30 zylx first version
*/
#ifndef __UART_CONFIG_H__
#define __UART_CONFIG_H__
#include <rtthread.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#if defined(BSP_USING_UART1)
#ifndef UART1_CONFIG
#define UART1_CONFIG \
{ \
.name = "uart1", \
.Instance = USART1, \
.irq_type = USART1_IRQn, \
}
#endif
/* UART1_CONFIG */
#endif
/* BSP_USING_UART1 */
#if defined(BSP_UART1_RX_USING_DMA)
#ifndef UART1_DMA_CONFIG
#define UART1_DMA_CONFIG \
{ \
.Instance = UART1_RX_DMA_INSTANCE, \
.dma_rcc = UART1_RX_DMA_RCC, \
.dma_irq = UART1_RX_DMA_IRQ, \
}
#endif
/* UART1_DMA_CONFIG */
#endif
/* BSP_UART1_RX_USING_DMA */
#if defined(BSP_USING_UART2)
#ifndef UART2_CONFIG
#define UART2_CONFIG \
{ \
.name = "uart2", \
.Instance = USART2, \
.irq_type = USART2_IRQn, \
}
#endif
/* UART2_CONFIG */
#endif
/* BSP_USING_UART2 */
#if defined(BSP_UART2_RX_USING_DMA)
#ifndef UART2_DMA_CONFIG
#define UART2_DMA_CONFIG \
{ \
.Instance = UART2_RX_DMA_INSTANCE, \
.dma_rcc = UART2_RX_DMA_RCC, \
.dma_irq = UART2_RX_DMA_IRQ, \
}
#endif
/* UART2_DMA_CONFIG */
#endif
/* BSP_UART2_RX_USING_DMA */
#ifdef __cplusplus
}
#endif
#endif
/* __UART_CONFIG_H__ */
bsp/stm32/libraries/HAL_Drivers/drv_config.h
浏览文件 @
aec43da2
...
...
@@ -50,6 +50,9 @@ extern "C" {
#include "f7/tim_config.h"
#include "f7/sdio_config.h"
#include "f7/pwm_config.h"
#elif defined(SOC_SERIES_STM32L0)
#include "l0/dma_config.h"
#include "l0/uart_config.h"
#elif defined(SOC_SERIES_STM32L4)
#include "l4/dma_config.h"
#include "l4/uart_config.h"
...
...
bsp/stm32/libraries/HAL_Drivers/drv_dma.h
浏览文件 @
aec43da2
...
...
@@ -18,8 +18,8 @@
extern
"C"
{
#endif
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L
4
) \
|| defined(SOC_SERIES_STM32G0)
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L
0
) \
|| defined(SOC_SERIES_STM32L4)
|| defined(SOC_SERIES_STM32G0)
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
...
...
bsp/stm32/libraries/HAL_Drivers/drv_gpio.c
浏览文件 @
aec43da2
...
...
@@ -217,7 +217,7 @@ static const struct pin_index pins[] =
static
const
struct
pin_irq_map
pin_irq_map
[]
=
{
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0)
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32
L0) || defined(SOC_SERIES_STM32
G0)
{
GPIO_PIN_0
,
EXTI0_1_IRQn
},
{
GPIO_PIN_1
,
EXTI0_1_IRQn
},
{
GPIO_PIN_2
,
EXTI2_3_IRQn
},
...
...
bsp/stm32/libraries/HAL_Drivers/drv_usart.c
浏览文件 @
aec43da2
...
...
@@ -183,7 +183,7 @@ static int stm32_putc(struct rt_serial_device *serial, char c)
uart
=
(
struct
stm32_uart
*
)
serial
->
parent
.
user_data
;
UART_INSTANCE_CLEAR_FUNCTION
(
&
(
uart
->
handle
),
UART_FLAG_TC
);
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) \
|| defined(SOC_SERIES_STM32G0)
|| defined(SOC_SERIES_STM32
L0) || defined(SOC_SERIES_STM32
G0)
uart
->
handle
.
Instance
->
TDR
=
c
;
#else
uart
->
handle
.
Instance
->
DR
=
c
;
...
...
@@ -204,7 +204,7 @@ static int stm32_getc(struct rt_serial_device *serial)
if
(
__HAL_UART_GET_FLAG
(
&
(
uart
->
handle
),
UART_FLAG_RXNE
)
!=
RESET
)
{
#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0) \
|| defined(SOC_SERIES_STM32G0)
|| defined(SOC_SERIES_STM32
L0) || defined(SOC_SERIES_STM32
G0)
ch
=
uart
->
handle
.
Instance
->
RDR
&
0xff
;
#else
ch
=
uart
->
handle
.
Instance
->
DR
&
0xff
;
...
...
@@ -281,7 +281,7 @@ static void uart_isr(struct rt_serial_device *serial)
__HAL_UART_CLEAR_PEFLAG
(
&
uart
->
handle
);
}
#if !defined(SOC_SERIES_STM32L4) && !defined(SOC_SERIES_STM32F7) && !defined(SOC_SERIES_STM32F0) \
&& !defined(SOC_SERIES_STM32G0)
&& !defined(SOC_SERIES_STM32
L0) && !defined(SOC_SERIES_STM32
G0)
if
(
__HAL_UART_GET_FLAG
(
&
(
uart
->
handle
),
UART_FLAG_LBD
)
!=
RESET
)
{
UART_INSTANCE_CLEAR_FUNCTION
(
&
(
uart
->
handle
),
UART_FLAG_LBD
);
...
...
@@ -456,7 +456,8 @@ static void stm32_dma_config(struct rt_serial_device *serial)
{
rt_uint32_t
tmpreg
=
0x00U
;
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0)
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32L0)
/* enable DMA clock && Delay after an RCC peripheral clock enabling*/
SET_BIT
(
RCC
->
AHBENR
,
uart
->
config
->
dma_rx
->
dma_rcc
);
tmpreg
=
READ_BIT
(
RCC
->
AHBENR
,
uart
->
config
->
dma_rx
->
dma_rcc
);
...
...
@@ -470,7 +471,8 @@ static void stm32_dma_config(struct rt_serial_device *serial)
__HAL_LINKDMA
(
&
(
uart
->
handle
),
hdmarx
,
uart
->
dma
.
handle
);
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0)
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) \
|| defined(SOC_SERIES_STM32L0)
uart
->
dma
.
handle
.
Instance
=
uart
->
config
->
dma_rx
->
Instance
;
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
uart
->
dma
.
handle
.
Instance
=
uart
->
config
->
dma_rx
->
Instance
;
...
...
bsp/stm32/libraries/HAL_Drivers/drv_usart.h
浏览文件 @
aec43da2
...
...
@@ -20,14 +20,14 @@
int
rt_hw_usart_init
(
void
);
#if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) \
|| defined(SOC_SERIES_STM32G0)
|| defined(SOC_SERIES_STM32
L0) || defined(SOC_SERIES_STM32
G0)
#define DMA_INSTANCE_TYPE DMA_Channel_TypeDef
#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)
#define DMA_INSTANCE_TYPE DMA_Stream_TypeDef
#endif
/* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) */
#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F4) \
|| defined(SOC_SERIES_STM32G0)
|| defined(SOC_SERIES_STM32
L0) || defined(SOC_SERIES_STM32
G0)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_FLAG
#elif defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32F0)
#define UART_INSTANCE_CLEAR_FUNCTION __HAL_UART_CLEAR_IT
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录