91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-05
  • 語言: 其他
  • 標簽: MSP430??SD卡??FAT16FS??

資源簡介

MMC驅動層包含SD卡讀寫操作接口;FAT層包含文件操作接口。

資源截圖

代碼片段和文件信息

//?***********************************************************
//?File:?mmc.c
//?Description:?Library?to?access?a?MultiMediaCard
//??????????????functions:?init?read?write?...
//??C.?Speck?/?S.?Schauer
//??Texas?Instruments?Inc
//??June?2005
//
//?Version?1.1
//???corrected?comments?about?connection?the?MMC?to?the?MSP430
//???increased?timeout?in?mmcGetXXResponse
//
//?***********************************************************
//?MMC?Lib
//?***********************************************************
#include?
#include?“mmc.h“

//?Function?Prototypes
char?mmcGetResponse(void);
char?mmcGetXXResponse(const?char?resp);
//?char?mmcCheckBusy(void);
unsigned?char?spiSendByte(const?unsigned?char?data);
char?mmc_GoIdle();

//?Varialbes
//char?mmc_buffer[512]?=?{?0?};???????????????//?Buffer?for?mmc?i/o?for?data?and?registers

//---------------------------------------------------------------------
unsigned?char?spiSendByte(const?unsigned?char?data)
{
??while?(!(USICTL1&USIIFG));??????????????//?Wait?for?RX?to?finish
??USISRL=data;
??USICNT?=?8;?????????????????????????????//?send?8?bits?of?data
??while?(!(USICTL1&USIIFG));??????????????//?Wait?for?RX?to?finish
??return?(USISRL);?????????????????????//?Store?data
}

void?MMC_initSPI(void){
??//chip?select
??SD_CSn_PxDIR|=SD_CSn_PIN;
??SD_CSn_PxOUT|=SD_CSn_PIN;


??USICTL0?|=?USIPE7?+?USIPE6?+?USIPE5?+?USIMST?+?USIOE;?//?Port?SPI?master
??//USICTL1?|=?USICKPH;?//??USICKPH;?????????????????????????//?Counter?interrupt?flag?remains?set
??USICKCTL?=?USIDIV_0?+?USISSEL_2?+?USICKPL;??????????//?/4?SMCLK?+?USICKPL?+
??USICTL0?&=?~USISWRST;?????????????????????//?USI?released?for?operation

}


//?Initialize?MMC?card
//set?DI?and?CS?high?and?apply?more?than?74?pulses?to?SCLK
char?initMMC?(void){
??int?i;

??CS_HIGH();?//sey?CS?high
??for(i=0;i<11;i++)
????spiSendByte(0xff);//set?DI?high?with?ff?(10?times)

??return?(mmc_GoIdle());
}

char?mmc_GoIdle(){
??char?response=0x01;
??CS_LOW();

??//Send?Command?0?to?put?MMC?in?SPI?mode
??mmcSendCmd(MMC_GO_IDLE_STATE00x95);
??//Now?wait?for?READY?RESPONSE
??if(mmcGetResponse()!=0x01)
????return?MMC_INIT_ERROR;

??while(response==0x01)
??{
????CS_HIGH();
????spiSendByte(0xff);
????CS_LOW();
????mmcSendCmd(MMC_SEND_OP_COND0x000xff);
????response=mmcGetResponse();
??}
??CS_HIGH();
??spiSendByte(0xff);
??return?(MMC_SUCCESS);
}

//?mmc?Get?Responce
char?mmcGetResponse(void)
{
??//Response?comes?1-8bytes?after?command
??//the?first?bit?will?be?a?0
??//followed?by?an?error?code
??//data?will?be?0xff?until?response
??int?i=0;

??char?response;

??while(i<=64)
??{
????response=spiSendByte(0xff);
????if(response==0x00)break;
????if(response==0x01)break;
????i++;
??}
??return?response;
}

char?mmcGetXXResponse(const?char?resp)
{
??//Response?comes?1-8bytes?after?command
??//the?first?bit?will?be?a?0
??//followed?by?an?error?code
??//data?will?be?0xff?un

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????14457??2012-03-28?14:24??SD\mmc.c

?????文件???????4862??2012-04-03?21:16??SD\mmc.h

?????文件??????13310??2012-04-01?22:14??SD\ThinFAT.c

?????文件???????3489??2012-04-01?22:14??SD\ThinFAT.h

?????目錄??????????0??2012-04-02?13:53??SD

-----------?---------??----------?-----??----

????????????????36118????????????????????5


評論

共有 條評論