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

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

?? ata.c

?? 嵌入式系統(tǒng)中的fat32和fat16源代碼(完全版)
?? C
?? 第 1 頁 / 共 2 頁
字號(hào):

	// write data to drive
	ataWriteDataBuffer(Buffer, 512);

	// Wait for drive to finish write
	temp = ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);

	// Return the error bit from the status register...
	return (temp & ATA_SR_ERR) ? 1:0;
}
#endif
////////////////////


//*****************************************************************************
// Function: ataReadSectorLBA
// Parameters: Driver, lba address, Buffer
// Returns: on Suscefull returns 0, the result errors otherwise.
//
// Description: Read one Sector (512 Bytes) from the ata dispositive
//*****************************************************************************
unsigned char ataReadSectorsLBA(	unsigned char Drive,
									unsigned long lba,
                            		unsigned char *Buffer)
{
  	unsigned int cyl, head, sect;
  	unsigned char temp;


	sect = (int) ( lba & 0x000000ffL );
	lba = lba >> 8;
	cyl = (int) ( lba & 0x0000ffff );
	lba = lba >> 16;
	head = ( (int) ( lba & 0x0fL ) ) | ATA_HEAD_USE_LBA;

	temp = ataReadSectorsCHS( Drive, head, cyl, sect, Buffer );
	return temp;
}


////////////////////
#ifndef ATA_READ_ONLY
//*****************************************************************************
// Function: ataWriteSectorsLBA
// Parameters: Driver, lba address, Buffer
// Returns: on Suscefull returns 0, the result errors otherwise.
//
// Description: Write one Sector (512 Bytes) to the ata dispositive
//*****************************************************************************
unsigned char ataWriteSectorsLBA(	unsigned char Drive,
									unsigned long lba,
									unsigned char *Buffer)
{
	unsigned int cyl, head, sect;
	unsigned char temp;

	sect = (int) ( lba & 0x000000ffL );
	lba = lba >> 8;
	cyl = (int) ( lba & 0x0000ffff );
	lba = lba >> 16;
	head = ( (int) ( lba & 0x0fL ) ) | ATA_HEAD_USE_LBA;

	temp = ataWriteSectorsCHS( Drive, head, cyl, sect, Buffer );
	return temp;
}
#endif
////////////////////


//*****************************************************************************
// Function: ataReadSectors
// Parameters: Driver, lba, Buffer, SectorInCache
// Returns: on Suscefull returns 0, the result errors otherwise.
//
// Description: Read one Sector (512 Bytes) from the ata dispositive
//*****************************************************************************
unsigned char ataReadSectors(	unsigned char Drive,
								unsigned long lba,//sector number
                            	unsigned char *Buffer,
                            	unsigned long *SectorInCache //actual sector
                            )
{
  	unsigned int cyl, head, sect;
  	unsigned char temp;


	// if the Sector is already in the memory buffer, we don't need to read the sector again
 	if(*SectorInCache==lba)
  		return 0;

	*SectorInCache=lba;

	// check if drive supports native LBA mode
	if(ataDriveInfo.LBAsupport)
	{
		// drive supports using native LBA
		temp = ataReadSectorsLBA(Drive, lba, Buffer);
	}
	else
	{
		// drive required CHS access
		// convert LBA to pseudo CHS
		// remember to offset the sector count by one
		sect = (unsigned char) (lba % ataDriveInfo.sectors)+1;
		lba = lba / ataDriveInfo.sectors;
		head = (unsigned char) (lba % ataDriveInfo.heads);
		lba = lba / ataDriveInfo.heads;
		cyl = (unsigned short) lba;

		temp = ataReadSectorsCHS( Drive, head, cyl, sect, Buffer );
	}
	return temp;
}


////////////////////
#ifndef ATA_READ_ONLY
//*****************************************************************************
// Function: ataWriteSectors
// Parameters: Driver, lba, Buffer
// Returns: on Suscefull returns 0, the result errors otherwise.
//
// Description: Write one Sector (512 Bytes) to the ata dispositive
//*****************************************************************************
unsigned char ataWriteSectors(	unsigned char Drive,
								unsigned long lba,
                            	unsigned char *Buffer)
{
  	unsigned int cyl, head, sect;
  	unsigned char temp;

	// check if drive supports native LBA mode
	if(ataDriveInfo.LBAsupport)
	{
		// drive supports using native LBA
		temp = ataWriteSectorsLBA(Drive, lba, Buffer);
	}
	else
	{
		// drive required CHS access
		// convert LBA to pseudo CHS
		// remember to offset the sector count by one
		sect = (unsigned char) (lba % ataDriveInfo.sectors)+1;
		lba = lba / ataDriveInfo.sectors;
		head = (unsigned char) (lba % ataDriveInfo.heads);
		lba = lba / ataDriveInfo.heads;
		cyl = (unsigned short) lba;

		temp = ataWriteSectorsCHS( Drive, head, cyl, sect, Buffer );
	}
	return temp;
}
#endif
////////////////////


//*****************************************************************************
// Function: ataDriveSelect
// Parameters: Drive Number
// Returns: none.
//
// Description: Change the drive, Master or Slave
//*****************************************************************************
void ataDriveSelect(unsigned char DriveNo)
{
	ataWriteByte(ATA_REG_HDDEVSEL, 0xA0+(DriveNo ? 0x10:00)); // Drive selection
}


//*****************************************************************************
// Function: ataReadByte
// Parameters: reg
// Returns: The Readed Data from the ata dispositive.
//
// Description: Read one Byte from the ata dispositive
//*****************************************************************************
unsigned char ataReadByte(unsigned char reg)
{
	register unsigned char ret;

  	PORT_DATAL= 0xFF;				// habilita pull-ups
  	DDR_DATAL  = 0x00; 		      	// Use the DATAH as an input
  	PORT_ADDR = PORT_ADDR & 0xe0; 		// Clear the lower 5 bits of the address line
  	PORT_ADDR = PORT_ADDR | (reg & 0x1f); 	// Assert the address Line

  	cbi(PORT_IDE_RD, PIN_IDE_RD);                  	// Assert DIOR
  	__asm volatile ("NOP");
  	__asm volatile ("NOP");
  	__asm volatile ("NOP");

  	ret = PIN_DATAL;
  	sbi(PORT_IDE_RD, PIN_IDE_RD);			      	// Negate DIOR

  	return (ret);
}


//*****************************************************************************
// Function: ataWriteByte
// Parameters: reg, data
// Returns: none.
//
// Description: Write one Byte to the ata dispositive
//*****************************************************************************
void ataWriteByte(unsigned char reg, unsigned char data)
{
  	DDR_DATAL = 0xff;			   	// Use DATAL an an output
  	PORT_ADDR = PORT_ADDR & 0xe0;	       		// Clear the Lower 5 bits of the Address Line
  	PORT_ADDR = PORT_ADDR | (reg & 0x1f); 	// Assert the Address line

  	PORT_DATAL = data;				// Output the data

  	cbi(PORT_IDE_WR,PIN_IDE_WR);				// Assert DIOW
  	__asm volatile ("NOP");
  	__asm volatile ("NOP");
  	__asm volatile ("NOP");
  	sbi(PORT_IDE_WR,PIN_IDE_WR);				// Negate DIOW
}



//*****************************************************************************
// Function: IDE_Wait_State
// Parameters: test_bit
// Returns: on suscefull returns 1, otherwise returns 0.
//
// Description: Test a bit in the status register
//*****************************************************************************
unsigned char IDE_Wait_State(unsigned char test_bit)
{
	if ((ataReadByte(ATA_REG_ACTSTATUS) & test_bit) == test_bit)
		return 1;
	return 0;
}



//*****************************************************************************
// Function: ataGetSizeInSectors
// Parameters: none
// Returns: Size in sectors from the ata dispositive
//
// Description: Returns the number of sectors from the ata dispositive
//*****************************************************************************
unsigned long ataGetSizeInSectors(void)
{
	return(ataDriveInfo.sizeinsectors);
}


//*****************************************************************************
// Function: ataGetSize
// Parameters: none
// Returns: Size in bytes from the ata dispositive
//
// Description: Returns the size in bytes from the ata dispositive
//*****************************************************************************
unsigned long ataGetSize(void)
{
	return(ataDriveInfo.sizeinsectors/(1000000/512));
}



//*****************************************************************************
// Function: ataGetModel
// Parameters: none
// Returns: Model string from the ata dispositive
//
// Description: Returns the model string from the ata dispositive
//*****************************************************************************
char *ataGetModel(void)
{
	return(ataDriveInfo.model);
}


//*****************************************************************************
// Function: delay
// Parameters: time in us
// Returns: none
//
// Description: delay for a minimum of <us> microseconds
// 			    the time resolution is dependent on the time the loop takes
// 	            e.g. with 4Mhz and 5 cycles per loop, the resolution is 1.25 us
//*****************************************************************************
void delay(unsigned short us)
{
	unsigned short delay_loops;
	register unsigned short i;

	delay_loops = (us+3)/5*CYCLES_PER_US; // +3 for rounding up (dirty)

	// one loop takes 5 cpu cycles
	for (i=0; i < delay_loops; i++) {};
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一色哟哟哟| 国产91对白在线观看九色| 欧美精品一区二区三区久久久| 成人午夜免费av| 人人精品人人爱| 一区二区三区资源| 久久久久久97三级| 欧美一区二区啪啪| 色8久久精品久久久久久蜜| 狠狠v欧美v日韩v亚洲ⅴ| 亚洲国产精品一区二区www| 亚洲国产电影在线观看| 日韩视频免费观看高清完整版在线观看 | 亚洲国产日产av| 国产日产亚洲精品系列| 日韩精品一区二区三区视频在线观看| 日本韩国一区二区三区视频| 成人av影视在线观看| 国产在线精品一区二区三区不卡| 日日夜夜精品免费视频| 亚洲一区影音先锋| 亚洲免费视频中文字幕| 成人欧美一区二区三区白人| 国产午夜精品在线观看| 精品国精品自拍自在线| 欧美一区二区三区免费视频| 欧美精品三级日韩久久| 欧美日韩国产在线播放网站| 欧美午夜理伦三级在线观看| 一本色道久久加勒比精品| jlzzjlzz国产精品久久| 成人免费视频网站在线观看| 国产成人午夜精品影院观看视频| 黑人精品欧美一区二区蜜桃| 国产一本一道久久香蕉| 精品亚洲成av人在线观看| 狠狠色丁香九九婷婷综合五月| 久久精品噜噜噜成人av农村| 精品中文字幕一区二区 | 成人v精品蜜桃久久一区| 成人夜色视频网站在线观看| 成人丝袜高跟foot| 99久久免费国产| 色综合天天性综合| 欧美最猛黑人xxxxx猛交| 欧美日韩一区不卡| 日韩欧美一卡二卡| 久久久亚洲精品石原莉奈| 国产日本亚洲高清| 亚洲欧洲日韩在线| 亚洲一区二区在线视频| 免费在线观看精品| 国产精品一区免费视频| av一区二区三区| 在线亚洲精品福利网址导航| 欧美日韩国产电影| 日韩视频免费观看高清完整版在线观看 | 色综合久久88色综合天天免费| 91久久久免费一区二区| 欧美一区二区视频观看视频| 精品乱人伦一区二区三区| 国产人久久人人人人爽| 亚洲激情五月婷婷| 热久久一区二区| 国产成人aaaa| 在线看一区二区| 欧美成人伊人久久综合网| 国产日韩欧美制服另类| 亚洲欧美另类综合偷拍| 日韩高清在线观看| 国产一区二区三区综合| 91亚洲午夜精品久久久久久| 欧美丰满高潮xxxx喷水动漫| 久久精品视频在线看| 亚洲精品免费电影| 麻豆精品视频在线观看视频| av成人动漫在线观看| 在线成人免费视频| 亚洲国产成人午夜在线一区| 亚洲中国最大av网站| 国产一区在线不卡| 欧美专区亚洲专区| 久久精品男人的天堂| 亚洲一级电影视频| 高清av一区二区| 91精品欧美一区二区三区综合在| 欧美韩国一区二区| 日韩成人精品在线| 色综合久久综合| 久久久久久久久岛国免费| 亚洲国产精品人人做人人爽| 国产精品99久久久久| 欧美人伦禁忌dvd放荡欲情| 中文字幕不卡在线播放| 日本aⅴ免费视频一区二区三区| 99re在线视频这里只有精品| 精品国产乱码久久久久久1区2区 | 精品写真视频在线观看| 在线欧美小视频| 中文字幕成人av| 激情图区综合网| 91精品久久久久久久久99蜜臂| 国产精品美女久久久久久久网站| 日本麻豆一区二区三区视频| 色综合视频一区二区三区高清| 国产色婷婷亚洲99精品小说| 青青草97国产精品免费观看| 色天使色偷偷av一区二区| 国产欧美日韩亚州综合 | 国产精品久久久一本精品| 热久久免费视频| 欧美精品18+| 一级精品视频在线观看宜春院| 成人中文字幕电影| 久久久久久久久久看片| 久久国内精品视频| 欧美一区二区福利视频| 午夜视频在线观看一区二区| 色噜噜狠狠色综合中国| 中文字幕一区二区三区在线不卡 | 日韩黄色免费电影| 欧美人伦禁忌dvd放荡欲情| 亚洲国产精品自拍| 91福利国产成人精品照片| 亚洲伦理在线精品| 91丝袜呻吟高潮美腿白嫩在线观看| 久久精品网站免费观看| 国产精品自在欧美一区| 久久久噜噜噜久噜久久综合| 国产精品18久久久久久久久久久久| 日韩欧美在线影院| 精品一区二区三区蜜桃| 日韩免费高清电影| 激情综合色综合久久综合| 精品美女一区二区| 国产高清亚洲一区| 国产精品久久久久桃色tv| 成人av免费在线| 亚洲欧美日韩久久| 色av成人天堂桃色av| 亚洲一区精品在线| 欧美一区二区三区在线看| 麻豆高清免费国产一区| 26uuu精品一区二区| 福利电影一区二区三区| 国产精品传媒入口麻豆| 色偷偷久久人人79超碰人人澡| 依依成人精品视频| 欧美视频中文字幕| 日韩精品久久久久久| 欧美va亚洲va| 国产河南妇女毛片精品久久久| 国产精品二区一区二区aⅴ污介绍| 色综合久久久久综合99| 亚洲电影欧美电影有声小说| 欧美一区二区三区视频免费播放| 美女网站在线免费欧美精品| 久久久午夜精品理论片中文字幕| 成人精品国产一区二区4080| 亚洲影视在线观看| 欧美xxxxx裸体时装秀| www.66久久| 日本中文字幕不卡| 欧美国产日本韩| 欧美丝袜丝交足nylons| 九九九久久久精品| 亚洲三级免费电影| 欧美精品xxxxbbbb| 成人精品在线视频观看| 一区二区三区丝袜| 日韩免费看的电影| 99精品视频一区二区| 亚洲大片一区二区三区| 久久色在线观看| 日本精品一级二级| 精品影院一区二区久久久| ●精品国产综合乱码久久久久| 欧美日韩精品免费观看视频| 国产精品中文字幕欧美| 一二三区精品视频| 精品国产乱码久久久久久免费| 99re8在线精品视频免费播放| 日本视频在线一区| 亚洲欧美成人一区二区三区| 日韩欧美国产午夜精品| 91网上在线视频| 国产资源精品在线观看| 亚洲综合偷拍欧美一区色| 久久久国产精品不卡| 欧美系列亚洲系列| 高清不卡一二三区| 久热成人在线视频| 亚洲成va人在线观看| 国产精品久久久一本精品| 精品三级在线看| 欧美日韩精品综合在线| voyeur盗摄精品| 国产精品亚洲а∨天堂免在线| 亚洲成av人**亚洲成av**| 国产精品国产精品国产专区不片|