|
发表于 2014-1-5 21:49:12
|
显示全部楼层
大概看了一下 估计类似znfat的字节流那样处理的,比如你要将读到的字节字节送到VS1003进行播放 可以在这里设置(假设vs1003的送数据函数为SengData(uchar dat))
- DRESULT disk_readp (
- BYTE* buffer, /* Pointer to the destination object */
- DWORD sector, /* Sector number (LBA) */
- WORD sofs, /* Offset in the sector */
- WORD count /* Byte count (bit15:destination) */
- )
- {
- DRESULT res;
- uint8 r1;
- uint16 bc;
-
- res = RES_ERROR;
- r1 = MMC_SD_SendCommand(17, sector<<9);//读命令
- if(r1 != 0x00)
- return res;
-
- SPI_CS_Assert();
-
- bc = 0;
- do
- { /* Wait for data packet */
- if(bc++ > 1000) {SPI_CS_Deassert();return res;}
-
- }while(SPI_WriteByte(0xff) != 0xfe); //等数据的开始
- /* Skip leading bytes */
- if (sofs)
- {
- bc = sofs;
- do
- {
- SPI_WriteByte(0xff);
- }
- while(--bc);
- }
- if(buffer) /* Store data to the memory */
- {
- bc = count;
- do
- {
- *(buffer++)=SPI_WriteByte(0xff);
- } while (--bc);
- }
- else /* Forward data to the outgoing stream (depends on the project) */
- {
- bc = count;
- do
- {
- SPI_WriteByte(0xff); //就是在这里改了 这里只是读取不用 可改为 SendData(uchar dat) 即可
- } while (--bc);
- }
-
复制代码 |
|