Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
okll00
rt-thread
提交
2ed84b61
R
rt-thread
项目概览
okll00
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2ed84b61
编写于
9月 11, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
9月 11, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3056 from niannianyouyu/master
Add UART1 driver of rv32m1_vega
上级
4ba5fe5a
67ffb943
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
42 addition
and
5 deletion
+42
-5
bsp/rv32m1_vega/README.md
bsp/rv32m1_vega/README.md
+3
-1
bsp/rv32m1_vega/ri5cy/board/pin_mux.c
bsp/rv32m1_vega/ri5cy/board/pin_mux.c
+7
-0
bsp/rv32m1_vega/ri5cy/driver/Kconfig
bsp/rv32m1_vega/ri5cy/driver/Kconfig
+3
-0
bsp/rv32m1_vega/ri5cy/driver/drv_uart.c
bsp/rv32m1_vega/ri5cy/driver/drv_uart.c
+29
-4
未找到文件。
bsp/rv32m1_vega/README.md
浏览文件 @
2ed84b61
...
...
@@ -54,7 +54,7 @@ msh />
| 驱动 | 支持情况 | 备注 |
| ------ | ---- | :------ |
| UART | 支持 | UART0, RX(PTC7), TX(PTC8) |
|
| 未
支持 | UART1, RX(PTA25), TX(PTA26) |
|
|
支持 | UART1, RX(PTA25), TX(PTA26) |
| clock | 支持 | |
| GPIO | 支持(列表可能不完善,同时也需要按照使用到的IO调整pinmux、clock) | |
| MMC/SD | 支持 | |
...
...
@@ -67,6 +67,8 @@ msh />
| PTA23 | LED_GREEN |
| PTA24 | LED_RED |
| PTA24 | LED_STS |
| PTA25 | UART1_RX |
| PTA26 | UART1_TX |
| PTE8 | BTN_SW3 |
| PTE9 | BTN_SW4 |
| PTE12 | BTN_SW5 |
...
...
bsp/rv32m1_vega/ri5cy/board/pin_mux.c
浏览文件 @
2ed84b61
...
...
@@ -39,6 +39,8 @@ void BOARD_InitBootPins(void) {
#define PIN22_IDX 22u
/*!< Pin number for pin 22 in a port */
#define PIN23_IDX 23u
/*!< Pin number for pin 23 in a port */
#define PIN24_IDX 24u
/*!< Pin number for pin 24 in a port */
#define PIN25_IDX 25u
/*!< Pin number for pin 25 in a port */
#define PIN26_IDX 26u
/*!< Pin number for pin 26 in a port */
#define PIN27_IDX 27u
/*!< Pin number for pin 27 in a port */
/*
...
...
@@ -48,6 +50,8 @@ BOARD_InitPins:
- pin_list:
- {pin_num: N2, peripheral: LPUART0, signal: RX, pin_signal: LPCMP0_IN0/PTC7/LLWU_P15/LPSPI0_PCS3/LPUART0_RX/LPI2C1_HREQ/TPM0_CH0/LPTMR1_ALT1}
- {pin_num: P3, peripheral: LPUART0, signal: TX, pin_signal: LPCMP0_IN1/PTC8/LPSPI0_SCK/LPUART0_TX/LPI2C0_HREQ/TPM0_CH1}
- {pin_num: B5, peripheral: LPUART1, signal: RX, pin_signal: PTA25/LPUART1_RX/LPSPI3_SOUT/LPI2C2_SDAS/FB_AD31}
- {pin_num: A5, peripheral: LPUART1, signal: TX, pin_signal: PTA26/LPUART1_TX/LPSPI3_PCS2/LPI2C2_SCLS/FB_AD30}
- {pin_num: U11, peripheral: SDHC0, signal: CMD, pin_signal: ADC0_SE12/PTD9/SDHC0_CMD/LPSPI2_SIN/LPI2C1_SCLS/TRACE_DATA0/TPM2_CH2/FXIO0_D29, slew_rate: fast, open_drain: disable,
drive_strength: low, pull_select: up, pull_enable: enable}
- {pin_num: P10, peripheral: SDHC0, signal: 'DATA, 0', pin_signal: ADC0_SE10/PTD7/SDHC0_D0/LPSPI2_SOUT/EMVSIM0_PD/TRACE_DATA2/TPM2_CH4/FXIO0_D27, slew_rate: fast,
...
...
@@ -87,6 +91,7 @@ void BOARD_InitPins(void) {
PORT_SetPinConfig
(
PORTC
,
PIN27_IDX
,
&
portc27_pinP6_config
);
/* PORTC27 (pin P6) is configured as PTC27 */
PORT_SetPinMux
(
PORTC
,
PIN7_IDX
,
kPORT_MuxAlt3
);
/* PORTC7 (pin N2) is configured as LPUART0_RX */
PORT_SetPinMux
(
PORTC
,
PIN8_IDX
,
kPORT_MuxAlt3
);
/* PORTC8 (pin P3) is configured as LPUART0_TX */
const
port_pin_config_t
portd10_pinP11_config
=
{
kPORT_PullUp
,
/* Internal pull-up resistor is enabled */
kPORT_FastSlewRate
,
/* Fast slew rate is configured */
...
...
@@ -151,6 +156,8 @@ void BOARD_InitPins(void) {
PORT_SetPinMux
(
PORTA
,
PIN22_IDX
,
kPORT_MuxAsGpio
);
/* PORTA22 (pin D6) is configured as PTA24 */
PORT_SetPinMux
(
PORTA
,
PIN23_IDX
,
kPORT_MuxAsGpio
);
/* PORTA23 (pin D6) is configured as PTA24 */
PORT_SetPinMux
(
PORTA
,
PIN24_IDX
,
kPORT_MuxAsGpio
);
/* PORTA24 (pin D6) is configured as PTA24 */
PORT_SetPinMux
(
PORTA
,
PIN25_IDX
,
kPORT_MuxAlt2
);
/* PORTA25 (pin B5) is configured as LPUART1_RX */
PORT_SetPinMux
(
PORTA
,
PIN26_IDX
,
kPORT_MuxAlt2
);
/* PORTA26 (pin A5) is configured as LPUART1_TX */
}
/*******************************************************************************
...
...
bsp/rv32m1_vega/ri5cy/driver/Kconfig
浏览文件 @
2ed84b61
config BSP_USING_UART0
bool "Enable UART0 (PTC7/PTC8)"
default y
config BSP_USING_UART1
bool "Enable UART1 (PTA25/PTA26)"
default y
bsp/rv32m1_vega/ri5cy/driver/drv_uart.c
浏览文件 @
2ed84b61
...
...
@@ -4,8 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018/10/28 Bernard Unify UART driver for FSL library.
* Date Author Notes
* 2018/10/28 Bernard Unify UART driver for FSL library.
* 2019/09/07 niannianyouyu Add the driver of UART1
*/
#include <rthw.h>
...
...
@@ -54,6 +55,15 @@ void LPUART0_IRQHandler(void)
}
#endif
#if defined(BSP_USING_UART1)
struct
rt_serial_device
serial1
;
void
LPUART1_IRQHandler
(
void
)
{
uart_isr
(
&
serial1
);
}
#endif
static
const
struct
fsl_uart
uarts
[]
=
{
#ifdef BSP_USING_UART0
...
...
@@ -63,9 +73,18 @@ static const struct fsl_uart uarts[] =
&
serial0
,
"uart0"
,
},
#ifdef BSP_USING_UART1
{
LPUART1
,
LPUART1_IRQn
,
&
serial1
,
"uart1"
,
},
#endif
#endif
};
/*
* UART Initiation
*/
...
...
@@ -146,8 +165,14 @@ static rt_err_t uart_configure(struct rt_serial_device *serial, struct serial_co
CLOCK_SetIpSrc
(
kCLOCK_Lpuart0
,
kCLOCK_IpSrcFircAsync
);
uint32_t
uartClkSrcFreq
=
CLOCK_GetIpFreq
(
kCLOCK_Lpuart0
);
LPUART_Init
(
uart
->
uart_base
,
&
config
,
uartClkSrcFreq
);
uint32_t
uartClkSrcFreq0
=
CLOCK_GetIpFreq
(
kCLOCK_Lpuart0
);
LPUART_Init
(
uart
->
uart_base
,
&
config
,
uartClkSrcFreq0
);
LPUART_EnableInterrupts
(
uart
->
uart_base
,
kLPUART_RxDataRegFullInterruptEnable
);
CLOCK_SetIpSrc
(
kCLOCK_Lpuart1
,
kCLOCK_IpSrcFircAsync
);
uint32_t
uartClkSrcFreq1
=
CLOCK_GetIpFreq
(
kCLOCK_Lpuart1
);
LPUART_Init
(
uart
->
uart_base
,
&
config
,
uartClkSrcFreq1
);
LPUART_EnableInterrupts
(
uart
->
uart_base
,
kLPUART_RxDataRegFullInterruptEnable
);
return
RT_EOK
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录