aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/osal/nil/osal.h29
-rw-r--r--os/nil/include/nil.h4
2 files changed, 32 insertions, 1 deletions
diff --git a/os/hal/osal/nil/osal.h b/os/hal/osal/nil/osal.h
index 77afc18eb..37838cc88 100644
--- a/os/hal/osal/nil/osal.h
+++ b/os/hal/osal/nil/osal.h
@@ -731,6 +731,8 @@ static inline msg_t osalThreadEnqueueTimeoutS(threads_queue_t *tqp,
*/
static inline void osalEventObjectInit(event_source_t *esp) {
+ osalDbgCheck(esp != NULL);
+
esp->flags = 0;
esp->cb = NULL;
esp->param = NULL;
@@ -747,6 +749,8 @@ static inline void osalEventObjectInit(event_source_t *esp) {
static inline void osalEventBroadcastFlagsI(event_source_t *esp,
eventflags_t flags) {
+ osalDbgCheck(esp != NULL);
+
esp->flags |= flags;
if (esp->cb != NULL)
esp->cb(esp);
@@ -763,6 +767,8 @@ static inline void osalEventBroadcastFlagsI(event_source_t *esp,
static inline void osalEventBroadcastFlags(event_source_t *esp,
eventflags_t flags) {
+ osalDbgCheck(esp != NULL);
+
chSysLock();
osalEventBroadcastFlagsI(esp, flags);
chSchRescheduleS();
@@ -770,6 +776,29 @@ static inline void osalEventBroadcastFlags(event_source_t *esp,
}
/**
+ * @brief Event callback setup.
+ * @note The callback is invoked from ISR context and can
+ * only invoke I-Class functions. The callback is meant
+ * to wakeup the task that will handle the event by
+ * calling @p osalEventGetAndClearFlagsI().
+ *
+ * @param[in] esp pointer to the event flags object
+ * @param[in] cb pointer to the callback function
+ * @param[in] param parameter to be passed to the callback function
+ *
+ * @api
+ */
+static inline void osalEventSetCallback(event_source_t *esp,
+ eventcallback_t cb,
+ void *param) {
+
+ osalDbgCheck(esp != NULL);
+
+ esp->cb = cb;
+ esp->param = param;
+}
+
+/**
* @brief Initializes s @p mutex_t object.
*
* @param[out] mp pointer to the @p mutex_t object
diff --git a/os/nil/include/nil.h b/os/nil/include/nil.h
index f815b2153..109f99533 100644
--- a/os/nil/include/nil.h
+++ b/os/nil/include/nil.h
@@ -391,8 +391,10 @@ typedef struct {
* @brief Panic message.
* @note This field is only present if some debug options have been
* activated.
+ * @note Accesses to this pointer must never be optimized out so the
+ * field itself is declared volatile.
*/
- const char *dbg_panic_msg;
+ const char * volatile dbg_panic_msg;
#endif
} nil_system_t;