All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] How do you test a bit set/clear from U-Boot command line/script?
@ 2006-04-26 19:56 Tolunay Orkun
  0 siblings, 0 replies; 4+ messages in thread
From: Tolunay Orkun @ 2006-04-26 19:56 UTC (permalink / raw)
  To: u-boot

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?

Best regards,
Tolunay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] How do you test a bit set/clear from U-Boot command line/script?
       [not found] <20060426222044.CA140353DAD@atlas.denx.de>
@ 2006-04-26 23:25 ` Tolunay Orkun
  0 siblings, 0 replies; 4+ messages in thread
From: Tolunay Orkun @ 2006-04-26 23:25 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <444FDD08.2010101@orkun.us> you wrote:
>   
>> 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:
>   
I did hope there was some clever way to do this using existing commands.

> Feel free to add new commands for AND, OR, and XOR...
>   
I will send a patch. I am not sure how OR or XOR could be useful 
though... We do not support multiple operations or store computed 
expression results anywhere.


Tolunay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] How do you test a bit set/clear from U-Boot command line/script?
  2006-04-26 20:50 ` Tolunay Orkun
@ 2006-04-26 22:20   ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2006-04-26 22:20 UTC (permalink / raw)
  To: u-boot

In message <444FDD08.2010101@orkun.us> 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

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
"An organization dries up if you don't challenge it with growth."
       - Mark Shepherd, former President and CEO of Texas Instruments

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] How do you test a bit set/clear from U-Boot command line/script?
       [not found] <20060426200809.6BE30353DAE@atlas.denx.de>
@ 2006-04-26 20:50 ` Tolunay Orkun
  2006-04-26 22:20   ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Tolunay Orkun @ 2006-04-26 20:50 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> In message <444FD06D.4060309@orkun.us> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-26 23:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-26 19:56 [U-Boot-Users] How do you test a bit set/clear from U-Boot command line/script? Tolunay Orkun
     [not found] <20060426200809.6BE30353DAE@atlas.denx.de>
2006-04-26 20:50 ` Tolunay Orkun
2006-04-26 22:20   ` Wolfgang Denk
     [not found] <20060426222044.CA140353DAD@atlas.denx.de>
2006-04-26 23:25 ` Tolunay Orkun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.