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

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

?? ff.c

?? FatFs/Tiny-FatFs Module Source Files R0.07
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* Read File                                                             */
/*-----------------------------------------------------------------------*/

FRESULT f_read (
	FIL *fp, 		/* Pointer to the file object */
	void *buff,		/* Pointer to data buffer */
	UINT btr,		/* Number of bytes to read */
	UINT *br		/* Pointer to number of bytes read */
)
{
	FRESULT res;
	DWORD clst, sect, remain;
	UINT rcnt, cc;
	BYTE *rbuff = buff;


	*br = 0;

	res = validate(fp->fs, fp->id);					/* Check validity of the object */
	if (res != FR_OK) LEAVE_FF(fp->fs, res);
	if (fp->flag & FA__ERROR)						/* Check abort flag */
		LEAVE_FF(fp->fs, FR_INT_ERR);
	if (!(fp->flag & FA_READ)) 						/* Check access mode */
		LEAVE_FF(fp->fs, FR_DENIED);
	remain = fp->fsize - fp->fptr;
	if (btr > remain) btr = (UINT)remain;			/* Truncate btr by remaining bytes */

	for ( ;  btr;									/* Repeat until all data transferred */
		rbuff += rcnt, fp->fptr += rcnt, *br += rcnt, btr -= rcnt) {
		if ((fp->fptr % SS(fp->fs)) == 0) {			/* On the sector boundary? */
			if (fp->csect >= fp->fs->csize) {		/* On the cluster boundary? */
				clst = (fp->fptr == 0) ?			/* On the top of the file? */
					fp->org_clust : get_cluster(fp->fs, fp->curr_clust);
				if (clst <= 1) ABORT(fp->fs, FR_INT_ERR);
				if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
				fp->curr_clust = clst;				/* Update current cluster */
				fp->csect = 0;						/* Reset sector offset in the cluster */
			}
			sect = clust2sect(fp->fs, fp->curr_clust);	/* Get current sector */
			if (!sect) ABORT(fp->fs, FR_INT_ERR);
			sect += fp->csect;
			cc = btr / SS(fp->fs);					/* When remaining bytes >= sector size, */
			if (cc) {								/* Read maximum contiguous sectors directly */
				if (fp->csect + cc > fp->fs->csize)	/* Clip at cluster boundary */
					cc = fp->fs->csize - fp->csect;
				if (disk_read(fp->fs->drive, rbuff, sect, (BYTE)cc) != RES_OK)
					ABORT(fp->fs, FR_DISK_ERR);
				fp->csect += (BYTE)cc;				/* Next sector address in the cluster */
				rcnt = SS(fp->fs) * cc;				/* Number of bytes transferred */
				continue;
			}
#if !_FS_TINY
#if !_FS_READONLY
			if (fp->flag & FA__DIRTY) {			/* Write sector I/O buffer if needed */
				if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
					ABORT(fp->fs, FR_DISK_ERR);
				fp->flag &= (BYTE)~FA__DIRTY;
			}
#endif
			if (fp->dsect != sect) {			/* Fill sector buffer with file data */
				if (disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
					ABORT(fp->fs, FR_DISK_ERR);
			}
#endif
			fp->dsect = sect;
			fp->csect++;							/* Next sector address in the cluster */
		}
		rcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs));	/* Get partial sector data from sector buffer */
		if (rcnt > btr) rcnt = btr;
#if _FS_TINY
		if (move_window(fp->fs, fp->dsect))			/* Move sector window */
			ABORT(fp->fs, FR_DISK_ERR);
		MemCpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt);	/* Pick partial sector */
#else
		MemCpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt);	/* Pick partial sector */
#endif
	}


	LEAVE_FF(fp->fs, FR_OK);
}




#if !_FS_READONLY
/*-----------------------------------------------------------------------*/
/* Write File                                                            */
/*-----------------------------------------------------------------------*/

FRESULT f_write (
	FIL *fp,			/* Pointer to the file object */
	const void *buff,	/* Pointer to the data to be written */
	UINT btw,			/* Number of bytes to write */
	UINT *bw			/* Pointer to number of bytes written */
)
{
	FRESULT res;
	DWORD clst, sect;
	UINT wcnt, cc;
	const BYTE *wbuff = buff;


	*bw = 0;

	res = validate(fp->fs, fp->id);					/* Check validity of the object */
	if (res != FR_OK) LEAVE_FF(fp->fs, res);
	if (fp->flag & FA__ERROR)						/* Check abort flag */
		LEAVE_FF(fp->fs, FR_INT_ERR);
	if (!(fp->flag & FA_WRITE))						/* Check access mode */
		LEAVE_FF(fp->fs, FR_DENIED);
	if (fp->fsize + btw < fp->fsize) btw = 0;		/* File size cannot reach 4GB */

	for ( ;  btw;									/* Repeat until all data transferred */
		wbuff += wcnt, fp->fptr += wcnt, *bw += wcnt, btw -= wcnt) {
		if ((fp->fptr % SS(fp->fs)) == 0) {			/* On the sector boundary? */
			if (fp->csect >= fp->fs->csize) {		/* On the cluster boundary? */
				if (fp->fptr == 0) {				/* On the top of the file? */
					clst = fp->org_clust;			/* Follow from the origin */
					if (clst == 0)					/* When there is no cluster chain, */
						fp->org_clust = clst = create_chain(fp->fs, 0);	/* Create a new cluster chain */
				} else {							/* Middle or end of the file */
					clst = create_chain(fp->fs, fp->curr_clust);			/* Follow or streach cluster chain */
				}
				if (clst == 0) break;				/* Could not allocate a new cluster (disk full) */
				if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
				if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
				fp->curr_clust = clst;				/* Update current cluster */
				fp->csect = 0;						/* Reset sector address in the cluster */
			}
#if _FS_TINY
			if (fp->fs->winsect == fp->dsect && move_window(fp->fs, 0))	/* Write back data buffer prior to following direct transfer */
				ABORT(fp->fs, FR_DISK_ERR);
#else
			if (fp->flag & FA__DIRTY) {		/* Write back data buffer prior to following direct transfer */
				if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
					ABORT(fp->fs, FR_DISK_ERR);
				fp->flag &= (BYTE)~FA__DIRTY;
			}
#endif
			sect = clust2sect(fp->fs, fp->curr_clust);	/* Get current sector */
			if (!sect) ABORT(fp->fs, FR_INT_ERR);
			sect += fp->csect;
			cc = btw / SS(fp->fs);					/* When remaining bytes >= sector size, */
			if (cc) {								/* Write maximum contiguous sectors directly */
				if (fp->csect + cc > fp->fs->csize)	/* Clip at cluster boundary */
					cc = fp->fs->csize - fp->csect;
				if (disk_write(fp->fs->drive, wbuff, sect, (BYTE)cc) != RES_OK)
					ABORT(fp->fs, FR_DISK_ERR);
				fp->csect += (BYTE)cc;				/* Next sector address in the cluster */
				wcnt = SS(fp->fs) * cc;				/* Number of bytes transferred */
				continue;
			}
#if _FS_TINY
			if (fp->fptr >= fp->fsize) {			/* Avoid silly buffer filling at growing edge */
				if (move_window(fp->fs, 0)) ABORT(fp->fs, FR_DISK_ERR);
				fp->fs->winsect = sect;
			}
#else
			if (fp->dsect != sect) {				/* Fill sector buffer with file data */
				if (fp->fptr < fp->fsize &&
					disk_read(fp->fs->drive, fp->buf, sect, 1) != RES_OK)
						ABORT(fp->fs, FR_DISK_ERR);
			}
#endif
			fp->dsect = sect;
			fp->csect++;							/* Next sector address in the cluster */
		}
		wcnt = SS(fp->fs) - (fp->fptr % SS(fp->fs));	/* Put partial sector into file I/O buffer */
		if (wcnt > btw) wcnt = btw;
#if _FS_TINY
		if (move_window(fp->fs, fp->dsect))			/* Move sector window */
			ABORT(fp->fs, FR_DISK_ERR);
		MemCpy(&fp->fs->win[fp->fptr % SS(fp->fs)], wbuff, wcnt);	/* Fit partial sector */
		fp->fs->wflag = 1;
#else
		MemCpy(&fp->buf[fp->fptr % SS(fp->fs)], wbuff, wcnt);	/* Fit partial sector */
		fp->flag |= FA__DIRTY;
#endif
	}

	if (fp->fptr > fp->fsize) fp->fsize = fp->fptr;	/* Update file size if needed */
	fp->flag |= FA__WRITTEN;						/* Set file changed flag */

	LEAVE_FF(fp->fs, FR_OK);
}




/*-----------------------------------------------------------------------*/
/* Synchronize the File Object                                           */
/*-----------------------------------------------------------------------*/

FRESULT f_sync (
	FIL *fp		/* Pointer to the file object */
)
{
	FRESULT res;
	DWORD tim;
	BYTE *dir;


	res = validate(fp->fs, fp->id);		/* Check validity of the object */
	if (res == FR_OK) {
		if (fp->flag & FA__WRITTEN) {	/* Has the file been written? */
#if !_FS_TINY	/* Write-back dirty buffer */
			if (fp->flag & FA__DIRTY) {
				if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
					LEAVE_FF(fp->fs, FR_DISK_ERR);
				fp->flag &= (BYTE)~FA__DIRTY;
			}
#endif
			/* Update the directory entry */
			res = move_window(fp->fs, fp->dir_sect);
			if (res == FR_OK) {
				dir = fp->dir_ptr;
				dir[DIR_Attr] |= AM_ARC;					/* Set archive bit */
				ST_DWORD(dir+DIR_FileSize, fp->fsize);		/* Update file size */
				ST_WORD(dir+DIR_FstClusLO, fp->org_clust);	/* Update start cluster */
				ST_WORD(dir+DIR_FstClusHI, fp->org_clust >> 16);
				tim = get_fattime();					/* Updated time */
				ST_DWORD(dir+DIR_WrtTime, tim);
				fp->flag &= (BYTE)~FA__WRITTEN;
				fp->fs->wflag = 1;
				res = sync(fp->fs);
			}
		}
	}

	LEAVE_FF(fp->fs, res);
}

#endif /* !_FS_READONLY */




/*-----------------------------------------------------------------------*/
/* Close File                                                            */
/*-----------------------------------------------------------------------*/

FRESULT f_close (
	FIL *fp		/* Pointer to the file object to be closed */
)
{
	FRESULT res;


#if _FS_READONLY
	res = validate(fp->fs, fp->id);
	if (res == FR_OK) fp->fs = NULL;
	LEAVE_FF(fp->fs, res);
#else
	res = f_sync(fp);
	if (res == FR_OK) fp->fs = NULL;
	return res;
#endif
}




#if _FS_MINIMIZE <= 2
/*-----------------------------------------------------------------------*/
/* Seek File R/W Pointer                                                 */
/*-----------------------------------------------------------------------*/

FRESULT f_lseek (
	FIL *fp,		/* Pointer to the file object */
	DWORD ofs		/* File pointer from top of file */
)
{
	FRESULT res;
	DWORD clst, bcs, nsect, ifptr;


	res = validate(fp->fs, fp->id);		/* Check validity of the object */
	if (res != FR_OK) LEAVE_FF(fp->fs, res);
	if (fp->flag & FA__ERROR)			/* Check abort flag */
		LEAVE_FF(fp->fs, FR_INT_ERR);
	if (ofs > fp->fsize					/* In read-only mode, clip offset with the file size */
#if !_FS_READONLY
		 && !(fp->flag & FA_WRITE)
#endif
		) ofs = fp->fsize;

	ifptr = fp->fptr;
	fp->fptr = 0; fp->csect = 255;
	nsect = 0;
	if (ofs > 0) {
		bcs = (DWORD)fp->fs->csize * SS(fp->fs);	/* Cluster size (byte) */
		if (ifptr > 0 &&
			(ofs - 1) / bcs >= (ifptr - 1) / bcs) {	/* When seek to same or following cluster, */
			fp->fptr = (ifptr - 1) & ~(bcs - 1);	/* start from the current cluster */
			ofs -= fp->fptr;
			clst = fp->curr_clust;
		} else {									/* When seek to back cluster, */
			clst = fp->org_clust;					/* start from the first cluster */
#if !_FS_READONLY
			if (clst == 0) {						/* If no cluster chain, create a new chain */
				clst = create_chain(fp->fs, 0);
				if (clst == 1) ABORT(fp->fs, FR_INT_ERR);
				if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
				fp->org_clust = clst;
			}
#endif
			fp->curr_clust = clst;
		}
		if (clst != 0) {
			while (ofs > bcs) {						/* Cluster following loop */
#if !_FS_READONLY
				if (fp->flag & FA_WRITE) {			/* Check if in write mode or not */
					clst = create_chain(fp->fs, clst);	/* Force streached if in write mode */
					if (clst == 0) {				/* When disk gets full, clip file size */
						ofs = bcs; break;
					}
				} else
#endif
					clst = get_cluster(fp->fs, clst);	/* Follow cluster chain if not in write mode */
				if (clst == 0xFFFFFFFF) ABORT(fp->fs, FR_DISK_ERR);
				if (clst <= 1 || clst >= fp->fs->max_clust) ABORT(fp->fs, FR_INT_ERR);
				fp->curr_clust = clst;
				fp->fptr += bcs;
				ofs -= bcs;
			}
			fp->fptr += ofs;
			fp->csect = (BYTE)(ofs / SS(fp->fs));	/* Sector offset in the cluster */
			if (ofs % SS(fp->fs)) {
				nsect = clust2sect(fp->fs, clst);	/* Current sector */
				if (!nsect) ABORT(fp->fs, FR_INT_ERR);
				nsect += fp->csect;
				fp->csect++;
			}
		}
	}
	if (nsect && nsect != fp->dsect && fp->fptr % SS(fp->fs)) {
#if !_FS_TINY
#if !_FS_READONLY
		if (fp->flag & FA__DIRTY) {			/* Write-back dirty buffer if needed */
			if (disk_write(fp->fs->drive, fp->buf, fp->dsect, 1) != RES_OK)
				ABORT(fp->fs, FR_DISK_ERR);
			fp->flag &= (BYTE)~FA__DIRTY;
		}
#endif
		if (disk_read(fp->fs->drive, fp->buf, nsect, 1) != RES_OK)
			ABORT(fp->fs, FR_DISK_ERR);
#endif
		fp->dsect = nsect;
	}
#if !_FS_READONLY
	if (fp->fptr > fp->fsize) {			/* Set changed flag if the file size is extended */
		fp->fsize = fp->fptr;
		fp->flag |= FA__WRITTEN;
	}
#endif

	LEAVE_FF(fp->fs, res);
}




#if _FS_MINIMIZE <= 1
/*-----------------------------------------------------------------------*/
/* Create a Directroy Object                                             */
/*-----------------------------------------------------------------------*/

FRESULT f_opendir (
	DIR *dj,			/* Pointer to directory object to create */
	const char *path	/* Pointer to the directory path */
)
{
	FRESULT res;
	NAMEBUF(sfn, lfn);
	BYTE *dir;


	res = auto_mount(&path, &dj->fs, 0);
	if (res == FR_OK) {
		INITBUF((*dj), sfn, lfn);
		res = follow_path(dj, path);			/* Follow the path to the directory */
		if (res == FR_OK) {						/* Follow completed */
			dir = dj->dir;
			if (dir) {							/* It is not the root dir */
				if (dir[DIR_Attr] & AM_DIR) {	/* The object is a directory */
					dj->sclust = ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) | LD_WORD(dir+DIR_FstClusLO);
				} else {						/* The object is not a directory */
					res = FR_NO_PATH;
				}
			} else {							/* It is the root dir */
				dj->sclust = (dj->fs->fs_type == FS_FAT32) ? dj->fs->dirbase : 0;
			}
			if (res == FR_OK) res = dir_seek(dj, 0);
			dj->id = dj->fs->id;
		} else {
			if (res == FR_NO_FILE) res = FR_NO_PATH;
		}
	}

	LEAVE_FF(dj->fs, res);
}




/*-----------------------------------------------------------------------*/
/* 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜视频福利| 亚洲123区在线观看| 国产一区福利在线| 久久亚洲二区三区| 国产一区二区在线影院| 欧美国产激情二区三区 | 欧美日韩国产另类不卡| 欧亚一区二区三区| 亚洲午夜久久久久久久久久久| 91麻豆福利精品推荐| 亚洲靠逼com| 欧美日韩高清一区二区不卡| 日韩和欧美一区二区| 精品剧情在线观看| 国产成a人亚洲精品| 亚洲精品国产高清久久伦理二区| 色诱视频网站一区| 日本欧美韩国一区三区| 久久久久久久久久久久电影| 成人av网址在线观看| 亚洲第一综合色| 2020国产精品| 色狠狠一区二区三区香蕉| 日韩精品亚洲一区| 久久精品男人天堂av| 欧洲中文字幕精品| 久久99国产精品久久99果冻传媒| 国产精品人妖ts系列视频| 在线播放中文字幕一区| 国产大陆a不卡| 亚洲综合免费观看高清完整版在线| 91精品久久久久久蜜臀| 国产宾馆实践打屁股91| 亚洲午夜一二三区视频| 一区二区三区中文在线| 欧美一区中文字幕| 99久久国产综合精品女不卡| 无吗不卡中文字幕| 中文字幕在线一区二区三区| 日韩视频一区二区三区在线播放| 91在线观看一区二区| 美女被吸乳得到大胸91| 亚洲精品视频在线观看网站| 2023国产精品自拍| 日韩一级完整毛片| 色中色一区二区| 成人性生交大片免费看中文| 青青草成人在线观看| 亚洲精品乱码久久久久久日本蜜臀| 精品日韩在线观看| 欧美日韩另类一区| 不卡一区二区在线| 国产激情偷乱视频一区二区三区| 日本一区中文字幕| 亚洲综合图片区| 国产精品久久夜| 国产亚洲一本大道中文在线| 欧美一区二区久久| 7878成人国产在线观看| 在线日韩av片| 日本韩国欧美一区二区三区| 成人黄色在线网站| 国产高清在线观看免费不卡| 毛片不卡一区二区| 日本麻豆一区二区三区视频| 亚洲午夜视频在线| 亚洲精品日产精品乱码不卡| 一区在线观看视频| 中文字幕av一区二区三区| 日韩精品专区在线影院观看| 欧美精品黑人性xxxx| 在线观看视频一区二区欧美日韩| a美女胸又www黄视频久久| 国产一区二区调教| 国产一区二区三区电影在线观看| 日本sm残虐另类| 天堂久久久久va久久久久| 亚洲国产毛片aaaaa无费看| 一级日本不卡的影视| 一区二区三区在线观看国产| 亚洲欧美日韩中文播放 | 91在线免费看| 成人av集中营| 97成人超碰视| 色综合激情五月| 欧美日韩视频第一区| 欧美日韩一区不卡| 7777精品伊人久久久大香线蕉完整版 | 日韩国产精品大片| 美腿丝袜亚洲色图| 裸体一区二区三区| 国产一区二区三区高清播放| 丁香激情综合五月| 一本到不卡精品视频在线观看| 色94色欧美sute亚洲线路二| 欧美日本一区二区三区四区| 91精品国产综合久久精品图片| 日韩欧美国产1| 久久精品一区二区三区不卡牛牛 | 91精品在线免费观看| 欧美二区三区的天堂| 欧美一区三区二区| 久久噜噜亚洲综合| 一区在线播放视频| 石原莉奈在线亚洲二区| 国产呦萝稀缺另类资源| 色综合久久久久久久久| 9191久久久久久久久久久| 337p粉嫩大胆噜噜噜噜噜91av| 国产亚洲一区字幕| 亚洲欧美aⅴ...| 日韩av一级片| 国产在线视频精品一区| 色综合激情久久| 91精品婷婷国产综合久久性色| 日韩欧美视频一区| 国产日韩av一区二区| 亚洲桃色在线一区| 精品一区二区三区在线视频| 懂色av一区二区夜夜嗨| 色天使色偷偷av一区二区| 欧美丰满一区二区免费视频| 欧美亚洲另类激情小说| 久久久亚洲午夜电影| 亚洲少妇中出一区| 日韩影院在线观看| 国产成人自拍在线| 91社区在线播放| 国产午夜亚洲精品羞羞网站| 亚洲欧美日韩在线| 国精品**一区二区三区在线蜜桃| 91香蕉视频在线| 在线不卡a资源高清| 日本一区二区免费在线| 亚洲宅男天堂在线观看无病毒 | 亚洲成a人片在线观看中文| 久久国产综合精品| 在线精品观看国产| 2020国产精品自拍| 亚洲成人av在线电影| 国产一区二区精品久久| 色8久久精品久久久久久蜜| 欧美成人精品高清在线播放| 亚洲三级小视频| 久久av资源网| 欧美三区在线观看| 国产精品视频观看| 国产成都精品91一区二区三| 91精品国产高清一区二区三区蜜臀| 国产精品婷婷午夜在线观看| 美国十次综合导航| 91久久一区二区| 亚洲欧美日韩系列| 国产精品一区免费视频| 欧美电影在哪看比较好| 国产精品久久毛片av大全日韩| 免费观看久久久4p| 欧美一区二区视频在线观看2020| 中文字幕一区二区三区精华液| 久久精品国产亚洲aⅴ| 欧美日本韩国一区| 一区二区三区日本| www.久久久久久久久| 久久婷婷色综合| 美女一区二区在线观看| 欧美午夜片在线观看| 亚洲青青青在线视频| 国产xxx精品视频大全| 日韩片之四级片| 久久99久久精品| 欧美一区二区三区的| 亚洲成年人影院| 欧美熟乱第一页| 精品福利二区三区| 国产高清亚洲一区| 视频一区二区欧美| 欧美色图第一页| 亚洲激情成人在线| 欧美日韩在线观看一区二区 | 国产精品久久福利| 国产福利视频一区二区三区| 精品国产电影一区二区| 寂寞少妇一区二区三区| 日韩精品一区二区在线观看| 免费成人小视频| 日韩视频一区在线观看| 亚洲大片精品永久免费| 91精品国产综合久久小美女| 日韩av午夜在线观看| 欧美乱妇一区二区三区不卡视频| 亚洲一区视频在线观看视频| 欧美精品一二三四| 石原莉奈在线亚洲二区| 日韩精品中文字幕在线不卡尤物 | 免费欧美日韩国产三级电影| 精品国产免费一区二区三区香蕉| 极品瑜伽女神91| 欧美国产日产图区| eeuss鲁片一区二区三区 | 99视频精品全部免费在线|