DNW里面显示的USB协议怎么跟EBOOT里面的通过USB接收处理协议对不上?
1>DNW里面的ABOUT菜单显示的为
2. USB Tx format: addr(4)+size(4)+data(n)+cs(2)
2>C:\WINCE500\PLATFORM\COMMON\SRC\COMMON\BOOT\BLCOMMON\blcommon.c里面的DownloadImage( )函数里面对USB传来的NK数据的接收处理方式为
static BOOL DownloadImage (LPDWORD pdwImageStart, LPDWORD pdwImageLength, LPDWORD pdwLaunchAddr)
{
.......
while (OEMReadData (sizeof (DWORD), (LPBYTE) &dwRecAddr) && //读地址
OEMReadData (sizeof (DWORD), (LPBYTE) &dwRecLen) && //读数据的长度
OEMReadData (sizeof (DWORD), (LPBYTE) &dwRecChk)) //读校验码
{
// last record of .bin file uses sentinel values for address and checksum.
if (!dwRecAddr && !dwRecChk)//2008--1--21 XQH 退出WHILE循环!!!
{
break;
}
// map the record address (FLASH data is cached, for example)
lpDest = OEMMapMemAddr (pCurDownloadFile->dwRegionStart, dwRecAddr);
//2008--9--4 XQH 读数据块/包
// read data block
if (!OEMReadData (dwRecLen, lpDest))//2008--1--17 xqh 通过USB接口将接收到的数据写到映射的地址处,也就NAND FLASH处!!!
{
EdbgOutputDebugString ("****** Data record %d corrupted, ABORT!!! ******\r\n", nPkgNum);
HALT (BLERR_CORRUPTED_DATA);
return (FALSE);
}
if (!VerifyChecksum (dwRecLen, lpDest, dwRecChk))//2008--1--17 XQH 计算每条记录的校验码!!!
{
EdbgOutputDebugString ("****** Checksum failure on record %d, ABORT!!! ******\r\n", nPkgNum);
HALT (BLERR_CHECKSUM);
return (FALSE);
}
// Look for ROMHDR to compute ROM offset. NOTE: romimage guarantees that the record containing
// the TOC signature and pointer will always come before the record that contains the ROMHDR contents.
//
if (dwRecLen == sizeof(ROMHDR) && (*(LPDWORD) OEMMapMemAddr(pCurDownloadFile->dwRegionStart, pCurDownloadFile->dwRegionStart + ROM_SIGNATURE_OFFSET) == ROM_SIGNATURE))
{
DWORD dwTempOffset = (dwRecAddr - *(LPDWORD)OEMMapMemAddr(pCurDownloadFile->dwRegionStart, pCurDownloadFile->dwRegionStart + ROM_SIGNATURE_OFFSET + sizeof(ULONG)));
ROMHDR *pROMHdr = (ROMHDR *)lpDest;
// Check to make sure this record really contains the ROMHDR.
//
if ((pROMHdr->physfirst == (pCurDownloadFile->dwRegionStart - dwTempOffset)) &&
(pROMHdr->physlast == (pCurDownloadFile->dwRegionStart - dwTempOffset + pCurDownloadFile->dwRegionLength)) &&
(DWORD)(HIWORD(pROMHdr->dllfirst << 16) <= pROMHdr->dlllast) &&
(DWORD)(LOWORD(pROMHdr->dllfirst << 16) <= pROMHdr->dlllast))
{
g_dwROMOffset = dwTempOffset;
EdbgOutputDebugString("rom_offset=0x%x.\r\n", g_dwROMOffset);
}
}
// verify partial checksum
OEMShowProgress (nPkgNum ++); //2008--1--17 XQH 显示NK下载的进度!!!
if (fIsFlash)
{
OEMContinueEraseFlash ();
}
}//WHILE循环!!!
}
//============================
那这两边不是对接不上吗?那NK是怎么通过USB传下来的?PC与ARM通过什么样的USB协议进行NK的数据通信?这个USB通信的协议格式到底是什么?
还是我没理解好,谁清楚这一块啊,指导一下啊!