dpl_os.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef DPL_DPL_OS_H
21 #define DPL_DPL_OS_H
22 
23 #include "os/os.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 #define DPL_ENTER_CRITICAL(_sr) (_sr = os_hw_enter_critical())
34 #define DPL_EXIT_CRITICAL(_sr) (os_hw_exit_critical(_sr))
35 #define DPL_ASSERT_CRITICAL() assert(os_hw_is_in_critical())
41 typedef os_sr_t dpl_sr_t;
42 
48 static inline uint32_t dpl_hw_enter_critical(void)
49 {
50  return os_hw_enter_critical();
51 }
52 
58 static inline void dpl_hw_exit_critical(uint32_t ctx)
59 {
61 }
62 
68 static inline bool dpl_hw_is_in_critical(void)
69 {
70  return os_hw_is_in_critical();
71 }
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* DPL_DPL_OS_H */
os_sr_t dpl_sr_t
CPU status register.
Definition: dpl_os.h:41
static void dpl_hw_exit_critical(uint32_t ctx)
Restores ISR context.
Definition: dpl_os.h:58
static uint32_t dpl_hw_enter_critical(void)
Disable ISRs.
Definition: dpl_os.h:48
static bool dpl_hw_is_in_critical(void)
Check if is in critical section.
Definition: dpl_os.h:68
Apache Mynewt Copyright 2015-2021 The Apache Software Foundation.
static bool os_hw_is_in_critical(void)
Check if is in critical section.
Definition: os.h:118
static void os_hw_exit_critical(uint32_t ctx)
Restores ISR context.
Definition: os.h:108
static uint32_t os_hw_enter_critical(void)
Disable ISRs.
Definition: os.h:97
uint32_t os_sr_t
CPU status register.
Definition: os.h:81