esp_spi_flash_counters.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #include "esp_err.h"
  10. #include "sdkconfig.h"
  11. #if CONFIG_SPI_FLASH_ENABLE_COUNTERS
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /**
  16. * Structure holding statistics for one type of operation
  17. */
  18. typedef struct {
  19. uint32_t count; // number of times operation was executed
  20. uint32_t time; // total time taken, in microseconds
  21. uint32_t bytes; // total number of bytes
  22. } esp_flash_counter_t;
  23. typedef struct {
  24. esp_flash_counter_t read;
  25. esp_flash_counter_t write;
  26. esp_flash_counter_t erase;
  27. } esp_flash_counters_t;
  28. // for deprecate old api
  29. typedef esp_flash_counter_t spi_flash_counter_t;
  30. typedef esp_flash_counters_t spi_flash_counters_t;
  31. /**
  32. * @brief Reset SPI flash operation counters
  33. */
  34. void esp_flash_reset_counters(void);
  35. void spi_flash_reset_counters(void) __attribute__((deprecated("Please use 'esp_flash_reset_counters' instead")));
  36. /**
  37. * @brief Print SPI flash operation counters
  38. */
  39. void esp_flash_dump_counters(FILE* stream);
  40. void spi_flash_dump_counters(void) __attribute__((deprecated("Please use 'esp_flash_dump_counters' instead")));
  41. /**
  42. * @brief Return current SPI flash operation counters
  43. *
  44. * @return pointer to the esp_flash_counters_t structure holding values
  45. * of the operation counters
  46. */
  47. const esp_flash_counters_t* esp_flash_get_counters(void);
  48. const spi_flash_counters_t* spi_flash_get_counters(void) __attribute__((deprecated("Please use 'esp_flash_get_counters' instead")));
  49. #ifdef __cplusplus
  50. }
  51. #endif
  52. #endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS