资源简介
在stm32f103中, 移植好的全部FATFS源码,并且封装了file_read ,file_write两个接口,二次开发只要根据自己的硬件,替换掉硬件读写口就行。有问题可以找我交流。

代码片段和文件信息
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN 2014 */
/*-----------------------------------------------------------------------*/
/* If a working storage control module is available it should be */
/* attached to the FatFs via a glue function rather than modifying it. */
/* This is an example of glue functions to attach various exsisting */
/* storage control modules to the FatFs module with a defined API. */
/*-----------------------------------------------------------------------*/
#include “includes.h“
#include “stm32f10x.h“
#include “system_api.h“
#include “mx25xx.h“
#include “diskio.h“
/*
*cluster/block: 同一个东西的不同叫法
* 在Windows下如NTFS等文件系统中叫做簇;
* 在Linux下如Ext4等文件系统中叫做块(block)
*
*sector: 即为扇区
*
*每个簇/块包含2的N次方个扇区
*/
#define MX25L32
#if defined MX25L16
#define MX25_DENST 0x15
#define FS_SECTOR_SIZE 512 /*512字节一个sector*/
#define FS_SECTOR_COUNT (2048*2) /*MX25L16一共2M,2*1024*1024/512 = 4096个sector*/
#define FS_BLOCK_SIZE 8 /*8个sector划为一个block\cluster*/
#elif defined MX25L32
#define MX25_DENST 0x16
#define FS_SECTOR_SIZE 512 /*512字节一个sector*/
#define FS_SECTOR_COUNT (2048*4) /*MX25L32一共4M,4*1024*1024/512 = 8192个sector*/
#define FS_BLOCK_SIZE 8 /*8个sector划为一个block\cluster*/
#else
#define MX25_DENST 0x17
#define FS_SECTOR_SIZE 512 /*512字节一个sector*/
#define FS_SECTOR_COUNT (2048*8) /*MX25L64一共8M,8*1024*1024/512 = 16384个sector*/
#define FS_BLOCK_SIZE 8 /*8个sector划为一个block\cluster*/
#endif
/**
* @brief
* @param
* This parameter can be one of the following values:
@
@param
@param
* @retval
* This parameter can be one of the following values:
*/
DSTATUS disk_initialize (
BYTE drv /* Physical drive nmuber (0..) */
)
{
struct exflash_id flashid;
mx25_init();
mx25_id_read(&flashid);
if(flashid.vendor!= MX25_DENST)
return RES_ERROR;
return RES_OK;
}
/**
* @brief
* @param
* This parameter can be one of the following values:
@
@param
@param
* @retval
* This parameter can be one of the following values:
*/
DSTATUS disk_status (
BYTE drv /* Physical drive nmuber (0..) */
)
{
return RES_OK;
}
/**
* @brief
* @param
* This parameter can be one of the following values:
@
@param
@param
* @retval
* This parameter can be one of the following values:
*/
DRESULT disk_read (
BYTE drv /* Physical drive nmuber to identify the drive */
BYTE *pbuf /* Data buffer to store read data */
DWORD sector /* Sector address in LBA */
UINT count /* Number of sectors to read */
)
{
for(; count > 0; count--)
{
mx25_read(sector*FS_SECTOR_SIZE pbuf FS_SECTOR_SIZE);
sector++;
pbuf += FS_SECTOR_SIZE;
}
return R
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 796 2015-09-05 12:51 fatfs\00readme.txt
文件 5133 2018-04-25 13:20 fatfs\diskio.c
文件 2724 2017-03-20 12:47 fatfs\diskio.h
文件 154279 2017-03-20 11:31 fatfs\ff.c
文件 13549 2017-03-20 16:18 fatfs\ff.h
文件 11350 2017-03-08 18:13 fatfs\ffconf.h
文件 3644 2018-03-31 21:46 fatfs\fs_api.c
文件 1139 2018-03-24 13:21 fatfs\fs_api.h
文件 704 2017-03-20 16:30 fatfs\integer.h
文件 249488 2014-05-19 00:56 fatfs\option\cc932.c
文件 724232 2014-05-19 00:56 fatfs\option\cc936.c
文件 567684 2014-05-19 00:56 fatfs\option\cc949.c
文件 450696 2014-05-19 00:56 fatfs\option\cc950.c
文件 30169 2014-05-19 00:56 fatfs\option\ccsbcs.c
文件 4705 2014-06-21 12:17 fatfs\option\syscall.c
文件 397 2014-05-19 00:56 fatfs\option\unicode.c
目录 0 2018-03-24 11:50 fatfs\option
目录 0 2018-08-03 11:14 fatfs
----------- --------- ---------- ----- ----
2220689 18
- 上一篇:MCNP计算
- 下一篇:利用栈求表达式的值,可供小学生作业,并能给出分数
相关资源
- stm32做的红外遥控解码程序
- 《emwin实战指南(基于STM32-ISO开发板)
- Beginning STM32: Developing with FreeRTOS libo
- stm32f103c8t6_sch.Lib
- ALIENTEK战舰STM32F1 V3开发板原理图.rar
- STM32F103RC+ADC+DMA多通道采样LCD显示
- I2C读写AT24C02 基于STM32F103 cube116540
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- STM32蓝牙和串口程序
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- stm32f030 IAP Demo(原创)
- STM32基于rt_thread操作系统的SDHC卡文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
- STM32F103 CC2500完整驱动(模拟SPI)
评论
共有 条评论