Loading...
Searching...
No Matches
os.h File Reference

Apache Mynewt Copyright 2015-2021 The Apache Software Foundation. More...

Detailed Description

Apache Mynewt Copyright 2015-2021 The Apache Software Foundation.

This product includes software developed at The Apache Software Foundation (http://www.apache.org/).

Portions of this software were developed at Runtime Inc, copyright 2015.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

mynewt-core error types

Definition in file os.h.

#include <assert.h>
#include <stdint.h>
#include "irq.h"
#include "os/os_types.h"
#include "os/os_error.h"
#include "os/endian.h"
#include "os/os_callout.h"
#include "os/os_cputime.h"
#include "os/os_dev.h"
#include "os/os_eventq.h"
#include "os/os_mbuf.h"
#include "os/os_mempool.h"
#include "os/os_mutex.h"
#include "os/os_sem.h"
#include "os/os_task.h"
#include "os/os_time.h"
#include "os/os_trace_api.h"
#include "os/queue.h"
+ Include dependency graph for os.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef uint32_t os_sr_t
 CPU status register.
 

Functions

static uint32_t os_hw_enter_critical (void)
 Disable ISRs.
 
static void os_hw_exit_critical (uint32_t ctx)
 Restores ISR context.
 
static bool os_hw_is_in_critical (void)
 Check if is in critical section.
 

MyNewt os/%.h required macros

PLEASE NOTE: Following macro definitions where copied directly from apache/mynewt-core and are under the copyright specified in the header.

#define min(a, b)   ((a)<(b)?(a):(b))
 
#define max(a, b)   ((a)>(b)?(a):(b))
 
#define OS_ALIGN(__n, __a)
 
#define OS_ALIGNMENT   (4)
 

Entering and exiting critical section defines

#define OS_ENTER_CRITICAL(_sr)   (_sr = os_hw_enter_critical())
 
#define OS_EXIT_CRITICAL(_sr)   (os_hw_exit_critical(_sr))
 
#define OS_ASSERT_CRITICAL()   assert(os_hw_is_in_critical())
 

Macro Definition Documentation

◆ max

#define max (   a,
 
)    ((a)>(b)?(a):(b))

Definition at line 67 of file os.h.

◆ min

#define min (   a,
 
)    ((a)<(b)?(a):(b))

Definition at line 63 of file os.h.

◆ OS_ALIGN

#define OS_ALIGN (   __n,
  __a 
)
Value:
( \
(((__n) & ((__a) - 1)) == 0) ? \
(__n) : \
((__n) + ((__a) - ((__n) & ((__a) - 1)))) \
)

Definition at line 70 of file os.h.

◆ OS_ALIGNMENT

#define OS_ALIGNMENT   (4)

Definition at line 75 of file os.h.

◆ OS_ASSERT_CRITICAL

#define OS_ASSERT_CRITICAL ( )    assert(os_hw_is_in_critical())

Definition at line 89 of file os.h.

◆ OS_ENTER_CRITICAL

#define OS_ENTER_CRITICAL (   _sr)    (_sr = os_hw_enter_critical())

Definition at line 87 of file os.h.

◆ OS_EXIT_CRITICAL

#define OS_EXIT_CRITICAL (   _sr)    (os_hw_exit_critical(_sr))

Definition at line 88 of file os.h.

Typedef Documentation

◆ os_sr_t

typedef uint32_t os_sr_t

CPU status register.

Definition at line 81 of file os.h.

Function Documentation

◆ os_hw_enter_critical()

static uint32_t os_hw_enter_critical ( void  )
inlinestatic

Disable ISRs.

Returns
current isr context

Definition at line 97 of file os.h.

◆ os_hw_exit_critical()

static void os_hw_exit_critical ( uint32_t  ctx)
inlinestatic

Restores ISR context.

Parameters
[in]ctxISR context to restore.

Definition at line 108 of file os.h.

◆ os_hw_is_in_critical()

static bool os_hw_is_in_critical ( void  )
inlinestatic

Check if is in critical section.

Returns
true, if in critical section, false otherwise

Definition at line 118 of file os.h.