#if (INCLUDE__UBINOS__UBIK_TEST == 1)
#if !(UBINOS__UBIK_TEST__EXCLUDE_TASKTESTSET3 == 1)
#include <stdio.h>
static void tasktest08_task1func(void * arg) {
int r;
int i;
unsigned int waittick =
ubik_timemstotick(UBINOS__UBIK_TEST__TASKWAITTIMEMS * UBINOS__UBIK_TEST__TASKLOOPCOUNT);
unsigned int remainingtick;
unsigned int temp;
for (i=0; i<UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1; i++) {
printf("1");
}
printf("\n");
printf(
"task 1 waits for first signal with timeout (for %d ms)\n",
ubik_ticktotimems(waittick * 3));
if (0 != r) {
printf("task 1: fail at signal_wait_timed(), err=%d\n", r);
goto end0;
}
temp = waittick * 2;
if (temp > remainingtick) {
temp = temp - remainingtick;
}
else {
temp = remainingtick - temp;
}
temp = temp * 100 / (waittick * 2);
if (5 < temp) {
printf("task 1: return value of task_getremainingtimeout function is wrong (%d)\n", temp);
goto end0;
}
for (i=0; i<UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1; i++) {
printf("1");
}
printf("\n");
remainingtick -= waittick;
printf(
"task 1 waits for second signal with timeout (for %d ms)\n",
ubik_ticktotimems(remainingtick));
printf("task 1: fail at signal_wait_timed(), err=%d\n", r);
goto end0;
}
printf("\n");
printf("task 1 wakes up\n");
if (0 != remainingtick) {
printf("task 1: return value of task_getremainingtimeout function is wrong (%d)\n", remainingtick);
goto end0;
}
for (i=0; i<UBINOS__UBIK_TEST__TASKLOOPCOUNT * 1; i++) {
printf("1");
}
printf("\n");
end0:
printf("task 1 ends\n");
}
static void tasktest08_task2func(void * arg) {
int r;
int i;
for (i=0; i<UBINOS__UBIK_TEST__TASKLOOPCOUNT * 2; i++) {
printf("2");
}
printf("\n");
printf("task 2 sends first signal\n");
if (0 != r) {
printf("task 2: fail at signal_send(), err=%d\n", r);
goto end0;
}
for (i=0; i<UBINOS__UBIK_TEST__TASKLOOPCOUNT * 2; i++) {
printf("2");
}
printf("\n");
end0:
printf("task 2 ends\n");
}
int r;
int r2;
unsigned int count1;
unsigned int count2;
unsigned int sleepvalue =
ubik_timemstotick(UBINOS__UBIK_TEST__TASKWAITTIMEMS) * UBINOS__UBIK_TEST__TASKLOOPCOUNT / 3;
printf("\n");
printf("<test>\n");
printf("<name>ubik_test_tasktest08</name>\n");
printf("<description>Test on get remaining timeout tick function of task</description>\n");
printf("<message>\n");
if (0 != r) {
printf("fail at signal_create(), err=%d\n", r);
r = -1;
goto end0;
}
printf("create task 2\n");
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end1;
}
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 01: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("create task 1\n");
if (0 != r) {
printf("fail at task_create_noautodel(), err=%d\n", r);
r = -1;
goto end2;
}
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 02: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 03: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 04: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 05: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 06: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
printf("\n");
printf("checking\n");
printf("\n");
printf("check point 07: ");
printf("fail\n");
r = -1;
goto end2;
}
printf("pass\n");
r = 0;
end2:
if (0 != r2) {
printf("fail at task_join_and_delete(), err=%d\n", r2);
r = -1;
}
end1:
if (0 != r2) {
printf("fail at signal_delete(), err=%d\n", r2);
r = -1;
}
end0:
r = -1;
}
else {
r = 0;
}
printf("</message>\n");
printf("<result>");
if (0 == r) {
printf("pass");
}
else {
printf("fail");
}
printf("</result>\n");
printf("</test>\n");
printf("\n");
return r;
}
#endif
#endif
void bsp_busywait(unsigned int count)
unsigned int bsp_getbusywaitcountperms(void)
int signal_wait_timed(signal_pt signal, unsigned int tick)
int signal_send(signal_pt signal, int sigtype)
int signal_delete(signal_pt *signal_p)
int signal_create(signal_pt *signal_p)
stdlib (Standard Library) API
int task_create_noautodel(task_pt *task_p, taskfunc_ft func, void *arg, int priority, unsigned int stackdepth, const char *name)
unsigned int task_getremainingtimeout(void)
int task_join_and_delete(task_pt *task_p, int *result_p, int count)
int task_sleep(unsigned int tick)
int task_getpriority(task_pt task)
#define NULL
Definition: type.h:42
unsigned int ubik_ticktotimems(unsigned int tick)
#define UBIK_ERR__TIMEOUT
Definition: ubik.h:32
unsigned int ubik_timemstotick(unsigned int timems)
volatile unsigned int _g_ubik_test_count1
태스크 별 시험 진행 상황을 저장하는 전역 변수 1
int ubik_test_tasktest08(void)
Test on get remaining timeout tick function of task.
task_pt _g_ubik_test_task_a[4]
시험 용 태스크 배열
volatile unsigned int _g_ubik_test_count2
태스크 별 시험 진행 상황을 저장하는 전역 변수 2
signal_pt _g_ubik_test_signal
시험 용 시그널
volatile unsigned int _g_ubik_test_result
시험 결과를 저장하는 전역 변수