1 /* 2 * Copyright (c) 2020 Raspberry Pi (Trading) Ltd. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _PICO_ERROR_H 8 #define _PICO_ERROR_H 9 10 #ifndef __ASSEMBLER__ 11 12 /*! 13 * \brief Common return codes from pico_sdk methods that return a status 14 * 15 * All `PICO_ERROR_` values are negative so they can be returned from functions that also 16 * want to return a zero or positive value on success. 17 * 18 * Note these error codes may be returned via bootrom functions too. 19 * 20 * \ingroup pico_base 21 */ 22 enum pico_error_codes { 23 PICO_OK = 0, ///< No error; the operation succeeded 24 PICO_ERROR_NONE = 0, ///< No error; the operation succeeded 25 PICO_ERROR_GENERIC = -1, ///< An unspecified error occurred 26 PICO_ERROR_TIMEOUT = -2, ///< The function failed due to timeout 27 PICO_ERROR_NO_DATA = -3, ///< Attempt for example to read from an empty buffer/FIFO 28 PICO_ERROR_NOT_PERMITTED = -4, ///< Permission violation e.g. write to read-only flash partition, or security violation 29 PICO_ERROR_INVALID_ARG = -5, ///< Argument is outside of range of supported values` 30 PICO_ERROR_IO = -6, ///< An I/O error occurred 31 PICO_ERROR_BADAUTH = -7, ///< The authorization failed due to bad credentials 32 PICO_ERROR_CONNECT_FAILED = -8, ///< The connection failed 33 PICO_ERROR_INSUFFICIENT_RESOURCES = -9, ///< Dynamic allocation of resources failed 34 PICO_ERROR_INVALID_ADDRESS = -10, ///< Address argument was out-of-bounds or was determined to be an address that the caller may not access 35 PICO_ERROR_BAD_ALIGNMENT = -11, ///< Address was mis-aligned (usually not on word boundary) 36 PICO_ERROR_INVALID_STATE = -12, ///< Something happened or failed to happen in the past, and consequently we (currently) can't service the request 37 PICO_ERROR_BUFFER_TOO_SMALL = -13, ///< A user-allocated buffer was too small to hold the result or working state of this function 38 PICO_ERROR_PRECONDITION_NOT_MET = -14, ///< The call failed because another function must be called first 39 PICO_ERROR_MODIFIED_DATA = -15, ///< Cached data was determined to be inconsistent with the actual version of the data 40 PICO_ERROR_INVALID_DATA = -16, ///< A data structure failed to validate 41 PICO_ERROR_NOT_FOUND = -17, ///< Attempted to access something that does not exist; or, a search failed 42 PICO_ERROR_UNSUPPORTED_MODIFICATION = -18, ///< Write is impossible based on previous writes; e.g. attempted to clear an OTP bit 43 PICO_ERROR_LOCK_REQUIRED = -19, ///< A required lock is not owned 44 PICO_ERROR_VERSION_MISMATCH = -20, ///< A version mismatch occurred (e.g. trying to run PIO version 1 code on RP2040) 45 PICO_ERROR_RESOURCE_IN_USE = -21 ///< The call could not proceed because requires resourcesw were unavailable 46 }; 47 48 #endif // !__ASSEMBLER__ 49 50 #endif