|
现制作一个从SD卡启动烧镜像的BootLoader, 启动后在从SD卡读镜像时发现特别慢,经查发现是在读镜像时要先检查S3C6410的Normal Interrupt Status Register(NORINTSTS)的Buffer Read Ready (STABUFRDRDY),等待置位后才能读取,代码如下:
- int WaitForBufferReadReady(void)
- {
-
- UINT32 uLoop=0;
- //RETAILMSG(1, (TEXT("WaitForBufferReadReady function called \n")));
- // normal interrupt status register
- while (!(g_vpHSMMCReg->NORINTSTS & 0x20)) // this is the read buffer ready status bit
- { //
- uLoop++;
- }
-
- // ignore ready bit. because time out~!
- // it seemed that this issure was not resolved
- //
- // {
- // if (uLoop%500000==0 && uLoop>0)
- // {
- // RETAILMSG(1, (TEXT("WaitForBufferReadReady return false \n")));
- // return 0;
- // }
- // uLoop++;
- // }
- RETAILMSG(1, (TEXT("WaitForBufferReadReady function finished uLoop == %d \n"), uLoop));
- return 1;
- }
复制代码
调试发现每读一个Sector 要循环250万次(上述代码中的uLoop打印为2246277)才能等到 寄存器置位。考虑花费的时间都是在等待寄存器置位,这个速度现在是没法用的。
拜请各位老大帮忙。
|
|