Skip to content

Commit ae50e1a

Browse files
committed
Refer to ux internal marco instead of using direct tx
1 parent 1249abe commit ae50e1a

12 files changed

+405
-382
lines changed

common/core/inc/ux_utility.h

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -180,26 +180,31 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
180180
#if !defined(UX_STANDALONE)
181181
#define _ux_system_semaphore_create _ux_utility_semaphore_create
182182
#define _ux_system_semaphore_create_norc _ux_utility_semaphore_create
183-
#define _ux_system_semaphore_created(sem) ((sem)->tx_semaphore_id != UX_EMPTY)
184183
#define _ux_system_semaphore_get _ux_utility_semaphore_get
185184
#define _ux_system_semaphore_get_norc _ux_utility_semaphore_get
186-
#define _ux_system_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
187185
#define _ux_system_semaphore_delete _ux_utility_semaphore_delete
188186
#define _ux_system_semaphore_put _ux_utility_semaphore_put
189187
#define _ux_system_thread_create _ux_utility_thread_create
190188
#define _ux_system_thread_create_norc _ux_utility_thread_create
191-
#define _ux_system_thread_created(t) ((t)->tx_thread_id != UX_EMPTY)
192189
#define _ux_system_thread_delete _ux_utility_thread_delete
193190
#define _ux_system_mutex_create _ux_utility_mutex_create
194191
#define _ux_system_mutex_delete _ux_utility_mutex_delete
195192
#define _ux_system_mutex_off _ux_utility_mutex_off
196193
#define _ux_system_mutex_on _ux_utility_mutex_on
197194
#define _ux_system_event_flags_create _ux_utility_event_flags_create
198-
#define _ux_system_event_flags_created(e) ((e)->tx_event_flags_group_id != UX_EMPTY)
199195
#define _ux_system_event_flags_delete _ux_utility_event_flags_delete
200196
#define _ux_system_event_flags_get _ux_utility_event_flags_get
201197
#define _ux_system_event_flags_set _ux_utility_event_flags_set
202198
#define _ux_system_event_flags_set_rc _ux_utility_event_flags_set
199+
#ifdef TX_API_H
200+
#define _ux_system_thread_entry(t) ((t)->tx_thread_entry)
201+
#define _ux_system_thread_created(t) ((t)->tx_thread_id != UX_EMPTY)
202+
#define _ux_system_semaphore_created(sem) ((sem)->tx_semaphore_id != UX_EMPTY)
203+
#define _ux_system_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
204+
#define _ux_system_event_flags_created(e) ((e)->tx_event_flags_group_id != UX_EMPTY)
205+
#define _ux_system_mutex_created(m) ((m)->tx_mutex_id != UX_EMPTY)
206+
#define _ux_system_mutex_suspended_count(m) ((m)->tx_mutex_suspended_count)
207+
#endif /* TX_API_H */
203208
#else
204209
#define _ux_system_semaphore_create(sem,name,cnt) (UX_SUCCESS)
205210
#define _ux_system_semaphore_create_norc(sem,name,cnt) do{}while(0)
@@ -223,18 +228,16 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
223228
#define _ux_system_event_flags_get(g,req,gopt,actual,wopt) (*actual = 0)
224229
#define _ux_system_event_flags_set(g,flags,option) do{(void)flags;}while(0)
225230
#define _ux_system_event_flags_set_rc(g,flags,option) (UX_SUCCESS)
231+
#define _ux_system_mutex_created(m) (UX_FALSE)
226232
#endif
227233

228234
#if !defined(UX_DEVICE_STANDALONE)
229235
#define _ux_device_thread_create _ux_utility_thread_create
230236
#define _ux_device_thread_delete _ux_utility_thread_delete
231-
#define _ux_device_thread_entry(t) ((t)->tx_thread_entry)
232237
#define _ux_device_thread_suspend _ux_utility_thread_suspend
233238
#define _ux_device_thread_resume _ux_utility_thread_resume
234239
#define _ux_device_thread_relinquish _ux_utility_thread_relinquish
235240
#define _ux_device_semaphore_create _ux_utility_semaphore_create
236-
#define _ux_device_semaphore_created(sem) ((sem)->tx_semaphore_id != 0)
237-
#define _ux_device_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
238241
#define _ux_device_semaphore_delete _ux_utility_semaphore_delete
239242
#define _ux_device_semaphore_get _ux_utility_semaphore_get
240243
#define _ux_device_semaphore_put _ux_utility_semaphore_put
@@ -246,6 +249,15 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
246249
#define _ux_device_event_flags_delete _ux_utility_event_flags_delete
247250
#define _ux_device_event_flags_get _ux_utility_event_flags_get
248251
#define _ux_device_event_flags_set _ux_utility_event_flags_set
252+
#ifdef TX_API_H
253+
#define _ux_device_thread_entry(t) ((t)->tx_thread_entry)
254+
#define _ux_device_thread_created(t) ((t)->tx_thread_id != UX_EMPTY)
255+
#define _ux_device_semaphore_created(sem) ((sem)->tx_semaphore_id != UX_EMPTY)
256+
#define _ux_device_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
257+
#define _ux_device_event_flags_created(e) ((e)->tx_event_flags_group_id != UX_EMPTY)
258+
#define _ux_device_mutex_created(m) ((m)->tx_mutex_id != UX_EMPTY)
259+
#define _ux_device_mutex_suspended_count(m) ((m)->tx_mutex_suspended_count)
260+
#endif /* TX_API_H */
249261
#else
250262
#define _ux_device_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS)
251263
#define _ux_device_thread_delete(t) do{}while(0)
@@ -267,20 +279,18 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
267279
#define _ux_device_event_flags_delete(g) do{}while(0)
268280
#define _ux_device_event_flags_get(g,req,gopt,actual,wopt) do{}while(0)
269281
#define _ux_device_event_flags_set(g,flags,option) do{}while(0)
282+
#define _ux_device_event_flags_created(e) (UX_FALSE)
283+
#define _ux_device_mutex_created(m) (UX_FALSE)
270284
#endif
271285

272286

273287
#if !defined(UX_HOST_STANDALONE)
274288
#define _ux_host_thread_create _ux_utility_thread_create
275-
#define _ux_host_thread_created(thr) ((thr)->tx_thread_id != 0)
276289
#define _ux_host_thread_delete _ux_utility_thread_delete
277-
#define _ux_host_thread_entry(thr) ((thr)->tx_thread_entry)
278290
#define _ux_host_thread_resume _ux_utility_thread_resume
279291
#define _ux_host_thread_sleep _ux_utility_thread_sleep
280292
#define _ux_host_thread_schedule_other _ux_utility_thread_schedule_other
281293
#define _ux_host_semaphore_create _ux_utility_semaphore_create
282-
#define _ux_host_semaphore_created(sem) ((sem)->tx_semaphore_id != 0)
283-
#define _ux_host_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
284294
#define _ux_host_semaphore_delete _ux_utility_semaphore_delete
285295
#define _ux_host_semaphore_get _ux_utility_semaphore_get
286296
#define _ux_host_semaphore_get_norc _ux_utility_semaphore_get
@@ -296,6 +306,15 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
296306
#define _ux_host_event_flags_set _ux_utility_event_flags_set
297307
#define _ux_host_timer_create _ux_utility_timer_create
298308
#define _ux_host_timer_delete _ux_utility_timer_delete
309+
#ifdef TX_API_H
310+
#define _ux_host_thread_entry(t) ((t)->tx_thread_entry)
311+
#define _ux_host_thread_created(t) ((t)->tx_thread_id != UX_EMPTY)
312+
#define _ux_host_semaphore_created(sem) ((sem)->tx_semaphore_id != UX_EMPTY)
313+
#define _ux_host_semaphore_waiting(sem) ((sem)->tx_semaphore_count != 0)
314+
#define _ux_host_event_flags_created(e) ((e)->tx_event_flags_group_id != UX_EMPTY)
315+
#define _ux_host_mutex_created(m) ((m)->tx_mutex_id != UX_EMPTY)
316+
#define _ux_host_mutex_suspended_count(m) ((m)->tx_mutex_suspended_count)
317+
#endif /* TX_API_H */
299318
#else
300319
#define _ux_host_thread_create(t,name,entry,entry_param,stack,stack_size,priority,preempt_threshold,time_slice,auto_start) (UX_SUCCESS)
301320
#define _ux_host_thread_created(t) (UX_FALSE)
@@ -322,6 +341,8 @@ extern ALIGN_TYPE _ux_utility_time_elapsed(ALIGN_TYPE, ALIGN_TYPE);
322341
#define _ux_host_event_flags_set(g,flags,option) do{}while(0)
323342
#define _ux_host_timer_create(t,name,func,arg,tick0,tick1,flag) (UX_SUCCESS)
324343
#define _ux_host_timer_delete(t) do{}while(0)
344+
#define _ux_host_event_flags_created(e) (UX_FALSE)
345+
#define _ux_host_mutex_created(m) (UX_FALSE)
325346
#endif
326347

327348

0 commit comments

Comments
 (0)