Skip to content

Commit 3ffc5f0

Browse files
committed
docs:update CN translation for API reference storage(fatfs and index)
1 parent ae87b28 commit 3ffc5f0

File tree

12 files changed

+315
-242
lines changed

12 files changed

+315
-242
lines changed

docs/en/api-reference/storage/fatfs.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,3 @@ They provide implementation of disk I/O functions for SD/MMC cards and can be re
8484
.. doxygenfunction:: ff_diskio_register_wl_partition
8585
.. doxygenfunction:: ff_diskio_register_raw_partition
8686

87-

docs/en/api-reference/storage/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Storage API
1414
SPI Flash and Partition APIs <spi_flash>
1515
SPIFFS Filesystem <spiffs>
1616
Virtual Filesystem <vfs>
17-
Wear Levelling <wear-levelling>
17+
Wear Levelling API <wear-levelling>
18+
1819

1920

2021
Code examples for this API section are provided in the :example:`storage` directory of ESP-IDF examples.

docs/en/api-reference/storage/nvs_flash.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Introduction
88

99
Non-volatile storage (NVS) library is designed to store key-value pairs in flash. This section introduces some concepts used by NVS.
1010

11-
1211
Underlying storage
1312
^^^^^^^^^^^^^^^^^^
1413

@@ -32,14 +31,14 @@ NVS operates on key-value pairs. Keys are ASCII strings; the maximum key length
3231

3332
.. note::
3433

35-
String values are currently limited to 4000 bytes. This includes the null terminator. Blob values are limited to 508000 bytes or 97.6% of the partition size - 4000 bytes, whichever is lower.
34+
String values are currently limited to 4000 bytes. This includes the null terminator. Blob values are limited to 508,000 bytes or 97.6% of the partition size - 4000 bytes, whichever is lower.
3635

3736
Additional types, such as ``float`` and ``double`` might be added later.
3837

3938
Keys are required to be unique. Assigning a new value to an existing key works as follows:
4039

41-
- if the new value is of the same type as the old one, value is updated
42-
- if the new value has a different data type, an error is returned
40+
- If the new value is of the same type as the old one, value is updated.
41+
- If the new value has a different data type, an error is returned.
4342

4443
Data type check is also performed when reading a value. An error is returned if the data type of the read operation does not match the data type of the value.
4544

@@ -80,7 +79,7 @@ NVS Encryption
8079

8180
Data stored in NVS partitions can be encrypted using AES-XTS in the manner similar to the one mentioned in disk encryption standard IEEE P1619. For the purpose of encryption, each entry is treated as one `sector` and relative address of the entry (w.r.t. partition-start) is fed to the encryption algorithm as `sector-number`. The NVS Encryption can be enabled by enabling :ref:`CONFIG_NVS_ENCRYPTION`. The keys required for NVS encryption are stored in yet another partition, which is protected using :doc:`Flash Encryption <../../security/flash-encryption>`. Therefore, enabling :doc:`Flash Encryption <../../security/flash-encryption>` is a prerequisite for NVS encryption.
8281

83-
The NVS Encryption is enabled by default when :doc:`Flash Encryption <../../security/flash-encryption>` is enabled. This is done because WiFi driver stores credentials (like SSID and passphrase) in the default NVS partition. It is important to encrypt them as default choice if platform level encryption is already enabled.
82+
The NVS Encryption is enabled by default when :doc:`Flash Encryption <../../security/flash-encryption>` is enabled. This is done because Wi-Fi driver stores credentials (like SSID and passphrase) in the default NVS partition. It is important to encrypt them as default choice if platform level encryption is already enabled.
8483

8584
For using NVS encryption, the partition table must contain the :ref:`nvs_key_partition`. Two partition tables containing the :ref:`nvs_key_partition` are provided for NVS encryption under the partition table option (menuconfig->Partition Table). They can be selected with the project configuration menu (``idf.py menuconfig``). Please refer to the example :example:`security/flash_encryption` for how to configure and use NVS encryption feature.
8685

@@ -96,18 +95,18 @@ NVS key partition
9695
::
9796

9897
+-----------+--------------+-------------+----+
99-
| XTS encryption key(32) |
98+
| XTS encryption key (32) |
10099
+---------------------------------------------+
101100
| XTS tweak key (32) |
102101
+---------------------------------------------+
103-
| CRC32(4) |
102+
| CRC32 (4) |
104103
+---------------------------------------------+
105104

106105
The XTS encryption keys in the :ref:`nvs_key_partition` can be generated in one of the following two ways.
107106

108107
1. Generate the keys on the ESP chip:
109108

110-
When NVS encryption is enabled the :cpp:func:`nvs_flash_init` API function can be used to initialize the encrypted default NVS partition. The API function internally generates the XTS encryption keys on the ESP chip. The API function finds the first :ref:`nvs_key_partition`. Then the API function automatically generates and stores the nvs keys in that partition by making use of the :cpp:func:`nvs_flash_generate_keys` API function provided by :component_file:`nvs_flash/include/nvs_flash.h`. New keys are generated and stored only when the respective key partiton is empty. The same key partition can then be used to read the security configurations for initializing a custom encrypted NVS partition with help of :cpp:func:`nvs_flash_secure_init_partition`.
109+
When NVS encryption is enabled the :cpp:func:`nvs_flash_init` API function can be used to initialize the encrypted default NVS partition. The API function internally generates the XTS encryption keys on the ESP chip. The API function finds the first :ref:`nvs_key_partition`. Then the API function automatically generates and stores the NVS keys in that partition by making use of the :cpp:func:`nvs_flash_generate_keys` API function provided by :component_file:`nvs_flash/include/nvs_flash.h`. New keys are generated and stored only when the respective key partiton is empty. The same key partition can then be used to read the security configurations for initializing a custom encrypted NVS partition with help of :cpp:func:`nvs_flash_secure_init_partition`.
111110

112111
The API functions :cpp:func:`nvs_flash_secure_init` and :cpp:func:`nvs_flash_secure_init_partition` do not generate the keys internally. When these API functions are used for initializing encrypted NVS partitions, the keys can be generated after startup using the :cpp:func:`nvs_flash_generate_keys` API function provided by ``nvs_flash.h``. The API function will then write those keys onto the key-partition in encrypted form.
113112

@@ -178,7 +177,7 @@ You can find code examples in the :example:`storage` directory of ESP-IDF exampl
178177

179178
:example:`storage/nvs_rw_value_cxx`
180179

181-
This example does exactly the same as :example:`storage/nvs_rw_value`, except that it uses the C++ nvs handle class.
180+
This example does exactly the same as :example:`storage/nvs_rw_value`, except that it uses the C++ NVS handle class.
182181

183182
Internals
184183
---------
@@ -378,5 +377,3 @@ API Reference
378377
.. include-build-file:: inc/nvs_flash.inc
379378

380379
.. include-build-file:: inc/nvs.inc
381-
382-

docs/en/api-reference/storage/sdmmc.rst

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,30 @@ An example which combines the SDMMC driver with the FATFS library is provided in
7474

7575
For card configuration and data transfer, choose the pair of functions relevant to your case from the table below.
7676

77-
========================================================================= ================================= =================================
78-
Action Read Function Write Function
79-
========================================================================= ================================= =================================
80-
Read and write a single byte using IO_RW_DIRECT (CMD52) :cpp:func:`sdmmc_io_read_byte` :cpp:func:`sdmmc_io_write_byte`
81-
Read and write multiple bytes using IO_RW_EXTENDED (CMD53) in byte mode :cpp:func:`sdmmc_io_read_bytes` :cpp:func:`sdmmc_io_write_bytes`
82-
Read and write blocks of data using IO_RW_EXTENDED (CMD53) in block mode :cpp:func:`sdmmc_io_read_blocks` :cpp:func:`sdmmc_io_write_blocks`
83-
========================================================================= ================================= =================================
77+
.. list-table::
78+
:widths: 55 25 20
79+
:header-rows: 1
80+
81+
* - Action
82+
- Read Function
83+
- Write Function
84+
* - Read and write a single byte using IO_RW_DIRECT (CMD52)
85+
- :cpp:func:`sdmmc_io_read_byte`
86+
- :cpp:func:`sdmmc_io_write_byte`
87+
* - Read and write multiple bytes using IO_RW_EXTENDED (CMD53) in byte mode
88+
- :cpp:func:`sdmmc_io_read_bytes`
89+
- :cpp:func:`sdmmc_io_write_bytes`
90+
* - Read and write blocks of data using IO_RW_EXTENDED (CMD53) in block mode
91+
- :cpp:func:`sdmmc_io_read_blocks`
92+
- :cpp:func:`sdmmc_io_write_blocks`
8493

8594
SDIO interrupts can be enabled by the application using the function :cpp:func:`sdmmc_io_enable_int`. When using SDIO in 1-line mode, the D1 line also needs to be connected to use SDIO interrupts.
8695

8796
If you want the application to wait until the SDIO interrupt occurs, use :cpp:func:`sdmmc_io_wait_int`.
8897

8998
.. only:: esp32
9099

91-
There is a component ESSL (ESP Serial Slave Link) to use if you are communicating with an ESP32
92-
SDIO slave. See :doc:`/api-reference/protocols/esp_serial_slave_link` and example :example:`peripherals/sdio/host`.
100+
There is a component ESSL (ESP Serial Slave Link) to use if you are communicating with an ESP32 SDIO slave. See :doc:`/api-reference/protocols/esp_serial_slave_link` and example :example:`peripherals/sdio/host`.
93101

94102
Combo (memory + IO) cards
95103
^^^^^^^^^^^^^^^^^^^^^^^^^

docs/en/api-reference/storage/spi_flash.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Overview
77
--------
88
The spi_flash component contains API functions related to reading, writing, erasing, memory mapping for data in the external flash. The spi_flash component also has higher-level API functions which work with partitions defined in the :doc:`partition table </api-guides/partition-tables>`.
99

10-
Different from the API before IDF v4.0, the functionality of esp_flash_* APIs is not limited to the "main" SPI flash chip (the same SPI flash chip from which program runs). With different chip pointers, you can access to external flashes chips connected to not only SPI0/1 but also other SPI buses like SPI2.
10+
Different from the API before IDF v4.0, the functionality of `esp_flash_*` APIs is not limited to the "main" SPI flash chip (the same SPI flash chip from which program runs). With different chip pointers, you can access to external flash chips connected to not only SPI0/1 but also other SPI buses like SPI2.
1111

1212
.. note::
1313

@@ -20,7 +20,7 @@ Different from the API before IDF v4.0, the functionality of esp_flash_* APIs is
2020
Flash APIs after IDF v4.0 are no longer *atomic*. A writing operation during another on-going read operation, on the overlapped flash address, may cause the return data from the read operation to be partly same as before, and partly updated as new written.
2121

2222

23-
Kconfig option :ref:`CONFIG_SPI_FLASH_USE_LEGACY_IMPL` can be used to switch ``spi_flash_*`` functions back to the implementation before IDF v4.0. However, the code size may get bigger if you use the new API and the old API the same time.
23+
Kconfig option :ref:`CONFIG_SPI_FLASH_USE_LEGACY_IMPL` can be used to switch ``spi_flash_*`` functions back to the implementation before ESP-IDF v4.0. However, the code size may get bigger if you use the new API and the old API at the same time.
2424

2525
Encrypted reads and writes use the old implementation, even if :ref:`CONFIG_SPI_FLASH_USE_LEGACY_IMPL` is not enabled. As such, encrypted flash operations are only supported with the main flash chip (and not with other flash chips, that is on SPI1 with different CS, or on other SPI buses). Reading through cache is only supported on the main flash, which is determined by the HW.
2626

@@ -96,7 +96,7 @@ Concurrency Constraints for flash on SPI1
9696

9797
.. attention::
9898

99-
The SPI0/1 bus is shared between the instruction & data cache (for firmware execution) and the SPI1 peripheral (controlled by the drivers including this SPI Flash driver). Hence, calling SPI Flash API on SPI1 bus (including the main flash) will cause significant influence to the whole system. See :doc:`spi_flash_concurrency` for more details.
99+
The SPI0/1 bus is shared between the instruction & data cache (for firmware execution) and the SPI1 peripheral (controlled by the drivers including this SPI flash driver). Hence, calling SPI Flash API on SPI1 bus (including the main flash) will cause significant influence to the whole system. See :doc:`spi_flash_concurrency` for more details.
100100

101101
.. _flash-partition-apis:
102102

@@ -147,11 +147,12 @@ Memory mapping API are declared in ``esp_spi_flash.h`` and ``esp_partition.h``:
147147
Differences between :cpp:func:`spi_flash_mmap` and :cpp:func:`esp_partition_mmap` are as follows:
148148

149149
- :cpp:func:`spi_flash_mmap` must be given a {IDF_TARGET_CACHE_SIZE} aligned physical address.
150-
- :cpp:func:`esp_partition_mmap` may be given any arbitrary offset within the partition, it will adjust the returned pointer to mapped memory as necessary
150+
- :cpp:func:`esp_partition_mmap` may be given any arbitrary offset within the partition, it will adjust the returned pointer to mapped memory as necessary.
151151

152152
Note that since memory mapping happens in pages, it may be possible to read data outside of the partition provided to ``esp_partition_mmap``, regardless of the partition boundary.
153153

154-
.. note:: mmap is supported by cache, so it can only be used on main flash.
154+
.. note::
155+
mmap is supported by cache, so it can only be used on main flash.
155156

156157
SPI Flash Implementation
157158
------------------------
@@ -219,13 +220,13 @@ In order to perform some flash operations, it is necessary to make sure that bot
219220
- In a single-core setup, the SDK does it by disabling interrupts/scheduler before performing the flash operation.
220221
- In a dual-core setup, this is slightly more complicated as the SDK needs to make sure that the other CPU is not running any code from flash.
221222

222-
When SPI flash API is called on CPU A (can be PRO or APP), start the spi_flash_op_block_func function on CPU B using the esp_ipc_call API. This API wakes up a high priority task on CPU B and tells it to execute a given function, in this case, spi_flash_op_block_func. This function disables cache on CPU B and signals that the cache is disabled by setting the s_flash_op_can_start flag. Then the task on CPU A disables cache as well and proceeds to execute flash operation.
223+
When SPI flash API is called on CPU A (can be PRO or APP), start the ``spi_flash_op_block_func`` function on CPU B using the ``esp_ipc_call`` API. This API wakes up a high priority task on CPU B and tells it to execute a given function, in this case, ``spi_flash_op_block_func``. This function disables cache on CPU B and signals that the cache is disabled by setting the ``s_flash_op_can_start`` flag. Then the task on CPU A disables cache as well and proceeds to execute flash operation.
223224

224225
While a flash operation is running, interrupts can still run on CPUs A and B. It is assumed that all interrupt code is placed into RAM. Once the interrupt allocation API is added, a flag should be added to request the interrupt to be disabled for the duration of a flash operations.
225226

226-
Once the flash operation is complete, the 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 CPU A as well and returns control to the calling code.
227+
Once the flash operation is complete, the 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 CPU A as well and returns control to the calling code.
227228

228-
Additionally, all API functions are protected with a mutex (s_flash_op_mutex).
229+
Additionally, all API functions are protected with a mutex (``s_flash_op_mutex``).
229230

230231
In a single core environment (:ref:`CONFIG_FREERTOS_UNICORE` enabled), you need to disable both caches, so that no inter-CPU communication can take place.
231232

docs/en/api-reference/storage/spiffs.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ To flash the image onto {IDF_TARGET_NAME} at offset 0x110000, run::
112112

113113
python esptool.py --chip {IDF_TARGET_PATH_NAME} --port [port] --baud [baud] write_flash -z 0x110000 spiffs.bin
114114

115-
116115
Notes on which SPIFFS tool to use
117116
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118117

0 commit comments

Comments
 (0)