[U-Boot-Users] strange problem on lib_mips/board.c after relocate code
zhuzhenhua
zzh.hust at gmail.com
Thu Nov 17 04:49:13 CET 2005
after relcate code and jump into board_init_r()
1.if i use printf to output string, it never put, but serial_puts is
ok, and printf in board_init_f is ok.
2. and also in board_init_r(), the serial_puts sometimes put
correctly, sometimes not.
and in board_init_f, it's fine for every time.
as flollow is my serial.c functions
int serial_init (void)
{
volatile u32 *uart0_config = (volatile u32*)(UART0_ADDR + UART0_CTL);
/* Set parity, stop bits and word length to 8N1 */
*uart0_config = UART0_CONFIG_VAL;
// serial_setbrg(); /*in our fpga board, baurate is fixed at 57600 */
return 0;
}
void serial_setbrg (void)
{
volatile u32 *uart0_clk = (volatile u32*)(ACTIONS_CMUHOSC_ADDR +
UART0_CLK_CON);
/* Set uart0_clk_con */
*uart0_clk = (((CORE_CLK_HZ/(CONFIG_BAUDRATE * 8))&0x0000FFFF) |
(UART0_50DIV_SEL&0x00070000) | (UART0_CLK_EN&0x00080000));
}
void serial_putc (const char c)
{
volatile u32 *uart0_stat = (volatile u32*)(UART0_ADDR + UART0_STAT);
volatile u32 *uart0_txdata = (volatile u32*)(UART0_ADDR + UART0_TXDATA);
if (c == '\n') serial_putc ('\r');
/* Wait for fifo to shift out some bytes */
while((*uart0_stat&UART0_STAT_TXFULL)); // the tx full bit means the
fifo is full
*uart0_txdata = (u32)c;
}
void serial_puts (const char *s)
{
while (*s)
{
serial_putc (*s++);
}
}
More information about the U-Boot
mailing list