This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: HAL register write problem



On 18-Jan-2001 jeremy wrote:
> My platform is Samsung KS32C50100, which operates in big-endian mode.
> I got some problem with writing to register using HAL_WRITE function.
> For example, in plf_stub.c where I put the UART initialization function
> in,
> Here I write some initialize value to UART control registers,
>  HAL_WRITE_UINT8 (CYG_DEVICE_SERIAL_RS232_UART_UTXBUF, 0x0);
>  HAL_WRITE_UINT8 (CYG_DEVICE_SERIAL_RS232_UART_URXBUF, 0x0);
>  HAL_WRITE_UINT16(CYG_DEVICE_SERIAL_RS232_UART_UBRDIV, 0x280);
> 
> The first two lines for writing 8-bits registers works fine. But the
> last line doesn't write
> anything into the 16-bits register. I defined that 16-bits register
> like this in the first part
> of the program:
>#define CYG_DEVICE_SERIAL_RS232_UART_UBRDIV \
>     ((volatile cyg_uint16 *) CYG_DEVICE_SERIAL_RS232_UART_BASE + 0x14)
> 
> I tried to write it as a word register by HAL_WRITE_UINT32, doesn't work
> either,
> Only works when I use HAL_WRITE_UINT8, but this way only writes in 0x80
> instead
> of 0x280. So the only way I can write it is to use arm ldr instruction
> in vectors.S, which
> is not good because I'll have more 16&32 bits registers to write.
> Can anyone help me with this?
> Thanks a lot!
>

How does the code generated by the HAL_WRITE_UINT16() macro differ from
what you can do by hand?  Have you compared the actual instruction sequences?

If you can do it manually, you should be able to do it using the macros.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]