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 
9 #pragma once
10 
22 #include "os/os.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define DPL_ENTER_CRITICAL(_sr) (_sr = os_hw_enter_critical())
33 #define DPL_EXIT_CRITICAL(_sr) (os_hw_exit_critical(_sr))
34 #define DPL_ASSERT_CRITICAL() assert(os_hw_is_in_critical())
40 typedef os_sr_t dpl_sr_t;
41 
47 static inline uint32_t dpl_hw_enter_critical(void)
48 {
49  return os_hw_enter_critical();
50 }
51 
57 static inline void dpl_hw_exit_critical(uint32_t ctx)
58 {
60 }
61 
67 static inline bool dpl_hw_is_in_critical(void)
68 {
69  return os_hw_is_in_critical();
70 }
71 
72 #ifdef __cplusplus
73 }
74 #endif
os_sr_t dpl_sr_t
CPU status register.
Definition: dpl_os.h:40
static void dpl_hw_exit_critical(uint32_t ctx)
Restores ISR context.
Definition: dpl_os.h:57
static uint32_t dpl_hw_enter_critical(void)
Disable ISRs.
Definition: dpl_os.h:47
static bool dpl_hw_is_in_critical(void)
Check if is in critical section.
Definition: dpl_os.h:67
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:117
static void os_hw_exit_critical(uint32_t ctx)
Restores ISR context.
Definition: os.h:107
static uint32_t os_hw_enter_critical(void)
Disable ISRs.
Definition: os.h:96
uint32_t os_sr_t
CPU status register.
Definition: os.h:80