From 840076a741a92bfb76a1e689d0e3632c3fc87fc1 Mon Sep 17 00:00:00 2001 From: hqm <13720409820@163.com> Date: Fri, 12 Aug 2022 15:53:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86fatfs=5Fport=E4=BB=A5=E5=8F=8A=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9B=B8=E5=85=B3=E6=8C=87=E4=BB=A4=201.=20fatfs=5Fpo?= =?UTF-8?q?rt=E6=94=AF=E6=8C=81=E8=AE=BE=E7=BD=AE=E5=8D=B7=E6=A0=87=202.?= =?UTF-8?q?=20=E6=96=87=E4=BB=B6=E6=8C=87=E4=BB=A4=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/linux/Makefile | 5 ++++- example/linux/fatfs_disk_mmc.c | 13 ++++++------- example/linux/fatfs_disk_ram.c | 13 ++++++------- example/linux/xcmd_confg.h | 2 +- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/example/linux/Makefile b/example/linux/Makefile index b49f556..77a19c4 100755 --- a/example/linux/Makefile +++ b/example/linux/Makefile @@ -48,8 +48,11 @@ build/%.o:%.c mkbuilddir: mkdir -p build -.PHONY:clean +.PHONY:clean distclean clean: + rm -rf build xcmder xcmder.map + +distclean: rm -rf build xcmder fatfs.img xcmder.map diff --git a/example/linux/fatfs_disk_mmc.c b/example/linux/fatfs_disk_mmc.c index 2b7efc8..1f25523 100644 --- a/example/linux/fatfs_disk_mmc.c +++ b/example/linux/fatfs_disk_mmc.c @@ -6,7 +6,6 @@ #include #include #include -#include "diskio.h" #define MMC_DISK_SECTION_SIZE (512) #define MMC_DISK_SECTION_COUNT (1024) @@ -101,24 +100,24 @@ static DRESULT m_disk_ioctl(BYTE cmd, void *buff) int mmc_disk_init(void) { FRESULT res; - disk.disk_name = "MMC Disk"; disk.disk_initialize = m_disk_initialize; disk.disk_ioctl = m_disk_ioctl; disk.disk_read = m_disk_read; disk.disk_status = m_disk_status; disk.disk_write = m_disk_write; - if(f_disk_regist(&disk, 1) == -1) + + if(f_disk_regist(&disk, "MMC", 1) == -1) { printf("MMC disk regist ERROR!\r\n"); return FR_DISK_ERR; } - res = f_mount(&g_fs, "1:", 1); //挂载文件系统 , "1:"就是挂载的设备号为1的设备 + res = f_mount(&g_fs, disk.disk_path, 1); //挂载文件系统 , "1:"就是挂载的设备号为1的设备 if (res == FR_NO_FILESYSTEM) //FR_NO_FILESYSTEM值为13,表示没有有效的设备 { - res = f_mkfs("1:", 0, g_work, sizeof(g_work)); - res = f_mount(NULL, "1:", 1); //取消文件系统 - res = f_mount(&g_fs, "1:", 1); //挂载文件系统 + res = f_mkfs(disk.disk_path, 0, g_work, sizeof(g_work)); + res = f_mount(NULL, disk.disk_path, 1); //取消文件系统 + res = f_mount(&g_fs, disk.disk_path, 1); //挂载文件系统 } if(res == FR_OK) diff --git a/example/linux/fatfs_disk_ram.c b/example/linux/fatfs_disk_ram.c index 3163f7f..a1da327 100644 --- a/example/linux/fatfs_disk_ram.c +++ b/example/linux/fatfs_disk_ram.c @@ -5,7 +5,7 @@ static DiskIo_t disk; #define RAM_DISK_SECTION_SIZE (512) -#define RAM_DISK_SECTION_COUNT (1024) +#define RAM_DISK_SECTION_COUNT (256) static char *ram_buf[RAM_DISK_SECTION_COUNT][RAM_DISK_SECTION_SIZE]; static FATFS g_fs; static BYTE g_work[FF_MAX_SS]; @@ -56,24 +56,23 @@ static DRESULT m_disk_ioctl(BYTE cmd, void *buff) int ram_disk_init(void) { FRESULT res; - disk.disk_name = "RAM Disk"; disk.disk_initialize = m_disk_initialize; disk.disk_ioctl = m_disk_ioctl; disk.disk_read = m_disk_read; disk.disk_status = m_disk_status; disk.disk_write = m_disk_write; - if(f_disk_regist(&disk, 0) == -1) + if(f_disk_regist(&disk, "RAM", 0) == -1) { printf("RAM disk regist ERROR!\r\n"); return FR_DISK_ERR; } - res = f_mount(&g_fs, "0:", 1); //挂载文件系统 , "1:"就是挂载的设备号为1的设备 + res = f_mount(&g_fs, disk.disk_path, 1); //挂载文件系统 , "1:"就是挂载的设备号为1的设备 if (res == FR_NO_FILESYSTEM) //FR_NO_FILESYSTEM值为13,表示没有有效的设备 { - res = f_mkfs("0:", 0, g_work, sizeof(g_work)); - res = f_mount(NULL, "0:", 1); //取消文件系统 - res = f_mount(&g_fs, "0:", 1); //挂载文件系统 + res = f_mkfs(disk.disk_path, 0, g_work, sizeof(g_work)); + res = f_mount(NULL, disk.disk_path, 1); //取消文件系统 + res = f_mount(&g_fs, disk.disk_path, 1); //挂载文件系统 } if(res == FR_OK) diff --git a/example/linux/xcmd_confg.h b/example/linux/xcmd_confg.h index cff342d..dfed81d 100755 --- a/example/linux/xcmd_confg.h +++ b/example/linux/xcmd_confg.h @@ -17,7 +17,7 @@ extern "C" { #define XCMD_LINE_MAX_LENGTH (128) /* 命令行支持的最大字符数 */ #define XCMD_HISTORY_MAX_NUM (16) /* 支持的历史记录个数, 这个参数对内存的影响很大,建议arduino设置为0,0为不支持 */ -#define XCMD_PARAM_MAX_NUM (8) /* 支持输入的参数个数 */ +#define XCMD_PARAM_MAX_NUM (64) /* 支持输入的参数个数 */ // #define XCMD_DEFAULT_PROMPT "->" /* 提示符 */ // #define XCMD_DEFAULT_PROMPT_CLOLR TX_GREEN /* 提示符颜色 */ // #define ENABLE_XCMD_EXPORT /* 需要修改lds,启用后支持XCMD_EXPORT_CMD和XCMD_EXPORT_KEY方法导出命令 */