62 exitall = exitfunction; |
62 exitall = exitfunction; |
63 stop_timer = 1; |
63 stop_timer = 1; |
64 rt_cond_signal(&timer_set); |
64 rt_cond_signal(&timer_set); |
65 } |
65 } |
66 |
66 |
67 void cleanup_all(void) |
|
68 { |
|
69 if (rt_task_join(&timerloop_task) != 0){ |
|
70 printf("Failed to join with Timerloop task\n"); |
|
71 } |
|
72 rt_task_delete(&timerloop_task); |
|
73 } |
|
74 |
67 |
75 /** |
68 /** |
76 * Clean all Semaphores, mutex, condition variable and main task |
69 * Clean all Semaphores, mutex, condition variable and main task |
77 */ |
70 */ |
78 void TimerCleanup(void) |
71 void TimerCleanup(void) |
79 { |
72 { |
80 rt_sem_delete(&CanFestival_mutex); |
73 rt_sem_delete(&CanFestival_mutex); |
81 rt_mutex_delete(&condition_mutex); |
74 rt_mutex_delete(&condition_mutex); |
82 rt_cond_delete(&timer_set); |
75 rt_cond_delete(&timer_set); |
83 rt_sem_delete(&control_task); |
76 rt_sem_delete(&control_task); |
|
77 rt_task_unblock(&timerloop_task); |
84 if (rt_task_join(&timerloop_task) != 0){ |
78 if (rt_task_join(&timerloop_task) != 0){ |
85 printf("Failed to join with Timerloop task\n"); |
79 printf("Failed to join with Timerloop task\n"); |
86 } |
80 } |
87 rt_task_delete(&timerloop_task); |
81 rt_task_delete(&timerloop_task); |
88 } |
82 } |
223 * Wait for the CAN Receiver Task end |
217 * Wait for the CAN Receiver Task end |
224 * @param *ReceiveLoop_task CAN receiver thread |
218 * @param *ReceiveLoop_task CAN receiver thread |
225 */ |
219 */ |
226 void WaitReceiveTaskEnd(TASK_HANDLE *ReceiveLoop_task) |
220 void WaitReceiveTaskEnd(TASK_HANDLE *ReceiveLoop_task) |
227 { |
221 { |
|
222 rt_task_unblock(ReceiveLoop_task); |
228 if (rt_task_join(ReceiveLoop_task) != 0){ |
223 if (rt_task_join(ReceiveLoop_task) != 0){ |
229 printf("Failed to join with Receive task\n"); |
224 printf("Failed to join with Receive task\n"); |
230 } |
225 } |
231 rt_task_delete(ReceiveLoop_task); |
226 rt_task_delete(ReceiveLoop_task); |
232 } |
227 } |