ChibiOS/HAL  7.1.5
osal.h
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 /**
18  * @file osal.h
19  * @brief OSAL module header.
20  *
21  * @addtogroup OSAL
22  * @{
23  */
24 
25 #ifndef OSAL_H
26 #define OSAL_H
27 
28 #include <stddef.h>
29 #include <stdint.h>
30 #include <stdbool.h>
31 
32 /*===========================================================================*/
33 /* Module constants. */
34 /*===========================================================================*/
35 
36 /**
37  * @name Common constants
38  * @{
39  */
40 #if !defined(FALSE) || defined(__DOXYGEN__)
41 #define FALSE 0
42 #endif
43 
44 #if !defined(TRUE) || defined(__DOXYGEN__)
45 #define TRUE 1
46 #endif
47 
48 #define OSAL_SUCCESS false
49 #define OSAL_FAILED true
50 /** @} */
51 
52 /**
53  * @name Messages
54  * @{
55  */
56 #define MSG_OK (msg_t)0
57 #define MSG_TIMEOUT (msg_t)-1
58 #define MSG_RESET (msg_t)-2
59 /** @} */
60 
61 /**
62  * @name Special time constants
63  * @{
64  */
65 #define TIME_IMMEDIATE ((sysinterval_t)0)
66 #define TIME_INFINITE ((sysinterval_t)-1)
67 /** @} */
68 
69 /**
70  * @name Systick modes.
71  * @{
72  */
73 #define OSAL_ST_MODE_NONE 0
74 #define OSAL_ST_MODE_PERIODIC 1
75 #define OSAL_ST_MODE_FREERUNNING 2
76 /** @} */
77 
78 /**
79  * @name Systick parameters.
80  * @{
81  */
82 /**
83  * @brief Size in bits of the @p systick_t type.
84  */
85 #define OSAL_ST_RESOLUTION 32
86 
87 /**
88  * @brief Required systick frequency or resolution.
89  */
90 #define OSAL_ST_FREQUENCY 1000
91 
92 /**
93  * @brief Systick mode required by the underlying OS.
94  */
95 #define OSAL_ST_MODE OSAL_ST_MODE_PERIODIC
96 /** @} */
97 
98 /**
99  * @name IRQ-related constants
100  * @{
101  */
102 /**
103  * @brief Total priority levels.
104  * @brief Implementation not mandatory.
105  */
106 #define OSAL_IRQ_PRIORITY_LEVELS 16U
107 
108 /**
109  * @brief Highest IRQ priority for HAL drivers.
110  * @brief Implementation not mandatory.
111  */
112 #define OSAL_IRQ_MAXIMUM_PRIORITY 0U
113 /** @} */
114 
115 /*===========================================================================*/
116 /* Module pre-compile time settings. */
117 /*===========================================================================*/
118 
119 /**
120  * @brief Enables OSAL assertions.
121  */
122 #if !defined(OSAL_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
123 #define OSAL_DBG_ENABLE_ASSERTS FALSE
124 #endif
125 
126 /**
127  * @brief Enables OSAL functions parameters checks.
128  */
129 #if !defined(OSAL_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
130 #define OSAL_DBG_ENABLE_CHECKS FALSE
131 #endif
132 
133 /*===========================================================================*/
134 /* Derived constants and error checks. */
135 /*===========================================================================*/
136 
137 #if !(OSAL_ST_MODE == OSAL_ST_MODE_NONE) && \
138  !(OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC) && \
139  !(OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING)
140 #error "invalid OSAL_ST_MODE setting in osal.h"
141 #endif
142 
143 #if (OSAL_ST_RESOLUTION != 16) && (OSAL_ST_RESOLUTION != 32)
144 #error "invalid OSAL_ST_RESOLUTION, must be 16 or 32"
145 #endif
146 
147 /*===========================================================================*/
148 /* Module data structures and types. */
149 /*===========================================================================*/
150 
151 /**
152  * @brief Type of a system status word.
153  */
154 typedef uint32_t syssts_t;
155 
156 /**
157  * @brief Type of a message.
158  */
159 typedef int32_t msg_t;
160 
161 /**
162  * @brief Type of system time counter.
163  */
164 typedef uint32_t systime_t;
165 
166 /**
167  * @brief Type of system time interval.
168  */
169 typedef uint32_t sysinterval_t;
170 
171 /**
172  * @brief Type of realtime counter.
173  */
174 typedef uint32_t rtcnt_t;
175 
176 /**
177  * @brief Type of a thread reference.
178  */
179 typedef void * thread_reference_t;
180 
181 /**
182  * @brief Type of an event flags mask.
183  */
184 typedef uint32_t eventflags_t;
185 
186 /**
187  * @brief Type of an event flags object.
188  * @note The content of this structure is not part of the API and should
189  * not be relied upon. Implementers may define this structure in
190  * an entirely different way.
191  * @note Retrieval and clearing of the flags are not defined in this
192  * API and are implementation-dependent.
193  */
195 
196 /**
197  * @brief Type of an event source callback.
198  * @note This type is not part of the OSAL API and is provided
199  * exclusively as an example and for convenience.
200  */
201 typedef void (*eventcallback_t)(event_source_t *esp);
202 
203 /**
204  * @brief Events source object.
205  * @note The content of this structure is not part of the API and should
206  * not be relied upon. Implementers may define this structure in
207  * an entirely different way.
208  * @note Retrieval and clearing of the flags are not defined in this
209  * API and are implementation-dependent.
210  */
211 struct event_source {
212  volatile eventflags_t flags; /**< @brief Stored event flags. */
213  eventcallback_t cb; /**< @brief Event source callback. */
214  void *param; /**< @brief User defined field. */
215 };
216 
217 /**
218  * @brief Type of a mutex.
219  * @note If the OS does not support mutexes or there is no OS then them
220  * mechanism can be simulated.
221  */
222 typedef uint32_t mutex_t;
223 
224 /**
225  * @brief Type of a thread queue.
226  * @details A thread queue is a queue of sleeping threads, queued threads
227  * can be dequeued one at time or all together.
228  * @note If the OSAL is implemented on a bare metal machine without RTOS
229  * then the queue can be implemented as a single thread reference.
230  */
231 typedef struct {
234 
235 /*===========================================================================*/
236 /* Module macros. */
237 /*===========================================================================*/
238 
239 /**
240  * @name Debug related macros
241  * @{
242  */
243 /**
244  * @brief Condition assertion.
245  * @details If the condition check fails then the OSAL panics with a
246  * message and halts.
247  * @note The condition is tested only if the @p OSAL_ENABLE_ASSERTIONS
248  * switch is enabled.
249  * @note The remark string is not currently used except for putting a
250  * comment in the code about the assertion.
251  *
252  * @param[in] c the condition to be verified to be true
253  * @param[in] remark a remark string
254  *
255  * @api
256  */
257 #define osalDbgAssert(c, remark) do { \
258  /*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
259  if (OSAL_DBG_ENABLE_ASSERTS != FALSE) { \
260  if (!(c)) { \
261  /*lint -restore*/ \
262  osalSysHalt(__func__); \
263  } \
264  } \
265 } while (false)
266 
267 /**
268  * @brief Function parameters check.
269  * @details If the condition check fails then the OSAL panics and halts.
270  * @note The condition is tested only if the @p OSAL_ENABLE_CHECKS switch
271  * is enabled.
272  *
273  * @param[in] c the condition to be verified to be true
274  *
275  * @api
276  */
277 #define osalDbgCheck(c) do { \
278  /*lint -save -e506 -e774 [2.1, 14.3] Can be a constant by design.*/ \
279  if (OSAL_DBG_ENABLE_CHECKS != FALSE) { \
280  if (!(c)) { \
281  /*lint -restore*/ \
282  osalSysHalt(__func__); \
283  } \
284  } \
285 } while (false)
286 
287 /**
288  * @brief I-Class state check.
289  * @note Implementation is optional.
290  */
291 #define osalDbgCheckClassI()
292 
293 /**
294  * @brief S-Class state check.
295  * @note Implementation is optional.
296  */
297 #define osalDbgCheckClassS()
298 /** @} */
299 
300 /**
301  * @name IRQ service routines wrappers
302  * @{
303  */
304 /**
305  * @brief Priority level verification macro.
306  */
307 #define OSAL_IRQ_IS_VALID_PRIORITY(n) \
308  (((n) >= OSAL_IRQ_MAXIMUM_PRIORITY) && ((n) < OSAL_IRQ_PRIORITY_LEVELS))
309 
310 /**
311  * @brief IRQ prologue code.
312  * @details This macro must be inserted at the start of all IRQ handlers.
313  */
314 #define OSAL_IRQ_PROLOGUE()
315 
316 /**
317  * @brief IRQ epilogue code.
318  * @details This macro must be inserted at the end of all IRQ handlers.
319  */
320 #define OSAL_IRQ_EPILOGUE()
321 
322 /**
323  * @brief IRQ handler function declaration.
324  * @details This macro hides the details of an ISR function declaration.
325  *
326  * @param[in] id a vector name as defined in @p vectors.s
327  */
328 #define OSAL_IRQ_HANDLER(id) void id(void)
329 /** @} */
330 
331 /**
332  * @name Time conversion utilities
333  * @{
334  */
335 /**
336  * @brief Seconds to system ticks.
337  * @details Converts from seconds to system ticks number.
338  * @note The result is rounded upward to the next tick boundary.
339  *
340  * @param[in] secs number of seconds
341  * @return The number of ticks.
342  *
343  * @api
344  */
345 #define OSAL_S2I(secs) \
346  ((sysinterval_t)((uint32_t)(secs) * (uint32_t)OSAL_ST_FREQUENCY))
347 
348 /**
349  * @brief Milliseconds to system ticks.
350  * @details Converts from milliseconds to system ticks number.
351  * @note The result is rounded upward to the next tick boundary.
352  *
353  * @param[in] msecs number of milliseconds
354  * @return The number of ticks.
355  *
356  * @api
357  */
358 #define OSAL_MS2I(msecs) \
359  ((sysinterval_t)((((((uint32_t)(msecs)) * \
360  ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000UL) + 1UL))
361 
362 /**
363  * @brief Microseconds to system ticks.
364  * @details Converts from microseconds to system ticks number.
365  * @note The result is rounded upward to the next tick boundary.
366  *
367  * @param[in] usecs number of microseconds
368  * @return The number of ticks.
369  *
370  * @api
371  */
372 #define OSAL_US2I(usecs) \
373  ((sysinterval_t)((((((uint32_t)(usecs)) * \
374  ((uint32_t)OSAL_ST_FREQUENCY)) - 1UL) / 1000000UL) + 1UL))
375 /** @} */
376 
377 /**
378  * @name Time conversion utilities for the realtime counter
379  * @{
380  */
381 /**
382  * @brief Seconds to realtime counter.
383  * @details Converts from seconds to realtime counter cycles.
384  * @note The macro assumes that @p freq >= @p 1.
385  *
386  * @param[in] freq clock frequency, in Hz, of the realtime counter
387  * @param[in] sec number of seconds
388  * @return The number of cycles.
389  *
390  * @api
391  */
392 #define OSAL_S2RTC(freq, sec) ((freq) * (sec))
393 
394 /**
395  * @brief Milliseconds to realtime counter.
396  * @details Converts from milliseconds to realtime counter cycles.
397  * @note The result is rounded upward to the next millisecond boundary.
398  * @note The macro assumes that @p freq >= @p 1000.
399  *
400  * @param[in] freq clock frequency, in Hz, of the realtime counter
401  * @param[in] msec number of milliseconds
402  * @return The number of cycles.
403  *
404  * @api
405  */
406 #define OSAL_MS2RTC(freq, msec) (rtcnt_t)((((freq) + 999UL) / 1000UL) * (msec))
407 
408 /**
409  * @brief Microseconds to realtime counter.
410  * @details Converts from microseconds to realtime counter cycles.
411  * @note The result is rounded upward to the next microsecond boundary.
412  * @note The macro assumes that @p freq >= @p 1000000.
413  *
414  * @param[in] freq clock frequency, in Hz, of the realtime counter
415  * @param[in] usec number of microseconds
416  * @return The number of cycles.
417  *
418  * @api
419  */
420 #define OSAL_US2RTC(freq, usec) (rtcnt_t)((((freq) + 999999UL) / 1000000UL) * (usec))
421 /** @} */
422 
423 /**
424  * @name Sleep macros using absolute time
425  * @{
426  */
427 /**
428  * @brief Delays the invoking thread for the specified number of seconds.
429  * @note The specified time is rounded up to a value allowed by the real
430  * system tick clock.
431  * @note The maximum specifiable value is implementation dependent.
432  *
433  * @param[in] secs time in seconds, must be different from zero
434  *
435  * @api
436  */
437 #define osalThreadSleepSeconds(secs) osalThreadSleep(OSAL_S2I(secs))
438 
439 /**
440  * @brief Delays the invoking thread for the specified number of
441  * milliseconds.
442  * @note The specified time is rounded up to a value allowed by the real
443  * system tick clock.
444  * @note The maximum specifiable value is implementation dependent.
445  *
446  * @param[in] msecs time in milliseconds, must be different from zero
447  *
448  * @api
449  */
450 #define osalThreadSleepMilliseconds(msecs) osalThreadSleep(OSAL_MS2I(msecs))
451 
452 /**
453  * @brief Delays the invoking thread for the specified number of
454  * microseconds.
455  * @note The specified time is rounded up to a value allowed by the real
456  * system tick clock.
457  * @note The maximum specifiable value is implementation dependent.
458  *
459  * @param[in] usecs time in microseconds, must be different from zero
460  *
461  * @api
462  */
463 #define osalThreadSleepMicroseconds(usecs) osalThreadSleep(OSAL_US2I(usecs))
464 /** @} */
465 
466 /*===========================================================================*/
467 /* External declarations. */
468 /*===========================================================================*/
469 
470 extern const char *osal_halt_msg;
471 
472 #ifdef __cplusplus
473 extern "C" {
474 #endif
475  void osalInit(void);
476  void osalSysHalt(const char *reason);
477  void osalSysPolledDelayX(rtcnt_t cycles);
478  void osalOsTimerHandlerI(void);
479  void osalOsRescheduleS(void);
481  void osalThreadSleepS(sysinterval_t time);
482  void osalThreadSleep(sysinterval_t time);
493  eventcallback_t cb,
494  void *param);
495  void osalMutexLock(mutex_t *mp);
496  void osalMutexUnlock(mutex_t *mp);
497 #ifdef __cplusplus
498 }
499 #endif
500 
501 /*===========================================================================*/
502 /* Module inline functions. */
503 /*===========================================================================*/
504 
505 /**
506  * @brief Disables interrupts globally.
507  *
508  * @special
509  */
510 static inline void osalSysDisable(void) {
511 
512 }
513 
514 /**
515  * @brief Enables interrupts globally.
516  *
517  * @special
518  */
519 static inline void osalSysEnable(void) {
520 
521 }
522 
523 /**
524  * @brief Enters a critical zone from thread context.
525  * @note This function cannot be used for reentrant critical zones.
526  *
527  * @special
528  */
529 static inline void osalSysLock(void) {
530 
531 }
532 
533 /**
534  * @brief Leaves a critical zone from thread context.
535  * @note This function cannot be used for reentrant critical zones.
536  *
537  * @special
538  */
539 static inline void osalSysUnlock(void) {
540 
541 }
542 
543 /**
544  * @brief Enters a critical zone from ISR context.
545  * @note This function cannot be used for reentrant critical zones.
546  *
547  * @special
548  */
549 static inline void osalSysLockFromISR(void) {
550 
551 }
552 
553 /**
554  * @brief Leaves a critical zone from ISR context.
555  * @note This function cannot be used for reentrant critical zones.
556  *
557  * @special
558  */
559 static inline void osalSysUnlockFromISR(void) {
560 
561 }
562 
563 /**
564  * @brief Returns the execution status and enters a critical zone.
565  * @details This functions enters into a critical zone and can be called
566  * from any context. Because its flexibility it is less efficient
567  * than @p chSysLock() which is preferable when the calling context
568  * is known.
569  * @post The system is in a critical zone.
570  *
571  * @return The previous system status, the encoding of this
572  * status word is architecture-dependent and opaque.
573  *
574  * @xclass
575  */
576 static inline syssts_t osalSysGetStatusAndLockX(void) {
577 
578  return (syssts_t)0;
579 }
580 
581 /**
582  * @brief Restores the specified execution status and leaves a critical zone.
583  * @note A call to @p chSchRescheduleS() is automatically performed
584  * if exiting the critical zone and if not in ISR context.
585  *
586  * @param[in] sts the system status to be restored.
587  *
588  * @xclass
589  */
590 static inline void osalSysRestoreStatusX(syssts_t sts) {
591 
592  (void)sts;
593 }
594 
595 /**
596  * @brief Adds an interval to a system time returning a system time.
597  *
598  * @param[in] systime base system time
599  * @param[in] interval interval to be added
600  * @return The new system time.
601  *
602  * @xclass
603  */
604 static inline systime_t osalTimeAddX(systime_t systime,
605  sysinterval_t interval) {
606 
607  return systime + (systime_t)interval;
608 }
609 
610 /**
611  * @brief Subtracts two system times returning an interval.
612  *
613  * @param[in] start first system time
614  * @param[in] end second system time
615  * @return The interval representing the time difference.
616  *
617  * @xclass
618  */
619 static inline sysinterval_t osalTimeDiffX(systime_t start, systime_t end) {
620 
621  return (sysinterval_t)((systime_t)(end - start));
622 }
623 
624 /**
625  * @brief Checks if the specified time is within the specified time window.
626  * @note When start==end then the function returns always false because the
627  * time window has zero size.
628  * @note This function can be called from any context.
629  *
630  * @param[in] time the time to be verified
631  * @param[in] start the start of the time window (inclusive)
632  * @param[in] end the end of the time window (non inclusive)
633  * @retval true current time within the specified time window.
634  * @retval false current time not within the specified time window.
635  *
636  * @xclass
637  */
638 static inline bool osalTimeIsInRangeX(systime_t time,
639  systime_t start,
640  systime_t end) {
641 
642  return (bool)((systime_t)((systime_t)time - (systime_t)start) <
643  (systime_t)((systime_t)end - (systime_t)start));
644 }
645 
646 /**
647  * @brief Initializes a threads queue object.
648  *
649  * @param[out] tqp pointer to the threads queue object
650  *
651  * @init
652  */
653 static inline void osalThreadQueueObjectInit(threads_queue_t *tqp) {
654 
655  osalDbgCheck(tqp != NULL);
656 }
657 
658 /**
659  * @brief Initializes an event source object.
660  *
661  * @param[out] esp pointer to the event source object
662  *
663  * @init
664  */
665 static inline void osalEventObjectInit(event_source_t *esp) {
666 
667  osalDbgCheck(esp != NULL);
668 
669  esp->flags = (eventflags_t)0;
670  esp->cb = NULL;
671  esp->param = NULL;
672 }
673 
674 /**
675  * @brief Initializes s @p mutex_t object.
676  *
677  * @param[out] mp pointer to the @p mutex_t object
678  *
679  * @init
680  */
681 static inline void osalMutexObjectInit(mutex_t *mp) {
682 
683  osalDbgCheck(mp != NULL);
684 
685  *mp = 0;
686 }
687 
688 #endif /* OSAL_H */
689 
690 /** @} */
eventflags_t
uint32_t eventflags_t
Type of an event flags mask.
Definition: osal.h:184
osalThreadSleep
void osalThreadSleep(sysinterval_t time)
Suspends the invoking thread for the specified time.
Definition: osal.c:170
osalSysHalt
void osalSysHalt(const char *reason)
System halt with error message.
Definition: osal.c:77
osalThreadSuspendS
msg_t osalThreadSuspendS(thread_reference_t *trp)
Sends the current thread sleeping and sets a reference variable.
Definition: osal.c:185
osalThreadDequeueAllI
void osalThreadDequeueAllI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up all threads from the queue.
Definition: osal.c:309
event_source
Events source object.
Definition: osal.h:211
osalTimeDiffX
static sysinterval_t osalTimeDiffX(systime_t start, systime_t end)
Subtracts two system times returning an interval.
Definition: osal.h:619
osalSysDisable
static void osalSysDisable(void)
Disables interrupts globally.
Definition: osal.h:510
osalSysLockFromISR
static void osalSysLockFromISR(void)
Enters a critical zone from ISR context.
Definition: osal.h:549
osalSysUnlock
static void osalSysUnlock(void)
Leaves a critical zone from thread context.
Definition: osal.h:539
osalOsTimerHandlerI
void osalOsTimerHandlerI(void)
System timer handler.
Definition: osal.c:105
osalEventObjectInit
static void osalEventObjectInit(event_source_t *esp)
Initializes an event source object.
Definition: osal.h:665
systime_t
uint32_t systime_t
Type of system time counter.
Definition: osal.h:164
osalSysGetStatusAndLockX
static syssts_t osalSysGetStatusAndLockX(void)
Returns the execution status and enters a critical zone.
Definition: osal.h:576
osalMutexLock
void osalMutexLock(mutex_t *mp)
Locks the specified mutex.
Definition: osal.c:384
osalOsRescheduleS
void osalOsRescheduleS(void)
Checks if a reschedule is required and performs it.
Definition: osal.c:119
msg_t
int32_t msg_t
Type of a message.
Definition: osal.h:159
osalSysPolledDelayX
void osalSysPolledDelayX(rtcnt_t cycles)
Polled delay.
Definition: osal.c:94
osalEventBroadcastFlags
void osalEventBroadcastFlags(event_source_t *esp, eventflags_t flags)
Add flags to an event source object.
Definition: osal.c:341
osalEventBroadcastFlagsI
void osalEventBroadcastFlagsI(event_source_t *esp, eventflags_t flags)
Add flags to an event source object.
Definition: osal.c:323
syssts_t
uint32_t syssts_t
Type of a system status word.
Definition: osal.h:154
osalTimeAddX
static systime_t osalTimeAddX(systime_t systime, sysinterval_t interval)
Adds an interval to a system time returning a system time.
Definition: osal.h:604
event_source::flags
volatile eventflags_t flags
Stored event flags.
Definition: osal.h:212
threads_queue_t
Type of a thread queue.
Definition: osal.h:231
osalTimeIsInRangeX
static bool osalTimeIsInRangeX(systime_t time, systime_t start, systime_t end)
Checks if the specified time is within the specified time window.
Definition: osal.h:638
osalThreadDequeueNextI
void osalThreadDequeueNextI(threads_queue_t *tqp, msg_t msg)
Dequeues and wakes up one thread from the queue, if any.
Definition: osal.c:294
osalThreadSleepS
void osalThreadSleepS(sysinterval_t time)
Suspends the invoking thread for the specified time.
Definition: osal.c:153
eventcallback_t
void(* eventcallback_t)(event_source_t *esp)
Type of an event source callback.
Definition: osal.h:201
rtcnt_t
uint32_t rtcnt_t
Type of realtime counter.
Definition: osal.h:174
osalInit
void osalInit(void)
OSAL module initialization.
Definition: osal.c:63
osalThreadEnqueueTimeoutS
msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp, sysinterval_t timeout)
Enqueues the caller thread.
Definition: osal.c:277
osalDbgCheck
#define osalDbgCheck(c)
Function parameters check.
Definition: osal.h:277
osalSysRestoreStatusX
static void osalSysRestoreStatusX(syssts_t sts)
Restores the specified execution status and leaves a critical zone.
Definition: osal.h:590
osalThreadSuspendTimeoutS
msg_t osalThreadSuspendTimeoutS(thread_reference_t *trp, sysinterval_t timeout)
Sends the current thread sleeping and sets a reference variable.
Definition: osal.c:211
thread_reference_t
void * thread_reference_t
Type of a thread reference.
Definition: osal.h:179
osalEventSetCallback
void osalEventSetCallback(event_source_t *esp, eventcallback_t cb, void *param)
Event callback setup.
Definition: osal.c:365
osalSysUnlockFromISR
static void osalSysUnlockFromISR(void)
Leaves a critical zone from ISR context.
Definition: osal.h:559
sysinterval_t
uint32_t sysinterval_t
Type of system time interval.
Definition: osal.h:169
osalOsGetSystemTimeX
systime_t osalOsGetSystemTimeX(void)
Current system time.
Definition: osal.c:136
osalSysLock
static void osalSysLock(void)
Enters a critical zone from thread context.
Definition: osal.h:529
osalThreadResumeS
void osalThreadResumeS(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
Definition: osal.c:247
event_source::cb
eventcallback_t cb
Event source callback.
Definition: osal.h:213
osal_halt_msg
const char * osal_halt_msg
Pointer to a halt error message.
Definition: osal.c:40
osalThreadResumeI
void osalThreadResumeI(thread_reference_t *trp, msg_t msg)
Wakes up a thread waiting on a thread reference object.
Definition: osal.c:230
mutex_t
uint32_t mutex_t
Type of a mutex.
Definition: osal.h:222
event_source::param
void * param
User defined field.
Definition: osal.h:214
osalMutexUnlock
void osalMutexUnlock(mutex_t *mp)
Unlocks the specified mutex.
Definition: osal.c:404
osalSysEnable
static void osalSysEnable(void)
Enables interrupts globally.
Definition: osal.h:519
osalMutexObjectInit
static void osalMutexObjectInit(mutex_t *mp)
Initializes s mutex_t object.
Definition: osal.h:681
osalThreadQueueObjectInit
static void osalThreadQueueObjectInit(threads_queue_t *tqp)
Initializes a threads queue object.
Definition: osal.h:653