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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fat.c

?? yampp mp3 reference
?? C
字號:

/*
  Copyright (C) 2001 Jesper Hansen <jesperh@telia.com>.

  This file is part of the yampp system.

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software Foundation, 
  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/


#include <io.h>
#include <string.h>

#include "types.h"
#include "ata_if.h"
#include "fat.h"
#include "mem.h"
#include "progmem.h"
#include "uart.h"

u08 *SectorBuffer;
u08 *long_name_buffer;
u08 *dir_name_buffer;

u32 FirstDataSector;
u16 Bytes_Per_Sector;
u16 Sectors_Per_Cluster;
u32 FirstFATSector;
u32 FirstDirSector;
u32 FileSize;
u32 FatInCache;
u32 MyCluster;


/*************************************************************************/
/*************************************************************************/


u32 clust2sect(u32 clust)
{
	return ((clust-2) * Sectors_Per_Cluster) + FirstDataSector;
}

u08 init_fat( u08 device)
{
	struct partrecord *pr;
	struct bpb710 *bpb;
    u32 first_sec;

	// setup pointers
	long_name_buffer = (u08 *) LONGNAME_BUF;
	dir_name_buffer  = (u08 *) DIRNAME_BUF;

	// clear cache 
	FatInCache = 0;


//+++++++++++++++++++++++++++++++++++++++
//
     //fix from Uli (Ulrich.Behrenbeck@Informatik-Werkstatt.de)
 	ATA_SW_Reset();
    ATA_Read_Sectors(DRIVE0,1,1,1,1,SectorBuffer);  // LBA bit NOT set !!!,a raw erroneous CHS access
//
//++++++++++++++++++++++++++++++++++++++++

	// read partition table
    ATA_Read_Sectors_LBA( 	DRIVE0,
    						0,
							1,
                            SectorBuffer);
	
	// get the partition record
	pr = (struct partrecord *) ((struct partsector *) SectorBuffer)->psPart;

	// and find the first valid sector
	first_sec = pr->prStartLBA;

	// Read the Partition BootSector
    ATA_Read_Sectors_LBA( 	DRIVE0,
    						first_sec,
							1,
                            SectorBuffer);

	// get BIOS parameter block
	bpb = (struct bpb710 *)  ((struct bootsector710 *) SectorBuffer)->bsBPB;

	// and setup some constants
	FirstDataSector 	= bpb->bpbResSectors + bpb->bpbFATs * bpb->bpbBigFATsecs;
	FirstDataSector    += first_sec;
	Sectors_Per_Cluster = bpb->bpbSecPerClust;
	Bytes_Per_Sector 	= bpb->bpbBytesPerSec;
	FirstFATSector 		= bpb->bpbResSectors + first_sec;
	FirstDirSector 		= bpb->bpbRootClust;

	return 0;	
}

//////////////////////////////////////////////////////////////




extern u08 *buffer1;

u16 entrycount;
u08 dirlisting = 0;


struct direntry * get_de(u16 entry, u32 basecluster)
{
    u32 prevcluster;
	struct direntry *de;	
    u16 i,index;
	
	// always clear the longname buffer
	*long_name_buffer = 0;

	//avoid warnings
	de = 0; 
	prevcluster = 0;

	index = 16*Sectors_Per_Cluster;	// crank it up
	do 
	{
		if (index == 16*Sectors_Per_Cluster)	// time for a new cluster ?
		{
			ATA_Read_Sectors_LBA( 	DRIVE0,
   									clust2sect(basecluster),
									Sectors_Per_Cluster,
           			                buffer1);
				
            prevcluster = basecluster;					// save cluster for directry backstep below
            basecluster = next_cluster(basecluster);
			de = (struct direntry *) buffer1;
			index = 0;
		}	
	
		if (*de->deName != 0xE5)	// if not a deleted entry
		{
			// if this is a long name entry
			if (de->deAttributes == ATTR_LONG_FILENAME)
			{
				struct winentry *we;
			    char *p;
				u16 b;

				we = (struct winentry *) de;
				b = 13 *( (we->weCnt-1) & 0x0f);				// index into string
				p = &long_name_buffer[b];
				for (i=0;i<5;i++)	*p++ = we->wePart1[i*2];	// copy first part			
				for (i=0;i<6;i++)	*p++ = we->wePart2[i*2];	// second part
				for (i=0;i<2;i++)	*p++ = we->wePart3[i*2];	// and third part
				if (we->weCnt & 0x40) *p = 0;					// in case dirnamelength is multiple of 13
			}
			else 
			if ((de->deAttributes & (ATTR_HIDDEN|ATTR_SYSTEM|ATTR_VOLUME)) == 0) // normal file entry (including directories)
			{
				// if the longname buffer is empty, copy the short name in there
				
				// ignore the dot names/directories 
				if (*de->deName != '.')
				{
					if (*long_name_buffer == 0)
					{
						char *p = long_name_buffer;
						for (i=0;i<8;i++)	*p++ = de->deName[i];		// copy first part			
						*p++ = '.';
						for (i=0;i<3;i++)	*p++ = (de->deExtension[i] & 0x5F);	// copy second part	(in lower case)		
						*p = 0;
					}

					if (de->deAttributes == ATTR_DIRECTORY)	// is it a directory ?
					{
							struct direntry *subde;
							char *p;
							
							// copy name buffer to directory buffer
							strcpy(dir_name_buffer,long_name_buffer);

							// special handling for directory names that only have a short entry
							// they may have a dot and some spaces in the name from the copying above
							// fix this
							
							if ( (p = strrchr(dir_name_buffer,'.')) != 0 )
							{
								while (*p == ' ' || *p == '.')
										*p-- = 0;
							}
							
							// add a slash to the directory
							strcat(dir_name_buffer,"/");

							subde = get_de(entry,((u32)de->deHighClust << 16) + de->deStartCluster);
							if (subde)
							{
								return subde;
							}	
							else	
							{
				    		  	ATA_Read_Sectors_LBA( 	DRIVE0,			// reload original sector
	    												clust2sect(prevcluster),
														Sectors_Per_Cluster,
	                    		    	    			buffer1);
								*dir_name_buffer = 0;
	                    	}
					}
					else
					{
						if (dirlisting == DIRLIST_VERBOSE)	
						{
							// print the name
							UART_Puts(dir_name_buffer);
							UART_Putsln(long_name_buffer);
						}

						// if this is the entry we're looking for, exit
						if (entrycount == entry)
						{
							// check for ".mp3" extension, and if it exist,
							// then cut it off, else skip file
							char *p;
							if ( (p = strrchr(long_name_buffer,'.')) != 0 )
							{
								if ( *(p+1) == 'm' && *(p+2) == 'p' && *(p+3) == '3' )
								{
									*p = 0;	// cut it
									
									if (!dirlisting)
										return de;
								}	
							}
						}
						*long_name_buffer = 0;
						entrycount++;			// increment entry counter		
					}
				}	
			}				
		}
		de++;		// point to next directory entry
		index++;	// increment index count within this sector
		
	} while (index == (16*Sectors_Per_Cluster) || *de->deName);	// 0 in de->deName[0] if no more entries


	return 0;
}


//
// do a directory listing 
// either just scan to find # of files,
// or print dir/filename on each
//
u16 dirlist(u08 mode)
{
	*dir_name_buffer = 0;
	*long_name_buffer = 0;
	entrycount = 0;

	dirlisting = mode;
	get_de(-1,FirstDirSector);	// scan through all
	dirlisting = 0;
	return entrycount;
}


//
//
//
u32 get_dir_entry(u16 entry)
{
	struct direntry *de;

	*dir_name_buffer = 0;
	*long_name_buffer = 0;

	entrycount = 0;

	de = get_de(entry,FirstDirSector);	// check in root

	if (de)
	{
		FileSize = de->deFileSize;
		MyCluster = (u32) ((u32)de->deHighClust << 16) + de->deStartCluster;
		return MyCluster;
	}

	return 0;
}


//
// return the size of the last directory entry
//
u32 get_filesize(void)
{
	return FileSize;
}


//
// return the long name of the last directory entry
//
u08 *get_filename(void)
{	
	return long_name_buffer;
}

//
// return the directory of the last directory entry
//
u08 *get_dirname(void)
{	
	return dir_name_buffer;
}


//
// load a clusterfull of data
//
void load_sectors(u08 *buffer)
{

	if (!MyCluster)
		return;

	// read cluster
	while ( ATA_Read_Sectors_LBA( 	DRIVE0,
   									clust2sect(MyCluster),
									Sectors_Per_Cluster,
           	                		buffer) != 0)
    {
    	UART_SendByte('*');
    	ATA_SW_Reset();
    };

	MyCluster = next_cluster(MyCluster);

}

//
// find next cluster in the FAT chain
//
u32 next_cluster(u32 cluster)
{
	u32 FatOffset = cluster << 2;	
	u32 sector    = FirstFATSector + (FatOffset / Bytes_Per_Sector);
	u16 offset 	= FatOffset % Bytes_Per_Sector;

	if (sector != FatInCache)
	{
		// read sector
	    while (ATA_Read_Sectors_LBA(DRIVE0,
	   								sector,
									1,
	           	                	(u08*)FATCACHE) != 0)
	    {
	    	UART_SendByte('&');
	    	ATA_SW_Reset();
	    };

		FatInCache = sector;
    }
           	                
	FatOffset =  (*((u32*) &((char*)FATCACHE)[offset])) & FAT32_MASK;

	if ( FatOffset >= (CLUST_EOFS & FAT32_MASK) )
		FatOffset = 0;

	return FatOffset;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲男人都懂的| 在线观看av不卡| 亚洲精品在线电影| kk眼镜猥琐国模调教系列一区二区 | 午夜视频一区二区三区| 欧美午夜免费电影| 日本强好片久久久久久aaa| 日韩一区二区视频在线观看| 琪琪久久久久日韩精品| 精品国产免费久久 | 亚洲超碰97人人做人人爱| 欧美日韩精品三区| 久久国产精品一区二区| 欧美精品一区二区久久婷婷| 国产成人亚洲综合a∨婷婷图片 | 99国产精品久久| 一区二区理论电影在线观看| 欧美一区二区三区在线观看视频| 美女尤物国产一区| 国产精品蜜臀在线观看| 色88888久久久久久影院野外| 日韩国产成人精品| 777午夜精品免费视频| 久久精品999| 亚洲欧美日韩久久| 91精品久久久久久蜜臀| 国产高清精品久久久久| 一区二区三区在线不卡| 精品日本一线二线三线不卡| 日韩午夜精品视频| 日本欧美一区二区| 国产精品天天看| 欧美久久一二三四区| 丁香一区二区三区| 日韩成人一区二区三区在线观看| 国产三级久久久| 91麻豆精品国产91久久久久久 | 欧美性生活久久| 六月丁香综合在线视频| 国产精品1区2区| 亚洲一区二区av在线| 久久亚洲精华国产精华液 | 成人一区二区三区中文字幕| 看电视剧不卡顿的网站| 成人av网站免费| 久草这里只有精品视频| 亚洲自拍偷拍麻豆| 日本一区二区三级电影在线观看| 欧美日韩国产综合视频在线观看 | 成人免费高清在线观看| 午夜欧美在线一二页| 中文字幕一区二区三区精华液 | 欧美成人精精品一区二区频| 91老司机福利 在线| 国产.欧美.日韩| 美女一区二区视频| 亚洲妇女屁股眼交7| 亚洲天堂网中文字| 欧美韩日一区二区三区| 欧美成人高清电影在线| 欧美男男青年gay1069videost| 99热在这里有精品免费| 国产一区福利在线| 精品亚洲aⅴ乱码一区二区三区| 亚洲图片欧美色图| 亚洲精品免费在线播放| 国产精品综合一区二区三区| 亚洲 欧美综合在线网络| 亚洲天堂网中文字| 亚洲人成电影网站色mp4| 国产精品系列在线| 国产精品免费aⅴ片在线观看| 国产色一区二区| 久久综合99re88久久爱| 欧美成人一区二区三区片免费| 在线电影国产精品| 4438亚洲最大| 日韩亚洲欧美成人一区| 欧美一区二区三区在| 欧美一区二区三区四区高清 | 久久疯狂做爰流白浆xx| 久久国产三级精品| 久久99国产精品久久99果冻传媒| 日韩电影免费一区| 狠狠色狠狠色综合| 国产福利不卡视频| 成人av资源站| 在线观看日韩一区| 欧美性猛交一区二区三区精品| 欧美影视一区在线| 欧美精品亚洲二区| 欧美大片在线观看一区| 久久久精品日韩欧美| 国产精品视频看| 亚洲欧美经典视频| 亚洲成人综合在线| 奇米在线7777在线精品| 国产伦精品一区二区三区视频青涩| 国产精品白丝jk白祙喷水网站| 成人高清免费在线播放| 欧美色窝79yyyycom| 日韩欧美国产电影| 欧美极品少妇xxxxⅹ高跟鞋 | 26uuu精品一区二区三区四区在线| 久久综合九色综合97_久久久| 国产精品美女久久久久久久| 精一区二区三区| 午夜精品一区二区三区三上悠亚| 免费成人av在线播放| 国产麻豆精品视频| 久久精品人人做人人综合 | 成人蜜臀av电影| 一本一道久久a久久精品| 欧美日韩第一区日日骚| 欧美不卡视频一区| 亚洲视频在线观看一区| 亚洲国产精品综合小说图片区| 久久成人综合网| 91无套直看片红桃| 欧美sm美女调教| 日韩久久久久久| 国产精品的网站| 美腿丝袜亚洲综合| 不卡大黄网站免费看| 67194成人在线观看| 国产精品免费av| 麻豆国产91在线播放| 91片在线免费观看| 精品久久人人做人人爰| 一区二区三区在线视频免费观看| 精品亚洲免费视频| 欧美美女一区二区在线观看| 中文字幕精品一区二区三区精品| 免费看欧美美女黄的网站| 91首页免费视频| 久久久久久影视| 亚洲成人你懂的| 不卡的av中国片| 日韩欧美中文字幕精品| 一区二区不卡在线播放| 风间由美一区二区av101| 91精品综合久久久久久| 亚洲欧美日韩国产综合| 国产高清精品网站| 欧美精品一区二区三| 青青草国产精品97视觉盛宴| 色综合天天综合网天天狠天天| 亚洲欧美国产77777| 久久99国内精品| 日韩一区二区免费电影| 亚洲国产精品久久一线不卡| 91小视频免费观看| 国产精品日产欧美久久久久| 国产乱色国产精品免费视频| 日韩精品影音先锋| 六月婷婷色综合| 欧美sm美女调教| 激情欧美日韩一区二区| 欧美电视剧免费观看| 青青国产91久久久久久 | 日韩精品一区二| 五月天久久比比资源色| 在线看一区二区| 亚洲精品国产一区二区精华液| av中文字幕不卡| 成人欧美一区二区三区1314| 成人激情电影免费在线观看| 中文字幕免费一区| 国产91丝袜在线18| 中日韩av电影| 91在线免费看| 一区二区三区免费| 欧美熟乱第一页| 午夜精品视频一区| 欧美一级欧美一级在线播放| 美女一区二区在线观看| 欧美mv和日韩mv国产网站| 老司机精品视频线观看86| 日韩精品中文字幕在线不卡尤物| 久热成人在线视频| 日本一区二区三区四区 | 色悠久久久久综合欧美99| 最新国产成人在线观看| 色中色一区二区| 洋洋av久久久久久久一区| 欧美人与禽zozo性伦| 久久国产福利国产秒拍| 国产女同性恋一区二区| 99久久婷婷国产| 亚洲国产欧美在线人成| 91精品国产欧美一区二区成人| 极品少妇xxxx偷拍精品少妇| 国产精品久久久久久亚洲伦| 91极品视觉盛宴| 麻豆精品蜜桃视频网站| 国产精品嫩草99a| 欧美天堂亚洲电影院在线播放| 青娱乐精品视频| 国产精品情趣视频| 4438x亚洲最大成人网|