[U-Boot] Timer implementations
Nishanth Menon
nm at ti.com
Tue Oct 26 17:22:34 CEST 2010
Wolfgang Denk had written, on 10/26/2010 10:17 AM, the following:
> Dear Nishanth Menon,
>
> In message <4CC6EFB1.9000701 at ti.com> you wrote:
>> uint64_t etime; /* actually this could be u32 */
>>
>> etime = get_ticks() + usec2ticks(MAX_RETRY_US);
>> while (!(readl(&mmc_base->stat) & CC_MASK)) {
>> if (get_ticks() <= etime) {
>> printf("%s: timedout waiting for cc2!\n", __func__);
>> return;
>> }
>> }
>>
>> sounds right?
>
> No. This code is always wrong. Please fix it as described.
Apologies on being a dudhead, I suppose you mean the following:
ulong start;
start = get_timer(0);
while (!(readl(&mmc_base->stat) & CC_MASK)) {
if (get_timer(start) > usec2ticks(MAX_RETRY_US)) {
printf("%s: timedout waiting for cc2!\n", __func__);
return;
}
}
would this be better?
--
Regards,
Nishanth Menon
More information about the U-Boot
mailing list