[U-Boot] Strange data behaviour
Remco Poelstra
remco.poelstra at duran-audio.com
Wed Feb 18 09:19:08 CET 2009
Wolfgang Denk schreef:
>> U0THR = hex_data[(0xDEADBEEF>>4)&0xF];
>> }
>> }
>> ---------------
>> When I run it likes this I get 8 E's. Which is what I expect. When I run
>> it with the commented-out line, I get back 8 0x0's. So it seems that the
>> output is only correct when it is constant.
>> Does anyone have a clue on why that is?
>
> What exactly is U0THR ?
Hi,
Thanks for your reply.
For my processor, U0THR is defnied as:
#define U0THR (*(volatile unsigned char *)(UART0_BASE_ADDR +
0x00))
UART0_BASE_ADDR is equal to 0xE000C000
The register itself represents the top of the UART0 transmit FIFO.
>
> The only definition I can find in the U-Boot sources is here:
>
> include/asm-arm/arch-lpc2292/lpc2292_registers.h:#define U0THR 0xE000C000
>
> but that is obviously not what you are using.
>
> You probably forget the effects of compiler optimization and/or
> caching here.
>
>
> I bet you are using a plain pointer access without a "volatile",
> which is essential here. Maybe even some form of "sync" is needed. In
> any case, you should use appropriate accessor functions to access
> device registers.
I do not know any accessor functions.
What do you mean with a "sync"?
Kind regards,
Remco Poelstra
More information about the U-Boot
mailing list