TNeo  v1.08
tn_oldsymbols.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * TNeo: real-time kernel initially based on TNKernel
4  *
5  * TNKernel: copyright 2004, 2013 Yuri Tiomkin.
6  * PIC32-specific routines: copyright 2013, 2014 Anders Montonen.
7  * TNeo: copyright 2014 Dmitry Frank.
8  *
9  * TNeo was born as a thorough review and re-implementation of
10  * TNKernel. The new kernel has well-formed code, inherited bugs are fixed
11  * as well as new features being added, and it is tested carefully with
12  * unit-tests.
13  *
14  * API is changed somewhat, so it's not 100% compatible with TNKernel,
15  * hence the new name: TNeo.
16  *
17  * Permission to use, copy, modify, and distribute this software in source
18  * and binary forms and its documentation for any purpose and without fee
19  * is hereby granted, provided that the above copyright notice appear
20  * in all copies and that both that copyright notice and this permission
21  * notice appear in supporting documentation.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE DMITRY FRANK AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DMITRY FRANK OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33  * THE POSSIBILITY OF SUCH DAMAGE.
34  *
35  ******************************************************************************/
36 
37 /**
38  * \file
39  *
40  * Compatibility layer for old projects that use old TNKernel names;
41  * usage of them in new projects is discouraged.
42  *
43  * If you're porting your existing application written for TNKernel, it
44  * might be useful though.
45  *
46  * Included automatially if the option `#TN_OLD_TNKERNEL_NAMES` is set.
47  *
48  */
49 
50 #ifndef _TN_OLDSYMBOLS_H
51 #define _TN_OLDSYMBOLS_H
52 
53 /*******************************************************************************
54  * INCLUDED FILES
55  ******************************************************************************/
56 
57 #include "tn_common.h"
58 
59 
60 
61 #ifndef TN_OLD_TNKERNEL_NAMES
62 # error TN_OLD_TNKERNEL_NAMES is not defined
63 #endif
64 
65 #if TN_OLD_TNKERNEL_NAMES || DOXYGEN_ACTIVE
66 
67 
68 #ifdef __cplusplus
69 extern "C" { /*}*/
70 #endif
71 
72 /*******************************************************************************
73  * PUBLIC TYPES
74  ******************************************************************************/
75 
76 /// old TNKernel name of `TN_ListItem`
77 typedef struct TN_ListItem CDLL_QUEUE;
78 
79 /// old TNKernel name of `#TN_Mutex`
80 typedef struct TN_Mutex TN_MUTEX;
81 
82 /// old TNKernel name of `#TN_DQueue`
83 typedef struct TN_DQueue TN_DQUE;
84 
85 /// old TNKernel name of `#TN_Task`
86 typedef struct TN_Task TN_TCB;
87 
88 /// old TNKernel name of `#TN_FMem`
89 typedef struct TN_FMem TN_FMP;
90 
91 /// old TNKernel name of `#TN_Sem`
92 typedef struct TN_Sem TN_SEM;
93 
94 
95 #if TN_OLD_EVENT_API
96 /// old TNKernel name of `#TN_EventGrp`
97 /// available if only `#TN_OLD_EVENT_API` is non-zero
98 typedef struct TN_EventGrp TN_EVENT;
99 #endif
100 
101 
102 
103 
104 /*******************************************************************************
105  * PROTECTED GLOBAL DATA
106  ******************************************************************************/
107 
108 /*******************************************************************************
109  * DEFINITIONS
110  ******************************************************************************/
111 
112 /*
113  * compatibility with old struct names
114  */
115 /// old TNKernel struct name of `TN_ListItem`
116 #define _CDLL_QUEUE TN_ListItem
117 
118 /// old TNKernel struct name of `#TN_Mutex`
119 #define _TN_MUTEX TN_Mutex
120 
121 /// old TNKernel struct name of `#TN_DQueue`
122 #define _TN_DQUE TN_DQueue
123 
124 /// old TNKernel struct name of `#TN_Task`
125 #define _TN_TCB TN_Task
126 
127 /// old TNKernel struct name of `#TN_FMem`
128 #define _TN_FMP TN_FMem
129 
130 /// old TNKernel struct name of `#TN_Sem`
131 #define _TN_SEM TN_Sem
132 
133 #if TN_OLD_EVENT_API || defined(DOXYGEN_ACTIVE)
134 /// old TNKernel struct name of `#TN_EventGrp`,
135 /// available if only `#TN_OLD_EVENT_API` is non-zero
136 # define _TN_EVENT TN_EventGrp
137 #endif
138 
139 /// old TNKernel name of `#TN_MAKE_ALIG` macro
140 ///
141 /// \attention it is recommended to use `#TN_MAKE_ALIG_SIZE` macro instead
142 /// of this one, in order to avoid confusion caused by various
143 /// TNKernel ports: refer to the section \ref tnkernel_diff_make_alig for details.
144 #define MAKE_ALIG TN_MAKE_ALIG
145 
146 
147 /// old TNKernel name of `#TN_TASK_STATE_RUNNABLE`
148 #define TSK_STATE_RUNNABLE TN_TASK_STATE_RUNNABLE
149 
150 /// old TNKernel name of `#TN_TASK_STATE_WAIT`
151 #define TSK_STATE_WAIT TN_TASK_STATE_WAIT
152 
153 /// old TNKernel name of `#TN_TASK_STATE_SUSPEND`
154 #define TSK_STATE_SUSPEND TN_TASK_STATE_SUSPEND
155 
156 /// old TNKernel name of `#TN_TASK_STATE_WAITSUSP`
157 #define TSK_STATE_WAITSUSP TN_TASK_STATE_WAITSUSP
158 
159 /// old TNKernel name of `#TN_TASK_STATE_DORMANT`
160 #define TSK_STATE_DORMANT TN_TASK_STATE_DORMANT
161 
162 /// old TNKernel name of `#TN_TASK_CREATE_OPT_START`
163 #define TN_TASK_START_ON_CREATION TN_TASK_CREATE_OPT_START
164 
165 /// old TNKernel name of `#TN_TASK_EXIT_OPT_DELETE`
166 #define TN_EXIT_AND_DELETE_TASK TN_TASK_EXIT_OPT_DELETE
167 
168 
169 
170 /// old TNKernel name of `#TN_EVENTGRP_WMODE_AND`
171 #define TN_EVENT_WCOND_AND TN_EVENTGRP_WMODE_AND
172 
173 /// old TNKernel name of `#TN_EVENTGRP_WMODE_OR`
174 #define TN_EVENT_WCOND_OR TN_EVENTGRP_WMODE_OR
175 
176 
177 /// old TNKernel name of `#TN_WAIT_REASON_NONE`
178 #define TSK_WAIT_REASON_NONE TN_WAIT_REASON_NONE
179 
180 /// old TNKernel name of `#TN_WAIT_REASON_SLEEP`
181 #define TSK_WAIT_REASON_SLEEP TN_WAIT_REASON_SLEEP
182 
183 /// old TNKernel name of `#TN_WAIT_REASON_SEM`
184 #define TSK_WAIT_REASON_SEM TN_WAIT_REASON_SEM
185 
186 /// old TNKernel name of `#TN_WAIT_REASON_EVENT`
187 #define TSK_WAIT_REASON_EVENT TN_WAIT_REASON_EVENT
188 
189 /// old TNKernel name of `#TN_WAIT_REASON_DQUE_WSEND`
190 #define TSK_WAIT_REASON_DQUE_WSEND TN_WAIT_REASON_DQUE_WSEND
191 
192 /// old TNKernel name of `#TN_WAIT_REASON_DQUE_WRECEIVE`
193 #define TSK_WAIT_REASON_DQUE_WRECEIVE TN_WAIT_REASON_DQUE_WRECEIVE
194 
195 /// old TNKernel name of `#TN_WAIT_REASON_MUTEX_C`
196 #define TSK_WAIT_REASON_MUTEX_C TN_WAIT_REASON_MUTEX_C
197 
198 /// old TNKernel name of `#TN_WAIT_REASON_MUTEX_I`
199 #define TSK_WAIT_REASON_MUTEX_I TN_WAIT_REASON_MUTEX_I
200 
201 /// old TNKernel name of `#TN_WAIT_REASON_WFIXMEM`
202 #define TSK_WAIT_REASON_WFIXMEM TN_WAIT_REASON_WFIXMEM
203 
204 
205 
206 /// old TNKernel name of `#TN_RC_OK`
207 #define TERR_NO_ERR TN_RC_OK
208 
209 /// old TNKernel name of `#TN_RC_OVERFLOW`
210 #define TERR_OVERFLOW TN_RC_OVERFLOW
211 
212 /// old TNKernel name of `#TN_RC_WCONTEXT`
213 #define TERR_WCONTEXT TN_RC_WCONTEXT
214 
215 /// old TNKernel name of `#TN_RC_WSTATE`
216 #define TERR_WSTATE TN_RC_WSTATE
217 
218 /// old TNKernel name of `#TN_RC_TIMEOUT`
219 #define TERR_TIMEOUT TN_RC_TIMEOUT
220 
221 /// old TNKernel name of `#TN_RC_WPARAM`
222 #define TERR_WRONG_PARAM TN_RC_WPARAM
223 
224 /// old TNKernel name of `#TN_RC_ILLEGAL_USE`
225 #define TERR_ILUSE TN_RC_ILLEGAL_USE
226 
227 /// old TNKernel name of `#TN_RC_INVALID_OBJ`
228 #define TERR_NOEXS TN_RC_INVALID_OBJ
229 
230 /// old TNKernel name of `#TN_RC_DELETED`
231 #define TERR_DLT TN_RC_DELETED
232 
233 /// old TNKernel name of `#TN_RC_FORCED`
234 #define TERR_FORCED TN_RC_FORCED
235 
236 /// old TNKernel name of `#TN_RC_INTERNAL`
237 #define TERR_INTERNAL TN_RC_INTERNAL
238 
239 
240 
241 /// old TNKernel name of `#TN_MUTEX_PROT_CEILING`
242 #define TN_MUTEX_ATTR_CEILING TN_MUTEX_PROT_CEILING
243 
244 /// old TNKernel name of `#TN_MUTEX_PROT_INHERIT`
245 #define TN_MUTEX_ATTR_INHERIT TN_MUTEX_PROT_INHERIT
246 
247 
248 
249 
250 /// old TNKernel name of `#tn_sem_acquire_polling`
251 #define tn_sem_polling tn_sem_acquire_polling
252 
253 /// old TNKernel name of `#tn_sem_iacquire_polling`
254 #define tn_sem_ipolling tn_sem_iacquire_polling
255 
256 
257 /// old name of `#tn_sem_wait`
258 #define tn_sem_acquire tn_sem_wait
259 
260 /// old name of `#tn_sem_wait_polling`
261 #define tn_sem_acquire_polling tn_sem_wait_polling
262 
263 /// old name of `#tn_sem_iwait_polling`
264 #define tn_sem_iacquire_polling tn_sem_iwait_polling
265 
266 
267 
268 /// old TNKernel name of `#tn_fmem_iget_polling`
269 #define tn_fmem_get_ipolling tn_fmem_iget_polling
270 
271 
272 /// old TNKernel name of `#tn_queue_ireceive_polling`
273 #define tn_queue_ireceive tn_queue_ireceive_polling
274 
275 
276 /// old TNKernel name of `#tn_sys_start`
277 #define tn_start_system tn_sys_start
278 
279 /// old TNKernel name of `#tn_sys_tslice_set`
280 #define tn_sys_tslice_ticks tn_sys_tslice_set
281 
282 
283 
284 /// old TNKernel name of `#TN_ARCH_STK_ATTR_BEFORE`
285 #define align_attr_start TN_ARCH_STK_ATTR_BEFORE
286 
287 /// old TNKernel name of `#TN_ARCH_STK_ATTR_AFTER`
288 #define align_attr_end TN_ARCH_STK_ATTR_AFTER
289 
290 
291 /// old TNKernel name of `#tn_arch_int_dis`
292 #define tn_cpu_int_disable tn_arch_int_dis
293 
294 /// old TNKernel name of `#tn_arch_int_en`
295 #define tn_cpu_int_enable tn_arch_int_en
296 
297 
298 /// old TNKernel name of `#tn_arch_sr_save_int_dis`
299 #define tn_cpu_save_sr tn_arch_sr_save_int_dis
300 
301 /// old TNKernel name of `#tn_arch_sr_restore`
302 #define tn_cpu_restore_sr tn_arch_sr_restore
303 
304 
305 /// old TNKernel name of `#TN_INT_DIS_SAVE`
306 #define tn_disable_interrupt TN_INT_DIS_SAVE
307 
308 /// old TNKernel name of `#TN_INT_RESTORE`
309 #define tn_enable_interrupt TN_INT_RESTORE
310 
311 
312 /// old TNKernel name of `#TN_INT_IDIS_SAVE`
313 #define tn_idisable_interrupt TN_INT_IDIS_SAVE
314 
315 /// old TNKernel name of `#TN_INT_IRESTORE`
316 #define tn_ienable_interrupt TN_INT_IRESTORE
317 
318 
319 /// old TNKernel name of `#TN_IS_INT_DISABLED`
320 #define tn_chk_irq_disabled TN_IS_INT_DISABLED
321 
322 /// old TNKernel name of `#TN_PRIORITIES_CNT`
323 #define TN_NUM_PRIORITY TN_PRIORITIES_CNT
324 
325 /// old TNKernel name of `#TN_INT_WIDTH`
326 #define _TN_BITS_IN_INT TN_INT_WIDTH
327 
328 /// old TNKernel name for `sizeof(#TN_UWord)`
329 #define TN_ALIG sizeof(TN_UWord)
330 
331 /// old TNKernel name for `#TN_NO_TIME_SLICE`
332 #define NO_TIME_SLICE TN_NO_TIME_SLICE
333 
334 /// old TNKernel name for `#TN_MAX_TIME_SLICE`
335 #define MAX_TIME_SLICE TN_MAX_TIME_SLICE
336 
337 
338 
339 
340 /// old name for `#TN_STACK_ARR_DEF`
341 #define TN_TASK_STACK_DEF TN_STACK_ARR_DEF
342 
343 /// old name for `#TN_TickCnt`
344 #define TN_Timeout TN_TickCnt
345 
346 
347 
348 //-- event stuff {{{
349 
350 #if TN_OLD_EVENT_API || DOXYGEN_ACTIVE
351 
352 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
353 /// non-zero.
354 ///
355 /// Old name for `#TN_EVENTGRP_ATTR_SINGLE`,
356 #define TN_EVENT_ATTR_SINGLE TN_EVENTGRP_ATTR_SINGLE
357 
358 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
359 /// non-zero.
360 ///
361 /// Old name for `#TN_EVENTGRP_ATTR_MULTI`,
362 #define TN_EVENT_ATTR_MULTI TN_EVENTGRP_ATTR_MULTI
363 
364 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
365 /// non-zero.
366 ///
367 /// Old name for `#TN_EVENTGRP_ATTR_CLR`,
368 #define TN_EVENT_ATTR_CLR TN_EVENTGRP_ATTR_CLR
369 
370 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
371 /// non-zero.
372 ///
373 /// Old name for `#tn_eventgrp_create_wattr()`,
374 #define tn_event_create(ev, attr, pattern) \
375  tn_eventgrp_create_wattr((ev), (enum TN_EGrpAttr)(attr), (pattern))
376 
377 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
378 /// non-zero.
379 ///
380 /// Old name for `#tn_eventgrp_delete()`,
381 #define tn_event_delete tn_eventgrp_delete
382 
383 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
384 /// non-zero.
385 ///
386 /// Old name for `#tn_eventgrp_wait()`,
387 #define tn_event_wait tn_eventgrp_wait
388 
389 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
390 /// non-zero.
391 ///
392 /// Old name for `#tn_eventgrp_wait_polling()`,
393 #define tn_event_wait_polling tn_eventgrp_wait_polling
394 
395 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
396 /// non-zero.
397 ///
398 /// Old name for `#tn_eventgrp_iwait_polling()`,
399 #define tn_event_iwait tn_eventgrp_iwait_polling
400 
401 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
402 /// non-zero.
403 ///
404 /// Old TNKernel-compatible way of calling `#tn_eventgrp_modify (event,
405 /// #TN_EVENTGRP_OP_SET, pattern)`
406 #define tn_event_set(ev, pattern) tn_eventgrp_modify ((ev), TN_EVENTGRP_OP_SET, (pattern))
407 
408 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
409 /// non-zero.
410 ///
411 /// Old TNKernel-compatible way of calling `#tn_eventgrp_imodify (event,
412 /// #TN_EVENTGRP_OP_SET, pattern)`
413 #define tn_event_iset(ev, pattern) tn_eventgrp_imodify((ev), TN_EVENTGRP_OP_SET, (pattern))
414 
415 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
416 /// non-zero.
417 ///
418 /// Old TNKernel-compatible way of calling `#tn_eventgrp_modify (event,
419 /// #TN_EVENTGRP_OP_CLEAR, (~pattern))`
420 ///
421 /// \attention Unlike `#tn_eventgrp_modify()`, the pattern should be inverted!
422 #define tn_event_clear(ev, pattern) tn_eventgrp_modify ((ev), TN_EVENTGRP_OP_CLEAR, (~(pattern)))
423 
424 /// \attention Deprecated. Available if only `#TN_OLD_EVENT_API` option is
425 /// non-zero.
426 ///
427 /// Old TNKernel-compatible way of calling `#tn_eventgrp_imodify (event,
428 /// #TN_EVENTGRP_OP_CLEAR, (~pattern))`
429 ///
430 /// \attention Unlike `#tn_eventgrp_modify()`, the pattern should be inverted!
431 #define tn_event_iclear(ev, pattern) tn_eventgrp_imodify((ev), TN_EVENTGRP_OP_CLEAR, (~(pattern)))
432 
433 #else
434 //-- no compatibility with event API
435 #endif
436 
437 //}}}
438 
439 
440 //-- Internal implementation details {{{
441 
442 //-- Exclude it from doxygen-generated docs
443 #if !DOXYGEN_SHOULD_SKIP_THIS
444 
445 #define tn_ready_list _tn_tasks_ready_list
446 #define tn_create_queue _tn_tasks_created_list
447 #define tn_created_tasks_cnt _tn_tasks_created_cnt
448 
449 #define tn_tslice_ticks _tn_tslice_ticks
450 
451 #define tn_sys_state _tn_sys_state
452 
453 #define tn_next_task_to_run _tn_next_task_to_run
454 #define tn_curr_run_task _tn_curr_run_task
455 
456 #define tn_ready_to_run_bmp _tn_ready_to_run_bmp
457 
458 #define tn_idle_task _tn_idle_task
459 
460 #endif
461 
462 //}}}
463 
464 /*******************************************************************************
465  * PUBLIC FUNCTION PROTOTYPES
466  ******************************************************************************/
467 
468 
469 #ifdef __cplusplus
470 } /* extern "C" */
471 #endif
472 
473 #endif // TN_OLD_TNKERNEL_NAMES
474 
475 #endif // _TN_OLDSYMBOLS_H
476 
477 
478 /*******************************************************************************
479  * end of file
480  ******************************************************************************/
481 
482 
Semaphore.
Definition: tn_sem.h:88
Mutex.
Definition: tn_mutex.h:122
Structure representing data queue object.
Definition: tn_dqueue.h:105
Task.
Definition: tn_tasks.h:330
Definitions used through the whole kernel.
Fixed memory blocks pool.
Definition: tn_fmem.h:80
Event group.
Definition: tn_eventgrp.h:212
Circular doubly linked list item, for internal kernel usage.
Definition: tn_list.h:63