Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources

This commit is contained in:
2026-07-06 11:30:13 +08:00
commit e76462eeb7
3451 changed files with 1415300 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include "vfs.h"
#include "fat.h"
#include "heap.h"
/*****************************************************************
* 从内存申请一片空间,然后格式化成一个fat的文件系统,这里假装是sd
***************************************************************/
int vfs_demo_fs_heap_init(uint8_t *heap_buf,uint32_t heap_size)
{
blockdevice_t *heap = blockdevice_heap_create(heap_buf,heap_size);
filesystem_t *fat = filesystem_fat_create();
uint8_t *src = (uint8_t*)0x10100000;
hw_memcpy(heap_buf,src,heap_size);
os_printf("Heap:%X\n",heap);
int err = fs_mount("/sd", fat, heap);
if (err == -1) {
os_printf("format / with FAT\n");
err = fs_format(fat, heap);
if (err == -1) {
os_printf("fs_format error: %s", strerror(errno));
return false;
}
err = fs_mount("/sd", fat, heap);
os_printf("errno:%d\n",errno);
if (err == -1) {
os_printf("fs_mount error: %s", strerror(errno));
return false;
}
}
return true;
}

View File

@@ -0,0 +1,31 @@
#include "vfs.h"
#include "fat.h"
/*****************************************************************
* 从内存申请一片空间,然后格式化成一个fat的文件系统,这里假装是sd
***************************************************************/
int vfs_demo_fs_sd_init()
{
extern blockdevice_t *blockdevice_sd_create();
blockdevice_t *heap = blockdevice_sd_create();
filesystem_t *fat = filesystem_fat_create();
os_printf("Heap:%X\n",heap);
int err = fs_mount("/sd", fat, heap);
if (err == -1) {
os_printf("format / with FAT\n");
err = fs_format(fat, heap);
if (err == -1) {
os_printf("fs_format error: %s", strerror(errno));
return false;
}
err = fs_mount("/sd", fat, heap);
os_printf("errno:%d\n",errno);
if (err == -1) {
os_printf("fs_mount error: %s", strerror(errno));
return false;
}
}
return true;
}