public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Samsung register problem
@ 2001-01-22 18:05 Paul Pham
  2001-01-23  7:15 ` Grant Edwards
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Pham @ 2001-01-22 18:05 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

For those of you working on a Samsung chip, I need some help debugging my
code. The following are excerpts from hal_diag.c (with similar analogs in
plf_stub.c) and darpa_misc.c, the main module for my board. I've
double-checked that the register defines are correct, and in Insight (with
the Simulator target), I can tell that the correct bits are getting set.
However, USTAT_XMT_HOLDING_EMPTY (the transmit holding register for UART
status) is never true, so whenever I try to write a character, the program
gets stuck in an infinite loop. Is there something else I need to do to the
control registers so that these changes take affect?

Thanks,
Paul

>>

void hal_hardware_init(void)
{
  // Any hardware/platform initialization that needs to be done.
  // Set all unknowns as edge triggered

  // Clear and initialize cache
  HAL_WRITE_UINT32(SYSCFG, SYSCFG_STALL_DISABLE       |
		           SYSCFG_CACHE_ENABLE        |
		           SYSCFG_WRITE_BUFFER_ENABLE |
		           SYSCFG_SFR_START_ADDRESS   |
		           SYSCFG_CACHE_4KB           |
		           SYSCFG_ADDRESS_MUX_ENABLE  |
		           SYSCFG_MEMORY_BANK6_SDRAM  |
		           SYSCFG_MEMORY_BANK7_SDRAM);
  HAL_WRITE_UINT32(BANKCON1, BANKCON_DATA_BUS_WIDTH_16_BITS |
		             BANKCON_BASE_ADDRESS(0x20000)  |
		             BANKCON_END_ADDRESS(0x41FFFF));
  HAL_WRITE_UINT32(BANKCON6, BANKCON_DATA_BUS_WIDTH_16_BITS |
		   BANKCON_BASE_ADDRESS(0x1000000) |
		   BANKCON_END_ADDRESS(0x4FFFFFF));
  HAL_WRITE_UINT32(BANKCON7, BANKCON_DATA_BUS_WIDTH_16_BITS |
		   BANKCON_BASE_ADDRESS(0x5000000) |
		   BANKCON_BASE_ADDRESS(0x8FFFFFF));

}

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
}

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

end of thread, other threads:[~2001-01-23  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-22 18:05 [ECOS] Samsung register problem Paul Pham
2001-01-23  7:15 ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).