[mb9bf568r] 手动-自动格式整理
This commit is contained in:
parent
061182271f
commit
6ca82399f4
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : application.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2009 - 2011, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
/*
|
|
||||||
此demo用于演示动态线程创建
|
|
||||||
*/
|
|
||||||
#include <rtthread.h>
|
|
||||||
#include "board.h"
|
|
||||||
|
|
||||||
#ifdef RT_USING_FINSH
|
|
||||||
#include <finsh.h>
|
|
||||||
#include <shell.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static rt_thread_t tid1 = RT_NULL;
|
|
||||||
static rt_thread_t tid2 = RT_NULL;
|
|
||||||
|
|
||||||
|
|
||||||
static void thread1_entry(void* parameter)
|
|
||||||
{
|
|
||||||
rt_uint32_t count = 0;
|
|
||||||
|
|
||||||
rt_kprintf("thread1 dynamicly created ok\n");
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
rt_kprintf("thread1 count: %d\n",count++);
|
|
||||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void thread2_entry(void* parameter)
|
|
||||||
{
|
|
||||||
rt_uint32_t count = 0;
|
|
||||||
rt_kprintf("thread2 dynamicly created ok\n");
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
if(count == 3)
|
|
||||||
break;
|
|
||||||
rt_kprintf("thread2 count: %d\n",count++);
|
|
||||||
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
||||||
|
|
||||||
}
|
|
||||||
rt_thread_delay(RT_TICK_PER_SECOND * 4);
|
|
||||||
|
|
||||||
rt_thread_delete(tid1);
|
|
||||||
rt_kprintf("thread1 deleted ok\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int demo_init(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
tid1 = rt_thread_create("thread1",
|
|
||||||
thread1_entry,
|
|
||||||
RT_NULL,
|
|
||||||
512, 6, 10);
|
|
||||||
|
|
||||||
if (tid1 != RT_NULL)
|
|
||||||
rt_thread_startup(tid1);
|
|
||||||
|
|
||||||
tid2 = rt_thread_create("thread2",
|
|
||||||
thread2_entry,
|
|
||||||
RT_NULL,
|
|
||||||
512, 6, 10);
|
|
||||||
|
|
||||||
if (tid2 != RT_NULL)
|
|
||||||
rt_thread_startup(tid2);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : startup.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2009 - 2011, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2009 - 2011 RT-Thread Develop Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : board.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2009, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Change Logs:
|
||||||
|
* Date Author Notes
|
||||||
|
*/
|
||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : serial.c
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* File : serial.h
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||||
* This file is part of RT-Thread RTOS
|
|
||||||
* COPYRIGHT (C) 2006, RT-Thread Development Team
|
|
||||||
*
|
*
|
||||||
* The license and distribution terms for this file may be
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rt-thread.org/license/LICENSE
|
|
||||||
*
|
*
|
||||||
* Change Logs:
|
* Change Logs:
|
||||||
* Date Author Notes
|
* Date Author Notes
|
||||||
|
|
Loading…
Reference in New Issue