fatreadfile.c
来自「用C51单片机实现的MP3播放器的c代码程序。」· C语言 代码 · 共 43 行
C
43 行
#ifndef _FAT32_DEFINE
#include "FAT32.c"
#endif
WORD FAT32ReadFile(BYTE fp);
WORD FAT32ReadFile(BYTE fp)
{
register WORD tmp;
if (FCB[fp].ByteCnt==FCB[fp].Size) return(0);
else
{
FCB[fp].ByteCnt+=IDE.BytesPerSec;
if (FCB[fp].ByteCnt<=FCB[fp].Size) tmp=IDE.BytesPerSec;
else
{
FCB[fp].ByteCnt-=IDE.BytesPerSec;
tmp=FCB[fp].Size-FCB[fp].ByteCnt;
FCB[fp].ByteCnt=FCB[fp].Size;
}
if (FCB[fp].ClusSecCnt==FAT32.SecPerClus) //读下一簇
{
FCB[fp].LastCluster=FAT32NextCluster(FCB[fp].LastCluster);
if (FCB[fp].LastCluster==0x0fffffff) return(0);
IDEReadSector(ClusterToSector(FCB[fp].LastCluster));
FCB[fp].ClusSecCnt=1;
}
else if (FCB[fp].ClusSecCnt==0) //读第一簇
{
IDEReadSector(ClusterToSector(FCB[fp].LastCluster));
FCB[fp].ClusSecCnt++;
}
else //读当前簇下一扇区
{
IDEReadSector(ClusterToSector(FCB[fp].LastCluster)+FCB[fp].ClusSecCnt);
FCB[fp].ClusSecCnt++;
}
}
return(tmp);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?