mirror of
https://github.com/espressif/esp-idf
synced 2025-04-15 03:00:11 -04:00
The following three headers will be mockes: * esp_flash.h * esp_spi_flash.h * esp_partition.h * counter functions live in own header * add spi_flash sim dir for esp_err.h to Unity * modified gen_esp_err_to_name.py to ignore sim/ dir in spi_flash component Add cmock .yaml config file Add spi hal header until soc can mock the hal layer as well.
67 lines
1.7 KiB
C
67 lines
1.7 KiB
C
// 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.
|
|
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "esp_err.h"
|
|
#include "sdkconfig.h"
|
|
|
|
#if CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* Structure holding statistics for one type of operation
|
|
*/
|
|
typedef struct {
|
|
uint32_t count; // number of times operation was executed
|
|
uint32_t time; // total time taken, in microseconds
|
|
uint32_t bytes; // total number of bytes
|
|
} spi_flash_counter_t;
|
|
|
|
typedef struct {
|
|
spi_flash_counter_t read;
|
|
spi_flash_counter_t write;
|
|
spi_flash_counter_t erase;
|
|
} spi_flash_counters_t;
|
|
|
|
/**
|
|
* @brief Reset SPI flash operation counters
|
|
*/
|
|
void spi_flash_reset_counters(void);
|
|
|
|
/**
|
|
* @brief Print SPI flash operation counters
|
|
*/
|
|
void spi_flash_dump_counters(void);
|
|
|
|
/**
|
|
* @brief Return current SPI flash operation counters
|
|
*
|
|
* @return pointer to the spi_flash_counters_t structure holding values
|
|
* of the operation counters
|
|
*/
|
|
const spi_flash_counters_t* spi_flash_get_counters(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif //CONFIG_SPI_FLASH_ENABLE_COUNTERS
|
|
|