ucfs分析扩展

本文介绍如何基于ucfs扩展文件系统,使其支持除RAM、SMC外的设备,如Flash。主要涉及数据结构FS__devinfo_type的修改,fs_conf.h和fs_info.c文件的更新,以及FS__device_type和FS__fsl_type结构的定义,通过层次调用来实现文件的读写操作。

以提供的ucfs为基础,可以对它进行扩展,让其支持除了ram、smc等存储设备以外的设备,比如flash等。这里仍以它自带的ram,fat为例,说明之。
总的来看,最终要的就是数据结构FS__devinfo_type,在其中包括了操作系统类型(fat)和底层硬驱动的信息,并可以利用这些信息进行进一步的映射。


方法步骤如下:
1.在fs_conf.h中添加

#define FS_USE_FAT_FSL          1    /* FAT12/FAT16 file system */
#if FS_USE_FAT_FSL
  #define FS_MAXDEV             (FS_USE_SMC_DRIVER + FS_USE_WINDRIVE_DRIVER + FS_USE_RAMDISK_DRIVER + FS_USE_MMC_DRIVER + FS_USE_IDE_DRIVER)
  #define FS_FAT_MAXUNIT        2         /* max number of medias per device */
  #define FS_FAT_NOFAT32        0         /* 1 disables FAT32 support */
  #define FS_FAT_NOFORMAT       0       &n

µC/FS µC/FS is a compact, reliable, high-performance file system. It offers full-featured file and directory access with flexible device and volume management including support for partitions. Source Code: µC/FS is provided in ANSI-C source to licensees. The source code is written to an exacting coding standard that emphasizes cleanness and readability. Moreover, extensive comments pepper the code to elucidate its logic and describe global variables and functions. Where appropriate, the code directly references standards and supporting documents. Device Drivers: Device drivers are available for most common media including SD/MMC cards, NAND flash, NOR flash. Each of these is written with a clear, layered structure so that it can easily be ported to your hardware. The device driver structure is simple—basically just initialization, read and write functions—so that µC/FS can easily be ported to a new medium. Devices and Volumes: Multiple media can be accessed simultaneously, including multiple instances of the same type of medium (since all drivers are re-entrant). DOS partitions are supported, so more than one volume can be located on a device. In addition, the logical device driver allows a single volume to span several (typically identical) devices, such as a bank of flash chips. FAT: All standard FAT variants and features are supported including FAT12/FAT16/FAT32 and long file names, which encompasses Unicode file names. Files can be up to 4-GB and volumes up to 8-TB (the standard maximum). An optional journaling module provides total power fail-safety to the FAT system driver. Application Programming Interface (API): µC/FS provides two APIs for file and directory access. A proprietary API with parallel argument placement and meaningful return error codes is provided, with functions like FSFile_Wr(), FSFile_Rd() and FSFile_PosSet(). Alternatively, a standard POSIX-like API is provided, including functions like fs_fwrite(), fs_fread() and fs_fsetpos
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值