[U-Boot] register polling from HUSH parser?
Masahiro Yamada
yamada.masahiro at socionext.com
Thu Apr 28 08:03:18 CEST 2016
Hi Wolfgang,
2016-04-27 18:46 GMT+09:00 Wolfgang Denk <wd at denx.de>:
> Dear Masahiro,
>
> In message <CAK7LNATy2wfxErhQTaPtJ+YREPLttD9oGDr3kZff7TXBD0BCVQ at mail.gmail.com> you wrote:
>>
>> Is there any good way to poll a certain register
>> in a HUSH parser script?
>
> Yes, there is :-)
>
>> For example, I want to wait
>> until the register value of 0x50000000 becomes 1
>> in a HUSH script.
>
> OK...
>
>> The pseudo code would be like this:
>>
>> while readl(0x50000000) != 1
>> do
>> ;
>> done;
>
> And in HUSH:
>
> while itest *50000000 != 1
> do
> ...
> done
>
>> I wish there were a command that
>> stores a value of a given address into an environment,
>> but I have no idea about that.
>
> Try "help setexpr". If you want to store the value as is, just apply
> a null operation, like
>
> => setexp foo *50000000 | 0
> => printenv foo
>
>
> Hope this helps...
Yes, it really helped me.
Thank you!
I think itest.l works as expected on 32bit architecture,
but the problem is that sizeof(unsigned long) is 8
on 64bit architecture.
So, "case 4" in the following gets 8-byte data.
This is probably not what we expect...
switch (w) {
case 1:
l = (long)(*(unsigned char *)buf);
break;
case 2:
l = (long)(*(unsigned short *)buf);
break;
case 4:
l = (long)(*(unsigned long *)buf);
break;
}
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list