RTX任务管理
os_sys_init()
void os_sys_init (void (*task)(void) ); /* 操作系统启动后执行的任务 */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>void main (void) {os_sys_init (task1); /* start the kernel */while(1); /* will never come here */}
os_sys_init_prio
void os_sys_init_prio (void (*task)(void), /* Task to start */U8 priority); /* Task priority (1-254) */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>void main (void) {os_sys_init_prio (task1, 10);while(1);}
os_sys_init_user
void os_sys_init_user (void (*task)(void), /* Task to start */U8 priority, /* Task priority (1-254) */void* stack, /* Task stack */U16 size); /* Stack size */
函数描述:
该函数定义在rtl.h.注意要点:
返回值:
演示:
static U64 stk1[400/8]; /* 400-byte stack */void main (void) {os_sys_init_user (task1, 10, &stk1, sizeof(stk1));while(1);}
os_tsk_create
OS_TID os_tsk_create (void (*task)(void), /* Task to create */U8 priority ); /* Task priority (1-254) */
函数描述:
注意要点:
返回值:
演示:
OS_TID tsk1, tsk2;__task void task1 (void) {..tsk2 = os_tsk_create (task2, 1);..}__task void task2 (void) {..}
os_tsk_create_ex
OS_TID os_tsk_create_ex (void (*task)(void *), /* Task to create */U8 priority, /* Task priority (1-254) */void* argv ); /* Argument to the task */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk1, tsk2_0, tsk2_1;int param[2] = {0, 1};__task void task1 (void) {..tsk2_0 = os_tsk_create_ex (task2, 1, ¶m[0]);tsk2_1 = os_tsk_create_ex (task2, 1, ¶m[1]);..}__task void task2 (void *argv) {..switch (*(int *)argv) {case 0:printf("This is a first instance of task2.\n");break;case 1:printf("This is a second instance of task2.\n");break;}..}
os_tsk_create_user
OS_TID os_tsk_create_user(void (*task)(void), /* Task to create */U8 priority, /* Task priority (1-254) */void* stk, /* Pointer to the task's stack */U16 size ); /* Number of bytes in the stack */
函数描述:
注意要点:
返回值:
演示:
OS_TID tsk1,tsk2;static U64 stk2[400/8];__task void task1 (void) {../* Create task 2 with a bigger stack */tsk2 = os_tsk_create_user (task2, 1, &stk2, sizeof(stk2));..}__task void task2 (void) {/* We need a bigger stack here. */U8 buf[200];..}
os_tsk_create_user_ex
OS_TID os_tsk_create_user_ex (void (*task)(void *), /* Task to create */U8 priority, /* Task priority (1-254) */void* stk, /* Pointer to the task's stack */U16 size, /* Size of stack in bytes */void* argv ); /* Argument to the task */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk1,tsk2_0,tsk2_1;static U64 stk2[2][400/8];__task void task1 (void) {../* Create task 2 with a bigger stack */tsk2_0 = os_tsk_create_user_ex (task2, 1,&stk2[0], sizeof(stk2[0]),(void *)0);tsk2_1 = os_tsk_create_user_ex (task2, 1,&stk2[1], sizeof(stk2[1]),(void *)1);..}__task void task2 (void *argv) {/* We need a bigger stack here. */U8 buf[200];..switch ((int)argv) {case 0:printf("This is a first instance of task2.\n");break;case 1:printf("This is a second instance of task2.\n");break;}..}
os_tsk_delete
OS_RESULT os_tsk_delete (OS_TID task_id ); /* Id of the task to delete */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk3;__task void task2 (void) {tsk3 = os_tsk_create (task3, 0);..if (os_tsk_delete (tsk3) == OS_R_OK) {printf("\n'task 3' deleted.");}else {printf ("\nFailed to delete 'task 3'.");}}__task void task3 (void) {..}
os_tsk_delete_self
#include <rtl.h>void os_tsk_delete_self (void);
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>__task void task2 (void) {..os_tsk_delete_self();}
os_tsk_pass
#include <rtl.h>void os_tsk_pass (void);
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk1;__task void task1 (void) {..os_tsk_pass();..}
os_tsk_prio
OS_RESULT os_tsk_prio (OS_TID task_id, /* ID of the task */U8 new_prio ); /* New priority of the task (1-254) */
函数描述:
注意要点:
返回值:

演示:
#include <RTL.h>OS_TID tsk1,tsk2;__task void task1 (void) {..os_tsk_prio_self (5);/* Changing the priority of task2 will cause a task switch. */os_tsk_prio(tsk2, 10);..}__task void task2 (void) {../* Change priority of this task will cause task switch. */os_tsk_prio_self (1);..}
os_tsk_prio_self
#include <rtl.h>OS_RESULT os_tsk_prio_self (U8 new_prio ); /* New priority of task (1-254) */
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk1;__task void task1 (void) {..os_tsk_prio_self(10); /* Increase its priority, for the critical section */.. /* This is a critical section */..os_tsk_prio_self(2); /* Decrease its priority at end of critical section */..}
os_tsk_self
#include <rtl.h>OS_TID os_tsk_self (void);
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>OS_TID tsk1;__task void task1 (void) {tsk1 = os_tsk_self();..}
isr_tsk_get
#include <rtl.h>OS_TID isr_tsk_get (void);
函数描述:
注意要点:
返回值:
演示:
#include <rtl.h>void os_error (U32 err_code) {/* This function is called when a runtime error is detected. */OS_TID err_task;switch (err_code) {case OS_ERR_STK_OVF:/* Identify the task with stack overflow. */err_task = isr_tsk_get();break;case OS_ERR_FIFO_OVF:break;case OS_ERR_MBX_OVF:break;}for (;;);}
RTX任务管理的更多相关文章
- RTX——第7章 任务管理
以下内容转载自安富莱电子: http://forum.armfly.com/forum.php 单任务系统学习多任务系统之前,我们先来回顾下单任务系统的编程框架,即裸机时的编程框架. 裸机编程主要是采 ...
- RTX基础教程目录
以下RTX教程转载自安富莱电子论坛: http://forum.armfly.com/forum.php?mod=viewthread&tid=16909&extra=page%3D1 ...
- RTX——第13章 事件标志组
以下内容转载自安富莱电子: http://forum.armfly.com/forum.php 前面的章节我们已经讲解了任务管理和时间管理,从本章节开始讲解任务间的通信和同步机制.首先讲解任务间的通信 ...
- PHP实现RTX发送消息提醒
RTX是腾讯公司推出的企业级即时通信平台,大多数公司都在使用它,但是我们很多时候需要将自己系统或者产品的一些通知实时推送给RTX,这就需要用到RTX的服务端SDK,建议先去看看RTX的SDK开发文档( ...
- BPM任务管理解决方案分享
一.方案概述任务是企业管理者很多意志的直接体现,对于非常规性事务较多的企业,经常存在各类公司下达的各种任务跟进难.监控难等问题,任务不是完成效果不理解,就是时间超期,甚至很多公司管理层下达的任务都不了 ...
- 用Excel做出比肩任务管理软件的操作技巧
用Excel做出比肩任务管理软件的操作技巧 在项目管理中,网上有各种各样的工具可以选择,到底用哪个,曾一度困扰着我.我是一个有轻度强迫症的人,总是喜欢试用各种各样的系统,以比较他们之间的不同,试图选择 ...
- [No00008D]腾讯通RTX联系方式批量获取
公司用的RTX让我一直很不爽,QQ比RTX好多少为啥不让用,微信都有企业版了为啥还用腾讯通?终于今天发现唯一的好处是可以从服务器上拉公司妹子们的联系方式!!当然,我要这些联系方式,只是为了联tiao系 ...
- Quartz.NET总结(五)基于Quartz.net 的开源任务管理平台
前面总结了很多,关于Quartz.net 的文章,介绍了如何使用Quartz.net.不清楚的朋友,可以看我之前的系列文章,http://www.cnblogs.com/zhangweizhong/c ...
- .NET轻量级任务任务管理类
概述 最近做项目总是遇到服务跑批等需求,一直想写个任务管理的DLL,现在整理了一下思路,编写了一个DLL类库,使用方便.只要调用的子类继承服务基类便可以实现任务的整体调度.先看看页面效果: 使用方式 ...
随机推荐
- redis:消息发布与订阅频道
1. 发布与订阅频道 消息发布与订阅像收音机与广播台的关系 1.1. publish channel message 发布频道 语法:publish channel message 作用:发布频道消息 ...
- Java集合框架(比较啰嗦)
阅读目录 概念与作用 集合框架的体系结构 Collection接口和List接口简介 Map和HashMap简介 集合工具类:Collections 小结 概念与作用 集合概念 现实生活中:很多事物凑 ...
- Understanding Built-In User and Group Accounts in IIS 7
Understanding Built-In User and Group Accounts in IIS 7 By lzb October 19, 2018 Introduction In earl ...
- Intellij IDEA使用Docker插件部署应用
1.安装Docker插件 配置Docker Api,在API URL中填入api的地址,记得Docker后台程序启动是要配置 -H tcp://0.0.0.0:2375 开放远程地址端口,注意这里的i ...
- Linux命令之rpm篇
作业五:rpm命令 1) 挂载光盘文件到/media目录 [root@localhost 桌面]# mount /dev/sr0 /media mount: /dev/sr0 写保护,将以只读方式 ...
- 唯美PS转手绘之SAI篇_百度经验
唯美PS转手绘之SAI篇 https://jingyan.baidu.com/article/fd8044fad3d5c05030137a5f.html
- Mac本地环境配置以及安装织梦CMS,增加新的坑解决办法
Mac上其实已经自带了Apache和PHP,只是默认关闭的.开启一下就行了. Apache配置 apache已经自带了,只需在“终端”输入命令开启下就行了. 开启apache服务 sudo ap ...
- C# Monitor实现
Monitor的code如下,非常简单: public static class Monitor { public static extern void Enter(Object obj); publ ...
- 使用Mybatis时mybatis-config.xml配置中"configuration" 的内容必须匹配 (.....)解决方案
一.简述 使用Mybatis配置mybatis-config配置文件时,经常遇到下列报错信息:org.xml.sax.SAXParseException; lineNumber: 36; column ...
- PowerShe 消息提示框测试
1. 使用powerShell 弹出一个简单的消息框,代码如下,创建test.ps1脚本文件. $ConfirmPreference = 'None' $ws = New-Object -ComObj ...