esp_psram_impl.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "esp_err.h"
  8. #include "sdkconfig.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define PSRAM_SIZE_2MB (2 * 1024 * 1024)
  13. #define PSRAM_SIZE_4MB (4 * 1024 * 1024)
  14. #define PSRAM_SIZE_8MB (8 * 1024 * 1024)
  15. #define PSRAM_SIZE_16MB (16 * 1024 * 1024)
  16. #define PSRAM_SIZE_32MB (32 * 1024 * 1024)
  17. #define PSRAM_SIZE_64MB (64 * 1024 * 1024)
  18. /**
  19. * @brief To get the physical psram size in bytes.
  20. *
  21. * @param[out] out_size_bytes physical psram size in bytes.
  22. */
  23. esp_err_t esp_psram_impl_get_physical_size(uint32_t *out_size_bytes);
  24. /**
  25. * @brief To get the available physical psram size in bytes.
  26. *
  27. * @param[out] out_size_bytes availabe physical psram size in bytes.
  28. */
  29. esp_err_t esp_psram_impl_get_available_size(uint32_t *out_size_bytes);
  30. /**
  31. * @brief Enable psram and configure it to a ready state
  32. *
  33. * @return
  34. * - ESP_OK: On success
  35. * - ESP_ERR_NOT_SUPPORTED: PSRAM ID / vendor ID check fail
  36. * - ESP_ERR_INVALID_STATE: On esp32, when VSPI peripheral is needed but cannot be claimed
  37. */
  38. esp_err_t esp_psram_impl_enable(void);
  39. /**
  40. * @brief get psram CS IO
  41. *
  42. * @return psram CS IO
  43. */
  44. uint8_t esp_psram_impl_get_cs_io(void);