2022-02-21 16:09:24 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-07-04 19:01:03 -04:00
|
|
|
|
|
|
|
#ifndef _Flash_Access_H_
|
|
|
|
#define _Flash_Access_H_
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Universal flash access interface class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Flash_Access
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual size_t chip_size() = 0;
|
|
|
|
|
|
|
|
virtual esp_err_t erase_sector(size_t sector) = 0;
|
|
|
|
virtual esp_err_t erase_range(size_t start_address, size_t size) = 0;
|
|
|
|
|
|
|
|
virtual esp_err_t write(size_t dest_addr, const void *src, size_t size) = 0;
|
|
|
|
virtual esp_err_t read(size_t src_addr, void *dest, size_t size) = 0;
|
|
|
|
|
|
|
|
virtual size_t sector_size() = 0;
|
|
|
|
|
|
|
|
virtual esp_err_t flush()
|
|
|
|
{
|
|
|
|
return ESP_OK;
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual ~Flash_Access() {};
|
|
|
|
};
|
|
|
|
|
2020-11-10 02:40:01 -05:00
|
|
|
#endif // _Flash_Access_H_
|