Austin Schuh | 41baf20 | 2022-01-01 14:33:40 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * The MIT License (MIT) |
| 3 | * |
| 4 | * Copyright (c) 2019 Ha Thach (tinyusb.org) |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to deal |
| 8 | * in the Software without restriction, including without limitation the rights |
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | * copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | * THE SOFTWARE. |
| 23 | * |
| 24 | * This file is part of the TinyUSB stack. |
| 25 | */ |
| 26 | |
| 27 | /** \ingroup Group_Common |
| 28 | * \defgroup Group_Error Error Codes |
| 29 | * @{ */ |
| 30 | |
| 31 | #ifndef _TUSB_ERRORS_H_ |
| 32 | #define _TUSB_ERRORS_H_ |
| 33 | |
| 34 | #include "tusb_option.h" |
| 35 | |
| 36 | #ifdef __cplusplus |
| 37 | extern "C" { |
| 38 | #endif |
| 39 | |
| 40 | #define ERROR_ENUM(x) x, |
| 41 | #define ERROR_STRING(x) #x, |
| 42 | |
| 43 | #define ERROR_TABLE(ENTRY) \ |
| 44 | ENTRY(TUSB_ERROR_NONE )\ |
| 45 | ENTRY(TUSB_ERROR_INVALID_PARA )\ |
| 46 | ENTRY(TUSB_ERROR_DEVICE_NOT_READY )\ |
| 47 | ENTRY(TUSB_ERROR_INTERFACE_IS_BUSY )\ |
| 48 | ENTRY(TUSB_ERROR_HCD_OPEN_PIPE_FAILED )\ |
| 49 | ENTRY(TUSB_ERROR_OSAL_TIMEOUT )\ |
| 50 | ENTRY(TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED )\ |
| 51 | ENTRY(TUSB_ERROR_MSCH_DEVICE_NOT_MOUNTED )\ |
| 52 | ENTRY(TUSB_ERROR_NOT_SUPPORTED )\ |
| 53 | ENTRY(TUSB_ERROR_NOT_ENOUGH_MEMORY )\ |
| 54 | ENTRY(TUSB_ERROR_FAILED )\ |
| 55 | |
| 56 | /// \brief Error Code returned |
| 57 | /// TODO obsolete and to be remove |
| 58 | typedef enum |
| 59 | { |
| 60 | ERROR_TABLE(ERROR_ENUM) |
| 61 | TUSB_ERROR_COUNT |
| 62 | }tusb_error_t; |
| 63 | |
| 64 | #if CFG_TUSB_DEBUG |
| 65 | /// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0 |
| 66 | extern char const* const tusb_strerr[TUSB_ERROR_COUNT]; |
| 67 | #endif |
| 68 | |
| 69 | #ifdef __cplusplus |
| 70 | } |
| 71 | #endif |
| 72 | |
| 73 | #endif /* _TUSB_ERRORS_H_ */ |
| 74 | |
| 75 | /** @} */ |