📄 testostasknoteget.c
字号:
#include "taskTest.h"
static unsigned32 task_id;
static void tak_entry(
void* argument
)
{
while(1)
OSTaskDelay(1);
}
int testOSTaskNoteGet()
{
OS_STATUS status;
unsigned32 note;
printf("*** test of OSTaskNoteGet ***\n");
printf("create a task named TSK\n");
status = OSTaskCreate("TSK",102,STACK_MINIMUM_SIZE,OS_DEFAULT,OS_DEFAULT,&task_id);
if(status != OS_OK)
{
printf("OSTaskCreate error:[%s]\n",serrno(errno));
return (-1);
}
status = OSTaskStart( task_id, tak_entry, 0 );
if(status != OS_OK)
{
printf("OSTaskStart error:[%s]\n",serrno(errno));
return (-1);
}
printf("set the OS_NOTEPAD_1 of TSK to 11\n");
status = OSTaskNoteSet(task_id,OS_NOTEPAD_1,11);
if(status != OS_OK)
{
printf("OSTaskNoteSet error:[%s]\n",serrno(errno));
return (-1);
}
printf("get the OS_NOTEPAD_1 of TSK\n");
status = OSTaskNoteGet(task_id,OS_NOTEPAD_1,¬e);
if(status != OS_OK)
{
printf("OSTaskNoteGet error:[%s]\n",serrno(errno));
return (-1);
}
else
{
if(note != 11)
{
printf("OSTaskNoteGet get wrong note[%d]\n",note);
return -1;
}
else
printf("OSTaskNoteGet get right note[%d]\n",note);
}
OSTaskDelay(1000);
OSTaskDelete(task_id);
printf("*** OSTaskNoteGet test OK! ***\n");
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -