Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
5d275ff0
R
rt-thread
项目概览
wwsmg1
/
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,发现更多精彩内容 >>
未验证
提交
5d275ff0
编写于
3月 29, 2021
作者:
B
Bernard Xiong
提交者:
GitHub
3月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4538 from mysterywolf/taihu
[taihu] auto formatted
上级
cecd78b1
8a5876a9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
102 addition
and
118 deletion
+102
-118
bsp/taihu/applications/application.c
bsp/taihu/applications/application.c
+42
-46
bsp/taihu/applications/board.c
bsp/taihu/applications/board.c
+5
-9
bsp/taihu/applications/board.h
bsp/taihu/applications/board.h
+2
-6
bsp/taihu/applications/startup.c
bsp/taihu/applications/startup.c
+26
-30
bsp/taihu/rtconfig.h
bsp/taihu/rtconfig.h
+27
-27
未找到文件。
bsp/taihu/applications/application.c
浏览文件 @
5d275ff0
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 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-04-16 first version
* 2011-04-16
first version
*/
#include <rtthread.h>
#define THREAD_STACK_SIZE
1024
#define THREAD_STACK_SIZE
1024
#if 0
struct rt_semaphore sem1, sem2;
...
...
@@ -27,44 +23,44 @@ static rt_uint8_t thread2_stack[THREAD_STACK_SIZE];
static void thread1_entry(void* parameter)
{
while (1)
{
rt_sem_release(&sem2);
rt_kprintf("thread1..: %s\n", rt_thread_self()->name);
rt_sem_take(&sem1, RT_WAITING_FOREVER);
rt_kprintf("get semaphore: %s!\n", rt_thread_self()->name);
}
while (1)
{
rt_sem_release(&sem2);
rt_kprintf("thread1..: %s\n", rt_thread_self()->name);
rt_sem_take(&sem1, RT_WAITING_FOREVER);
rt_kprintf("get semaphore: %s!\n", rt_thread_self()->name);
}
}
static void thread2_entry(void* parameter)
{
while (1)
{
rt_sem_take(&sem2, RT_WAITING_FOREVER);
rt_kprintf("thread2--->: %s\n", rt_thread_self()->name);
rt_sem_release(&sem1);
}
while (1)
{
rt_sem_take(&sem2, RT_WAITING_FOREVER);
rt_kprintf("thread2--->: %s\n", rt_thread_self()->name);
rt_sem_release(&sem1);
}
}
/* user application */
int rt_application_init()
{
rt_err_t result;
rt_err_t result;
rt_sem_init(&sem1, "s1", 0, RT_IPC_FLAG_FIFO);
rt_sem_init(&sem2, "s2", 0, RT_IPC_FLAG_FIFO);
rt_sem_init(&sem1, "s1", 0, RT_IPC_FLAG_FIFO);
rt_sem_init(&sem2, "s2", 0, RT_IPC_FLAG_FIFO);
result = rt_thread_init(&thread1, "t1",
thread1_entry, RT_NULL,
&thread1_stack[0], sizeof(thread1_stack), 10, 10);
if (result == RT_EOK)
rt_thread_startup(&thread1);
result = rt_thread_init(&thread1, "t1",
thread1_entry, RT_NULL,
&thread1_stack[0], sizeof(thread1_stack), 10, 10);
if (result == RT_EOK)
rt_thread_startup(&thread1);
result = rt_thread_init(&thread2, "t2", thread2_entry, RT_NULL,
&thread2_stack[0], sizeof(thread2_stack), 18, 10);
if (result == RT_EOK)
rt_thread_startup(&thread2);
result = rt_thread_init(&thread2, "t2", thread2_entry, RT_NULL,
&thread2_stack[0], sizeof(thread2_stack), 18, 10);
if (result == RT_EOK)
rt_thread_startup(&thread2);
return 0;
return 0;
}
#else
static
struct
rt_thread
thread1
;
...
...
@@ -74,27 +70,27 @@ rt_timer_t ttimer;
static
void
thread1_entry
(
void
*
parameter
)
{
rt_uint32_t
count
=
0
;
while
(
1
)
{
rt_kprintf
(
"%s: count = %d
\n
"
,
rt_thread_self
()
->
name
,
count
++
);
rt_uint32_t
count
=
0
;
while
(
1
)
{
rt_kprintf
(
"%s: count = %d
\n
"
,
rt_thread_self
()
->
name
,
count
++
);
rt_thread_delay
(
10
);
}
rt_thread_delay
(
10
);
}
}
/* user application */
int
rt_application_init
()
{
rt_err_t
result
;
rt_err_t
result
;
result
=
rt_thread_init
(
&
thread1
,
"t1"
,
thread1_entry
,
RT_NULL
,
&
thread1_stack
[
0
],
sizeof
(
thread1_stack
),
10
,
10
);
result
=
rt_thread_init
(
&
thread1
,
"t1"
,
thread1_entry
,
RT_NULL
,
&
thread1_stack
[
0
],
sizeof
(
thread1_stack
),
10
,
10
);
ttimer
=
&
(
thread1
.
thread_timer
);
if
(
result
==
RT_EOK
)
rt_thread_startup
(
&
thread1
);
ttimer
=
&
(
thread1
.
thread_timer
);
if
(
result
==
RT_EOK
)
rt_thread_startup
(
&
thread1
);
return
0
;
return
0
;
}
#endif
bsp/taihu/applications/board.c
浏览文件 @
5d275ff0
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 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-04-16 first version
* 2011-04-16
first version
*/
#include <rtthread.h>
...
...
@@ -19,6 +15,6 @@
void
rt_hw_board_init
()
{
rt_hw_serial_init
();
rt_console_set_device
(
"uart1"
);
rt_hw_serial_init
();
rt_console_set_device
(
"uart1"
);
}
bsp/taihu/applications/board.h
浏览文件 @
5d275ff0
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 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
...
...
bsp/taihu/applications/startup.c
浏览文件 @
5d275ff0
/*
* File : startup.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, 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
...
...
@@ -33,42 +29,42 @@ extern int __heap_end;
*/
void
rtthread_startup
(
void
)
{
/* init hardware interrupt */
rt_hw_interrupt_init
();
/* init hardware interrupt */
rt_hw_interrupt_init
();
/* init board */
rt_hw_board_init
();
rt_show_version
();
/* init board */
rt_hw_board_init
();
rt_show_version
();
/* init timer system */
rt_system_timer_init
();
/* init timer system */
rt_system_timer_init
();
/* init memory system */
/* init memory system */
#ifdef RT_USING_HEAP
rt_system_heap_init
((
void
*
)
&
__heap_start
,
(
void
*
)
&
__heap_end
);
rt_system_heap_init
((
void
*
)
&
__heap_start
,
(
void
*
)
&
__heap_end
);
#endif
/* init scheduler system */
rt_system_scheduler_init
();
/* init scheduler system */
rt_system_scheduler_init
();
/* init application */
rt_application_init
();
/* init application */
rt_application_init
();
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init
();
finsh_set_device
(
"uart1"
);
/* init finsh */
finsh_system_init
();
finsh_set_device
(
"uart1"
);
#endif
/* init soft timer thread */
rt_system_timer_thread_init
();
/* init soft timer thread */
rt_system_timer_thread_init
();
/* init idle thread */
rt_thread_idle_init
();
/* init 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
;
}
bsp/taihu/rtconfig.h
浏览文件 @
5d275ff0
...
...
@@ -3,19 +3,19 @@
#define __RTTHREAD_CFG_H__
/* RT_NAME_MAX*/
#define RT_NAME_MAX
8
#define RT_NAME_MAX
8
/* RT_ALIGN_SIZE*/
#define RT_ALIGN_SIZE
4
#define RT_ALIGN_SIZE
4
/* PRIORITY_MAX*/
#define RT_THREAD_PRIORITY_MAX
32
#define IDLE_THREAD_STACK_SIZE
1024
#define RT_THREAD_PRIORITY_MAX
32
#define IDLE_THREAD_STACK_SIZE
1024
/* Tick per Second*/
#define RT_TICK_PER_SECOND
100
#define RT_TICK_PER_SECOND
100
/* CPU Frequency 200MHz */
#define RT_CPU_FREQ
200
#define RT_CPU_FREQ
200
/* SECTION: RT_DEBUG */
/* open debug for system assert */
...
...
@@ -59,12 +59,12 @@
/* Using Device System*/
#define RT_USING_DEVICE
#define RT_USING_UART1
#define RT_UART_RX_BUFFER_SIZE
64
#define RT_UART_RX_BUFFER_SIZE
64
/* SECTION: Console options */
#define RT_USING_CONSOLE
/* the buffer size of console*/
#define RT_CONSOLEBUF_SIZE
128
#define RT_CONSOLEBUF_SIZE
128
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
...
...
@@ -85,34 +85,34 @@
#define RT_LWIP_DNS
/* the number of simulatenously active TCP connections*/
#define RT_LWIP_TCP_PCB_NUM
5
#define RT_LWIP_TCP_PCB_NUM
5
/* ip address of target*/
#define RT_LWIP_IPADDR0
192
#define RT_LWIP_IPADDR1
168
#define RT_LWIP_IPADDR2
1
#define RT_LWIP_IPADDR3
30
#define RT_LWIP_IPADDR0
192
#define RT_LWIP_IPADDR1
168
#define RT_LWIP_IPADDR2
1
#define RT_LWIP_IPADDR3
30
/* gateway address of target*/
#define RT_LWIP_GWADDR0
192
#define RT_LWIP_GWADDR1
168
#define RT_LWIP_GWADDR2
1
#define RT_LWIP_GWADDR3
1
#define RT_LWIP_GWADDR0
192
#define RT_LWIP_GWADDR1
168
#define RT_LWIP_GWADDR2
1
#define RT_LWIP_GWADDR3
1
/* mask address of target*/
#define RT_LWIP_MSKADDR0
255
#define RT_LWIP_MSKADDR1
255
#define RT_LWIP_MSKADDR2
255
#define RT_LWIP_MSKADDR3
0
#define RT_LWIP_MSKADDR0
255
#define RT_LWIP_MSKADDR1
255
#define RT_LWIP_MSKADDR2
255
#define RT_LWIP_MSKADDR3
0
/* tcp thread options */
#define RT_LWIP_TCPTHREAD_PRIORITY
12
#define RT_LWIP_TCPTHREAD_MBOX_SIZE
4
#define RT_LWIP_TCPTHREAD_STACKSIZE
1024
#define RT_LWIP_TCPTHREAD_PRIORITY
12
#define RT_LWIP_TCPTHREAD_MBOX_SIZE
4
#define RT_LWIP_TCPTHREAD_STACKSIZE
1024
/* ethernet if thread options */
#define RT_LWIP_ETHTHREAD_PRIORITY
15
#define RT_LWIP_ETHTHREAD_MBOX_SIZE
4
#define RT_LWIP_ETHTHREAD_STACKSIZE
512
#define RT_LWIP_ETHTHREAD_PRIORITY
15
#define RT_LWIP_ETHTHREAD_MBOX_SIZE
4
#define RT_LWIP_ETHTHREAD_STACKSIZE
512
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录