This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Samsung register problem
- To: Paul Pham <ppham at MIT dot EDU>
- Subject: Re: [ECOS] Samsung register problem
- From: Grant Edwards <grante at visi dot com>
- Date: Tue, 23 Jan 2001 09:20:24 -0600
- Cc: ecos-discuss at sourceware dot cygnus dot com
- References: <NEBBLDBMIIDEJLLIEJFBMEIPCAAA.ppham@mit.edu>
> For those of you working on a Samsung chip, I need some help debugging my
> code. The following are excerpts from hal_diag.c
[...]
> void hal_diag_init(void)
> {
> static int init = 0;
> char *msg = "\n\rDARPA eCos\n\r";
>
> if (init++) return;
>
> /* iRDA mode off, 8-N-1. */
> HAL_WRITE_UINT8 (ULCON, ULCON_IRDA_DISABLE |
> ULCON_PARITY_NONE |
> ULCON_STOP_1_BITS |
> ULCON_WORD_8_BITS);
> HAL_WRITE_UINT16 (UBRDIV, UBRDIV_BAUD_RATE(115200));
> HAL_WRITE_UINT8 (UCON, UCON_RCV_MODE_INT |
> UCON_XMT_MODE_INT |
> UCON_SEND_BREAK_DISABLE |
> UCON_LOOPBACK_DISABLE |
> UCON_RCV_STATUS_INT_ENABLE |
> UCON_RCV_TIMEOUT_DISABLE);
> HAL_WRITE_UINT8 (UFCON, UFCON_ENABLE |
> UFCON_RCV_RESET |
> UFCON_XMT_RESET |
> UFCON_RCV_TRIGGER_4_BYTES |
> UFCON_XMT_TRIGGER_4_BYTES);
>
> while (*msg) {
> hal_diag_write_char(*msg++);
> }
> }
>
>
> void hal_diag_write_char(char c)
> {
> hal_diag_init();
> while (!USTAT_XMT_HOLDING_EMPTY());
>
> HAL_WRITE_UINT8 (UTXH_B, c);
> HAL_IO_BARRIER ();
> #ifdef DEBUG_DIAG
> diag_buffer[diag_bp++] = c;
> if (diag_bp == DIAG_BUFSIZE) diag_bp = 0;
> #endif
> }
I use all 32-bit reads/writes when I access the UARTs.
I don't know which part you're using, but in the ks32c5000, all
of the UART registers are 32 bits wide. They're on 4-byte
address boundaries at e000, e004, e008, e00c, e010, etc.
For example, the status register is at e008. If you're in
big-endian mode, doing at 8-bit read at e008 will get you bits
24-31 of the status register (the stuff you want is in bits
0-7).
What are the values of ULCON, UBRDIV, UCON, UFCON, etc.?
--
Grant Edwards
grante@visi.com