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

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

?? ide_access.c

?? blackfin平臺實現對SD卡的支持
?? C
字號:
/***********************************************************************************
* File              : ide_access.C
* Processor    : ADSP-BF533  
* IDDE          : VisualDSP++3.5
* Description  : define bunch of IDE driver interface functions to FAT including:
*                  
*                    fnIDE_SectorByte();
*                    funIDE_WriteSectorByte();
*			 fnIDE_SectorWord();
*			 fnIDE_SectorDWORD();
*			 fnIDE_SectorData();
*			 fnIDE_WriteSectorData();
*			 fnIDE_BufferSector();
*			 fnIDE_WriteBufferSector();
*			 fnIDE_InitDrive();
*                    
***********************************************************************************/

#include "ide_base.h"
#include "ide_access.h"
#include "type.h"

IDE_BUFFER buffers;

IDE_DRIVER IDE_current;

/**********************************************************************************
* Function     : nIDE_SectorByte
* Description : Read one byte from a specified address of current sector
* Input         : WORD Sublocation
* Return       : one byte value
***********************************************************************************/

BYTE fnIDE_SectorByte(WORD sublocation)
{
	BYTE data=0;          
	
    	data=buffers.currentsector.u8data[sublocation];	  // Read Data from specified pos
	return (data);
}

/**********************************************************************************
* Function     : fnIDE_WriteSectorByte
* Description : write one byte to a specified address of current sector
* Input         : WORD Sublocation
* Return       : one byte written value
***********************************************************************************/

BYTE fnIDE_WriteSectorByte(WORD sublocation, BYTE value)
{
	buffers.currentsector.u8data[sublocation]=value;
	return (value);
}

/**********************************************************************************
* Function     : fnIDE_SectorWord
* Description : read one word from a specified address of current sector
* Input         : WORD Sublocation
* Return       : one word read value
***********************************************************************************/

WORD fnIDE_SectorWord(WORD sublocation) // Return Word at position specified
{
	WORD data=0; 
	 
	data	=buffers.currentsector.u8data[sublocation];	  // Read Data from specified pos
	data   +=buffers.currentsector.u8data[sublocation+1]<<8;
	return (data);					  			 // Return value
}


/**********************************************************************************
* Function     : fnIDE_SectorDWord
* Description : read double word from a specified address of current sector
* Input         : WORD Sublocation
* Return       : double word read value
***********************************************************************************/

DWORD fnIDE_SectorDWORD(WORD sublocation) // Return Word at position specified
{
	DWORD data=0; 
	 
	data	=buffers.currentsector.u8data[sublocation];	  // Read Data from specified pos
	data   +=buffers.currentsector.u8data[sublocation+1]<<8;
	data   +=buffers.currentsector.u8data[sublocation+2]<<16;
	data   +=buffers.currentsector.u8data[sublocation+3]<<24;
	return (data);					  			 // Return value
}

/**********************************************************************************
* Function     : fnIDE_SectorData
* Description : read a section of data from a specified starting address of current sector
* Input         : WORD Sublocation - starting address
*                     BYTE *buffer - reading data buffer
*                    WORD size - size of reading data section
***********************************************************************************/

void fnIDE_SectorData(WORD sublocation, BYTE *buffer, WORD size)
{
	WORD i;
	for(i=0;i<size;i++)
	{
		buffer[i]=buffers.currentsector.u8data[sublocation+i];
	}
}

/**********************************************************************************
* Function     : fnIDE_WriteSectorData
* Description : write a section of data from a specified starting address of current sector
* Input         : WORD Sublocation - starting address
*                     BYTE *buffer - writing data buffer
*                    WORD size -  size of writing data section
* Return       : double word read value
***********************************************************************************/

void fnIDE_WriteSectorData(WORD sublocation, BYTE *buffer, WORD size)
{
	WORD i;
	for(i=0;i<size;i++)
	{
		buffers.currentsector.u8data[sublocation+i]=buffer[i];
	}
}

/**********************************************************************************
* Function     : fnIDE_BufferSector
* Description : read a specified logic sector
* Input         : BYTE *buffer - reading data buffer
*                    DWORD LBALocation -  address of logic sector
*                    BYTE count - counts of reading sectors(up to 256), count=0 means read 256 sectors
* Return       : 0-normal; 1-error
***********************************************************************************/

int fnIDE_BufferSector(WORD *buf,DWORD LBALocation,BYTE count)
{
	
	WORD    i,temp;
	BYTE 	j;
	BYTE	errorcode;

	Wait_ReadyBusy(); 
	            
	buffers.SectorCurrentlyLoaded=LBALocation; // update current sector loaded
	
    	*pDriveHead	=((LBALocation >> 24) & 0xFF) | 0xE0;
    	*pCylinderHigh	=(LBALocation >> 16) & 0xFF;
    	*pCylinderLow	=(LBALocation >> 8) & 0xFF;
    	*pSectorNumber	=LBALocation & 0xFF;
    	*pSectorCount	= count; 		   	 	   
    	*pCommand	= 0x21;//IDE_CMD_READSECTOR;		   // Read sector
	
	
	Wait_DRQ();
	j=count;
	temp=0;
	do
	{
		
		Wait_DRQ();
    		for(i=0; i < SECTORWORDSIZE; i++)
    		{
    			buf[temp+i]=*pDataPort;
    		}
    		j--;
    		temp += SECTORWORDSIZE ;
    	}while(j!=0);
	
    	errorcode	= CheckforError();
	if (errorcode!=0) 
		return 1; 
	
	return 0;
}

/**********************************************************************************
* Function     : fnIDE_WriteBufferSector
* Description : write a specified logic sector
* Input         : BYTE *buffer - writing data buffer
*                    DWORD LBALocation -  address of logic sector
*                    BYTE count - counts of writing sectors(up to 256), count=0 means write 256 sectors
* Return       : 0-normal; 1-error
***********************************************************************************/

int fnIDE_WriteBufferSector(WORD *buf,DWORD LBALocation,BYTE count)
{
	WORD    i,temp;
	BYTE    j;
	BYTE	errorcode;
	
	if (LBALocation>=IDE_current.maxLBA) 
	   {
	   printf("\r\nIDE_BufferSector: Out of Range Disc Read of 0x%lx", LBALocation);
	   return 1;
	   }
	
	Wait_ReadyBusy();
	//if (buffers.SectorCurrentlyLoaded!=LBALocation) // Dont reload if already loaded
	//{              
	buffers.SectorCurrentlyLoaded=LBALocation; // update current sector loaded
	
    	*pDriveHead	=((LBALocation >> 24) & 0xFF) | 0xE0;//bit6=1:LBA mode bit6=0:CHS mode
    	*pCylinderHigh	=(LBALocation >> 16) & 0xFF;
    	*pCylinderLow	=(LBALocation >> 8) & 0xFF;
    	*pSectorNumber	=LBALocation & 0xFF;
	//}
    	/*temp= (LBALocation/IDE_current.head_num)/IDE_current.one_cylinder_sector;
    	*pDriveHead= (LBALocation/IDE_current.one_cylinder_sector)%IDE_current.head_num;
    	*pCylinderHigh	=(temp>>8)&0xFF;
    	*pCylinderLow	=temp&0xFF;
    	*pSectorNumber	=(LBALocation%IDE_current.one_cylinder_sector)+1;*/
    	*pSectorCount	= count; 		   	 	   // 1 Sector to be read only
    	*pCommand	= 0x31;//IDE_CMD_READSECTOR;		   // Read sector
	
	/*errorcode	= CheckforError();
	if (errorcode!=0) 
		return 1; 		   // Were there any Errors ?			   */
	
	Wait_DRQ();			 // Wait till Data is available in IDE buffer
	
	j=count;
	temp=0;					 // Reading Status Register reset INT too
	do
	{
		
		Wait_DRQ();
    		for(i=0; i < SECTORWORDSIZE; i++)
    		{
    			*pDataPort=buf[temp+i];
    		}
    		j--;
    		temp += SECTORWORDSIZE ;
    	}while(j!=0);
    
    	errorcode	= CheckforError();
		if (errorcode!=0) 
			return 1; 
				 // Were there any Errors ?
	
	//}
	return 0;
}
/**********************************************************************************
* Function     : fnIDE_InitDrive
* Description : get HD information
* Input         : none
* Return       : none
***********************************************************************************/

void fnIDE_InitDrive(void)
{
	WORD i,cnt;
	BYTE chardata;
	DWORD TotalLBAs=0;
	
	IdeIdle();
   	// Wait till not busy and RDY?
	Wait_ReadyBusy();

   	// Send Command for drive identification 
   	*pCommand = IDE_CMD_IDENTIFY;
   	// Wait for DRQ
	Wait_DRQ();

   	// Read in first 62 bytes of the drive identification
   	for (i=0; i<256; i++)
   	{
		// Read data words from drives buffer
		buffers.currentsector.u16data[i] = *pDataPort;		   
	}
	buffers.SectorCurrentlyLoaded=0xFFFFFFFF;

		// Assuming drive supports LBA find max LBA sector
	TotalLBAs = buffers.currentsector.u16data[61];
	TotalLBAs = TotalLBAs << 16;
	IDE_current.maxLBA = TotalLBAs + buffers.currentsector.u16data[60];
	IDE_current.head_num = buffers.currentsector.u16data[3];
	IDE_current.cylinder_num = buffers.currentsector.u16data[1];
	IDE_current.one_cylinder_sector = buffers.currentsector.u16data[6];
	i=0;
	for (cnt=10; cnt<19; cnt++) 
	{
		chardata = buffers.currentsector.u16data[cnt]>>8;
		IDE_current.serialnum[i] = chardata;
		i++;		
		chardata = buffers.currentsector.u16data[cnt];
		IDE_current.serialnum[i] = chardata;
		i++;
	}
	IDE_current.serialnum[i]='\0';	
	i=0;	
	for (cnt=27; cnt<46; cnt++) 
	{
		chardata = buffers.currentsector.u16data[cnt]>>8;
		IDE_current.modelnum[i] = chardata;
		i++;		
		chardata = buffers.currentsector.u16data[cnt];
		IDE_current.modelnum[i] = chardata;
		i++;
	}
	IDE_current.modelnum[i] = '\0'	;
	
#ifdef DEBUG	
	printf("\r\nHard Disc Auto Detect Parameters");
	printf("\r\n--------------------------------\r\n");
	// Detect HDD or CDROM
	printf("\r\nType of device: ");		
	if (buffers.currentsector.u16data[0]&0x8000) 
		printf("ATA Device ");
	else 
		printf("ATAPI Device ");
		
		// Detect removable media
	if (buffers.currentsector.u16data[i]&0x0080) 
		printf("which has removable media");

		// Heads 
	printf("\r\nThe number of heads is = %d",IDE_current.head_num);
		
		// Cylinders
	printf("\r\nThe number of Cylinders is =  %d",IDE_current.cylinder_num);

		// Sectors Per Track 
	printf("\r\nThe number of Sectors per track is = %d", IDE_current.one_cylinder_sector);

		// Serial Number
	printf("\r\nThe number of Serial Number of the device is = %s",IDE_current.serialnum);
		// Model Number
	printf("\r\nThe number of Model Number of the device is = %s",IDE_current.modelnum);	
	// CHS or LBA
	if(!((buffers.currentsector.u16data[49] >> 8) & 0x1)) 
		printf("\r\nCHS Mode Only (NO LBA)");
	else
		printf("\r\nLBA Supported");
		
	// Report max lba address
	printf("\r\nLBA sectors is 0x%lx\n", TotalLBAs);
#endif
		 
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜成人在线视频| 色综合天天综合狠狠| 色综合天天性综合| 日韩欧美成人一区二区| 亚洲美女精品一区| 国产高清精品网站| 日韩欧美亚洲国产精品字幕久久久| 亚洲柠檬福利资源导航| 粉嫩嫩av羞羞动漫久久久| 日韩午夜在线观看视频| 亚洲大尺度视频在线观看| 99国产精品久久久久久久久久| 久久久久久久久久久黄色| 日韩制服丝袜先锋影音| 欧美视频一区二区在线观看| 亚洲欧美中日韩| 成人午夜短视频| 欧美精品一区二区精品网| 秋霞午夜av一区二区三区| 欧美日韩中字一区| 亚洲一区成人在线| 色婷婷精品久久二区二区蜜臂av| 国产精品天天摸av网| 国产经典欧美精品| 国产三级精品在线| 风间由美中文字幕在线看视频国产欧美| 精品少妇一区二区三区日产乱码 | 欧美视频一区二| 亚洲一区二区在线免费看| 91国产丝袜在线播放| 亚洲精品免费播放| 欧美色视频一区| 丝袜亚洲另类欧美综合| 欧美一级在线视频| 国模娜娜一区二区三区| 日本一区二区三区国色天香 | 伊人色综合久久天天| 日本高清不卡aⅴ免费网站| 亚洲午夜久久久久| 91麻豆精品国产91久久久久久久久| 亚洲一本大道在线| 欧美sm美女调教| 成人中文字幕在线| 亚洲人成精品久久久久久| 欧美三级视频在线观看| 日本午夜精品视频在线观看| 亚洲精品在线免费播放| 丁香一区二区三区| 亚洲综合在线视频| 日韩三级av在线播放| 国产v日产∨综合v精品视频| 国产精品国产三级国产aⅴ原创 | 日本中文字幕一区二区有限公司| 日韩欧美国产一二三区| 国产激情精品久久久第一区二区 | 色婷婷国产精品综合在线观看| 亚洲国产精品人人做人人爽| 91精品在线一区二区| 国产激情精品久久久第一区二区| 亚洲猫色日本管| 日韩美一区二区三区| 大尺度一区二区| 丝袜亚洲另类丝袜在线| 国产精品人成在线观看免费| 欧美美女一区二区| www.亚洲在线| 美女视频免费一区| 亚洲免费伊人电影| 精品国产伦一区二区三区观看体验 | 成人看片黄a免费看在线| 亚洲精品国产视频| 26uuuu精品一区二区| 91麻豆成人久久精品二区三区| 老司机精品视频在线| 亚洲欧美日韩国产成人精品影院| 欧美电影免费观看高清完整版在线| 99麻豆久久久国产精品免费| 日韩国产欧美三级| 夜夜精品视频一区二区| 国产欧美精品一区二区色综合朱莉| 欧美三级日韩三级国产三级| 国产成人精品一区二区三区四区 | 亚洲五码中文字幕| 国产精品国产成人国产三级| 日韩视频在线永久播放| 在线观看www91| 本田岬高潮一区二区三区| 黄页网站大全一区二区| 日本美女一区二区| 亚洲一级二级在线| 一区二区久久久| 国产精品白丝在线| 国产日韩v精品一区二区| 欧美tk—视频vk| 日韩一级成人av| 在线电影欧美成精品| 欧美色老头old∨ideo| 91网站最新网址| 一本大道久久a久久精二百| 99r国产精品| 99精品视频在线观看免费| 成人黄色一级视频| 国产suv精品一区二区6| 国产精品一区二区免费不卡| 久久99九九99精品| 麻豆成人91精品二区三区| 三级久久三级久久| 日本中文一区二区三区| 日韩电影免费在线| 丝袜美腿成人在线| 美腿丝袜亚洲一区| 久久99在线观看| 韩国三级在线一区| 国产成人aaaa| jvid福利写真一区二区三区| va亚洲va日韩不卡在线观看| 97久久人人超碰| 欧洲av一区二区嗯嗯嗯啊| 欧美影视一区二区三区| 7777精品伊人久久久大香线蕉的 | 麻豆精品国产传媒mv男同 | 波多野结衣在线一区| 成人动漫av在线| 91美女在线观看| 欧美性一级生活| 91精品国产高清一区二区三区蜜臀| 7777精品伊人久久久大香线蕉完整版 | 日韩精品成人一区二区在线| 日本系列欧美系列| 国产乱码精品一品二品| www.亚洲精品| 欧美精品视频www在线观看| 欧美成人官网二区| 国产精品视频观看| 亚洲综合色丁香婷婷六月图片| 天堂一区二区在线| 成人永久aaa| 欧美日韩中字一区| 久久色视频免费观看| 亚洲欧美日韩国产中文在线| 日韩精品一级二级 | 中文字幕中文在线不卡住| 亚洲日本在线看| 石原莉奈在线亚洲三区| 国产成人精品综合在线观看 | 天堂久久一区二区三区| 国产精品亚洲午夜一区二区三区| 91麻豆视频网站| 日韩免费视频一区二区| 日韩美女视频一区二区 | 丝袜国产日韩另类美女| 国产一区二区三区蝌蚪| 欧美又粗又大又爽| 精品久久久久一区二区国产| 亚洲欧美电影一区二区| 九色|91porny| 欧美日韩在线不卡| 国产欧美精品在线观看| 日韩中文字幕一区二区三区| 成人美女视频在线观看18| 欧美一区二区精美| 中文字幕亚洲视频| 国产乱码一区二区三区| 欧美日韩第一区日日骚| 国产精品福利影院| 精品一区二区三区不卡| 欧美巨大另类极品videosbest | 欧美一级生活片| 亚洲天堂av一区| 国产精品一级片在线观看| 在线成人av网站| 亚洲精品成人在线| 成人精品视频一区| 精品国产乱码久久久久久久久| 亚洲午夜精品在线| 91在线播放网址| 国产精品美女久久久久久久久久久 | 成人一道本在线| 精品伦理精品一区| 亚洲成av人片在线观看| 色婷婷综合久久| 亚洲欧洲韩国日本视频| 成人一区二区三区视频 | 天堂成人国产精品一区| 色老汉一区二区三区| **欧美大码日韩| 丁香婷婷综合色啪| 欧美国产欧美综合| 国产真实乱偷精品视频免| 精品久久人人做人人爽| 国内偷窥港台综合视频在线播放| 91精品国产综合久久久久久久| 亚洲图片一区二区| 欧美亚洲综合另类| 亚洲一线二线三线久久久| 欧美午夜精品久久久久久孕妇| 亚洲综合在线电影| 欧美日韩久久一区| 麻豆精品在线看| 久久精品一区二区三区不卡牛牛 |