This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: HAL register write problem
- To: jeremy <chienyul at home dot com>
- Subject: Re: [ECOS] HAL register write problem
- From: Jonathan Larmour <jlarmour at redhat dot com>
- Date: Fri, 19 Jan 2001 03:04:39 +0000
- Cc: ecos-discuss at sourceware dot cygnus dot com
- Organization: Red Hat UK Ltd.
- References: <000e01c08183$65c3bf00$7c6509c0@viatech.com>
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)
At a guess, you were probably intending to write
#define CYG_DEVICE_SERIAL_RS232_UART_UBRDIV \
((volatile cyg_uint16 *) (CYG_DEVICE_SERIAL_RS232_UART_BASE + 0x14))
because adding 0x14 to something cast to a pointer to a 16-bit type will
increment it by 2*0x14=0x28 bytes.
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Un cheval, pas du glue. Pas du cheval, beaucoup du glue. || Opinions==mine