import RT-Thread@9217865c without bsp, libcpu and components/net
This commit is contained in:
commit
e2376a3709
1414 changed files with 390370 additions and 0 deletions
145
components/fal/docs/fal_api.md
Normal file
145
components/fal/docs/fal_api.md
Normal file
|
@ -0,0 +1,145 @@
|
|||
# FAL API
|
||||
|
||||
## 查找 Flash 设备
|
||||
|
||||
```C
|
||||
const struct fal_flash_dev *fal_flash_device_find(const char *name)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| name | Flash 设备名称 |
|
||||
| return | 如果查找成功,将返回 Flash 设备对象,查找失败返回 NULL |
|
||||
|
||||
## 查找 Flash 分区
|
||||
|
||||
```C
|
||||
const struct fal_partition *fal_partition_find(const char *name)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| name | Flash 分区名称 |
|
||||
| return | 如果查找成功,将返回 Flash 分区对象,查找失败返回 NULL |
|
||||
|
||||
## 获取分区表
|
||||
|
||||
```C
|
||||
const struct fal_partition *fal_get_partition_table(size_t *len)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| len | 分区表的长度 |
|
||||
| return | 分区表 |
|
||||
|
||||
## 临时设置分区表
|
||||
|
||||
FAL 初始化时会自动装载默认分区表。使用该设置将临时修改分区表,重启后会 **丢失** 该设置
|
||||
|
||||
```C
|
||||
void fal_set_partition_table_temp(struct fal_partition *table, size_t len)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| table | 分区表 |
|
||||
| len | 分区表的长度 |
|
||||
|
||||
## 从分区读取数据
|
||||
|
||||
```C
|
||||
int fal_partition_read(const struct fal_partition *part, uint32_t addr, uint8_t *buf, size_t size)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| part | 分区对象 |
|
||||
| addr | 相对分区的偏移地址 |
|
||||
| buf | 存放待读取数据的缓冲区 |
|
||||
| size | 待读取数据的大小 |
|
||||
| return | 返回实际读取的数据大小 |
|
||||
|
||||
## 往分区写入数据
|
||||
|
||||
```C
|
||||
int fal_partition_write(const struct fal_partition *part, uint32_t addr, const uint8_t *buf, size_t size)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| part | 分区对象 |
|
||||
| addr | 相对分区的偏移地址 |
|
||||
| buf | 存放待写入数据的缓冲区 |
|
||||
| size | 待写入数据的大小 |
|
||||
| return | 返回实际写入的数据大小 |
|
||||
|
||||
## 擦除分区数据
|
||||
|
||||
```C
|
||||
int fal_partition_erase(const struct fal_partition *part, uint32_t addr, size_t size)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| part | 分区对象 |
|
||||
| addr | 相对分区的偏移地址 |
|
||||
| size | 擦除区域的大小 |
|
||||
| return | 返回实际擦除的区域大小 |
|
||||
|
||||
## 擦除整个分区数据
|
||||
|
||||
```C
|
||||
int fal_partition_erase_all(const struct fal_partition *part)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| part | 分区对象 |
|
||||
| return | 返回实际擦除的区域大小 |
|
||||
|
||||
## 打印分区表
|
||||
|
||||
```c
|
||||
void fal_show_part_table(void)
|
||||
```
|
||||
|
||||
## 创建块设备
|
||||
|
||||
该函数可以根据指定的分区名称,创建对应的块设备,以便于在指定的分区上挂载文件系统
|
||||
|
||||
```C
|
||||
struct rt_device *fal_blk_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :----- | :----------------------- |
|
||||
| parition_name | 分区名称 |
|
||||
| return | 创建成功,则返回对应的块设备,失败返回空 |
|
||||
|
||||
## 创建 MTD Nor Flash 设备
|
||||
|
||||
该函数可以根据指定的分区名称,创建对应的 MTD Nor Flash 设备,以便于在指定的分区上挂载文件系统
|
||||
|
||||
```C
|
||||
struct rt_device *fal_mtd_nor_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :------------ | :---------------------------------------------------- |
|
||||
| parition_name | 分区名称 |
|
||||
| return | 创建成功,则返回对应的 MTD Nor Flash 设备,失败返回空 |
|
||||
|
||||
## 创建字符设备
|
||||
|
||||
该函数可以根据指定的分区名称,创建对应的字符设备,以便于通过 deivice 接口或 devfs 接口操作分区,开启了 POSIX 后,还可以通过 open/read/write 函数操作分区。
|
||||
|
||||
```C
|
||||
struct rt_device *fal_char_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| 参数 | 描述 |
|
||||
| :------------ | :----------------------------------------- |
|
||||
| parition_name | 分区名称 |
|
||||
| return | 创建成功,则返回对应的字符设备,失败返回空 |
|
||||
|
144
components/fal/docs/fal_api_en.md
Normal file
144
components/fal/docs/fal_api_en.md
Normal file
|
@ -0,0 +1,144 @@
|
|||
# FAL API
|
||||
|
||||
## Find Flash device
|
||||
|
||||
```C
|
||||
const struct fal_flash_dev *fal_flash_device_find(const char *name)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| name | Flash device name |
|
||||
| return | If the search is successful, the Flash device object will be returned, and if the search fails, it will return NULL |
|
||||
|
||||
## Find Flash Partition
|
||||
|
||||
```C
|
||||
const struct fal_partition *fal_partition_find(const char *name)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| name | Flash partition name |
|
||||
| return | If the search is successful, the Flash partition object will be returned, and if the search fails, it will return NULL |
|
||||
|
||||
## Get the partition table
|
||||
|
||||
```C
|
||||
const struct fal_partition *fal_get_partition_table(size_t *len)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| len | The length of the partition table |
|
||||
| return | Partition table |
|
||||
|
||||
## Temporarily set the partition table
|
||||
|
||||
The default partition table will be automatically loaded when FAL is initialized. Using this setting will temporarily modify the partition table and will **lost** this setting after restarting
|
||||
|
||||
```C
|
||||
void fal_set_partition_table_temp(struct fal_partition *table, size_t len)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| table | Partition table |
|
||||
| len | Length of the partition table |
|
||||
|
||||
## Read data from partition
|
||||
|
||||
```C
|
||||
int fal_partition_read(const struct fal_partition *part, uint32_t addr, uint8_t *buf, size_t size)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| part | Partition object |
|
||||
| addr | Relative partition offset address |
|
||||
| buf | Buffer to store the data to be read |
|
||||
| size | The size of the data to be read |
|
||||
| return | Return the actual read data size |
|
||||
|
||||
## Write data to partition
|
||||
|
||||
```C
|
||||
int fal_partition_write(const struct fal_partition *part, uint32_t addr, const uint8_t *buf, size_t size)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| part | Partition object |
|
||||
| addr | Relative partition offset address |
|
||||
| buf | Buffer to store data to be written |
|
||||
| size | The size of the data to be written |
|
||||
| return | Return the actual written data size |
|
||||
|
||||
## Erase partition data
|
||||
|
||||
```C
|
||||
int fal_partition_erase(const struct fal_partition *part, uint32_t addr, size_t size)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| part | Partition object |
|
||||
| addr | Relative partition offset address |
|
||||
| size | The size of the erased area |
|
||||
| return | Return the actual erased area size |
|
||||
|
||||
## Erase the entire partition data
|
||||
|
||||
```C
|
||||
int fal_partition_erase_all(const struct fal_partition *part)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| part | Partition object |
|
||||
| return | Return the actual erased area size |
|
||||
|
||||
## Print partition table
|
||||
|
||||
```c
|
||||
void fal_show_part_table(void)
|
||||
```
|
||||
|
||||
## Create block device
|
||||
|
||||
This function can create the corresponding block device according to the specified partition name, so as to mount the file system on the specified partition
|
||||
|
||||
```C
|
||||
struct rt_device *fal_blk_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :----- | :----------------------- |
|
||||
| parition_name | partition name |
|
||||
| return | If the creation is successful, the corresponding block device will be returned, and if it fails, empty |
|
||||
|
||||
## Create MTD Nor Flash device
|
||||
|
||||
This function can create the corresponding MTD Nor Flash device according to the specified partition name, so as to mount the file system on the specified partition
|
||||
|
||||
```C
|
||||
struct rt_device *fal_mtd_nor_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :------------ | :---------------------------------- ------------------ |
|
||||
| parition_name | Partition name |
|
||||
| return | If the creation is successful, the corresponding MTD Nor Flash device will be returned, otherwise empty |
|
||||
|
||||
## Create a character device
|
||||
|
||||
This function can create the corresponding character device according to the specified partition name to facilitate the operation of the partition through the deivice interface or the devfs interface. After POSIX is turned on, the partition can also be operated through the open/read/write function.
|
||||
|
||||
```C
|
||||
struct rt_device *fal_char_device_create(const char *parition_name)
|
||||
```
|
||||
|
||||
| Parameters | Description |
|
||||
| :------------ | :---------------------------------- ------- |
|
||||
| parition_name | partition name |
|
||||
| return | If the creation is successful, the corresponding character device will be returned, otherwise empty |
|
BIN
components/fal/docs/figures/fal-api-en.png
Normal file
BIN
components/fal/docs/figures/fal-api-en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
BIN
components/fal/docs/figures/fal-api.png
Normal file
BIN
components/fal/docs/figures/fal-api.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
BIN
components/fal/docs/figures/fal-port-en.png
Normal file
BIN
components/fal/docs/figures/fal-port-en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
components/fal/docs/figures/fal-port.png
Normal file
BIN
components/fal/docs/figures/fal-port.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
components/fal/docs/figures/fal_framework-en.png
Normal file
BIN
components/fal/docs/figures/fal_framework-en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
BIN
components/fal/docs/figures/fal_framework.png
Normal file
BIN
components/fal/docs/figures/fal_framework.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
Loading…
Add table
Add a link
Reference in a new issue