esp_flash_err.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <stdint.h>
  16. #include "esp_err.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*
  21. * Possible errors returned from esp flash internal functions, these error codes
  22. * should be consistent with esp_err_t codes. But in order to make the source
  23. * files less dependent to esp_err_t, they use the error codes defined in this
  24. * replacable header. This header should ensure the consistency to esp_err_t.
  25. */
  26. enum {
  27. /* These codes should be consistent with esp_err_t errors. However, error codes with the same values are not
  28. * allowed in ESP-IDF. This is a workaround in order to not introduce a dependency between the "soc" and
  29. * "esp_common" components. The disadvantage is that the output of esp_err_to_name(ESP_ERR_FLASH_SIZE_NOT_MATCH)
  30. * will be ESP_ERR_INVALID_SIZE. */
  31. ESP_ERR_FLASH_SIZE_NOT_MATCH = ESP_ERR_INVALID_SIZE, ///< The chip doesn't have enough space for the current partition table
  32. ESP_ERR_FLASH_NO_RESPONSE = ESP_ERR_INVALID_RESPONSE, ///< Chip did not respond to the command, or timed out.
  33. };
  34. //The ROM code has already taken 1 and 2, to avoid possible conflicts, start from 3.
  35. #define ESP_ERR_FLASH_NOT_INITIALISED (ESP_ERR_FLASH_BASE+3) ///< esp_flash_chip_t structure not correctly initialised by esp_flash_init().
  36. #define ESP_ERR_FLASH_UNSUPPORTED_HOST (ESP_ERR_FLASH_BASE+4) ///< Requested operation isn't supported via this host SPI bus (chip->spi field).
  37. #define ESP_ERR_FLASH_UNSUPPORTED_CHIP (ESP_ERR_FLASH_BASE+5) ///< Requested operation isn't supported by this model of SPI flash chip.
  38. #define ESP_ERR_FLASH_PROTECTED (ESP_ERR_FLASH_BASE+6) ///< Write operation failed due to chip's write protection being enabled.
  39. #ifdef __cplusplus
  40. }
  41. #endif