From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Paul Pham" To: Subject: [ECOS] Samsung register problem Date: Mon, 22 Jan 2001 18:05:00 -0000 Message-id: X-SW-Source: 2001-01/msg00382.html 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 }