33 *
44 * SPDX-License-Identifier: Apache-2.0
55 *
6- * SPDX-FileContributor: 2015-2023 Espressif Systems (Shanghai) CO LTD
6+ * SPDX-FileContributor: 2015-2024 Espressif Systems (Shanghai) CO LTD
77 */
88
99#pragma once
1212#include "esp_err.h"
1313#include "driver/spi_common.h"
1414#include "driver/spi_master.h"
15- #include "dhara/map.h"
1615
1716#ifdef __cplusplus
1817extern "C" {
@@ -47,7 +46,7 @@ esp_err_t spi_nand_flash_init_device(spi_nand_flash_config_t *config, spi_nand_f
4746 * @param sector_id The id of the sector to read.
4847 * @return ESP_OK on success, or a flash error code if the read failed.
4948 */
50- esp_err_t spi_nand_flash_read_sector (spi_nand_flash_device_t * handle , uint8_t * buffer , dhara_sector_t sector_id );
49+ esp_err_t spi_nand_flash_read_sector (spi_nand_flash_device_t * handle , uint8_t * buffer , uint32_t sector_id );
5150
5251/** @brief Copy a sector to another sector from the nand flash.
5352 *
@@ -56,7 +55,7 @@ esp_err_t spi_nand_flash_read_sector(spi_nand_flash_device_t *handle, uint8_t *b
5655 * @param dst_sec The destination sector id to which data should be copied.
5756 * @return ESP_OK on success, or a flash error code if the copy failed.
5857 */
59- esp_err_t spi_nand_flash_copy_sector (spi_nand_flash_device_t * handle , dhara_sector_t src_sec , dhara_sector_t dst_sec );
58+ esp_err_t spi_nand_flash_copy_sector (spi_nand_flash_device_t * handle , uint32_t src_sec , uint32_t dst_sec );
6059
6160/** @brief Write a sector to the nand flash.
6261 *
@@ -65,7 +64,7 @@ esp_err_t spi_nand_flash_copy_sector(spi_nand_flash_device_t *handle, dhara_sect
6564 * @param sector_id The id of the sector to write.
6665 * @return ESP_OK on success, or a flash error code if the write failed.
6766 */
68- esp_err_t spi_nand_flash_write_sector (spi_nand_flash_device_t * handle , const uint8_t * buffer , dhara_sector_t sector_id );
67+ esp_err_t spi_nand_flash_write_sector (spi_nand_flash_device_t * handle , const uint8_t * buffer , uint32_t sector_id );
6968
7069/** @brief Trim sector from the nand flash.
7170 *
@@ -77,7 +76,7 @@ esp_err_t spi_nand_flash_write_sector(spi_nand_flash_device_t *handle, const uin
7776 * @param sector_id The id of the sector to be trimmed.
7877 * @return ESP_OK on success, or a flash error code if the trim failed.
7978 */
80- esp_err_t spi_nand_flash_trim (spi_nand_flash_device_t * handle , dhara_sector_t sector_id );
79+ esp_err_t spi_nand_flash_trim (spi_nand_flash_device_t * handle , uint32_t sector_id );
8180
8281/** @brief Synchronizes any cache to the device.
8382 *
@@ -94,23 +93,39 @@ esp_err_t spi_nand_flash_sync(spi_nand_flash_device_t *handle);
9493 * @param[out] number_of_sectors A pointer of where to put the return value
9594 * @return ESP_OK on success, or a flash error code if the operation failed.
9695 */
97- esp_err_t spi_nand_flash_get_capacity (spi_nand_flash_device_t * handle , dhara_sector_t * number_of_sectors );
96+ esp_err_t spi_nand_flash_get_capacity (spi_nand_flash_device_t * handle , uint32_t * number_of_sectors );
9897
9998/** @brief Retrieve the size of each sector.
10099 *
101100 * @param handle The handle to the SPI nand flash chip.
102- * @param[out] number_of_sectors A pointer of where to put the return value
101+ * @param[out] sectors_size A pointer of where to put the return value
103102 * @return ESP_OK on success, or a flash error code if the operation failed.
104103 */
105104esp_err_t spi_nand_flash_get_sector_size (spi_nand_flash_device_t * handle , uint32_t * sector_size );
106105
106+ /** @brief Retrieve the size of each block.
107+ *
108+ * @param handle The handle to the SPI nand flash chip.
109+ * @param[out] block_size A pointer of where to put the return value
110+ * @return ESP_OK on success, or a flash error code if the operation failed.
111+ */
112+ esp_err_t spi_nand_flash_get_block_size (spi_nand_flash_device_t * handle , uint32_t * block_size );
113+
107114/** @brief Erases the entire chip, invalidating any data on the chip.
108115 *
109116 * @param handle The handle to the SPI nand flash chip.
110117 * @return ESP_OK on success, or a flash error code if the erase failed.
111118 */
112119esp_err_t spi_nand_erase_chip (spi_nand_flash_device_t * handle );
113120
121+ /** @brief Retrieve the number of blocks available.
122+ *
123+ * @param handle The handle to the SPI nand flash chip.
124+ * @param[out] number_of_blocks A pointer of where to put the return value
125+ * @return ESP_OK on success, or a flash error code if the operation failed.
126+ */
127+ esp_err_t spi_nand_flash_get_block_num (spi_nand_flash_device_t * handle , uint32_t * number_of_blocks );
128+
114129/** @brief De-initialize the handle, releasing any resources reserved.
115130 *
116131 * @param handle The handle to the SPI nand flash chip.
0 commit comments