/*----------------------------------------------------------------------------
* RL-ARM - RTX
*----------------------------------------------------------------------------
* Name: RTX_EX1.C
* Purpose: Your First RTX example program
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*---------------------------------------------------------------------------*/ #include "cmsis_os.h" /* Forward reference */
void threadX (void const *argument); /* Thread IDs */
osThreadId main_id;
osThreadId threadX_id; /* Thread definitions */
osThreadDef(threadX, osPriorityNormal, , ); /*----------------------------------------------------------------------------
* Thread X
*---------------------------------------------------------------------------*/
void threadX (void const *argument) {
for (;;) {
/* Wait for completion of do-this */
osSignalWait(0x0004, osWaitForever); /* do-that */
/* Pause for 20 ms until signaling event to main thread */
osDelay();
/* Indicate to main thread completion of do-that */
osSignalSet(main_id, 0x0004);
}
} /*----------------------------------------------------------------------------
* Main Thread
*---------------------------------------------------------------------------*/
int main (void) { /* Get main thread ID */
main_id = osThreadGetId();
/* Create thread X */
threadX_id = osThreadCreate(osThread(threadX), NULL);
for (;;) { /* do-this */
/* Indicate to thread X completion of do-this */
osSignalSet(threadX_id, 0x0004);
/* Wait for completion of do-that */
osSignalWait(0x0004, osWaitForever);
/* Wait now for 50 ms */
osDelay();
}
} /*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/

最新文章

  1. C#基础——系统登录功能的实现
  2. js中的call与apply深入浅出
  3. IOS 其它语言比较-Objc与JAVA的比较
  4. CentOS 6.5 安装nginx 1.6.3
  5. iOS: 使用CGContextRef,CGPath和UIBezierPath来绘画
  6. zoj3745 Salary Increasing
  7. PKUSC 模拟赛 day2 上午总结
  8. python算法之二分查找
  9. 关于Dubbo一个接口多个实现的解决方案
  10. 《深入浅出设计模式》读书笔记 C#版(第一章)
  11. Python 2.7 闭包的局限
  12. Rest API
  13. swust oj 982
  14. java正则表达式学习笔记
  15. Java 元编程及其应用
  16. 简单实用的分页类-python
  17. MariaDB第三章(select)
  18. Javascript this 的一些总结
  19. url参数 加密
  20. robotframework 运行集合

热门文章

  1. 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:1.资源准备
  2. Web安全测试学习笔记(Cookie&Session)
  3. 使用RoboCopy 命令
  4. cocos2dx lua中继承与覆盖C++方法
  5. J2EE事务
  6. MSSQL 查询分组前N条记录
  7. C#(WinForm)实现软件注册
  8. 独立开发游戏越来越容易:Unity 发布旗下的最新游戏引擎 Unity 5,依然有免费版(转)
  9. STL六大组件之——算法小小小小的解析
  10. mybatis系列-15-查询缓存