亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? zfat.c

?? 可以實現fat文件系統
?? C
?? 第 1 頁 / 共 2 頁
字號:

#include "zfat.h"

//Following includes aren't required if using CodeVision AVR C
//CodeVision will include automatically if .H files are in project list.
//#include "ztype.h"
//#inlcude "zata.h"
//#inlcude "zlcd.h"
//#include "zcontrol.h"


unsigned long clust2LBA(unsigned long clust) {
//Convert cluster address to LBA address, uses the formula    將簇地址轉換為lba地址 使用下面的公式
	return ((clust-2) * Sectors_Per_Cluster) + FirstDataSector;
}

/*
unsigned long LBA2Cluster(unsigned long LBA) {
 return ((LBA-FirstDataSector)/Sectors_Per_Cluster)+2; 將lba地址轉換為簇地址
}
*/

void InitFAT(){
 	struct partRec *pr; 指向分區表的指針
	struct bootSec710 *boot; 指向啟動扇區  ????????
	struct driveID *driveInfo; 指向硬盤id結構
	word  rootDirSectors; 
	struct FAT32fsInfo *fsInfo; ??????????	
	dword tartSector;
	dword FATSz, dataSec, totalSector;
	byte	i;	
        RegWrite(DrvHeadReg,LBAMaster); 表示大硬盤模式
	RegWrite(CmdStsReg,0xEC); //ATA identify command. ata識別命令 也就是讀出ata的信息	
	while ((RegRead(CmdStsReg) & SR_DRQ)!=SR_DRQ);  //no error handling 沒有錯誤
	WriteAddr(IOReg); 
	ATA_Read(128);讀出128*2個字節
	driveInfo = (struct driveID *) sectorBuffer.data; 得到硬盤信息

        LCDclrscr();

	for (i=0; i<20; i+=2)  將讀出的數據進行解析
           {writechar(driveInfo->model[i+1]);//顯示部分
            writechar(driveInfo->model[i]); }; //顯示部分
	//Determine drive size. Multiplication and division is done by shifts
	startSector = driveInfo->totalSecHi;
	startSector = ((startSector<<16) + driveInfo->totalSecLo)>>11;	
	gotoxy(1,0);
	writeNumber(startSector); //Display drive size
	writestring("MB ");	
	
	
        //skipping boot code in first 445 bytes. So go to offset 446
        GoToSectorOffset(0,446);
	ATA_Read_Sectors_LBA(0, 32); 	  	//reading 64 byte partition records of 4 partition

  	readPos=0;				//New sector needs to be read	
  	sectorPos=0;
	pr = (struct partRec *) sectorBuffer.data;
	startSector = pr->startLBA;
	ATA_Read_Sectors_LBA(startSector, 64);  //Go to start sector of the partition

	boot = (struct bootSec710 *) sectorBuffer.data; //Load BPB struct pointer

	//All of the following calculations are from Microsoft FAT32 White Paper	
	Sectors_Per_Cluster = boot->BPB.secPerClust;
	Bytes_Per_Sector = boot->BPB.bytesPerSec;

	FirstFATSector = boot->BPB.resSectors + startSector;
	
	rootDirSectors=(((boot->BPB.rootDirEnts * 32)+ (Bytes_Per_Sector - 1)) / Bytes_Per_Sector);
	FATSz = boot->BPB.FATSz16;
	if (FATSz==0) FATSz = boot->BPB.FATSz32;
	if (boot->BPB.totSec16 != 0) totalSector=boot->BPB.totSec16;
	else totalSector=boot->BPB.totSec32;
	dataSec = totalSector - (boot->BPB.resSectors + (boot->BPB.FATs * FATSz) + rootDirSectors);

	FirstDataSector = boot->BPB.resSectors + (boot->BPB.FATs * FATSz) + rootDirSectors + startSector;

	if ((dataSec / Sectors_Per_Cluster) < 65525) {
	 Halt(3); //System is FAT16, not supported in this version.
	} 
	else {
	 FirstDirSector = boot->BPB.rootClust;
	 writestring("FAT32");//FATType=32;   
	} 
	
        GoToSectorOffset(startSector+1,484);	//Goto offset 484 of FSInfo sector (2nd sector)
 	ATA_Read(28);            
	fsInfo= (struct FAT32fsInfo *) sectorBuffer.data;
        DriveSize=fsInfo->freeCluster; //driveSize in # of cluster
					//Next freeCluster address changes everytime new file added or removed
	                                //Thus ZipAmp will see that user modified total files in drive, so
	                                //re-count of all files are needed.

 
	gotoxy(2,0);
	writeNumber((DriveSize*Sectors_Per_Cluster)>>11); //Display approx. free space in MB
	writestring("MB Free");		                  //Right shift of 11 is found from equation given below
							  //Display will give wrong value if free space > 65GB
							  //Because writeNumber function expects word value.
	
	//DriveSize is in # of cluster
	//size = (DriveSize * Sectors_Per_Cluster * Bytes_Per_Sector / (1024 * 1024)) MB
	//Assume Bytes_Per_Sector = 512,
	//Therefore, operation of ( 512 / ( 1024 * 1024) ) = Right shift of 11
 	
}

unsigned char getDirEntry(byte onlyMP3){
//gets a filename.ext, filesize, and start cluster of that file from the directory entry table.
//Returns 1 if file is found, returns 0 if no file found and reaches end of dir table.
//Finds only MP3 files and enters sub-directory if onlyMP3 is set, if its 0 then only reads root dir.
//Each file record in dir is 32 byte long.


	unsigned long cluster;
	word fileNum=0;
	dword extension;
	byte i,j,start,longNameFound;	
	struct direntry *file;	
	struct winentry *longFile;
	
	readPos=0; 

        if ((currentFileNum & dirReadOffset.fileNum) ==0) { //if reading from start of root dir
	  cluster=FirstDirSector;
	  sectorPos=0;
	  subDirLevel=0;   
	  
	  dirString[0]=2;
	  dirString[1]='/';
	  
	}
	else { 
       	 cluster=dirReadOffset.cluster;		//Start from last read cluster position.		
	 sectorPos=dirReadOffset.sectorPos;     //Last read sectorPos
	 fileNum=dirReadOffset.fileNum;		//Last read file number

	 //Find the previous file record read offset in the cluster
 	 GoToSectorOffset(clust2LBA(cluster)+sectorPos,dirReadOffset.offset);
	}               
	

	CLEAR:				//Jump position if an entry was invalid entry, clear fileName
	
	for (i=0; i<40; i++) fileName[i]=0; //Clear file name so all position is NULL.
	extension=0;
	longNameFound=0;

      do { //Directory read loop (infinite, unless a file found or reached end of directory)
      
 	  ATA_Read_Sectors_LBA(clust2LBA(cluster)+sectorPos, 16); //reading 32 byte in each iteration
          if (sectorPos==Sectors_Per_Cluster) {
           currentCluster=cluster;
           cluster=findNextCluster();           
           sectorPos=0; readPos=0;             
          } 	  

 	 
 	 
 	longFile=(struct winentry *) sectorBuffer.data; //Initialize pointer for long file name structure
 	file = (struct direntry *) sectorBuffer.data;   //Initialize pointer for short file name structure
 	
 	if (sectorBuffer.data[0] == 0xE5) {
	  //Deleted entry
 	 goto CLEAR;
 	}

 	 //------------------------------------------------------------------------------        	  
         /*End of a directory  block */ 
 	 if (sectorBuffer.data[0] == 0) {  //We reached end of a dir
 	  if (subDirLevel>0) { //Check if this end of a sub-dir, if true then go to one level up directory
  	    subDirLevel--;
  	    popDir(); //pop cluster address from stackfile to currentCluster
  	    cluster=currentCluster; //set dir cluster to popped cluster
  	    GoToSectorOffset(clust2LBA(cluster)+sectorPos,readPos); //go to dir file entry offset
  	    
  	    //Remove subdir text in dir string
  	    j=dirString[0]-2;
  	    while ((j>1)&&(dirString[j]!='/')) j--;
  	    dirString[0]=j+1;
  	    
  	    goto CLEAR; 	   
 	  }                             

 	  //If we are here then we reached end of root directory.
 	  currentFileNum=0;
 	  return 0; //Done. Finished reading all entries so return 0
 	 } 	 
 	
 	//-------------------------------------------------------------------------------              
	/* Active long name sub-component block. */ 	
 	 if ((longFile->Attr & ATTR_LONG_NAME_MASK) == ATTR_LONG_NAME) {
	   	
 	   start = 13 *( (longFile->Cnt-1) & 0x0F); //Fine offset of text in long file name

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
最新日韩在线视频| 亚洲电影一级黄| 午夜影院久久久| eeuss鲁片一区二区三区| 日韩久久免费av| 一区二区三区鲁丝不卡| 国产不卡在线播放| 日韩视频免费观看高清完整版在线观看| 国产精品久久网站| 精品亚洲porn| 正在播放亚洲一区| 亚洲一区二区三区在线播放| 99精品欧美一区二区蜜桃免费| 精品国产乱码久久久久久久久| 日韩在线观看一区二区| 色婷婷av久久久久久久| 亚洲欧洲成人自拍| 成人av资源网站| 国产日韩精品久久久| 美女一区二区在线观看| 欧美一区二区三区视频免费| 亚洲影院久久精品| 欧美日韩精品一区二区| 亚洲视频综合在线| 91久久奴性调教| 亚洲精品免费视频| 99riav一区二区三区| 国产精品久久久久久久久免费桃花| 国产综合久久久久影院| 精品国产乱码久久久久久牛牛| 欧美a一区二区| 91精品中文字幕一区二区三区| 亚洲综合免费观看高清在线观看| 色av综合在线| 亚洲国产aⅴ成人精品无吗| 91福利资源站| 亚洲综合色成人| 制服丝袜中文字幕亚洲| 蜜臀久久久久久久| 日韩欧美国产一二三区| 精品一区二区三区视频| 日韩午夜在线观看| 精品一区二区三区免费播放| 久久久久久久久一| 处破女av一区二区| 亚洲女同一区二区| 欧美日韩性生活| 久久成人久久爱| 国产肉丝袜一区二区| 99精品久久99久久久久| 一区二区三区中文字幕在线观看| 精品婷婷伊人一区三区三| 亚洲成人av一区| 日韩一级免费观看| 成人一区二区三区在线观看| 亚洲另类中文字| 欧美日韩一级大片网址| 激情欧美一区二区三区在线观看| 国产视频一区不卡| 在线观看www91| 激情欧美日韩一区二区| 国产精品美女久久久久久久网站| 在线免费不卡电影| 久久精品久久精品| 亚洲色图欧美激情| 日韩欧美一级片| 9i看片成人免费高清| 天堂精品中文字幕在线| 国产欧美一区二区三区沐欲| 在线精品视频一区二区三四| 国产美女精品人人做人人爽| 一区二区三区四区激情| 精品电影一区二区三区| 91国偷自产一区二区三区成为亚洲经典 | 亚洲欧美日韩国产另类专区| 欧美精品vⅰdeose4hd| 国产jizzjizz一区二区| 日本三级亚洲精品| 中文字幕一区三区| 久久青草欧美一区二区三区| 色综合色狠狠天天综合色| 激情五月激情综合网| 一区二区三区精品| 国产日韩欧美a| 日韩欧美成人激情| 欧美三级电影精品| yourporn久久国产精品| 国产伦精品一区二区三区视频青涩| 亚洲综合在线免费观看| 国产精品女同一区二区三区| 欧美一级久久久| 欧美日韩第一区日日骚| 99国内精品久久| 国产精品资源在线看| 蜜桃av一区二区在线观看| 亚洲一区二区不卡免费| 亚洲欧洲国产日本综合| 欧美激情自拍偷拍| 久久网站最新地址| 日韩免费视频线观看| 91精品国产综合久久久久久漫画| 色婷婷av一区二区三区软件| eeuss鲁片一区二区三区在线观看| 国产一区二区不卡在线| 久久99九九99精品| 久久国产欧美日韩精品| 水野朝阳av一区二区三区| 一区二区国产视频| 亚洲三级免费观看| 亚洲青青青在线视频| 亚洲精品成人少妇| 亚洲乱码日产精品bd| 亚洲少妇30p| 国产精品国产三级国产aⅴ入口| 中文乱码免费一区二区| 国产亚洲精品7777| 国产日韩欧美高清| 国产精品久久久久四虎| 国产精品国产自产拍高清av王其| 欧美国产综合色视频| 国产欧美一区二区三区在线看蜜臀| 国产欧美日韩中文久久| 国产精品毛片a∨一区二区三区| 国产午夜亚洲精品不卡| 中文字幕中文字幕在线一区| 国产精品久线观看视频| 亚洲欧洲一区二区在线播放| 亚洲欧美二区三区| 亚洲图片有声小说| 美女脱光内衣内裤视频久久影院| 美脚の诱脚舐め脚责91 | 天天综合色天天综合色h| 天天综合网天天综合色| 久久精品国产精品青草| 粉嫩绯色av一区二区在线观看| 成人一二三区视频| 在线观看日韩电影| 日韩一区二区精品在线观看| 久久久久国产精品厨房| 亚洲欧美综合另类在线卡通| 亚洲一区成人在线| 久草中文综合在线| av在线一区二区| 91麻豆精品国产91久久久使用方法 | 国产欧美日韩中文久久| 亚洲精品欧美在线| 久久精品国产精品青草| 99re6这里只有精品视频在线观看| 欧美性感一区二区三区| 久久久久综合网| 亚洲国产日韩av| 国产一区二区导航在线播放| 91精品福利视频| 亚洲精品一区二区在线观看| 亚洲少妇30p| 久久国产人妖系列| 在线看日本不卡| 国产亚洲制服色| 丝袜亚洲另类欧美综合| 成人免费毛片aaaaa**| 制服丝袜av成人在线看| 亚洲啪啪综合av一区二区三区| 免费在线视频一区| 色综合夜色一区| 久久亚洲精品小早川怜子| 亚洲一区二区不卡免费| 成人性生交大片| 精品捆绑美女sm三区| 一区二区三区.www| 国产成人免费视频| 精品剧情在线观看| 亚洲第一av色| 色综合欧美在线视频区| 久久久久国产精品麻豆| 蜜臀av一区二区三区| 在线观看日韩高清av| 国产精品免费视频观看| 国产在线播放一区| 91精品国产麻豆| 亚洲午夜视频在线| 92精品国产成人观看免费| 久久久精品国产免大香伊| 日韩高清国产一区在线| 日本电影亚洲天堂一区| 亚洲欧洲成人精品av97| 风间由美一区二区av101| 久久影院午夜片一区| 久久狠狠亚洲综合| 日韩一级二级三级| 青青草国产精品97视觉盛宴| 欧美性高清videossexo| 一区二区三区四区高清精品免费观看 | 日韩亚洲国产中文字幕欧美| 一区二区久久久| 欧美亚洲国产怡红院影院| 亚洲欧美日韩综合aⅴ视频| 91首页免费视频| 亚洲精品成人悠悠色影视| 欧美中文字幕久久| 婷婷开心久久网|