How do you test a bit set/clear from U-Boot command line/script?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
Within a u-boot script (to be executed by autoscr command), I need to read a GPIO port and if a particular GPIO bit is set execute some conditional commands. I am not sure how to do this with test/itest commands. Any ideas?
This is obviously highly hardware specific.
I am not asking anything about hardware. Forget I said GPIO. Let's say a value in general memory space. It could be in ram or flash....
I know I can compare a simple value using itest command. e.g.
itest *4000 -eq 1234 && echo 'Addr 4000 contains 1234'
Now my problem is how can I test a bit of 32 bit quantity (say bit 4) stored at location 4000? This is a question about general hush/u-boot shell capability? It is a generic question...
Best regards,
Tolunay
Quoted 11 lines · In message <[email protected]> you wrote:
I am not asking anything about hardware. Forget I said GPIO. Let's say a value in general memory space. It could be in ram or flash....
I know I can compare a simple value using itest command. e.g.
itest *4000 -eq 1234 && echo 'Addr 4000 contains 1234'
Now my problem is how can I test a bit of 32 bit quantity (say bit 4) stored at location 4000? This is a question about general hush/u-boot shell capability? It is a generic question...
At the moment there is no command that implements this. As you probaly are aware, the "itest" command just implements the following operations:
op_tbl_t op_table [] = {
{ "-lt", LT },
{ "<" , LT },
{ "-gt", GT },
{ ">" , GT },
{ "-eq", EQ },
{ "==" , EQ },
{ "-ne", NE },
{ "!=" , NE },
{ "<>" , NE },
{ "-ge", GE },
{ ">=" , GE },
{ "-le", LE },
{ "<=" , LE },
};Feel free to add new commands for AND, OR, and XOR...
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] "An organization dries up if you don't challenge it with growth." - Mark Shepherd, former President and CEO of Texas Instruments