2016-08-17 15:08:22 +00:00
|
|
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <assert.h>
|
2016-09-13 08:40:05 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-08-17 15:08:22 +00:00
|
|
|
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <freertos/task.h>
|
|
|
|
#include <freertos/semphr.h>
|
|
|
|
#include <rom/spi_flash.h>
|
|
|
|
#include <rom/cache.h>
|
2016-09-12 10:54:45 +00:00
|
|
|
#include <soc/soc.h>
|
2016-08-17 15:08:22 +00:00
|
|
|
#include <soc/dport_reg.h>
|
2016-08-24 10:01:01 +00:00
|
|
|
#include "sdkconfig.h"
|
2016-09-12 10:54:45 +00:00
|
|
|
#include "esp_ipc.h"
|
|
|
|
#include "esp_attr.h"
|
|
|
|
#include "esp_spi_flash.h"
|
2016-09-23 00:44:45 +00:00
|
|
|
#include "esp_log.h"
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
/*
|
|
|
|
Driver for SPI flash read/write/erase operations
|
|
|
|
|
|
|
|
In order to perform some flash operations, we need to make sure both CPUs
|
|
|
|
are not running any code from flash for the duration of the flash operation.
|
|
|
|
In a single-core setup this is easy: we disable interrupts/scheduler and do
|
|
|
|
the flash operation. In the dual-core setup this is slightly more complicated.
|
|
|
|
We need to make sure that the other CPU doesn't run any code from flash.
|
|
|
|
|
|
|
|
|
2016-09-12 11:54:35 +00:00
|
|
|
When SPI flash API is called on CPU A (can be PRO or APP), we start
|
|
|
|
spi_flash_op_block_func function on CPU B using esp_ipc_call API. This API
|
|
|
|
wakes up high priority task on CPU B and tells it to execute given function,
|
|
|
|
in this case spi_flash_op_block_func. This function disables cache on CPU B and
|
|
|
|
signals that cache is disabled by setting s_flash_op_can_start flag.
|
|
|
|
Then the task on CPU A disables cache as well, and proceeds to execute flash
|
|
|
|
operation.
|
2016-08-24 10:01:01 +00:00
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
While flash operation is running, interrupts can still run on CPU B.
|
2016-08-24 10:01:01 +00:00
|
|
|
We assume that all interrupt code is placed into RAM.
|
|
|
|
|
|
|
|
Once flash operation is complete, function on CPU A sets another flag,
|
|
|
|
s_flash_op_complete, to let the task on CPU B know that it can re-enable
|
|
|
|
cache and release the CPU. Then the function on CPU A re-enables the cache on
|
2016-09-12 11:54:35 +00:00
|
|
|
CPU A as well and returns control to the calling code.
|
2016-08-24 10:01:01 +00:00
|
|
|
|
|
|
|
Additionally, all API functions are protected with a mutex (s_flash_op_mutex).
|
|
|
|
|
|
|
|
In a single core environment (CONFIG_FREERTOS_UNICORE enabled), we simply
|
|
|
|
disable both caches, no inter-CPU communication takes place.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static esp_err_t spi_flash_translate_rc(SpiFlashOpResult rc);
|
2016-09-12 10:54:45 +00:00
|
|
|
static void IRAM_ATTR spi_flash_disable_cache(uint32_t cpuid, uint32_t* saved_state);
|
|
|
|
static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state);
|
2016-08-24 10:01:01 +00:00
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
static uint32_t s_flash_op_cache_state[2];
|
2016-08-24 10:01:01 +00:00
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
#ifndef CONFIG_FREERTOS_UNICORE
|
2016-08-24 10:01:01 +00:00
|
|
|
static SemaphoreHandle_t s_flash_op_mutex;
|
|
|
|
static bool s_flash_op_can_start = false;
|
|
|
|
static bool s_flash_op_complete = false;
|
2016-09-12 10:54:45 +00:00
|
|
|
#endif //CONFIG_FREERTOS_UNICORE
|
2016-08-24 10:01:01 +00:00
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
|
|
|
static const char* TAG = "spi_flash";
|
|
|
|
static spi_flash_counters_t s_flash_stats;
|
2016-09-13 08:40:05 +00:00
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
#define COUNTER_START() uint32_t ts_begin = xthal_get_ccount()
|
|
|
|
#define COUNTER_STOP(counter) do{ s_flash_stats.counter.count++; s_flash_stats.counter.time += (xthal_get_ccount() - ts_begin) / (XT_CLOCK_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)
|
2016-09-13 08:40:05 +00:00
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
2016-08-24 10:01:01 +00:00
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
#ifndef CONFIG_FREERTOS_UNICORE
|
|
|
|
|
|
|
|
static void IRAM_ATTR spi_flash_op_block_func(void* arg)
|
2016-08-17 15:08:22 +00:00
|
|
|
{
|
2016-09-12 10:54:45 +00:00
|
|
|
// Disable scheduler on this CPU
|
|
|
|
vTaskSuspendAll();
|
2016-08-24 10:01:01 +00:00
|
|
|
uint32_t cpuid = (uint32_t) arg;
|
2016-09-12 10:54:45 +00:00
|
|
|
// Disable cache so that flash operation can start
|
|
|
|
spi_flash_disable_cache(cpuid, &s_flash_op_cache_state[cpuid]);
|
|
|
|
s_flash_op_can_start = true;
|
|
|
|
while (!s_flash_op_complete) {
|
|
|
|
// until we have a way to use interrupts for inter-CPU communication,
|
|
|
|
// busy loop here and wait for the other CPU to finish flash operation
|
2016-08-17 15:08:22 +00:00
|
|
|
}
|
2016-09-12 10:54:45 +00:00
|
|
|
// Flash operation is complete, re-enable cache
|
|
|
|
spi_flash_restore_cache(cpuid, s_flash_op_cache_state[cpuid]);
|
|
|
|
// Re-enable scheduler
|
|
|
|
xTaskResumeAll();
|
2016-08-17 15:08:22 +00:00
|
|
|
}
|
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
void spi_flash_init()
|
|
|
|
{
|
|
|
|
s_flash_op_mutex = xSemaphoreCreateMutex();
|
2016-09-23 00:44:45 +00:00
|
|
|
|
|
|
|
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
|
|
|
spi_flash_reset_counters();
|
|
|
|
#endif
|
2016-08-24 10:01:01 +00:00
|
|
|
}
|
2016-08-17 15:08:22 +00:00
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
static void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu()
|
|
|
|
{
|
|
|
|
// Take the API lock
|
|
|
|
xSemaphoreTake(s_flash_op_mutex, portMAX_DELAY);
|
2016-09-12 10:54:45 +00:00
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
const uint32_t cpuid = xPortGetCoreID();
|
2016-09-13 04:47:21 +00:00
|
|
|
const uint32_t other_cpuid = (cpuid == 0) ? 1 : 0;
|
2016-09-12 10:54:45 +00:00
|
|
|
|
|
|
|
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) {
|
2016-09-13 04:47:21 +00:00
|
|
|
// Scheduler hasn't been started yet, it means that spi_flash API is being
|
|
|
|
// called from the 2nd stage bootloader or from user_start_cpu0, i.e. from
|
|
|
|
// PRO CPU. APP CPU is either in reset or spinning inside user_start_cpu1,
|
|
|
|
// which is in IRAM. So it is safe to disable cache for the other_cpuid here.
|
|
|
|
assert(other_cpuid == 1);
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_disable_cache(other_cpuid, &s_flash_op_cache_state[other_cpuid]);
|
|
|
|
} else {
|
|
|
|
// Signal to the spi_flash_op_block_task on the other CPU that we need it to
|
|
|
|
// disable cache there and block other tasks from executing.
|
|
|
|
s_flash_op_can_start = false;
|
|
|
|
s_flash_op_complete = false;
|
|
|
|
esp_ipc_call(other_cpuid, &spi_flash_op_block_func, (void*) other_cpuid);
|
|
|
|
while (!s_flash_op_can_start) {
|
|
|
|
// Busy loop and wait for spi_flash_op_block_func to disable cache
|
|
|
|
// on the other CPU
|
|
|
|
}
|
|
|
|
// Disable scheduler on CPU cpuid
|
|
|
|
vTaskSuspendAll();
|
|
|
|
// This is guaranteed to run on CPU <cpuid> because the other CPU is now
|
|
|
|
// occupied by highest priority task
|
|
|
|
assert(xPortGetCoreID() == cpuid);
|
2016-08-24 10:01:01 +00:00
|
|
|
}
|
|
|
|
// Disable cache on this CPU as well
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_disable_cache(cpuid, &s_flash_op_cache_state[cpuid]);
|
2016-08-24 10:01:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu()
|
|
|
|
{
|
2016-09-12 10:54:45 +00:00
|
|
|
const uint32_t cpuid = xPortGetCoreID();
|
2016-09-13 04:47:21 +00:00
|
|
|
const uint32_t other_cpuid = (cpuid == 0) ? 1 : 0;
|
2016-09-12 10:54:45 +00:00
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
// Re-enable cache on this CPU
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_restore_cache(cpuid, s_flash_op_cache_state[cpuid]);
|
|
|
|
|
|
|
|
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) {
|
2016-09-13 04:47:21 +00:00
|
|
|
// Scheduler is not running yet — this means we are running on PRO CPU.
|
|
|
|
// other_cpuid is APP CPU, and it is either in reset or is spinning in
|
|
|
|
// user_start_cpu1, which is in IRAM. So we can simply reenable cache.
|
|
|
|
assert(other_cpuid == 1);
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_restore_cache(other_cpuid, s_flash_op_cache_state[other_cpuid]);
|
|
|
|
} else {
|
|
|
|
// Signal to spi_flash_op_block_task that flash operation is complete
|
|
|
|
s_flash_op_complete = true;
|
|
|
|
// Resume tasks on the current CPU
|
|
|
|
xTaskResumeAll();
|
|
|
|
}
|
2016-08-24 10:01:01 +00:00
|
|
|
// Release API lock
|
|
|
|
xSemaphoreGive(s_flash_op_mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else // CONFIG_FREERTOS_UNICORE
|
|
|
|
|
|
|
|
void spi_flash_init()
|
|
|
|
{
|
2016-09-23 00:44:45 +00:00
|
|
|
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
|
|
|
spi_flash_reset_counters();
|
|
|
|
#endif
|
2016-08-24 10:01:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu()
|
2016-08-17 15:08:22 +00:00
|
|
|
{
|
|
|
|
vTaskSuspendAll();
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_disable_cache(0, &s_flash_op_cache_state[0]);
|
2016-08-17 15:08:22 +00:00
|
|
|
}
|
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
static void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu()
|
2016-08-17 15:08:22 +00:00
|
|
|
{
|
2016-09-12 10:54:45 +00:00
|
|
|
spi_flash_restore_cache(0, s_flash_op_cache_state[0]);
|
2016-08-17 15:08:22 +00:00
|
|
|
xTaskResumeAll();
|
|
|
|
}
|
|
|
|
|
2016-08-24 10:01:01 +00:00
|
|
|
#endif // CONFIG_FREERTOS_UNICORE
|
|
|
|
|
|
|
|
|
2016-09-13 07:16:36 +00:00
|
|
|
SpiFlashOpResult IRAM_ATTR spi_flash_unlock()
|
|
|
|
{
|
|
|
|
static bool unlocked = false;
|
|
|
|
if (!unlocked) {
|
|
|
|
SpiFlashOpResult rc = SPIUnlock();
|
|
|
|
if (rc != SPI_FLASH_RESULT_OK) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
unlocked = true;
|
|
|
|
}
|
|
|
|
return SPI_FLASH_RESULT_OK;
|
|
|
|
}
|
|
|
|
|
2016-08-17 15:08:22 +00:00
|
|
|
esp_err_t IRAM_ATTR spi_flash_erase_sector(uint16_t sec)
|
|
|
|
{
|
2016-09-13 08:40:05 +00:00
|
|
|
COUNTER_START();
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_disable_interrupts_caches_and_other_cpu();
|
2016-08-17 15:08:22 +00:00
|
|
|
SpiFlashOpResult rc;
|
2016-09-13 07:16:36 +00:00
|
|
|
rc = spi_flash_unlock();
|
2016-08-24 10:01:01 +00:00
|
|
|
if (rc == SPI_FLASH_RESULT_OK) {
|
|
|
|
rc = SPIEraseSector(sec);
|
2016-08-17 15:08:22 +00:00
|
|
|
}
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_enable_interrupts_caches_and_other_cpu();
|
2016-09-23 00:44:45 +00:00
|
|
|
COUNTER_STOP(erase);
|
2016-08-17 15:08:22 +00:00
|
|
|
return spi_flash_translate_rc(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t IRAM_ATTR spi_flash_write(uint32_t dest_addr, const uint32_t *src, uint32_t size)
|
|
|
|
{
|
2016-09-13 08:40:05 +00:00
|
|
|
COUNTER_START();
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_disable_interrupts_caches_and_other_cpu();
|
2016-08-17 15:08:22 +00:00
|
|
|
SpiFlashOpResult rc;
|
2016-09-13 07:16:36 +00:00
|
|
|
rc = spi_flash_unlock();
|
2016-08-24 10:01:01 +00:00
|
|
|
if (rc == SPI_FLASH_RESULT_OK) {
|
|
|
|
rc = SPIWrite(dest_addr, src, (int32_t) size);
|
2016-09-23 00:44:45 +00:00
|
|
|
COUNTER_ADD_BYTES(write, size);
|
2016-08-17 15:08:22 +00:00
|
|
|
}
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_enable_interrupts_caches_and_other_cpu();
|
2016-09-23 00:44:45 +00:00
|
|
|
COUNTER_STOP(write);
|
2016-08-17 15:08:22 +00:00
|
|
|
return spi_flash_translate_rc(rc);
|
|
|
|
}
|
|
|
|
|
|
|
|
esp_err_t IRAM_ATTR spi_flash_read(uint32_t src_addr, uint32_t *dest, uint32_t size)
|
|
|
|
{
|
2016-09-13 08:40:05 +00:00
|
|
|
COUNTER_START();
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_disable_interrupts_caches_and_other_cpu();
|
2016-09-26 04:47:17 +00:00
|
|
|
SpiFlashOpResult rc = SPIRead(src_addr, dest, (int32_t) size);
|
|
|
|
COUNTER_ADD_BYTES(read, size);
|
2016-08-24 10:01:01 +00:00
|
|
|
spi_flash_enable_interrupts_caches_and_other_cpu();
|
2016-09-23 00:44:45 +00:00
|
|
|
COUNTER_STOP(read);
|
2016-08-17 15:08:22 +00:00
|
|
|
return spi_flash_translate_rc(rc);
|
|
|
|
}
|
2016-08-24 10:01:01 +00:00
|
|
|
|
|
|
|
static esp_err_t spi_flash_translate_rc(SpiFlashOpResult rc)
|
|
|
|
{
|
|
|
|
switch (rc) {
|
|
|
|
case SPI_FLASH_RESULT_OK:
|
|
|
|
return ESP_OK;
|
|
|
|
case SPI_FLASH_RESULT_TIMEOUT:
|
|
|
|
return ESP_ERR_FLASH_OP_TIMEOUT;
|
|
|
|
case SPI_FLASH_RESULT_ERR:
|
|
|
|
default:
|
|
|
|
return ESP_ERR_FLASH_OP_FAIL;
|
|
|
|
}
|
|
|
|
}
|
2016-09-12 10:54:45 +00:00
|
|
|
|
2016-09-13 04:47:21 +00:00
|
|
|
static const uint32_t cache_mask = DPORT_APP_CACHE_MASK_OPSDRAM | DPORT_APP_CACHE_MASK_DROM0 |
|
|
|
|
DPORT_APP_CACHE_MASK_DRAM1 | DPORT_APP_CACHE_MASK_IROM0 |
|
|
|
|
DPORT_APP_CACHE_MASK_IRAM1 | DPORT_APP_CACHE_MASK_IRAM0;
|
|
|
|
|
2016-09-12 10:54:45 +00:00
|
|
|
static void IRAM_ATTR spi_flash_disable_cache(uint32_t cpuid, uint32_t* saved_state)
|
|
|
|
{
|
|
|
|
uint32_t ret = 0;
|
|
|
|
if (cpuid == 0) {
|
2016-09-13 15:02:03 +00:00
|
|
|
ret |= GET_PERI_REG_BITS2(DPORT_PRO_CACHE_CTRL1_REG, cache_mask, 0);
|
|
|
|
while (GET_PERI_REG_BITS2(DPORT_PRO_DCACHE_DBUG0_REG, DPORT_PRO_CACHE_STATE, DPORT_PRO_CACHE_STATE_S) != 1) {
|
2016-09-12 10:54:45 +00:00
|
|
|
;
|
|
|
|
}
|
2016-09-13 15:02:03 +00:00
|
|
|
SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL_REG, 1, 0, DPORT_PRO_CACHE_ENABLE_S);
|
2016-09-12 10:54:45 +00:00
|
|
|
} else {
|
2016-09-13 15:02:03 +00:00
|
|
|
ret |= GET_PERI_REG_BITS2(DPORT_APP_CACHE_CTRL1_REG, cache_mask, 0);
|
|
|
|
while (GET_PERI_REG_BITS2(DPORT_APP_DCACHE_DBUG0_REG, DPORT_APP_CACHE_STATE, DPORT_APP_CACHE_STATE_S) != 1) {
|
2016-09-12 10:54:45 +00:00
|
|
|
;
|
|
|
|
}
|
2016-09-13 15:02:03 +00:00
|
|
|
SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 0, DPORT_APP_CACHE_ENABLE_S);
|
2016-09-12 10:54:45 +00:00
|
|
|
}
|
|
|
|
*saved_state = ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void IRAM_ATTR spi_flash_restore_cache(uint32_t cpuid, uint32_t saved_state)
|
|
|
|
{
|
|
|
|
if (cpuid == 0) {
|
2016-09-13 15:02:03 +00:00
|
|
|
SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL_REG, 1, 1, DPORT_PRO_CACHE_ENABLE_S);
|
|
|
|
SET_PERI_REG_BITS(DPORT_PRO_CACHE_CTRL1_REG, cache_mask, saved_state, 0);
|
2016-09-12 10:54:45 +00:00
|
|
|
} else {
|
2016-09-13 15:02:03 +00:00
|
|
|
SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL_REG, 1, 1, DPORT_APP_CACHE_ENABLE_S);
|
|
|
|
SET_PERI_REG_BITS(DPORT_APP_CACHE_CTRL1_REG, cache_mask, saved_state, 0);
|
2016-09-12 10:54:45 +00:00
|
|
|
}
|
|
|
|
}
|
2016-09-13 08:40:05 +00:00
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
#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=%8dms bytes=%8d\n", name,
|
|
|
|
counter->count, counter->time, counter->bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
const spi_flash_counters_t* spi_flash_get_counters()
|
2016-09-13 08:40:05 +00:00
|
|
|
{
|
2016-09-23 00:44:45 +00:00
|
|
|
return &s_flash_stats;
|
2016-09-13 08:40:05 +00:00
|
|
|
}
|
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
void spi_flash_reset_counters()
|
2016-09-13 08:40:05 +00:00
|
|
|
{
|
|
|
|
memset(&s_flash_stats, 0, sizeof(s_flash_stats));
|
|
|
|
}
|
|
|
|
|
2016-09-23 00:44:45 +00:00
|
|
|
void spi_flash_dump_counters()
|
2016-09-13 08:40:05 +00:00
|
|
|
{
|
2016-09-23 00:44:45 +00:00
|
|
|
dump_counter(&s_flash_stats.read, "read ");
|
|
|
|
dump_counter(&s_flash_stats.write, "write");
|
|
|
|
dump_counter(&s_flash_stats.erase, "erase");
|
2016-09-13 08:40:05 +00:00
|
|
|
}
|
2016-09-23 00:44:45 +00:00
|
|
|
|
|
|
|
#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS
|