armsys2410 大容量sd卡驱动开发我的pb5.0更新了微软的《Windows CE 5.0 支持仅 SD 1.1 兼容的内存卡所小于 2 GB
》中提到的更新,
工程里也将 IMGSDBUS2 变量的值设置为 1。
直接加载了CataLog里的sd memory以及samsung 2410 sdio host.
但是armsys2410 仍不能识别4G sd卡。
我还差在哪里没有做吗?
引用: 引用楼主 CBEMA 的帖子:
armsys2410 大容量sd卡驱动开发我的pb5.0更新了微软的《Windows CE 5.0 支持仅 SD 1.1 兼容的内存卡所小于 2 GB
》中提到的更新,
工程里也将 IMGSDBUS2 变量的值设置为 1。
直接加载了CataLog里的sd memory以及samsung 2410 sdio host.
但是armsys2410 仍不能识别4G sd卡。
我还差在哪里没有做吗?
--------------------SD卡驱动是微软写的,不提供源码的吧,怎么改啊?
你的SD Controller能不能支持SD Ver2.0
如果能支持的话,4G的卡算SDHC了,要支持SDHC根据Ver2.0的Spec会在卡的识别过程中
发送CMD8,这个命令要返回Response7的信息。
这部分是底层Host Controller驱动的部分。所以你要先检查底层驱动这部分加了没有。
gsymichael ,你好。我的卡就是sdhc的4G卡。在微软网站上知道要加Response7,可是具体要修改那个源代码,我不是很了解。我所知道的微软提供的源代码有:
C:\WINCE500\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDHCDRIVERS\SDIOSTDHC\BASE
中的sdhcslot.cpp里BusRequestHandler( PSD_BUS_REQUEST pRequest)函数有
case ResponseR7:
wRegCommand |= CMD_RESPONSE_R1_R5_R6_R7;
break;
C:\WINCE500\PUBLIC\COMMON\OAK\CSP\ARM\SAMSUNG\S3C2410X\SDHC\SDHCBASE
中的sdiocontrollerbase.cpp里SendCommand(UINT16 Cmd, UINT32 Arg, UINT16 respType, BOOL bDataTransfer)函数里有
//----- 4. Send the command to the MMC controller -----
switch(respType)
{
case NoResponse: // Response is not required, but make sure the command was sent
DEBUGMSG (SDHC_RESPONSE_ZONE,(TEXT("SendCommand no response required")));
vm_pSDIReg->SDICCON = START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
while(!(vm_pSDIReg->SDICSTA & COMMAND_SENT))
{
dwWaitCount++;
if( dwWaitCount > WAIT_TIME )
{
DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHCD:SendCommand() - timeout waiting for command completion!\r\n")));
return SD_API_STATUS_RESPONSE_TIMEOUT;
}
if( !IsCardPresent() )
{
DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHCD:SendCommand() - Card ejected!\r\n")));
return SD_API_STATUS_DEVICE_REMOVED;
}
if(vm_pSDIReg->SDICSTA & COMMAND_TIMED_OUT)
{
DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHCD:SendCommand() - Command 0x%04x timed out!\r\n"), Cmd));
vm_pSDIReg->SDICSTA = COMMAND_TIMED_OUT; // Clear the error
return SD_API_STATUS_RESPONSE_TIMEOUT;
}
}
vm_pSDIReg->SDICSTA = COMMAND_SENT; // Clear the status
break;
case ResponseR1: // Short response required
case ResponseR1b:
case ResponseR3:
case ResponseR4:
case ResponseR5:
case ResponseR6:
DEBUGMSG (SDHC_RESPONSE_ZONE,(TEXT("sendSDICommand short response required")));
// vm_pSDIReg->SDICCON = uiNewCmdRegVal | WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
vm_pSDIReg->SDICCON = WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
break;
case ResponseR2: // Long response required
DEBUGMSG (SDHC_RESPONSE_ZONE,(TEXT("sendSDICommand long response required")));
// vm_pSDIReg->SDICCON = uiNewCmdRegVal | LONG_RESPONSE | WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
vm_pSDIReg->SDICCON = LONG_RESPONSE | WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
break;
default:
DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHCD:sendSDICommand() - Invalid response type. Command not sent!\r\n")));
return SD_API_STATUS_NOT_IMPLEMENTED;
break;
}中没有ResponseR7,应该如何加?
函数GetCommandResponse(PSD_BUS_REQUEST pRequest)中有
//----- 2. Copy the response information to our "response buffer" -----
// NOTE: All START_BIT and TRANSMISSION_BIT bits ='0'. All END_BIT bits ='0'. All RESERVED bits ='1'
respBuff = pRequest->CommandResponse.ResponseBuffer;
switch(pRequest->CommandResponse.ResponseType)
{
case NoResponse:
break;
case ResponseR1:
case ResponseR1b:
//--- SHORT RESPONSE (48 bits total)---
// Format: { START_BIT(1) | TRANSMISSION_BIT(1) | COMMAND_INDEX(6) | CARD_STATUS(32) | CRC7(7) | END_BIT(1) }
// NOTE: START_BIT and TRANSMISSION_BIT = 0, END_BIT = 1
//
*(respBuff ) = (BYTE)(START_BIT | TRANSMISSION_BIT | pRequest->CommandCode);
*(respBuff + 1) = (BYTE)(vm_pSDIReg->SDIRSP0 );
*(respBuff + 2) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 8 );
*(respBuff + 3) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 16);
*(respBuff + 4) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 24);
*(respBuff + 5) = (BYTE)(END_RESERVED | END_BIT);
break;
case ResponseR3:
case ResponseR4:
//--- SHORT RESPONSE (48 bits total)---
// Format: { START_BIT(1) | TRANSMISSION_BIT(1) | RESERVED(6) | CARD_STATUS(32) | RESERVED(7) | END_BIT(1) }
//
*(respBuff ) = (BYTE)(START_BIT | TRANSMISSION_BIT | START_RESERVED);
*(respBuff + 1) = (BYTE)(vm_pSDIReg->SDIRSP0 );
*(respBuff + 2) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 8 );
*(respBuff + 3) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 16);
*(respBuff + 4) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 24);
*(respBuff + 5) = (BYTE)(END_RESERVED | END_BIT);
break;
case ResponseR5:
case ResponseR6:
//--- SHORT RESPONSE (48 bits total)---
// Format: { START_BIT(1) | TRANSMISSION_BIT(1) | COMMAND_INDEX(6) | RCA(16) | CARD_STATUS(16) | CRC7(7) | END_BIT(1) }
//
*(respBuff ) = (BYTE)(START_BIT | TRANSMISSION_BIT | pRequest->CommandCode);
*(respBuff + 1) = (BYTE)(vm_pSDIReg->SDIRSP0 );
*(respBuff + 2) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 8 );
*(respBuff + 3) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 16);
*(respBuff + 4) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 24);
*(respBuff + 5) = (BYTE)(vm_pSDIReg->SDIRSP1 >> 24);
break;
case ResponseR2:
//--- LONG RESPONSE (136 bits total)---
// Format: { START_BIT(1) | TRANSMISSION_BIT(1) | RESERVED(6) | CARD_STATUS(127) | END_BIT(1) }
//
// NOTE: In this implementation, the caller doesn't require the upper 8 bits of reserved data.
// Consequently, these bits aren't included and the response info is copied directly into
// the beginning of the supplied buffer.
//
//*(respBuff ) = (BYTE)(START_BIT | TRANSMISSION_BIT | START_RESERVED);
//
*(respBuff + 0) = (BYTE)(vm_pSDIReg->SDIRSP3 );
*(respBuff + 1) = (BYTE)(vm_pSDIReg->SDIRSP3 >> 8 );
*(respBuff + 2) = (BYTE)(vm_pSDIReg->SDIRSP3 >> 16);
*(respBuff + 3) = (BYTE)(vm_pSDIReg->SDIRSP3 >> 24);
*(respBuff + 4) = (BYTE)(vm_pSDIReg->SDIRSP2 );
*(respBuff + 5) = (BYTE)(vm_pSDIReg->SDIRSP2 >> 8 );
*(respBuff + 6) = (BYTE)(vm_pSDIReg->SDIRSP2 >> 16);
*(respBuff + 7) = (BYTE)(vm_pSDIReg->SDIRSP2 >> 24);
*(respBuff + 8) = (BYTE)(vm_pSDIReg->SDIRSP1 );
*(respBuff + 9) = (BYTE)(vm_pSDIReg->SDIRSP1 >> 8 );
*(respBuff + 10)= (BYTE)(vm_pSDIReg->SDIRSP1 >> 16);
*(respBuff + 11)= (BYTE)(vm_pSDIReg->SDIRSP1 >> 24);
*(respBuff + 12)= (BYTE)(vm_pSDIReg->SDIRSP0 );
*(respBuff + 13)= (BYTE)(vm_pSDIReg->SDIRSP0 >> 8 );
*(respBuff + 14)= (BYTE)(vm_pSDIReg->SDIRSP0 >> 16);
*(respBuff + 15)= (BYTE)(vm_pSDIReg->SDIRSP0 >> 24);
break;
default:
DEBUGMSG(SDCARD_ZONE_ERROR, (TEXT("SDHCD:GetCmdResponse(): Unrecognized response type!\r\n")));
break;
}这里也没有ResponseR7。
我想要修改就是要修改这两处吧,应该怎么改呢?
你提到的这几个地方加:
1.
sdhcslot.cpp里BusRequestHandler( PSD_BUS_REQUEST pRequest)函数有
case ResponseR7:
wRegCommand |= CMD_RESPONSE_R1_R5_R6_R7;
break;
2.
sdiocontrollerbase.cpp里SendCommand(UINT16 Cmd, UINT32 Arg, UINT16 respType, BOOL bDataTransfer)函数里在case ResponseR6:下面加case ResponseR7:
case ResponseR1: // Short response required
case ResponseR1b:
case ResponseR3:
case ResponseR4:
case ResponseR5:
case ResponseR6:
case ResponseR7:
DEBUGMSG (SDHC_RESPONSE_ZONE,(TEXT("sendSDICommand short response required")));
// vm_pSDIReg->SDICCON = uiNewCmdRegVal | WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
vm_pSDIReg->SDICCON = WAIT_FOR_RESPONSE | START_COMMAND | COMMAND_START_BIT | (Cmd & MAX_CMD_VALUE);
break;
3.
函数GetCommandResponse(PSD_BUS_REQUEST pRequest)中加在case ResponseR1b:下面
case ResponseR1:
case ResponseR1b:
case ResponseR7:
//--- SHORT RESPONSE (48 bits total)---
// Format: { START_BIT(1) | TRANSMISSION_BIT(1) | COMMAND_INDEX(6) | CARD_STATUS(32) | CRC7(7) | END_BIT(1) }
// NOTE: START_BIT and TRANSMISSION_BIT = 0, END_BIT = 1
//
*(respBuff ) = (BYTE)(START_BIT | TRANSMISSION_BIT | pRequest->CommandCode);
*(respBuff + 1) = (BYTE)(vm_pSDIReg->SDIRSP0 );
*(respBuff + 2) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 8 );
*(respBuff + 3) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 16);
*(respBuff + 4) = (BYTE)(vm_pSDIReg->SDIRSP0 >> 24);
*(respBuff + 5) = (BYTE)(END_RESERVED | END_BIT);
break;