1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 #ifndef _OS_H 21 #define _OS_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #ifndef min 28 #define min(a, b) ((a)<(b)?(a):(b)) 29 #endif 30 31 #ifndef max 32 #define max(a, b) ((a)>(b)?(a):(b)) 33 #endif 34 35 #include "syscfg/syscfg.h" 36 #include "nimble/nimble_npl.h" 37 38 #define OS_ALIGN(__n, __a) ( \ 39 (((__n) & ((__a) - 1)) == 0) ? \ 40 (__n) : \ 41 ((__n) + ((__a) - ((__n) & ((__a) - 1)))) \ 42 ) 43 #define OS_ALIGNMENT (BLE_NPL_OS_ALIGNMENT) 44 45 typedef uint32_t os_sr_t; 46 #define OS_ENTER_CRITICAL(_sr) (_sr = ble_npl_hw_enter_critical()) 47 #define OS_EXIT_CRITICAL(_sr) (ble_npl_hw_exit_critical(_sr)) 48 49 /* Mynewt components (not abstracted in NPL) */ 50 #include "os/endian.h" 51 #include "os/queue.h" 52 #include "os/os_error.h" 53 #include "os/os_mbuf.h" 54 #include "os/os_mempool.h" 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* _OS_H */ 61