1 /* 2 * SPDX-FileCopyrightText: 2015-2022 The Apache Software Foundation (ASF) 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * SPDX-FileContributor: 2019-2022 Espressif Systems (Shanghai) CO LTD 7 */ 8 /* 9 * Licensed to the Apache Software Foundation (ASF) under one 10 * or more contributor license agreements. See the NOTICE file 11 * distributed with this work for additional information 12 * regarding copyright ownership. The ASF licenses this file 13 * to you under the Apache License, Version 2.0 (the 14 * "License"); you may not use this file except in compliance 15 * with the License. You may obtain a copy of the License at 16 * 17 * http://www.apache.org/licenses/LICENSE-2.0 18 * 19 * Unless required by applicable law or agreed to in writing, 20 * software distributed under the License is distributed on an 21 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 22 * KIND, either express or implied. See the License for the 23 * specific language governing permissions and limitations 24 * under the License. 25 */ 26 27 #ifndef H_OS_ERROR_ 28 #define H_OS_ERROR_ 29 30 #include "os/os.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* OS error enumerations */ 37 enum os_error { 38 OS_OK = 0, 39 OS_ENOMEM = 1, 40 OS_EINVAL = 2, 41 OS_INVALID_PARM = 3, 42 OS_MEM_NOT_ALIGNED = 4, 43 OS_BAD_MUTEX = 5, 44 OS_TIMEOUT = 6, 45 OS_ERR_IN_ISR = 7, /* Function cannot be called from ISR */ 46 OS_ERR_PRIV = 8, /* Privileged access error */ 47 OS_NOT_STARTED = 9, /* OS must be started to call this function, but isn't */ 48 OS_ENOENT = 10, /* No such thing */ 49 OS_EBUSY = 11, /* Resource busy */ 50 OS_ERROR = 12, /* Generic Error */ 51 }; 52 53 typedef enum os_error os_error_t; 54 55 /** 56 * @brief Converts an OS error code (`OS_[...]`) to an equivalent system error 57 * code (`SYS_E[...]`). 58 * 59 * @param os_error The OS error code to convert. 60 * 61 * @return The equivalent system error code. 62 */ 63 int os_error_to_sys(os_error_t os_error); 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif 70