资源简介
stm32f103通过spi2接力个2M flash,型号AT45DB,作为盘符,在MDK上编译运行通过。(保护原作者权利,声明是网上下载的,自己稍微做下改动)
![](http://www.nz998.com/pic/37475.jpg)
代码片段和文件信息
/*-----------------------------------------------------------------------*/
/* Low level disk I/O module skeleton for FatFs (C)ChaN 2007 */
/*-----------------------------------------------------------------------*/
/* This is a stub disk I/O module that acts as front end of the existing */
/* disk I/O modules and attach it to FatFs module with common interface. */
/*-----------------------------------------------------------------------*/
#include “diskio.h“
#include “spi_flash.h“
/*-----------------------------------------------------------------------*/
/* Correspondence between physical drive number and physical drive. */
#define ATA 0
#define MMC 1
#define USB 2
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
DSTATUS disk_initialize (
BYTE drv /* Physical drive nmuber (0..) */
)
{
// DSTATUS stat;
int result;
if (drv)
{
return STA_NOINIT;
}
result = SPIFLASH_disk_initialize();
if (result)
{
return STA_NOINIT;
}
else
{
return 0;
}
#if 0
switch (drv) {
case ATA :
result = ATA_disk_initialize();
// translate the reslut code here
return stat;
case MMC :
result = MMC_disk_initialize();
// translate the reslut code here
return stat;
case USB :
result = USB_disk_initialize();
// translate the reslut code here
return stat;
}
return STA_NOINIT;
#endif
}
/*-----------------------------------------------------------------------*/
/* Return Disk Status */
DSTATUS disk_status (
BYTE drv /* Physical drive nmuber (0..) */
)
{
return 0;
#if 0
DSTATUS stat;
int result;
switch (drv) {
case ATA :
result = ATA_disk_status();
// translate the reslut code here
return stat;
case MMC :
result = MMC_disk_status();
// translate the reslut code here
return stat;
case USB :
result = USB_disk_status();
// translate the reslut code here
return stat;
}
return STA_NOINIT;
#endif
}
/*-----------------------------------------------------------------------*/
/* Read Sector(s) */
DRESULT disk_read (
BYTE drv /* Physical drive nmuber (0..) */
BYTE *buff /* Data buffer to store read data */
DWORD sector /* Sector address (LBA) */
BYTE count /* Number of sectors to read (1..255) */
)
{
//uint32_t res;
if (count > 1)
{
flash_page_read_mu(sectorcountbuff);
}
else
{
flash_page_read_si(sectorbuff);
}
return RES_OK;
}
/*-----------------------------------------------------------------------*/
/* Write Sector(s) */
#if _READONLY == 0
DRESULT disk_write (
BYTE drv /* Physical drive nmuber (0..) */
const BYTE *buff /* Data to be written */
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5657 2010-02-13 16:50 stm32_fats\fatfs\doc\00index_e.html
文件 5656 2010-02-13 16:50 stm32_fats\fatfs\doc\00index_j.html
文件 2639 2009-12-12 22:31 stm32_fats\fatfs\doc\css_e.css
文件 3002 2009-12-13 14:19 stm32_fats\fatfs\doc\css_j.css
文件 18001 2010-02-13 16:55 stm32_fats\fatfs\doc\en\appnote.html
文件 2541 2009-10-22 21:39 stm32_fats\fatfs\doc\en\chdir.html
文件 1623 2009-10-12 13:48 stm32_fats\fatfs\doc\en\chdrive.html
文件 3001 2009-10-22 21:39 stm32_fats\fatfs\doc\en\chmod.html
文件 2194 2009-10-12 13:53 stm32_fats\fatfs\doc\en\close.html
文件 1631 2009-11-15 22:25 stm32_fats\fatfs\doc\en\dinit.html
文件 2679 2010-01-28 21:15 stm32_fats\fatfs\doc\en\dioctl.html
文件 1901 2009-08-23 17:09 stm32_fats\fatfs\doc\en\dread.html
文件 1599 2008-10-20 00:02 stm32_fats\fatfs\doc\en\dstat.html
文件 1999 2009-08-23 17:06 stm32_fats\fatfs\doc\en\dwrite.html
文件 1423 2009-12-05 14:02 stm32_fats\fatfs\doc\en\fattime.html
文件 5587 2010-01-22 17:19 stm32_fats\fatfs\doc\en\filename.html
文件 4952 2009-10-12 13:54 stm32_fats\fatfs\doc\en\forward.html
文件 3390 2010-01-23 11:15 stm32_fats\fatfs\doc\en\getfree.html
文件 2224 2009-10-12 14:08 stm32_fats\fatfs\doc\en\gets.html
文件 3855 2010-01-23 11:16 stm32_fats\fatfs\doc\en\lseek.html
文件 2468 2009-10-22 21:40 stm32_fats\fatfs\doc\en\mkdir.html
文件 3567 2009-10-12 14:05 stm32_fats\fatfs\doc\en\mkfs.html
文件 2099 2009-10-12 14:04 stm32_fats\fatfs\doc\en\mount.html
文件 5819 2010-01-23 11:12 stm32_fats\fatfs\doc\en\open.html
文件 2497 2009-10-22 21:40 stm32_fats\fatfs\doc\en\opendir.html
文件 2563 2010-01-23 11:17 stm32_fats\fatfs\doc\en\printf.html
文件 1813 2009-10-12 14:11 stm32_fats\fatfs\doc\en\putc.html
文件 1906 2009-10-12 14:12 stm32_fats\fatfs\doc\en\puts.html
文件 2681 2009-10-12 14:02 stm32_fats\fatfs\doc\en\read.html
文件 4343 2009-10-22 00:38 stm32_fats\fatfs\doc\en\readdir.html
............此处省略285个文件信息
相关资源
- 直流无刷电机方波驱动 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)
- AD7606采集程序
- stm32 用SPI 方式读写 SDHC
- stm32通过DMA方式采集ADC数据
- 意法半导体STM全系列微控制器STM32ST
- 基于STM32芯片的SX1278 驱动 LORA.rar
- STM32的PCB封装库,以及原理图库,48
- SX1280.rar
- STM32 DS3231驱动.zip
- STM32F103C8T6+NRF24l01无线通信
- 21天学会嵌入式开发STM32.zip
- STM32 电子密码锁设计,LCD12864显示
- STM32 LCD12864并口驱动实验
评论
共有 条评论