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

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

?? mci.c.bak

?? 優(yōu)龍LPC2468開(kāi)發(fā)板BIOS源程序,簡(jiǎn)潔明了
?? BAK
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
		/* bit 0 and bit 2 must be zero, or it's timeout or CRC error */
		/* It should go to IDEN state and bit 8 should be 1 */
		if ( !(respStatus & MCI_CMD_TIMEOUT) && ((respValue[0] & (0x0F << 8)) == 0x0500) )
		{
			CardRCA = respValue[0] & 0xFFFF0000;	/* Save the RCA value from SD card */
			return ( TRUE );	/* response is back and correct. */
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );
}

/******************************************************************************
** Function name:		MCI_Send_CSD
**
** Descriptions:		CMD9, SEND_CSD cmd, it should be sent only at
**						STBY state and after CMD3. See MMC and SD spec. state 
**						diagram.		
**
** parameters:			None
** Returned value:		Response value
** 
******************************************************************************/
DWORD MCI_Send_CSD( void )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];
	DWORD CmdArgument;

	if ( CardType == SD_CARD )
	{
		CmdArgument = CardRCA;
	}
	else			/* if MMC or unknown card type, use default RCA addr. */
	{
		CmdArgument = 0x00010000;
	}

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		/* Send SET_BLOCK_LEN command before read and write */
		MCI_CLEAR |= (MCI_CMD_TIMEOUT | MCI_CMD_CRC_FAIL | MCI_CMD_RESP_END);
		MCI_SendCmd( SEND_CSD, CmdArgument, EXPECT_LONG_RESP, 0 );
		respStatus = MCI_GetCmdResp( SEND_CSD, EXPECT_LONG_RESP, (DWORD *)&respValue[0] );
		if ( !respStatus )
		{
			return ( TRUE );
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );
}

/******************************************************************************
** Function name:		MCI_Select_Card
**
** Descriptions:		CMD7, SELECT_CARD, should be after CMD9, the state
**						will be inter-changed between STBY and TRANS after 
**						this cmd.		
**
** parameters:			None
** Returned value:		return false if response times out.
** 
******************************************************************************/
DWORD MCI_Select_Card( void )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];
	DWORD CmdArgument;

	if ( CardType == SD_CARD )
	{
		CmdArgument = CardRCA;
	}
	else			/* if MMC or unknown card type, use default RCA addr. */
	{
		CmdArgument = 0x00010000;
	}

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		/* Send SELECT_CARD command before read and write */
		MCI_CLEAR |= (MCI_CMD_TIMEOUT | MCI_CMD_CRC_FAIL | MCI_CMD_RESP_END);
		MCI_SendCmd( SELECT_CARD, CmdArgument, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( SELECT_CARD, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		if ( !respStatus && ((respValue[0] & (0x0F << 8)) == 0x0700 ))
		{						/* Should be in STANDBY state now and ready */
			return ( TRUE );
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );
}

/******************************************************************************
** Function name:		MCI_Send_Status
**
** Descriptions:		CMD13, SEND_STATUS, the most important cmd to
**						debug the state machine of the card.		
**
** parameters:			None
** Returned value:		Response value(card status), true if the ready bit 
**						is set in the card status register, if timeout, return 
**						INVALID_RESPONSE 0xFFFFFFFF.
** 
******************************************************************************/
DWORD MCI_Send_Status( void )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];
	DWORD CmdArgument;

	if ( CardType == SD_CARD )
	{
		CmdArgument = CardRCA;
	}
	else			/* if MMC or unknown card type, use default RCA addr. */
	{
		CmdArgument = 0x00010000;
	}

	/* Note that, since it's called after the block write and read, this timeout 
	is important based on the clock you set for the data communication. */
	retryCount = 0x60;
	while ( retryCount > 0 )
	{
		/* Send SELECT_CARD command before read and write */
		MCI_CLEAR |= (MCI_CMD_TIMEOUT | MCI_CMD_CRC_FAIL | MCI_CMD_RESP_END);
		MCI_SendCmd( SEND_STATUS, CmdArgument, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( SEND_STATUS, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		if ( !respStatus && (respValue[0] & (1 << 8)) )
		{	/* The ready bit should be set, it should be in either TRAN or RCV 
			state now */
			return ( respValue[0] );
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( INVALID_RESPONSE );
}
		
/******************************************************************************
** Function name:		MCI_Set_BlockLen
**
** Descriptions:		CMD16, SET_BLOCKLEN, called after CMD7(SELECT_CARD)
**						called in the TRANS state.		
**
** parameters:			The length of the data block to be written or read.
** Returned value:		true or false, return TRUE if ready bit is set, and it's
**						in TRANS state.
** 
******************************************************************************/
DWORD MCI_Set_BlockLen( DWORD blockLength )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		/* Send SET_BLOCK_LEN command before read and write */
		MCI_CLEAR |= (MCI_CMD_TIMEOUT | MCI_CMD_CRC_FAIL | MCI_CMD_RESP_END);
		MCI_SendCmd( SET_BLOCK_LEN, blockLength, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( SET_BLOCK_LEN, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		/* bit 9 through 12 should be in transfer state now. bit 8 is ready. */
		if ( !respStatus && ((respValue[0] & (0x0F << 8)) == 0x0900))			  		
		{		
			return ( TRUE );
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );
}

/******************************************************************************
** Function name:		MCI_Send_ACMD_Bus_Width
**
** Descriptions:		ACMD6, SET_BUS_WIDTH, if it's SD card, we can
**						use the 4-bit bus instead of 1-bit. This cmd
**						can only be called during TRANS state.
**						Since it's a ACMD, CMD55 APP_CMD needs to be
**						sent out first. 		
**
** parameters:			Bus width value, 1-bit is 0, 4-bit is 10
** Returned value:		true or false, true if the card is still in the 
**						TRANS state after the cmd.
** 
******************************************************************************/
DWORD MCI_Send_ACMD_Bus_Width( DWORD buswidth )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];

	retryCount = 0x20;			/* reset retry counter */
	while ( retryCount > 0 )
	{
		if ( MCI_Send_ACMD() == FALSE )
		{
			continue;
		}
			
		/* Send ACMD6 command to set the bus width */
		MCI_SendCmd( SET_ACMD_BUS_WIDTH, buswidth, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( SET_ACMD_BUS_WIDTH, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		if ( !respStatus && ((respValue[0] & (0x0F << 8)) == 0x0900) )
		{
			return ( TRUE );	/* response is back and correct. */
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return( FALSE );
}

/******************************************************************************
** Function name:		MCI_Send_Stop
**
** Descriptions:		CMD12, STOP_TRANSMISSION. if that happens, the card is 
**						maybe in a unknown state that need a warm reset.		
**
** parameters:			None
** Returned value:		true or false, true if, at least, the card status
**						shows ready bit is set.
** 
******************************************************************************/
DWORD MCI_Send_Stop( void )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		MCI_CLEAR = 0x7FF;
		MCI_SendCmd( STOP_TRANSMISSION, 0x00000000, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( STOP_TRANSMISSION, EXPECT_SHORT_RESP, (DWORD *)respValue );
		/* ready bit, bit 8, should be set in the card status register */
		if ( !respStatus && (respValue[0] & (1 << 8)) )
		{
			return( TRUE );
		}
		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );
}

/******************************************************************************
** Function name:		MCI_Send_Write_Block
**
** Descriptions:		CMD24, WRITE_BLOCK, send this cmd in the TRANS state
**						to write a block of data to the card.
**
** parameters:			block number
** Returned value:		Response value
** 
******************************************************************************/
DWORD MCI_Send_Write_Block( DWORD blockNum )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		MCI_CLEAR = 0x7FF;
		MCI_SendCmd( WRITE_BLOCK, blockNum * BLOCK_LENGTH, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( WRITE_BLOCK, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		/* it should be in the transfer state, bit 9~12 is 0x0100 and bit 8 is 1 */
		if ( !respStatus && ((respValue[0] & (0x0F << 8)) == 0x0900) )
		{
			return( TRUE );			/* ready and in TRAN state */
		}

		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );				/* Fatal error */
}

/******************************************************************************
** Function name:		MCI_Send_Read_Block
**
** Descriptions:		CMD17, READ_SINGLE_BLOCK, send this cmd in the TRANS 
**						state to read a block of data from the card.
**
** parameters:			block number
** Returned value:		Response value
** 
******************************************************************************/
DWORD MCI_Send_Read_Block( DWORD blockNum )
{
	DWORD i, retryCount;
	DWORD respStatus;
	DWORD respValue[4];

	retryCount = 0x20;
	while ( retryCount > 0 )
	{
		MCI_CLEAR = 0x7FF;
		MCI_SendCmd( READ_SINGLE_BLOCK, blockNum * BLOCK_LENGTH, EXPECT_SHORT_RESP, 0 );
		respStatus = MCI_GetCmdResp( READ_SINGLE_BLOCK, EXPECT_SHORT_RESP, (DWORD *)&respValue[0] );
		/* it should be in the transfer state, bit 9~12 is 0x0100 and bit 8 is 1 */
		if ( !respStatus && ((respValue[0] & (0x0F << 8)) == 0x0900) )
		{
			return( TRUE );			/* ready and in TRAN state */
		}

		for ( i = 0; i < 0x20; i++ );
		retryCount--;
	}
	return ( FALSE );					/* Fatal error */
}
	
/******************************************************************************
** Function name:		MCI_Write_Block
**
** Descriptions:		Set MCI data control register, data length and data
**						timeout, send WRITE_BLOCK cmd, finally, enable
**						interrupt. On completion of WRITE_BLOCK cmd, TX_ACTIVE
**						interrupt will occurs, data can be written continuously
**						into the FIFO until the block data length is reached.		
**
** parameters:			block number
** Returned value:		true or false, if cmd times out, return false and no 
**						need to continue.
** 
******************************************************************************/
DWORD MCI_Write_Block( DWORD blockNum ,DWORD * buf)
{
	DWORD i;
	DWORD DataCtrl = 0;

	WriteBuf = buf;
	MCI_CLEAR = 0x7FF;
	MCI_DATA_CTRL = 0;
	for ( i = 0; i < 0x10; i++ );

	/* Below status check is redundant, but ensure card is in TRANS state
	before writing and reading to from the card. */
	if ( MCI_CheckStatus() != TRUE )
	{
		MCI_Send_Stop();
		return( FALSE );
	}

	MCI_DATA_TMR = DATA_TIMER_VALUE;
	MCI_DATA_LEN = BLOCK_LENGTH;
	if ( MCI_Send_Write_Block( blockNum ) == FALSE )
	{
		return ( FALSE );
	}

#if MCI_DMA_ENABLED
	DMA_Init( 0, M2P );
	GPDMA_CH0_CFG |= 0x10001 | (0x00 << 1) | (0x04 << 6) | (0x05 << 11);
	/* Write, block transfer, DMA, and data length */
	DataCtrl |= ((1 << 0) | (1 << 3) | (DATA_BLOCK_LEN << 4));	
#else
	/* Write, block transfer, and data length */
	DataCtrl |= ((1 << 0) | (DATA_BLOCK_LEN << 4));
#endif	
	MCI_DATA_CTRL = DataCtrl;
	for ( i = 0; i < 0x10; i++ );
	
	MCI_TXEnable();

	/* When TX_ACTIVE is not set, it indicates TX is done from 
	Interrupt_Write_Block, now, Interrupt_Read_Block can start. */
	while ( MCI_STATUS & MCI_TX_ACTIVE );
	/* Note TXEnable() is called in the Interrupt_Write_Block(). */
	MCI_TXDisable();
	return ( TRUE );
}

/******************************************************************************
** Function name:		MCI_Read_Block
**
** Descriptions:		Set MCI data control register, data length and data
**						timeout, send READ_SINGLE_BLOCK cmd, finally, enable
**						interrupt. On completion of READ_SINGLE_BLOCK cmd, 
**						RX_ACTIVE interrupt will occurs, data can be read 
**						continuously into the FIFO until the block data 
**						length is reached.		
**
** parameters:			block number
** Returned value:		true or false, if cmd times out, return false and no 
**						need to continue.
**
** 
******************************************************************************/
DWORD MCI_Read_Block( DWORD blockNum ,DWORD * buf)
{
	DWORD i;
	DWORD DataCtrl = 0;

	ReadBuf = buf;
	MCI_CLEAR = 0x7FF;
	MCI_DATA_CTRL = 0;
	for ( i = 0; i < 0x10; i++ );

	/* Below status check is redundant, but ensure card is in TRANS state
	before writing and reading to from the card. */
	if ( MCI_CheckStatus() != TRUE )
	{
		MCI_Send_Stop();
		return( FALSE );
	}
	MCI_RXEnable();

	MCI_DATA_TMR = DATA_TIMER_VALUE;
	MCI_DATA_LEN = BLOCK_LENGTH;

	if ( MCI_Send_Read_Block( blockNum ) == FALSE )
	{
		return ( FALSE );
	}
#if MCI_DMA_ENABLED
	DMA_Init( 1, P2M );
	GPDMA_CH1_CFG |= 0x10001 | (0x04 << 1) | (0x00 << 6) | (0x06 << 11);
	/* Write, block transfer, DMA, and data length */
	DataCtrl |= ((1 << 0) | (1 << 1) | (1 << 3) | (DATA_BLOCK_LEN << 4));	
#else
	/* Read, enable, block transfer, and data length */
	DataCtrl |= ((1 << 0) | (1 << 1) | (DATA_BLOCK_LEN << 4));	
#endif
	MCI_DATA_CTRL = DataCtrl;

	/* When RX_ACTIVE is not set, it indicates RX is done from 
	Interrupt_Read_Block, now, validation of RX and TX buffer can start. */
	while ( MCI_STATUS & MCI_RX_ACTIVE );
	/* Note RXEnable() is called in the Interrupt_Read_Block(). */
	MCI_RXDisable();
	return ( TRUE );
}

/*****************************************************************************
**                            End Of File
******************************************************************************/

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
最新国产の精品合集bt伙计| 盗摄精品av一区二区三区| 久久精品国产免费| 精品在线播放午夜| 99re66热这里只有精品3直播| 欧美日韩亚洲综合在线| 精品少妇一区二区| 成人免费小视频| 免费在线视频一区| 成人午夜免费av| 欧美精品色综合| 中文字幕不卡一区| 亚洲aⅴ怡春院| 国产高清在线精品| 欧美亚洲国产一区二区三区| 精品处破学生在线二十三| 亚洲欧美一区二区视频| 日韩电影一区二区三区| 成人精品免费看| 欧美一区二区三区在线| 国产精品网曝门| 日本一区中文字幕| 91社区在线播放| 精品国产免费一区二区三区香蕉| 亚洲免费伊人电影| 国产中文字幕一区| 欧美日韩精品免费观看视频| 国产午夜精品理论片a级大结局| 一区二区三区四区视频精品免费 | 91丨porny丨首页| 日韩欧美国产1| 亚洲精品视频在线看| 国内精品第一页| 欧美剧情片在线观看| 欧美激情一区二区| 精品一区二区免费在线观看| 欧美午夜精品免费| 中文字幕亚洲欧美在线不卡| 九九**精品视频免费播放| 色偷偷88欧美精品久久久| 久久久国产精品麻豆| 日韩黄色小视频| 91久久精品一区二区二区| 久久精品亚洲一区二区三区浴池| 亚洲成人动漫av| 色综合色狠狠综合色| 国产偷国产偷精品高清尤物| 人妖欧美一区二区| 欧美三级日韩在线| 亚洲日本在线看| 成人免费福利片| 久久久蜜桃精品| 久久国产精品色婷婷| 欧美日本在线视频| 亚洲一区二区三区精品在线| 99v久久综合狠狠综合久久| 久久众筹精品私拍模特| 美国三级日本三级久久99| 欧美三级电影网| 夜夜精品视频一区二区| 99精品欧美一区二区蜜桃免费 | 成人黄色大片在线观看| 2021久久国产精品不只是精品| 日韩专区欧美专区| 欧美日韩高清影院| 亚洲va韩国va欧美va| 欧美视频精品在线观看| 一区二区三区久久| 在线免费精品视频| 亚洲综合色噜噜狠狠| 在线免费不卡电影| 一卡二卡三卡日韩欧美| 色噜噜夜夜夜综合网| 有坂深雪av一区二区精品| 色播五月激情综合网| 亚洲精选视频免费看| 日本高清不卡视频| 亚洲一区二区三区影院| 欧美日韩色一区| 日韩专区在线视频| 欧美电视剧免费观看| 精品一区二区三区的国产在线播放 | 久久精品人人做人人爽人人| 国产一区二区主播在线| 久久九九99视频| 国产成a人无v码亚洲福利| 国产精品网曝门| 91蝌蚪porny九色| 亚洲成人综合视频| 日韩一级高清毛片| 国产剧情av麻豆香蕉精品| 国产区在线观看成人精品| 成人97人人超碰人人99| 亚洲精品高清视频在线观看| 欧美日韩久久久| 九色porny丨国产精品| 国产视频一区二区三区在线观看| 99国产精品久久久久久久久久 | 欧美欧美欧美欧美| 蜜桃91丨九色丨蝌蚪91桃色| 国产情人综合久久777777| 色综合久久久久久久久| 丝袜美腿亚洲色图| 久久久www免费人成精品| 成人97人人超碰人人99| 亚洲成人在线观看视频| 欧美不卡一区二区| eeuss影院一区二区三区| 一区二区三区欧美日| 日韩一区二区三区在线观看| 国产精品一级二级三级| 亚洲精品成a人| 日韩一区二区免费高清| 懂色av一区二区三区免费观看| 亚洲蜜臀av乱码久久精品蜜桃| 欧美精品tushy高清| 国模无码大尺度一区二区三区| 日韩一区中文字幕| 91精品国产一区二区人妖| 国产成+人+日韩+欧美+亚洲 | 337p亚洲精品色噜噜噜| 丁香六月综合激情| 日韩成人免费电影| 国产精品伦一区二区三级视频| 欧美久久一二区| 岛国一区二区三区| 五月激情六月综合| 国产精品每日更新| 欧美一区二区视频在线观看2020| av成人老司机| 激情图片小说一区| 艳妇臀荡乳欲伦亚洲一区| 久久久五月婷婷| 91国偷自产一区二区三区观看| 狠狠色狠狠色综合| 亚洲一区二区视频在线观看| 国产无一区二区| 91精品国产综合久久福利软件| 99视频一区二区| 国产综合色精品一区二区三区| 一区二区免费在线播放| 国产欧美日韩在线看| 欧美精品色综合| 色综合久久久久网| 成人免费视频网站在线观看| 免费在线观看成人| 亚洲一区二区中文在线| 中文字幕在线视频一区| 精品国产乱码久久久久久图片| 97国产精品videossex| 国产成人午夜精品5599| 日韩av一级电影| 一区二区三区久久| 亚洲欧洲韩国日本视频| 国产欧美一区二区在线| 日韩一级片网址| 一区二区在线看| 色8久久人人97超碰香蕉987| 国产欧美一区二区精品性色超碰 | 日韩激情一区二区| av成人免费在线观看| 欧美激情在线看| 91精品国产综合久久精品图片| 91亚洲精品一区二区乱码| 国产一区二区三区在线看麻豆| 亚洲成av人片在线观看无码| 一区二区中文字幕在线| 国产欧美日韩久久| 久久综合久久综合亚洲| 欧美成人激情免费网| 欧美一区三区二区| 欧美巨大另类极品videosbest | 中文字幕第一区综合| 久久综合久久综合久久| 精品少妇一区二区三区视频免付费| 欧美日韩你懂的| 欧美系列一区二区| 欧美视频一区二区在线观看| 成人黄色av电影| 毛片av中文字幕一区二区| 欧美一级日韩不卡播放免费| 国产精品福利av| 色综合天天做天天爱| 麻豆传媒一区二区三区| 2024国产精品| 国产一区二区中文字幕| 国产精品久久久久久久久免费桃花| 美国三级日本三级久久99| 欧美精品一区在线观看| 理论电影国产精品| 国产亚洲综合在线| av一二三不卡影片| 国产在线精品一区二区三区不卡| 国产精品久久福利| 欧美电影免费观看高清完整版在线 | 午夜伦欧美伦电影理论片| 最新中文字幕一区二区三区| 欧美精品一区二区三区蜜桃视频 | 亚洲午夜电影在线| 成人免费一区二区三区在线观看 |