OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4398|回复: 5

原子哥,我下载了最新版的FATFS,移植到例程里,f_fkms文件的参数由3个变成了5个,这个需要怎么修改?

[复制链接]

2

主题

7

帖子

0

精华

新手上路

积分
34
金钱
34
注册时间
2016-4-28
在线时间
7 小时
发表于 2016-10-14 15:49:07 | 显示全部楼层 |阅读模式
1金钱
例程上的函数名
FRESULT f_mkfs (
        const TCHAR* path,        /* Logical drive number */
        BYTE sfd,                        /* Partitioning rule 0:FDISK, 1:SFD */
        UINT au                                /* Allocation unit [bytes] */
)
网站上最新版的变成了这个样子
FRESULT f_mkfs (
        const TCHAR* path,        /* Logical drive number */
        BYTE opt,                        /* Format option */
        DWORD au,                        /* Size of allocation unit [byte] */
        void* work,                        /* Pointer to working buffer */
        UINT len                        /* Size of working buffer */

)
函数很长就不粘过来了,需要移植的话怎么修改呢?

最佳答案

查看完整内容[请看2#楼]

path Pointer to the null-terminated string specifies the logical drive to be formatted. If there is no drive number in it, it means the default drive. The logical drive may or may not be mounted for the format process. opt Specifies the format option in combination of FM_FAT, FM_FAT32, FM_EXFAT and bitwise-or of these three, FM_ANY. FM_EXFAT is ignored when exFAT is not enabled. These flags spe ...
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

19

主题

430

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1341
金钱
1341
注册时间
2016-4-22
在线时间
187 小时
发表于 2016-10-14 15:49:08 | 显示全部楼层
path
Pointer to the null-terminated string specifies the logical drive to be formatted. If there is no drive number in it, it means the default drive. The logical drive may or may not be mounted for the format process.
opt
Specifies the format option in combination of FM_FAT, FM_FAT32, FM_EXFAT and bitwise-or of these three, FM_ANY. FM_EXFAT is ignored when exFAT is not enabled. These flags specify which FAT type to be created on the volume. If two or more types are specified, one out of them will be selected depends on the volume size. The flag FM_SFD specifies to place the volume on the drive in SFD format.
au
Specifies size of the allocation unit (cluter) in unit of byte. The valid value is N times the sector size. N is power of 2 from 1 to 128 for FAT volume and upto 16MiB for exFAT volume. If zero is given, the default allocation unit size is selected depends on the volume size.
work
Pointer to the working buffer used for the format process.
len
Size of the working buffer in unit of byte. It needs to be the sector size at least. Plenty of working buffer reduces number of write transaction to the device and the format process will be finished quickly.
伤情最是晚凉天,憔悴斯人不堪怜。
邀酒摧肠三杯醉,寻香惊梦五更寒。
钗头凤斜卿有泪,荼蘼花了我无缘。
小楼寂寞新雨月,也难如钩也难圆。
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
34
金钱
34
注册时间
2016-4-28
在线时间
7 小时
 楼主| 发表于 2016-10-14 15:49:33 | 显示全部楼层
求大神解答v!
回复

使用道具 举报

19

主题

430

帖子

0

精华

金牌会员

Rank: 6Rank: 6

积分
1341
金钱
1341
注册时间
2016-4-22
在线时间
187 小时
发表于 2016-10-14 17:16:26 | 显示全部楼层
[mw_shl_code=c,true]int main (void)
{
    FATFS fs;           /* File system object */
    FIL fil;            /* File object */
    FRESULT res;        /* API result code */
    UINT bw;            /* Bytes written */
    BYTE work[_MAX_SS]; /* Work area (larger is better for process time) */


    /* Create FAT volume */
    res = f_mkfs("", FM_ANY, 0, work, sizeof work);
    if (res) ...

    /* Register work area */
    f_mount(&fs, "", 0);

    /* Create a file as new */
    res = f_open(&fil, "hello.txt", FA_CREATE_NEW | FA_WRITE);
    if (res) ...

    /* Write a message */
    f_write(&fil, "Hello, World!\r\n", 15, &bw);
    if (bw != 15) ...

    /* Close the file */
    f_close(&fil);

    /* Unregister work area */
    f_mount(0, "", 0);
[/mw_shl_code]
伤情最是晚凉天,憔悴斯人不堪怜。
邀酒摧肠三杯醉,寻香惊梦五更寒。
钗头凤斜卿有泪,荼蘼花了我无缘。
小楼寂寞新雨月,也难如钩也难圆。
回复

使用道具 举报

2

主题

7

帖子

0

精华

新手上路

积分
34
金钱
34
注册时间
2016-4-28
在线时间
7 小时
 楼主| 发表于 2016-10-15 13:21:21 | 显示全部楼层
多谢多谢!
回复

使用道具 举报

30

主题

97

帖子

0

精华

初级会员

Rank: 2

积分
161
金钱
161
注册时间
2016-4-13
在线时间
68 小时
发表于 2018-12-15 20:49:11 | 显示全部楼层

你的文件系统实现了吗,可以请教一下吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-22 19:27

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表