Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
失败笔记本
rt-thread
提交
db16ba50
R
rt-thread
项目概览
失败笔记本
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
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,发现更多精彩内容 >>
未验证
提交
db16ba50
编写于
3月 23, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
3月 23, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4499 from mysterywolf/mb9bf506r
[mb9bf506r]manual & auto formatted
上级
bc618dd4
364ef38e
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
1154 addition
and
1195 deletion
+1154
-1195
bsp/mb9bf506r/applications/application.c
bsp/mb9bf506r/applications/application.c
+19
-23
bsp/mb9bf506r/applications/startup.c
bsp/mb9bf506r/applications/startup.c
+32
-36
bsp/mb9bf506r/drivers/board.c
bsp/mb9bf506r/drivers/board.c
+17
-21
bsp/mb9bf506r/drivers/board.h
bsp/mb9bf506r/drivers/board.h
+2
-6
bsp/mb9bf506r/drivers/fm3_uart.c
bsp/mb9bf506r/drivers/fm3_uart.c
+710
-715
bsp/mb9bf506r/drivers/fm3_uart.h
bsp/mb9bf506r/drivers/fm3_uart.h
+12
-16
bsp/mb9bf506r/drivers/led.c
bsp/mb9bf506r/drivers/led.c
+18
-22
bsp/mb9bf506r/drivers/led.h
bsp/mb9bf506r/drivers/led.h
+12
-16
bsp/mb9bf506r/drivers/nand.c
bsp/mb9bf506r/drivers/nand.c
+328
-332
bsp/mb9bf506r/drivers/nand.h
bsp/mb9bf506r/drivers/nand.h
+4
-8
未找到文件。
bsp/mb9bf506r/applications/application.c
浏览文件 @
db16ba50
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
@@ -33,35 +29,35 @@
void
rt_init_thread_entry
(
void
*
parameter
)
{
/* LED Initialization */
rt_hw_led_init
();
/* LED Initialization */
rt_hw_led_init
();
#ifdef RT_USING_COMPONENTS_INIT
/* initialization RT-Thread Components */
rt_components_init
();
/* initialization RT-Thread Components */
rt_components_init
();
#endif
/* Filesystem Initialization */
/* Filesystem Initialization */
#ifdef RT_USING_DFS
/* mount nand fat partition 1 as root directory */
if
(
dfs_mount
(
"nand"
,
"/"
,
"elm"
,
0
,
0
)
==
0
)
rt_kprintf
(
"File System initialized!
\n
"
);
else
rt_kprintf
(
"File System init failed!
\n
"
);
/* mount nand fat partition 1 as root directory */
if
(
dfs_mount
(
"nand"
,
"/"
,
"elm"
,
0
,
0
)
==
0
)
rt_kprintf
(
"File System initialized!
\n
"
);
else
rt_kprintf
(
"File System init failed!
\n
"
);
#endif
}
int
rt_application_init
(
void
)
{
rt_thread_t
tid
;
rt_thread_t
tid
;
tid
=
rt_thread_create
(
"init"
,
rt_init_thread_entry
,
RT_NULL
,
2048
,
RT_THREAD_PRIORITY_MAX
/
3
,
20
);
if
(
tid
!=
RT_NULL
)
rt_thread_startup
(
tid
);
tid
=
rt_thread_create
(
"init"
,
rt_init_thread_entry
,
RT_NULL
,
2048
,
RT_THREAD_PRIORITY_MAX
/
3
,
20
);
if
(
tid
!=
RT_NULL
)
rt_thread_startup
(
tid
);
return
0
;
return
0
;
}
/*@}*/
bsp/mb9bf506r/applications/startup.c
浏览文件 @
db16ba50
/*
* File : startup.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012, RT-Thread Development Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
@@ -38,60 +34,60 @@ extern int __bss_end;
*/
void
rtthread_startup
(
void
)
{
/* initialize board */
rt_hw_board_init
();
/* initialize board */
rt_hw_board_init
();
/* show version */
rt_show_version
();
/* show version */
rt_show_version
();
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
rt_system_heap_init
((
void
*
)
&
Image
$$
RW_IRAM1
$$
ZI
$$
Limit
,
(
void
*
)
FM3_SRAM_END
);
#elif __ICCARM__
rt_system_heap_init
(
__segment_end
(
"HEAP"
),
(
void
*
)
FM3_SRAM_END
);
#else
/* init memory system */
rt_system_heap_init
((
void
*
)
&
__bss_end
,
(
void
*
)
FM3_SRAM_END
);
#endif
#ifdef __CC_ARM
rt_system_heap_init
((
void
*
)
&
Image
$$
RW_IRAM1
$$
ZI
$$
Limit
,
(
void
*
)
FM3_SRAM_END
);
#elif __ICCARM__
rt_system_heap_init
(
__segment_end
(
"HEAP"
),
(
void
*
)
FM3_SRAM_END
);
#else
/* init memory system */
rt_system_heap_init
((
void
*
)
&
__bss_end
,
(
void
*
)
FM3_SRAM_END
);
#endif
#endif
/* init scheduler system */
rt_system_scheduler_init
();
/* init scheduler system */
rt_system_scheduler_init
();
#ifdef RT_USING_DEVICE
#if defined(RT_USING_DFS) && defined(RT_USING_DFS_UFFS)
rt_hw_nand_init
();
rt_hw_nand_init
();
#endif
#endif
/* initialize application */
rt_application_init
();
/* initialize application */
rt_application_init
();
/* initialize timer */
rt_system_timer_init
();
/* initialize timer thread */
rt_system_timer_thread_init
();
/* initialize timer thread */
rt_system_timer_thread_init
();
/* initialize idle thread */
rt_thread_idle_init
();
/* initialize idle thread */
rt_thread_idle_init
();
/* start scheduler */
rt_system_scheduler_start
();
/* start scheduler */
rt_system_scheduler_start
();
/* never reach here */
return
;
/* never reach here */
return
;
}
int
main
(
void
)
{
/* disable interrupt first */
rt_hw_interrupt_disable
();
/* disable interrupt first */
rt_hw_interrupt_disable
();
/* startup RT-Thread RTOS */
rtthread_startup
();
/* startup RT-Thread RTOS */
rtthread_startup
();
return
0
;
return
0
;
}
/*@}*/
bsp/mb9bf506r/drivers/board.c
浏览文件 @
db16ba50
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009 - 2012 RT-Thread Develop Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
@@ -32,13 +28,13 @@
*/
void
SysTick_Handler
(
void
)
{
/* enter interrupt */
rt_interrupt_enter
();
/* enter interrupt */
rt_interrupt_enter
();
rt_tick_increase
();
rt_tick_increase
();
/* leave interrupt */
rt_interrupt_leave
();
/* leave interrupt */
rt_interrupt_leave
();
}
/**
...
...
@@ -46,16 +42,16 @@ void SysTick_Handler(void)
*/
void
rt_hw_board_init
(
void
)
{
/* init systick */
SysTick_Config
(
SystemCoreClock
/
RT_TICK_PER_SECOND
);
/* initialize UART device */
rt_hw_serial_init
();
/* set console as UART device */
rt_console_set_device
(
RT_CONSOLE_DEVICE_NAME
);
/* initialize nand flash device */
rt_hw_nand_init
();
/* init systick */
SysTick_Config
(
SystemCoreClock
/
RT_TICK_PER_SECOND
);
/* initialize UART device */
rt_hw_serial_init
();
/* set console as UART device */
rt_console_set_device
(
RT_CONSOLE_DEVICE_NAME
);
/* initialize nand flash device */
rt_hw_nand_init
();
}
/*@}*/
bsp/mb9bf506r/drivers/board.h
浏览文件 @
db16ba50
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
bsp/mb9bf506r/drivers/fm3_uart.c
浏览文件 @
db16ba50
此差异已折叠。
点击以展开。
bsp/mb9bf506r/drivers/fm3_uart.h
浏览文件 @
db16ba50
/*
* File : fm3_uart.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
@@ -55,7 +51,7 @@
#define ESCR_DATABITS_7 0x03U
#define ESCR_DATABITS_9 0x04U
#define FIFO_SIZE
16
#define FIFO_SIZE
16
/*
* Enable/DISABLE Interrupt Controller
...
...
@@ -66,19 +62,19 @@
struct
uart03_device
{
FM3_MFS03_UART_TypeDef
*
uart_regs
;
/* irq number */
IRQn_Type
rx_irq
;
IRQn_Type
tx_irq
;
FM3_MFS03_UART_TypeDef
*
uart_regs
;
/* irq number */
IRQn_Type
rx_irq
;
IRQn_Type
tx_irq
;
};
struct
uart47_device
{
FM3_MFS47_UART_TypeDef
*
uart_regs
;
/* irq number */
IRQn_Type
rx_irq
;
IRQn_Type
tx_irq
;
rt_uint8_t
fifo_size
;
FM3_MFS47_UART_TypeDef
*
uart_regs
;
/* irq number */
IRQn_Type
rx_irq
;
IRQn_Type
tx_irq
;
rt_uint8_t
fifo_size
;
};
void
rt_hw_serial_init
(
void
);
...
...
bsp/mb9bf506r/drivers/led.c
浏览文件 @
db16ba50
/*
* File : led.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Develop Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-03-03 lgnq
*/
#include <rtthread.h>
#include <rthw.h>
...
...
@@ -20,8 +16,8 @@
void
rt_hw_led_on
(
rt_uint8_t
num
)
{
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
switch
(
num
)
{
case
1
:
...
...
@@ -31,16 +27,16 @@ void rt_hw_led_on(rt_uint8_t num)
USER_LED_PDOR
&=
~
USER_LED2
;
break
;
case
3
:
USER_LED_PDOR
&=
~
USER_LED3
;
USER_LED_PDOR
&=
~
USER_LED3
;
break
;
default:
break
;
}
}
}
void
rt_hw_led_off
(
rt_uint8_t
num
)
{
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
switch
(
num
)
{
...
...
@@ -51,17 +47,17 @@ void rt_hw_led_off(rt_uint8_t num)
USER_LED_PDOR
|=
USER_LED2
;
break
;
case
3
:
USER_LED_PDOR
|=
USER_LED3
;
USER_LED_PDOR
|=
USER_LED3
;
break
;
default:
break
;
}
}
}
void
rt_hw_led_toggle
(
rt_uint8_t
num
)
{
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
RT_ASSERT
(
num
<
LEDS_MAX_NUMBER
);
switch
(
num
)
{
case
1
:
...
...
@@ -80,11 +76,11 @@ void rt_hw_led_toggle(rt_uint8_t num)
if
(
USER_LED_PDOR
&
USER_LED3
)
USER_LED_PDOR
&=
~
USER_LED3
;
else
USER_LED_PDOR
|=
USER_LED3
;
USER_LED_PDOR
|=
USER_LED3
;
break
;
default:
break
;
}
}
}
void
led_init
(
void
)
...
...
@@ -102,7 +98,7 @@ void led_init(void)
void
pwm_update
(
rt_uint16_t
value
)
{
FM3_BT2_PWM
->
PDUT
=
value
;
FM3_BT2_PWM
->
PDUT
=
value
;
}
static
void
led1_thread_entry
(
void
*
parameter
)
...
...
@@ -130,11 +126,11 @@ void rt_hw_led_init(void)
led_init
();
led1_thread
=
rt_thread_create
(
"led1"
,
led1_thread_entry
,
RT_NULL
,
384
,
29
,
5
);
if
(
led1_thread
!=
RT_NULL
)
if
(
led1_thread
!=
RT_NULL
)
rt_thread_startup
(
led1_thread
);
led2_thread
=
rt_thread_create
(
"led2"
,
led2_thread_entry
,
RT_NULL
,
384
,
30
,
5
);
if
(
led2_thread
!=
RT_NULL
)
if
(
led2_thread
!=
RT_NULL
)
rt_thread_startup
(
led2_thread
);
}
...
...
bsp/mb9bf506r/drivers/led.h
浏览文件 @
db16ba50
/*
* File : led.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2011, RT-Thread Develop Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2011-03-03 lgnq
*/
#ifndef __LED_H__
#define __LED_H__
#include "mb9bf506r.h"
#define LEDS_MAX_NUMBER
4
#define LEDS_MAX_NUMBER
4
/* LED */
#define USER_LED1 (1UL<<0x9)
#define USER_LED2 (1UL<<0xa)
#define USER_LED3 (1UL<<0xb)
#define USER_LED_MASK
(USER_LED1 | USER_LED2 | USER_LED3)
#define USER_LED_PFR
FM3_GPIO->PFR1
#define USER_LED_PCR
FM3_GPIO->PCR1
#define USER_LED_PDOR
FM3_GPIO->PDOR1
#define USER_LED_DDR
FM3_GPIO->DDR1
#define USER_LED_MASK
(USER_LED1 | USER_LED2 | USER_LED3)
#define USER_LED_PFR
FM3_GPIO->PFR1
#define USER_LED_PCR
FM3_GPIO->PCR1
#define USER_LED_PDOR
FM3_GPIO->PDOR1
#define USER_LED_DDR
FM3_GPIO->DDR1
#define RT_DEVICE_CTRL_LED_ON
0
#define RT_DEVICE_CTRL_LED_OFF
1
#define RT_DEVICE_CTRL_LED_TOGGLE
2
#define RT_DEVICE_CTRL_LED_ON
0
#define RT_DEVICE_CTRL_LED_OFF
1
#define RT_DEVICE_CTRL_LED_TOGGLE
2
void
rt_hw_led_init
(
void
);
void
rt_hw_led_on
(
rt_uint8_t
num
);
...
...
bsp/mb9bf506r/drivers/nand.c
浏览文件 @
db16ba50
此差异已折叠。
点击以展开。
bsp/mb9bf506r/drivers/nand.h
浏览文件 @
db16ba50
/*
* File : nand.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
...
...
@@ -33,7 +29,7 @@
#define NF_ALE_OFFSET 0x00003000
#define NF_ADDR_OFFSET 0x00002000
#define NF_CMD_OFFSET 0x00001000
#define NF_DATA_OFFSET 0x00000000
#define NF_DATA_OFFSET 0x00000000
/* NAND command */
#define NAND_CMD_READ0 0x00
...
...
@@ -47,7 +43,7 @@
#define NAND_CMD_READID1 0x91
#define NAND_CMD_ERASE2 0xd0
#define NAND_CMD_RESET 0xff
#define FLASH_OK 0
#define FLASH_NG 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录