Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ihbai
rt-thread
提交
d766abab
R
rt-thread
项目概览
ihbai
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d766abab
编写于
8月 30, 2017
作者:
T
tanek liang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update uart and spi driver
上级
b7cf7c5f
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
248 addition
and
242 deletion
+248
-242
bsp/gd32450z-eval/drivers/drv_spi.c
bsp/gd32450z-eval/drivers/drv_spi.c
+9
-0
bsp/gd32450z-eval/drivers/drv_usart.c
bsp/gd32450z-eval/drivers/drv_usart.c
+105
-128
bsp/gd32450z-eval/gd32_rom.sct
bsp/gd32450z-eval/gd32_rom.sct
+15
-0
bsp/gd32450z-eval/project.ewp
bsp/gd32450z-eval/project.ewp
+1
-16
bsp/gd32450z-eval/project.uvprojx
bsp/gd32450z-eval/project.uvprojx
+118
-98
未找到文件。
bsp/gd32450z-eval/drivers/drv_spi.c
浏览文件 @
d766abab
...
...
@@ -17,6 +17,14 @@
#include <board.h>
#include <finsh.h>
#ifdef RT_USING_SPI
#if !defined(RT_USING_SPI0) && !defined(RT_USING_SPI1) && \
!defined(RT_USING_SPI2) && !defined(RT_USING_SPI3) && \
!defined(RT_USING_SPI4) && !defined(RT_USING_SPI5)
#error "Please define at least one SPIx"
#endif
//#define DEBUG
#define ARR_LEN(__N) (sizeof(__N) / sizeof(__N[0]))
...
...
@@ -345,3 +353,4 @@ rt_err_t stm32_spi_bus_register(uint32_t spi_periph,
p_spi_bus
->
hdma_rx
.
Init
.
PeriphBurst
=
DMA_PBURST_INC4
;
#endif
}
#endif
bsp/gd32450z-eval/drivers/drv_usart.c
浏览文件 @
d766abab
...
...
@@ -26,7 +26,7 @@
!defined(RT_USING_USART2) && !defined(RT_USING_UART3) && \
!defined(RT_USING_UART4) && !defined(RT_USING_USART5) && \
!defined(RT_USING_UART6) && !defined(RT_USING_UART7)
#error "Please define "
#error "Please define
at least one UARTx
"
#endif
...
...
@@ -57,18 +57,6 @@ static void uart_isr(struct rt_serial_device *serial);
#if defined(RT_USING_USART0)
struct
rt_serial_device
serial0
;
/* UART1 device driver structure */
const
struct
gd32_uart
usart0
=
{
USART0
,
// uart peripheral index
USART0_IRQn
,
// uart iqrn
RCU_USART0
,
RCU_GPIOA
,
RCU_GPIOA
,
// periph clock, tx gpio clock, rt gpio clock
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_9
,
// tx port, tx alternate, tx pin
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_10
,
// rx port, rx alternate, rx pin
&
serial0
,
"uart0"
,
};
void
USART0_IRQHandler
(
void
)
{
/* enter interrupt */
...
...
@@ -84,17 +72,6 @@ void USART0_IRQHandler(void)
#if defined(RT_USING_USART1)
struct
rt_serial_device
serial1
;
/* UART1 device driver structure */
const
struct
gd32_uart
usart1
=
{
USART1
,
// uart peripheral index
USART1_IRQn
,
// uart iqrn
RCU_USART1
,
RCU_GPIOA
,
RCU_GPIOA
,
// periph clock, tx gpio clock, rt gpio clock
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_2
,
// tx port, tx alternate, tx pin
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_3
,
// rx port, rx alternate, rx pin
&
serial1
,
"uart1"
,
};
void
USART1_IRQHandler
(
void
)
{
...
...
@@ -111,17 +88,6 @@ void USART1_IRQHandler(void)
#if defined(RT_USING_USART2)
struct
rt_serial_device
serial2
;
/* UART2 device driver structure */
const
struct
gd32_uart
usart2
=
{
USART2
,
// uart peripheral index
USART2_IRQn
,
// uart iqrn
RCU_USART2
,
RCU_GPIOB
,
RCU_GPIOB
,
// periph clock, tx gpio clock, rt gpio clock
GPIOB
,
GPIO_AF_7
,
GPIO_PIN_10
,
// tx port, tx alternate, tx pin
GPIOB
,
GPIO_AF_7
,
GPIO_PIN_11
,
// rx port, rx alternate, rx pin
&
serial2
,
"uart2"
,
};
void
USART2_IRQHandler
(
void
)
{
...
...
@@ -138,17 +104,6 @@ void USART2_IRQHandler(void)
#if defined(RT_USING_UART3)
struct
rt_serial_device
serial3
;
/* UART3 device driver structure */
const
struct
gd32_uart
uart3
=
{
UART3
,
// uart peripheral index
UART3_IRQn
,
// uart iqrn
RCU_UART3
,
RCU_GPIOC
,
RCU_GPIOC
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_10
,
// tx port, tx alternate, tx pin
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_11
,
// rx port, rx alternate, rx pin
&
serial3
,
"uart3"
,
};
void
UART3_IRQHandler
(
void
)
{
...
...
@@ -165,17 +120,6 @@ void UART3_IRQHandler(void)
#if defined(RT_USING_UART4)
struct
rt_serial_device
serial4
;
/* UART4 device driver structure */
const
struct
gd32_uart
uart4
=
{
UART4
,
// uart peripheral index
UART4_IRQn
,
// uart iqrn
RCU_UART4
,
RCU_GPIOC
,
RCU_GPIOD
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_12
,
// tx port, tx alternate, tx pin
GPIOD
,
GPIO_AF_8
,
GPIO_PIN_2
,
// rx port, rx alternate, rx pin
&
serial4
,
"uart4"
,
};
void
UART4_IRQHandler
(
void
)
{
...
...
@@ -191,17 +135,6 @@ void UART4_IRQHandler(void)
#if defined(RT_USING_USART5)
struct
rt_serial_device
serial5
;
/* UART5 device driver structure */
const
struct
gd32_uart
usart5
=
{
USART5
,
// uart peripheral index
USART5_IRQn
,
// uart iqrn
RCU_USART5
,
RCU_GPIOC
,
RCU_GPIOC
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_6
,
// tx port, tx alternate, tx pin
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_7
,
// rx port, rx alternate, rx pin
&
serial5
,
"uart5"
,
};
void
USART5_IRQHandler
(
void
)
{
...
...
@@ -218,17 +151,6 @@ void USART5_IRQHandler(void)
#if defined(RT_USING_UART6)
struct
rt_serial_device
serial6
;
/* UART6 device driver structure */
const
struct
gd32_uart
uart6
=
{
UART6
,
// uart peripheral index
UART6_IRQn
,
// uart iqrn
RCU_UART6
,
RCU_GPIOE
,
RCU_GPIOE
,
// periph clock, tx gpio clock, rt gpio clock
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_7
,
// tx port, tx alternate, tx pin
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_8
,
// rx port, rx alternate, rx pin
&
serial6
,
"uart6"
,
};
void
UART6_IRQHandler
(
void
)
{
...
...
@@ -245,17 +167,6 @@ void UART6_IRQHandler(void)
#if defined(RT_USING_UART7)
struct
rt_serial_device
serial7
;
/* UART7 device driver structure */
const
struct
gd32_uart
uart7
=
{
UART7
,
// uart peripheral index
UART7_IRQn
,
// uart iqrn
RCU_UART7
,
RCU_GPIOE
,
RCU_GPIOE
,
// periph clock, tx gpio clock, rt gpio clock
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_0
,
// tx port, tx alternate, tx pin
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_1
,
// rx port, rx alternate, rx pin
&
serial7
,
"uart7"
,
};
void
UART7_IRQHandler
(
void
)
{
...
...
@@ -270,6 +181,104 @@ void UART7_IRQHandler(void)
#endif
/* RT_USING_UART7 */
static
const
struct
gd32_uart
uarts
[]
=
{
#ifdef RT_USING_USART0
{
USART0
,
// uart peripheral index
USART0_IRQn
,
// uart iqrn
RCU_USART0
,
RCU_GPIOA
,
RCU_GPIOA
,
// periph clock, tx gpio clock, rt gpio clock
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_9
,
// tx port, tx alternate, tx pin
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_10
,
// rx port, rx alternate, rx pin
&
serial0
,
"uart0"
,
},
#endif
#ifdef RT_USING_USART1
{
USART1
,
// uart peripheral index
USART1_IRQn
,
// uart iqrn
RCU_USART1
,
RCU_GPIOA
,
RCU_GPIOA
,
// periph clock, tx gpio clock, rt gpio clock
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_2
,
// tx port, tx alternate, tx pin
GPIOA
,
GPIO_AF_7
,
GPIO_PIN_3
,
// rx port, rx alternate, rx pin
&
serial1
,
"uart1"
,
},
#endif
#ifdef RT_USING_USART2
{
USART2
,
// uart peripheral index
USART2_IRQn
,
// uart iqrn
RCU_USART2
,
RCU_GPIOB
,
RCU_GPIOB
,
// periph clock, tx gpio clock, rt gpio clock
GPIOB
,
GPIO_AF_7
,
GPIO_PIN_10
,
// tx port, tx alternate, tx pin
GPIOB
,
GPIO_AF_7
,
GPIO_PIN_11
,
// rx port, rx alternate, rx pin
&
serial2
,
"uart2"
,
},
#endif
#ifdef RT_USING_UART3
{
UART3
,
// uart peripheral index
UART3_IRQn
,
// uart iqrn
RCU_UART3
,
RCU_GPIOC
,
RCU_GPIOC
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_10
,
// tx port, tx alternate, tx pin
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_11
,
// rx port, rx alternate, rx pin
&
serial3
,
"uart3"
,
},
#endif
#ifdef RT_USING_UART4
{
UART4
,
// uart peripheral index
UART4_IRQn
,
// uart iqrn
RCU_UART4
,
RCU_GPIOC
,
RCU_GPIOD
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_12
,
// tx port, tx alternate, tx pin
GPIOD
,
GPIO_AF_8
,
GPIO_PIN_2
,
// rx port, rx alternate, rx pin
&
serial4
,
"uart4"
,
},
#endif
#ifdef RT_USING_USART5
{
USART5
,
// uart peripheral index
USART5_IRQn
,
// uart iqrn
RCU_USART5
,
RCU_GPIOC
,
RCU_GPIOC
,
// periph clock, tx gpio clock, rt gpio clock
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_6
,
// tx port, tx alternate, tx pin
GPIOC
,
GPIO_AF_8
,
GPIO_PIN_7
,
// rx port, rx alternate, rx pin
&
serial5
,
"uart5"
,
},
#endif
#ifdef RT_USING_UART6
{
UART6
,
// uart peripheral index
UART6_IRQn
,
// uart iqrn
RCU_UART6
,
RCU_GPIOE
,
RCU_GPIOE
,
// periph clock, tx gpio clock, rt gpio clock
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_7
,
// tx port, tx alternate, tx pin
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_8
,
// rx port, rx alternate, rx pin
&
serial6
,
"uart6"
,
},
#endif
#ifdef RT_USING_UART7
{
UART7
,
// uart peripheral index
UART7_IRQn
,
// uart iqrn
RCU_UART7
,
RCU_GPIOE
,
RCU_GPIOE
,
// periph clock, tx gpio clock, rt gpio clock
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_0
,
// tx port, tx alternate, tx pin
GPIOE
,
GPIO_AF_8
,
GPIO_PIN_1
,
// rx port, rx alternate, rx pin
&
serial7
,
"uart7"
,
},
#endif
};
/**
* @brief UART MSP Initialization
...
...
@@ -446,50 +455,18 @@ int gd32_hw_usart_init(void)
{
struct
serial_configure
config
=
RT_SERIAL_CONFIG_DEFAULT
;
int
i
;
static
const
struct
gd32_uart
*
uarts
[]
=
{
#ifdef RT_USING_USART0
&
usart0
,
#endif
#ifdef RT_USING_USART1
&
usart1
,
#endif
#ifdef RT_USING_USART2
&
usart2
,
#endif
#ifdef RT_USING_UART3
&
uart3
,
#endif
#ifdef RT_USING_UART4
&
uart4
,
#endif
#ifdef RT_USING_USART5
&
usart5
,
#endif
#ifdef RT_USING_UART6
&
uart6
,
#endif
#ifdef RT_USING_UART7
&
uart7
,
#endif
};
for
(
i
=
0
;
i
<
sizeof
(
uarts
)
/
sizeof
(
uarts
[
0
]);
i
++
)
{
uarts
[
i
]
->
serial
->
ops
=
&
gd32_uart_ops
;
uarts
[
i
]
->
serial
->
config
=
config
;
uarts
[
i
]
.
serial
->
ops
=
&
gd32_uart_ops
;
uarts
[
i
]
.
serial
->
config
=
config
;
/* register UART1 device */
rt_hw_serial_register
(
uarts
[
i
]
->
serial
,
uarts
[
i
]
->
device_name
,
rt_hw_serial_register
(
uarts
[
i
]
.
serial
,
uarts
[
i
]
.
device_name
,
RT_DEVICE_FLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
,
(
void
*
)
uarts
[
i
]);
(
void
*
)
&
uarts
[
i
]);
}
return
0
;
...
...
bsp/gd32450z-eval/gd32_rom.sct
0 → 100644
浏览文件 @
d766abab
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x00300000 { ; load region size_region
ER_IROM1 0x08000000 0x00300000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00030000 { ; RW data
.ANY (+RW +ZI)
}
}
bsp/gd32450z-eval/project.ewp
浏览文件 @
d766abab
...
...
@@ -198,7 +198,7 @@
</option>
<option>
<name>
DSPExtension
</name>
<state>
0
</state>
<state>
1
</state>
</option>
</data>
</settings>
...
...
@@ -2515,19 +2515,4 @@
<name>
$PROJ_DIR$\..\..\components\net\lwip-1.4.1\src\core\udp.c
</name>
</file>
</group>
<group>
<name>
trace
</name>
<file>
<name>
$PROJ_DIR$\..\..\components\trace\SystemView_Src_V240\SEGGER\SEGGER_RTT.c
</name>
</file>
<file>
<name>
$PROJ_DIR$\..\..\components\trace\SystemView_Src_V240\SEGGER\SEGGER_SYSVIEW.c
</name>
</file>
<file>
<name>
$PROJ_DIR$\..\..\components\trace\SystemView_Src_V240\Config\SEGGER_SYSVIEW_Config_RTThread.c
</name>
</file>
<file>
<name>
$PROJ_DIR$\..\..\components\trace\SystemView_Src_V240\Config\SEGGER_SYSVIEW_RTThread.c
</name>
</file>
</group>
</project>
bsp/gd32450z-eval/project.uvprojx
浏览文件 @
d766abab
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录