Hi Wolfgang, 2016-04-27 18:46 GMT+09:00 Wolfgang Denk <w...@denx.de>: > Dear Masahiro, > > In message > <cak7lnaty2wfxerhqtaptj+yreplttd9ogdr3kzff7txbd0b...@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 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot