mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-23 01:05:14 +00:00
support SPI_FLASH_ENABLE_COUNTERS feature on esp_flash driver and rename the functions to esp_flash_xx
This commit is contained in:
@@ -77,28 +77,6 @@
|
||||
|
||||
static const char *TAG __attribute__((unused)) = "spi_flash";
|
||||
|
||||
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
||||
static spi_flash_counters_t s_flash_stats;
|
||||
|
||||
#define COUNTER_START() uint32_t ts_begin = esp_cpu_get_cycle_count()
|
||||
#define COUNTER_STOP(counter) \
|
||||
do{ \
|
||||
s_flash_stats.counter.count++; \
|
||||
s_flash_stats.counter.time += (esp_cpu_get_cycle_count() - ts_begin) / (esp_clk_cpu_freq() / 1000000); \
|
||||
} while(0)
|
||||
|
||||
#define COUNTER_ADD_BYTES(counter, size) \
|
||||
do { \
|
||||
s_flash_stats.counter.bytes += size; \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define COUNTER_START()
|
||||
#define COUNTER_STOP(counter)
|
||||
#define COUNTER_ADD_BYTES(counter, size)
|
||||
|
||||
#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
||||
|
||||
const DRAM_ATTR spi_flash_guard_funcs_t g_flash_guard_default_ops = {
|
||||
.start = spi_flash_disable_interrupts_caches_and_other_cpu,
|
||||
.end = spi_flash_enable_interrupts_caches_and_other_cpu,
|
||||
@@ -197,33 +175,6 @@ esp_err_t IRAM_ATTR spi_flash_init_chip_state(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
||||
|
||||
static inline void dump_counter(spi_flash_counter_t *counter, const char *name)
|
||||
{
|
||||
ESP_LOGI(TAG, "%s count=%8d time=%8dus bytes=%8d\n", name,
|
||||
counter->count, counter->time, counter->bytes);
|
||||
}
|
||||
|
||||
const spi_flash_counters_t *spi_flash_get_counters(void)
|
||||
{
|
||||
return &s_flash_stats;
|
||||
}
|
||||
|
||||
void spi_flash_reset_counters(void)
|
||||
{
|
||||
memset(&s_flash_stats, 0, sizeof(s_flash_stats));
|
||||
}
|
||||
|
||||
void spi_flash_dump_counters(void)
|
||||
{
|
||||
dump_counter(&s_flash_stats.read, "read ");
|
||||
dump_counter(&s_flash_stats.write, "write");
|
||||
dump_counter(&s_flash_stats.erase, "erase");
|
||||
}
|
||||
|
||||
#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
||||
|
||||
void IRAM_ATTR spi_flash_set_rom_required_regs(void)
|
||||
{
|
||||
#if SOC_SPI_MEM_SUPPORT_OPI_MODE
|
||||
|
Reference in New Issue
Block a user