equal
deleted
inserted
replaced
34 |
34 |
35 static TIMEVAL last_time_read, |
35 static TIMEVAL last_time_read, |
36 last_occured_alarm, |
36 last_occured_alarm, |
37 last_alarm_set; |
37 last_alarm_set; |
38 |
38 |
|
39 void TimerInit(void) |
|
40 { |
|
41 /* only used in realtime apps */ |
|
42 } |
|
43 |
|
44 void TimerCleanup(void) |
|
45 { |
|
46 /* only used in realtime apps */ |
|
47 } |
39 |
48 |
40 void EnterMutex(void) |
49 void EnterMutex(void) |
41 { |
50 { |
42 spin_lock (&lock); |
51 spin_lock (&lock); |
43 } |
52 } |
69 // At first, TimeDispatch will call init_callback. |
78 // At first, TimeDispatch will call init_callback. |
70 SetAlarm(NULL, 0, init_callback, 0, 0); |
79 SetAlarm(NULL, 0, init_callback, 0, 0); |
71 LeaveMutex(); |
80 LeaveMutex(); |
72 } |
81 } |
73 |
82 |
74 void StopTimerLoop(void) |
83 void StopTimerLoop(TimerCallback_t exitfunction) |
75 { |
84 { |
76 EnterMutex(); |
85 EnterMutex(); |
77 del_timer (&timer); |
86 del_timer (&timer); |
|
87 exitfunction(NULL,0); |
78 LeaveMutex(); |
88 LeaveMutex(); |
79 } |
89 } |
80 |
90 |
81 void setTimer(TIMEVAL value) |
91 void setTimer(TIMEVAL value) |
82 { |
92 { |
97 void CreateReceiveTask(CAN_PORT port, TASK_HANDLE *Thread, void* ReceiveLoopPtr) |
107 void CreateReceiveTask(CAN_PORT port, TASK_HANDLE *Thread, void* ReceiveLoopPtr) |
98 { |
108 { |
99 *Thread = kthread_run(ReceiveLoopPtr, port, "canReceiveLoop"); |
109 *Thread = kthread_run(ReceiveLoopPtr, port, "canReceiveLoop"); |
100 } |
110 } |
101 |
111 |
102 void WaitReceiveTaskEnd(TASK_HANDLE Thread) |
112 void WaitReceiveTaskEnd(TASK_HANDLE *Thread) |
103 { |
113 { |
104 force_sig (SIGTERM, Thread); |
114 force_sig (SIGTERM, *Thread); |
105 } |
115 } |