資源簡(jiǎn)介
本例程利用fat從tf卡里讀取音頻文件,通過spi傳遞到vs1003b進(jìn)行播放。并實(shí)現(xiàn)了控制vs1003b io口的功能。

代碼片段和文件信息
/*-----------------------------------------------------------------------*/
/*?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?“sdcard.h“
/*-----------------------------------------------------------------------*/
/*?Correspondence?between?physical?drive?number?and?physical?drive.??????*/
#define?BlockSize????????????512?/*?Block?Size?in?Bytes?*/
#define?SD_Mode 0 //0?dma1?interrupt
static?SD_CardInfo?SDCardInfo;
/*-----------------------------------------------------------------------*/
/*?Inidialize?a?Drive????????????????????????????????????????????????????*/
DSTATUS?disk_initialize?(
BYTE?drv /*?Physical?drive?nmuber?(0..)?*/
)
{
????SD_Error?Status;
if(drv==0)
{
???? Status?=?SD_Init();
????
???? if(Status?!=?SD_OK)
???? {
???????? return?STA_NOINIT;?//其他錯(cuò)誤:初始化失敗
???? }
???? else
???? {
?? Status?=?SD_GetCardInfo(&SDCardInfo);?//讀sd卡信息
??? if?(Status?!=?SD_OK)
???? {
????? return??STA_NOINIT;//RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
????????}
??????????????//?Select?Card?
????? Status?=?SD_SelectDeselect((u32)?(SDCardInfo.RCA?<16));
????? if?(Status?!=?SD_OK)
????? {
???????? return??STA_NOINIT;//RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
????? }
??? switch(SD_Mode)
??? {
???? case?0:??//dma方式
???? Status?=?SD_EnableWideBusOperation(SDIO_BusWide_1b);
??????? if?(Status?!=?SD_OK)
???????? {??
????????? return?RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
???????? }
??????? Status?=?SD_SetDeviceMode(SD_DMA_MODE);
?????? if?(Status?!=?SD_OK)
?????? {
????????? return?RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
?????? }
?????? break;
???? case?1:??//中斷方式
??????? Status?=?SD_EnableWideBusOperation(SDIO_BusWide_1b);
??????? if?(Status?!=?SD_OK)
???????? {??
????????? return?RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
???????? }
????????
??????? Status?=?SD_SetDeviceMode(SD_INTERRUPT_MODE);??
?????? if?(Status?!=?SD_OK)
?????? {
????????? return?RES_NOTRDY;??//報(bào)NOT?READY錯(cuò)誤
?????? }
??????? break;
???????
????? default?:
????? return?RES_NOTRDY;
??? }
? return?0;???????????//初始化成功
? }
????}
????else//僅支持磁盤0的操作
????{
return?STA_NOINIT;??
????}
}
/*-----------------------------------------------------------------------*/
/*?Return?Disk?Status????????????????????????????????????????????????????*/
DSTATUS?disk_status?(
BYTE?drv /*?Physical?drive?nmuber?(0..)?*/
)
{
?if(drv==0)
?{
?????return?0;???????????????//初始化成功
?}
?else????//僅支持磁盤0的操作
?{
return?STA_NOINIT;??
?}
}?
/*--------------------------------------------------------
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????9882??2010-05-06?14:47??8.Vs1003b\FatFS\diskio.c
?????文件???????1907??2010-05-06?14:49??8.Vs1003b\FatFS\diskio.h
?????文件?????100215??2010-05-09?16:22??8.Vs1003b\FatFS\ff.c
?????文件??????29898??2010-05-09?16:22??8.Vs1003b\FatFS\ff.h
?????文件???????6339??2009-11-03?00:44??8.Vs1003b\FatFS\ffconf.h
?????文件????????898??2010-05-06?14:56??8.Vs1003b\FatFS\integer.h
?????文件?????249495??2009-06-05?23:03??8.Vs1003b\FatFS\option\cc932.c
?????文件?????724207??2009-06-05?23:02??8.Vs1003b\FatFS\option\cc936.c
?????文件?????567659??2009-06-05?23:03??8.Vs1003b\FatFS\option\cc949.c
?????文件?????450671??2009-06-05?23:03??8.Vs1003b\FatFS\option\cc950.c
?????文件??????30143??2009-06-13?20:45??8.Vs1003b\FatFS\option\ccsbcs.c
?????文件???????4058??2010-02-12?23:50??8.Vs1003b\FatFS\option\syncobj.c
?????文件???????5239??2009-11-03?00:43??8.Vs1003b\FatFS\ReadMe.txt
?????文件????????205??2010-07-20?20:25??8.Vs1003b\Jli
?????文件??????16249??2009-04-06?10:30??8.Vs1003b\Lib\core_cm3.c
?????文件??????42077??2009-04-06?10:30??8.Vs1003b\Lib\core_cm3.h
?????文件???????4951??2009-04-06?10:30??8.Vs1003b\Lib\inc\misc.h
?????文件??????19558??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_adc.h
?????文件???????7373??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_bkp.h
?????文件??????14289??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_can.h
?????文件???????1980??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_crc.h
?????文件??????10271??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_dac.h
?????文件???????2980??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_dbgmcu.h
?????文件??????18790??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_dma.h
?????文件???????5833??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_exti.h
?????文件??????14446??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_flash.h
?????文件??????17276??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_fsmc.h
?????文件??????15050??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_gpio.h
?????文件??????16923??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_i2c.h
?????文件???????3677??2009-04-06?10:30??8.Vs1003b\Lib\inc\stm32f10x_iwdg.h
............此處省略61個(gè)文件信息
- 上一篇:改進(jìn)模擬退火算法求解TSP問題
- 下一篇:qt5 qftp官方源碼
評(píng)論
共有 條評(píng)論