📄 testostimeridget.c
字号:
#include "timerTest.h"
int testOSTimerIdGet()
{
OS_STATUS status;
unsigned32 t_id1,t_id2,t_id3;
printf("*** test of OSTimerIdGet ***\n");
printf("create two timers.\n");
status = OSTimerCreate ("T1" , &t_id1);
if (status != OS_OK)
{
printf("OSTimerCreate error:[%s]\n",serrno(errno));
return -1;
}
else
printf("the id of TIMER1 is[%d]\n",t_id1);
status = OSTimerCreate ("T2" , &t_id2);
if (status != OS_OK)
{
printf("OSTimerCreate error:[%s]\n",serrno(errno));
return -1;
}
else
printf("the id of TIMER2 is[%d]\n",t_id2);
status = OSTimerIdGet ("T1",&t_id3);
if (status != OS_OK)
{
printf("OSTimerIdGet error:[%s]\n",serrno(errno));
return -1;
}
else
{
if(t_id1 == t_id3)
printf("the id of TIMER1 got by OSTimerIdGet is right[%d]\n",t_id3);
else
{
printf("the id of TIMER1 got by OSTimerIdGet is wrong[%d]\n",t_id3);
return -1;
}
}
status = OSTimerIdGet ("T2",&t_id3);
if (status != OS_OK)
{
printf("OSTimerIdGet error:[%s]\n",serrno(errno));
return -1;
}
else
{
if(t_id2 == t_id3)
printf("the id of TIMER2 got by OSTimerIdGet is right[%d]\n",t_id3);
else
{
printf("the id of TIMER2 got by OSTimerIdGet is wrong[%d]\n",t_id3);
return -1;
}
}
OSTimerDelete(t_id1);
OSTimerDelete(t_id2);
printf("*** OSTimerIdGet test OK! ***\n");
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -