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 _Partition_H_
|
|
|
|
#define _Partition_H_
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
#include "Flash_Access.h"
|
|
|
|
#include "esp_partition.h"
|
2022-10-14 08:15:32 -04:00
|
|
|
#include "spi_flash_mmap.h" // for SPI_FLASH_SEC_SIZE
|
2018-07-04 19:01:03 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief This class is used to access partition. Class implements Flash_Access interface
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Partition : public Flash_Access
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
Partition(const esp_partition_t *partition);
|
|
|
|
|
2023-03-30 10:15:43 -04:00
|
|
|
virtual size_t get_flash_size();
|
2018-07-04 19:01:03 -04:00
|
|
|
|
|
|
|
virtual esp_err_t erase_sector(size_t sector);
|
|
|
|
virtual esp_err_t erase_range(size_t start_address, size_t size);
|
|
|
|
|
|
|
|
virtual esp_err_t write(size_t dest_addr, const void *src, size_t size);
|
|
|
|
virtual esp_err_t read(size_t src_addr, void *dest, size_t size);
|
|
|
|
|
2023-03-30 10:15:43 -04:00
|
|
|
virtual size_t get_sector_size();
|
2023-09-07 09:59:47 -04:00
|
|
|
virtual bool is_readonly();
|
2018-07-04 19:01:03 -04:00
|
|
|
|
|
|
|
virtual ~Partition();
|
|
|
|
protected:
|
|
|
|
const esp_partition_t *partition;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _Partition_H_
|