17 #define timercmp(a, b, CMP) \
18 (((a)->tv_sec == (b)->tv_sec) ? \
19 ((a)->tv_usec CMP (b)->tv_usec) : \
20 ((a)->tv_sec CMP (b)->tv_sec))
21 #define timeradd(a, b, result) \
23 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
24 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
25 if ((result)->tv_usec >= 1000000) \
28 (result)->tv_usec -= 1000000; \
31 #define timersub(a, b, result) \
33 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
34 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
35 if ((result)->tv_usec < 0) { \
37 (result)->tv_usec += 1000000; \
41 #define USECS_PER_SEC 1000000
44 #define ECAT_TASK_PRIO_HIGH 20
45 #define ECAT_TASK_PRIO_LOW 80
46 #define ECAT_STACK_SIZE 10000
50 #ifndef use_task_delay
51 #define use_task_delay 1
56 #if (use_task_delay == 1)
58 taskDelay(usec / 1000);
68 return nanosleep(&ts, NULL);
80 return_value = clock_gettime(CLOCK_MONOTONIC, &ts);
81 tv->tv_sec = ts.tv_sec;
82 tv->tv_usec = ts.tv_nsec / 1000;
88 struct timeval current_time;
92 return_value.sec = current_time.tv_sec;
93 return_value.usec = current_time.tv_usec;
111 struct timeval start_time;
112 struct timeval timeout;
113 struct timeval stop_time;
118 timeradd(&start_time, &timeout, &stop_time);
120 self->stop_time.sec = stop_time.tv_sec;
121 self->stop_time.usec = stop_time.tv_usec;
126 struct timeval current_time;
127 struct timeval stop_time;
128 int is_not_yet_expired;
131 stop_time.tv_sec =
self->stop_time.sec;
132 stop_time.tv_usec =
self->stop_time.usec;
133 is_not_yet_expired =
timercmp(¤t_time, &stop_time, <);
135 return is_not_yet_expired ==
FALSE;
151 TASK_ID * tid = (TASK_ID *)thandle;
152 FUNCPTR func_ptr = func;
153 _Vx_usr_arg_t arg1 = (_Vx_usr_arg_t)param;
159 func_ptr, arg1, 0, 0, 0, 0, 0, 0, 0, 0, 0);
160 if(*tid == TASK_ID_ERROR)
171 TASK_ID * tid = (TASK_ID *)thandle;
172 FUNCPTR func_ptr = func;
173 _Vx_usr_arg_t arg1 = (_Vx_usr_arg_t)param;
179 func_ptr, arg1, 0, 0, 0, 0, 0, 0, 0, 0, 0);
181 if(*tid == TASK_ID_ERROR)