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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? api.#1

?? sl811 c8051F驅(qū)動(dòng)程序 保證絕對(duì)可以使用 USB通信協(xié)議USB1.1
?? #1
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
//************************************************************************
//author:dragon
//web:8dragon.com
//2004.2.5完成于桃龍?jiān)?//*************************************************************************
#include <c8051F020.h>
#include "api.h"
#include "file.h"
#include "host_811.h"
#include  "ufi.h"
#include "string.h"
#include "math.h"
struct _FILE  ApiFileControl;
extern struct _BPB	SimpleBpb;
extern	FAT_PARAMETER FatParameter;
BYTE BuffFile[8*512];
extern WORD FatCache[2][256];
BYTE CreateFile(char* filename, BYTE attribute)
{	
	struct _DIR dir,*pdir;
	BYTE name[11];
	struct _FILE file;
//	WORD NewCluster;
	BYTE Cache[512];
	static char NewFileName[12];
	char * p=NewFileName;
	////////////////////////////////////////////////////////////////////////
	//*Get valid filen name
	if(!CheckFileName(filename,p))
		return FALSE;	
	//*核對(duì)該文件是否已經(jīng)存在
	if(LocateFile(filename, NULL)!=0xffffffff)
		return FALSE;
	strncpy(name, p, 11);
	memset(&dir, 0, sizeof(dir));
	memcpy(dir.Name, name, 11);
	dir.Attr = attribute;
	dir.CrtDate =0;
	dir.CrtTime =0;
	dir.CrtTimeTenth =0;
	dir.FileSize =0;
	DelayMs(5);
	if(!LocateDir(&dir, &file))
		return FALSE;	
//	NewCluster=SeekEmptyCluseter();
//	if(NewCluster==0xffff)
//		return FALSE;
	DelayMs(15);
	if(!Read(file.DirSectorNum,1,(BYTE *)Cache))
		return FALSE;
	pdir = (struct _DIR *)Cache;
	pdir += file.DirIndex;
	pdir->FstClusLO =0x00;//WordSwap(NewCluster);
	pdir->FileSize=0;
	if(!Write(file.DirSectorNum,1,Cache,TRUE))
		if(!Write(file.DirSectorNum,1,Cache,TRUE))
		return FALSE;		
 return OpenFile(filename);	
}
BYTE WriteFile(const char* buffer, UINT bytes)
{
	BYTE *pCache;
	WORD Cache[512];
	UINT write_bytes =0,flag=0;
	UINT max_write_bytes_in_sector;
	WORD Cluster;
	////////////////////////////////////////////////////////////////////////
	//如果打開(kāi)的文件是一個(gè)空文件,則進(jìn)入下面
	//為其尋找一個(gè)開(kāi)始的數(shù)據(jù)蔟,標(biāo)記為0xffff
	//數(shù)據(jù)直接填在該簇對(duì)應(yīng)的扇區(qū)內(nèi)
	if(ApiFileControl.StartSectorNum<FatParameter.FirstDataSector)
	{
		Cluster=SeekEmptyCluster();
		if(!Read(FatParameter.FirstFatSecNum+(2*Cluster/SimpleBpb.BytsPerSec),1,(BYTE *)Cache))
			return FALSE;
		Cache[Cluster%(SimpleBpb.BytsPerSec/2)]=0xffff;
		if(!Write(FatParameter.FirstFatSecNum+(2*Cluster/SimpleBpb.BytsPerSec),1,(BYTE *)Cache,0))
			return FALSE;
		ApiFileControl.dir.FstClusLO=WordSwap(Cluster);
		ApiFileControl.StartSectorNum=ApiFileControl.CurrentSectorNum=ClusterToSec(Cluster);
		flag=1;
	}
	///////////////////////////////////////////////////////////////////////////////
	//
	//如過(guò)前一個(gè)WriteFile函數(shù)的字節(jié)或者打開(kāi)一個(gè)已經(jīng)有為內(nèi)容的文件的字節(jié)偏移剛好為
	//SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus的整數(shù)倍,為了保持總的算法一致
	//(都是先寫(xiě)好某簇為0xffff然后再寫(xiě)該簇的內(nèi)容)則開(kāi)始的時(shí)候必須先為其準(zhǔn)備好
	//一個(gè)未有內(nèi)容的簇,標(biāo)記好為0xffff,然后數(shù)據(jù)直接填在該簇對(duì)應(yīng)的扇區(qū)內(nèi)。
	//
	//////////////////////////////////////////////////////////////////////////////
	if((ApiFileControl.SectorOffset==0)&&flag==0)
		{
			Cluster =LinkClusterList(SecToCluster(ApiFileControl.CurrentSectorNum));
				if(Cluster == 0xffff)
					return FALSE;		
				ApiFileControl.CurrentSectorNum = ClusterToSec(Cluster);
		}
	for(;;)
	{
		pCache=BuffFile;//Cache;
		pCache += ApiFileControl.SectorOffset;
		if((SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset) > (bytes - write_bytes))
			max_write_bytes_in_sector =  (bytes - write_bytes);
		else
			max_write_bytes_in_sector=(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset);
		memcpy(pCache, buffer, max_write_bytes_in_sector);
		ApiFileControl.SectorOffset += max_write_bytes_in_sector;
		if(ApiFileControl.SectorOffset>=SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus)
		{				
				if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE*)BuffFile,FALSE))
					if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE*)BuffFile,FALSE))
						return FALSE;		
				if((write_bytes+max_write_bytes_in_sector)<bytes)
					{
						Cluster =LinkClusterList(SecToCluster(ApiFileControl.CurrentSectorNum));
						if(Cluster == 0xffff)
							return FALSE;		
						ApiFileControl.CurrentSectorNum = ClusterToSec(Cluster);			
					}
			
			ApiFileControl.SectorOffset = 0;
		}
		write_bytes += max_write_bytes_in_sector;
		buffer = (char*)buffer + max_write_bytes_in_sector;
		ApiFileControl.dir.FileSize +=  max_write_bytes_in_sector;
		if(write_bytes >= bytes)
			return TRUE;					
	}//end for cycle 
  return FALSE;
}
BYTE AddWriteFile(const char* buffer, UINT bytes)
{
	UINT write_bytes =0;
	UINT max_write_bytes_in_sector;
	////////////////////////////////////////////////////////////////////////
//	WORD Cluster;
//	DWORD Sector;
	BYTE *pCache;
//	BYTE BuffFile[4*512];
	/////////////////////////////////////////////////////////////////////////////
	//
	//****如果文件的大小不是SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus
	//的整數(shù)倍,則進(jìn)入下面的語(yǔ)句可以保證加寫(xiě)的東西精確到到字節(jié)
	//
	//////////////////////////////////////////////////////////////////////////////
	if(0<ApiFileControl.SectorOffset<SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus)
	{	
		pCache=BuffFile;	
		if((SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset) > (bytes - write_bytes))
			max_write_bytes_in_sector =  (bytes - write_bytes);
		else
			max_write_bytes_in_sector=(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset);	
	//	Cluster=SecToCluster(ApiFileControl.CurrentSectorNum);
	//	Sector=ClusterToSec(Cluster);		
		if(!Read(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE *)BuffFile))
			return FALSE;
		pCache += ApiFileControl.SectorOffset;
		memcpy(pCache, buffer, max_write_bytes_in_sector);
		if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE *)BuffFile,TRUE))
			if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE *)BuffFile,TRUE))
				return FALSE;		
		write_bytes += max_write_bytes_in_sector;
		buffer = (char*)buffer + max_write_bytes_in_sector;
		ApiFileControl.dir.FileSize +=  max_write_bytes_in_sector;
		if((bytes-max_write_bytes_in_sector)>0)
			ApiFileControl.SectorOffset=0;	
	}		
		if(!WriteFile(buffer,(bytes -write_bytes)))
			return FALSE;
		return TRUE;
}
BYTE OpenFile(const char* filename)
{
	DWORD FileFirstSector;
	WORD  Cluster;
	////////////////////////////////////////////////////////////////////////
	FileFirstSector=LocateFile(filename, &ApiFileControl);
	if(FileFirstSector==0xffffffff)
		return FALSE;	
	ApiFileControl.StartSectorNum = FileFirstSector;
	Cluster=WordSwap(ApiFileControl.dir.FstClusLO);
	for(;;)
	{
		if((GetListCluster(Cluster)==0xffff)||(Cluster==0))
	 		break;	 		  	
		Cluster=GetListCluster(Cluster);
	}
	//ApiFileControl.CurrentSectorNum為該簇對(duì)應(yīng)的第一個(gè)扇區(qū)
	ApiFileControl.CurrentSectorNum = ClusterToSec(Cluster);
	ApiFileControl.SectorOffset=(DWordSwap(ApiFileControl.dir.FileSize)%(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus));
	ApiFileControl.dir.FileSize=DWordSwap(ApiFileControl.dir.FileSize);
	return TRUE;
}
BYTE ReadFile(void* buffer, UINT bytes)
{
	BYTE*pCache;
	UINT read_bytes =0;
	UINT max_copy_bytes_in_sector;
	WORD Cluster,i;
	DWORD FileSize;
//	BYTE buf[600];
//	for(i=0;i<600;i++)
//		buf[i]='a';
//	memcpy(buffer,buf,400);
//	return TRUE;
	////////////////////////////////////////////////////////////////////////
	FileSize = ApiFileControl.dir.FileSize;
	if(bytes>=FileSize)
		bytes=FileSize;
	Cluster=SecToCluster(ApiFileControl.CurrentSectorNum);
//	Sector=ClusterToSec(Cluster);
	ApiFileControl.SectorOffset=ApiFileControl.SectorOffset%(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus);
		for(; ; )
		{	
			pCache=BuffFile;		
			pCache+=ApiFileControl.SectorOffset;
			if((SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset) > (bytes - read_bytes))
			max_copy_bytes_in_sector =  (bytes - read_bytes);
			else
			max_copy_bytes_in_sector=(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus - ApiFileControl.SectorOffset);
			ApiFileControl.SectorOffset+=max_copy_bytes_in_sector;
			if(!Read(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(BYTE *)BuffFile))
				return FALSE;
			memcpy((char *)buffer, pCache, max_copy_bytes_in_sector);
		//	 return TRUE;
			read_bytes+=max_copy_bytes_in_sector;
			if(read_bytes>=bytes)
				return TRUE;
			buffer = (char*)buffer + max_copy_bytes_in_sector;	
			Cluster=GetListCluster(Cluster);
			ApiFileControl.SectorOffset=0;
			ApiFileControl.CurrentSectorNum=ClusterToSec(Cluster);
			
		}//---------end for cycle
	return FALSE;
}
BYTE CloseFile()
{
	BYTE Cache[512];
	struct _DIR *dir;
	////////////////////////////////////////////////////////////////////////
	if(ApiFileControl.SectorOffset!=0)
	{			
		if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(unsigned char *)BuffFile,TRUE))
			if(!Write(ApiFileControl.CurrentSectorNum,SimpleBpb.SecPerClus,(unsigned char *)BuffFile,TRUE))
				return FALSE;
	}		
	DelayMs(50);
	if(!Read(ApiFileControl.DirSectorNum,1,Cache))
		if(!Read(ApiFileControl.DirSectorNum,1,Cache))
		return FALSE;
	dir = (struct _DIR *)Cache;
	dir += ApiFileControl.DirIndex;
	ApiFileControl.dir.FileSize=DWordSwap(ApiFileControl.dir.FileSize);
	memcpy(dir, &ApiFileControl.dir, sizeof(struct _DIR));
	DelayMs(50);
	if(!Write(ApiFileControl.DirSectorNum,1,Cache,TRUE))
		if(!Write(ApiFileControl.DirSectorNum,1,Cache,TRUE))
			return FALSE;
	if(FatCache[0][256]!=0)
	{
		if(!Write(FatCache[0][256],1,(BYTE *)FatCache[0],0))
			if(!Write(FatCache[0][256],1,(BYTE *)FatCache[0],0))
				return FALSE;
	}
	return TRUE;		
}
BYTE SetFileSector(const char * filename,DWORD fileSector,DWORD offset)
{	
	DWORD FileFirstSector;
	WORD  Cluster;
	////////////////////////////////////////////////////////////////////////
	FileFirstSector=LocateFile(filename, &ApiFileControl);
	if(FileFirstSector==0xffffffff)
		return FALSE;	
	ApiFileControl.StartSectorNum = FileFirstSector;
	Cluster=WordSwap(ApiFileControl.dir.FstClusLO);
	for(;;)
	{
		if((GetListCluster(Cluster)==0xffff)||(Cluster==0))
	 		break;	 		  	
		Cluster=GetListCluster(Cluster);
	}
	//ApiFileControl.CurrentSectorNum為該簇對(duì)應(yīng)的第一個(gè)扇區(qū)
	//扇區(qū)號(hào)移到到了該文件最后一簇的第一個(gè)扇區(qū)
	if((ClusterToSec(Cluster))>=fileSector>=0)
		ApiFileControl.CurrentSectorNum =fileSector;
	else 
		return FALSE;
	 ApiFileControl.SectorOffset=offset;	
//	ApiFileControl.SectorOffset=(DWordSwap(ApiFileControl.dir.FileSize)%(SimpleBpb.BytsPerSec*SimpleBpb.SecPerClus));
	ApiFileControl.dir.FileSize=DWordSwap(ApiFileControl.dir.FileSize);
	return TRUE;

}
BYTE DisplayFile()
{
	WORD i,j=0,k=0;
	BYTE buf[512];
	struct _DIR *dir;
	for(i=0;i<FatParameter.RootDirSectors;i++)
	{
	  if(!Read(FatParameter.FirstRootDirSecNum+i,1,buf))
		  return FALSE;
	  dir=(struct _DIR *)buf;
	  for(dir = (struct _DIR *)buf; (BYTE*)dir < buf + SimpleBpb.BytsPerSec; dir++)
	  {
			if(dir->Name[0] !='\0')
			{

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品人人爽人人爽| 久久激情五月婷婷| 2020日本不卡一区二区视频| 在线视频综合导航| 国产一区福利在线| 午夜一区二区三区视频| 亚洲国产成人午夜在线一区| 日韩免费观看高清完整版| 欧美网站一区二区| 欧美午夜一区二区三区免费大片| 国产成人免费在线| 国内精品久久久久影院色| 亚洲成av人片一区二区梦乃| 综合色中文字幕| 国产精品电影一区二区| 中文av一区特黄| 成人免费在线播放视频| 国产亚洲成年网址在线观看| 精品福利在线导航| 亚洲精品在线三区| 久久久久久久久99精品| 欧美激情综合在线| 亚洲人成7777| 免费在线观看日韩欧美| 香蕉乱码成人久久天堂爱免费| 一区二区三区在线观看欧美| 午夜视频一区二区| 美脚の诱脚舐め脚责91| 国产伦精品一区二区三区视频青涩 | 久久综合一区二区| 日韩一区欧美一区| 夜夜爽夜夜爽精品视频| 美女视频网站黄色亚洲| 国产成人精品综合在线观看 | 国产精品久久久久永久免费观看 | 日韩成人精品在线| 国产suv精品一区二区6| 91免费观看国产| 日韩一区二区不卡| 中文字幕一区二| 免费在线视频一区| 色又黄又爽网站www久久| 欧美一区二区在线不卡| 国产精品久久夜| 国产一区二区三区精品欧美日韩一区二区三区 | 国产jizzjizz一区二区| 欧美精品在线一区二区| 国产精品人成在线观看免费 | 日韩欧美资源站| 亚洲欧美日韩系列| 国产剧情一区二区| 91精品国产欧美一区二区成人| 亚洲人成网站影音先锋播放| 美女尤物国产一区| 欧美日韩精品一区二区| 中文字幕一区二区三区av| 男人的j进女人的j一区| 色综合网色综合| ...av二区三区久久精品| 激情丁香综合五月| 4hu四虎永久在线影院成人| 亚洲精品中文在线| 东方aⅴ免费观看久久av| 精品99一区二区| 精品亚洲国产成人av制服丝袜 | 欧美极品少妇xxxxⅹ高跟鞋| 精品亚洲免费视频| 精品美女一区二区三区| 蜜臀久久久99精品久久久久久| 欧美中文一区二区三区| 亚洲资源在线观看| 精品视频一区二区三区免费| 亚洲激情五月婷婷| 欧美亚洲国产一区在线观看网站| 亚洲欧美另类久久久精品| 99久久久无码国产精品| 亚洲综合偷拍欧美一区色| 欧美性受xxxx黑人xyx性爽| 亚洲综合激情小说| 91精品国产综合久久久久久漫画 | 国产成人啪午夜精品网站男同| 久久久久9999亚洲精品| 99这里只有精品| 亚洲成av人片在线观看无码| 欧美一级理论片| 成人一级片在线观看| 国产精品灌醉下药二区| 综合色天天鬼久久鬼色| 欧美日本精品一区二区三区| 国产尤物一区二区在线| 亚洲欧美日韩系列| 精品国产成人系列| 97久久超碰国产精品电影| 偷偷要91色婷婷| 欧美激情一区二区三区在线| 欧美日韩精品一区视频| 国产 欧美在线| 麻豆freexxxx性91精品| 亚洲精品视频免费看| 久久综合久久鬼色| 亚洲一区二区视频| 日韩欧美二区三区| 色88888久久久久久影院野外| 亚洲电影在线播放| 欧美电影免费观看高清完整版在| 69精品人人人人| 久草这里只有精品视频| 亚洲高清视频在线| 九九**精品视频免费播放| 国产麻豆91精品| 91色综合久久久久婷婷| 欧美三级日韩在线| 欧美不卡视频一区| 国产精品婷婷午夜在线观看| 欧美成人午夜电影| 色哟哟国产精品免费观看| 成人h精品动漫一区二区三区| 日本中文字幕一区二区视频 | 99久久99久久免费精品蜜臀| 国产在线播放一区| 伦理电影国产精品| 蜜桃av一区二区三区电影| 亚洲高清免费在线| 婷婷国产在线综合| 天堂成人免费av电影一区| 日韩高清不卡一区| 久久国产剧场电影| 国产寡妇亲子伦一区二区| 国产suv精品一区二区三区| 成人妖精视频yjsp地址| 成人av在线看| 欧美三级三级三级| 精品三级在线看| 日本一区二区三区在线不卡| 国产视频一区在线播放| 亚洲欧美日韩在线不卡| 天堂一区二区在线免费观看| 国精产品一区一区三区mba视频 | 不卡一区二区三区四区| 色视频成人在线观看免| 欧美精品一区视频| 亚洲午夜在线观看视频在线| 国产69精品久久99不卡| 日韩一级大片在线| 亚洲一本大道在线| 国产精品69毛片高清亚洲| 欧美亚洲尤物久久| 一区精品在线播放| 国产综合久久久久久久久久久久| 欧美色综合影院| 亚洲最色的网站| av电影天堂一区二区在线观看| 欧美大片一区二区| 国产一区二区三区美女| 欧美精品第1页| 美女被吸乳得到大胸91| 在线国产电影不卡| 亚洲成人在线免费| 欧美综合在线视频| 亚洲国产综合色| 97久久人人超碰| 亚洲精品国久久99热| 成人av影院在线| 亚洲视频图片小说| 色呦呦网站一区| 亚洲一区二区视频| 欧美日韩不卡一区| 免费人成在线不卡| 久久视频一区二区| 精品一区二区三区的国产在线播放| 日韩精品专区在线| 国产真实乱对白精彩久久| 欧美国产日本视频| www.欧美精品一二区| 亚洲综合一区二区精品导航| 欧美亚洲综合久久| 日韩欧美在线影院| 国产一区二区看久久| 亚洲啪啪综合av一区二区三区| 欧美手机在线视频| 成人免费视频app| 首页国产丝袜综合| 中文在线资源观看网站视频免费不卡| 成人午夜短视频| 天堂成人国产精品一区| 久久久久久久久免费| 这里只有精品电影| av一区二区久久| 国产福利电影一区二区三区| 亚洲国产日韩一区二区| 中文乱码免费一区二区| 日韩亚洲欧美一区| caoporm超碰国产精品| 日韩高清国产一区在线| 国产精品不卡一区二区三区| 欧美日韩成人一区| 国产精品资源网站| 丝袜诱惑制服诱惑色一区在线观看 | 午夜久久久影院| 国产精品网站在线播放|