MQX的任务创建
来源:互联网 发布:mysql schema是什么 编辑:程序博客网 时间:2024/06/06 00:26
公司用freescale的芯片,要用到MQX OS
任务模板列表(TASK_TEMPLATE_STRUCT)定义了一组初始化模板,基于该模板可以在处理器上生成任务。
{
_mqx_uint TASK_TEMPLATE_INDEX;
void _CODE_PTR_ TASK_ADDRESS)(uint_32);
_mem_size TASK_STACKSIZE;
_mqx_uint TASK_PRIORITY;
char _PTR_ TASK_NAME;
_mqx_uint TASK_ATTRIBUTES;
uint_32 CREATION_PARAMETER;
_mqx_uint DEFAULT_TIME_SLICE;
}
举例:一个任务模板列表
你可以初始化自己的任务模板列表,也可以使用默认的列表MQX_template_list
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
{ MAIN_TASK, world_task,
MQX_AUTO_START_TASK, 0L, 0},
{ HELLO, hello_task, 0x2000, 5, "hello_task",
MQX_TIME_SLICE_TASK, 0L, 100},
{ FLOAT, float_task, 0x2000, 5, "Float_task",
MQX_AUTO_START_TASK | MQX_FLOATING_POINT_TASK, 0L, 0},
{ 0, 0, 0, 0,
};
文档中的例子1: 创建一个自启动任务
#include
#include
#define HELLO_TASK 5
extern void hello_task(uint_32);
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
{ HELLO_TASK, hello_task, 500, 5, "hello",
MQX_AUTO_START_TASK, 0L, 0},
{ 0, 0, 0, 0, 0,
0, 0L, 0}
};
void hello_task(uint_32 initial_data)
{
printf("\n Hello World \n");
_mqx_exit(0);
}
文档中的例子2:
#include<mqx.h>
#include<fio.h>
#define HELLO_TASK 5
#define WORLD_TASK 6
extern void hello_task(uint_32);
extern void world_task(uint_32);
TASK_TEMPLATE_STRUCT MQX_template_list[] =
{
{WORLD_TASK, world_task, 500, 5, "world",
MQX_AUTO_START_TASK, 0L, 0},
{HELLO_TASK, hello_task, 500, 4, "hello",
0, 0L, 0},
{0, 0, 0, 0, 0,
0, 0L, 0}
};
void world_task(uint_32 initial_data)
{
_task_id hello_task_id;
hello_task_id = _task_create(0, HELLO_TASK, 0); //MQX 使用hello_task 模板生成hello_task 的一个实例
if (hello_task_id == MQX_NULL_TASK_ID) {
printf("\n Could not createhello_task\n");
} else {
printf(" World \n");
}
_mqx_exit(0);
}
void hello_task(uint_32 initial_data)
{
printf(" Hello \n");
_task_block();
}
说明(文档摘抄)
- MQX的任务创建
- MQX----任务同步
- MQX--开篇之MQX简介、初始化、任务
- MQX的启动过程
- MQX Lite 每个任务最低分配多少栈空间?
- iar下的MQX库文件编译
- MQX,ucOS和embos的比较
- UCOSII创建的创建任务
- 任务管理器的创建
- MQX下队列和socket(客户端的)的编程
- 更改MQX中printf对应的默认串口
- Feescale K60开发笔记8: MQX中看门狗的使用
- Feescale K60开发笔记10: MQX 4.2.0.2的安装
- linux的自动任务创建
- ucos 任务堆栈的创建
- MySQL的计划任务创建
- linux的自动任务创建
- Linux 定时任务的创建
- Getting Started with SQL Server 2008 R2 Failover Clustering
- powerdesigner 大小写转换
- 4.3 C风格字符串
- 异或运算^和他的一个常用作用
- 快速实现程序包与配置文件分离
- MQX的任务创建
- html实现单线表格
- 学习struts2需要注意(jar包导入)
- 问题九十五:Reverse Text
- 执行PL/SQL块时出现 ORA-06550 错误(批量建表)
- volatile关键字
- 【linux】用命令行方式关闭CentOS防火墙
- CXF simple frontend, allow all SSL certificates and set basic authentication credentials
- 现货黄金分时图