[BACK]Return to cons_ns16550.c CVS log [TXT][DIR] Up to [local] / prex / boot / arm / cats

Annotation of prex/boot/arm/cats/cons_ns16550.c, Revision 1.1

1.1     ! nbrk        1: /*
        !             2:  * $Id: cons_ns16550.c,v 1.1 2008/07/17 18:10:36 nbrk Exp $
        !             3:  */
        !             4: /*
        !             5:  * ns16550 USART to be used by bootldr.
        !             6:  */
        !             7: #include <boot.h>
        !             8: #include <platform.h>
        !             9:
        !            10: #define IO_BASE        0x7c000000
        !            11:
        !            12: #define USART0_BASE    (IO_BASE + 0x3f8)
        !            13: #define USART1_BASE    (IO_BASE + 0x2f8)
        !            14:
        !            15: #define UART_DR        0       /* TX/RX data register */
        !            16: #define UART_LSR       5       /* line status register */
        !            17: #define  LST_DR                0x01    /* receiver data ready */
        !            18: #define  LSR_TEMT      0x40    /* transmitter empty */
        !            19:
        !            20: void
        !            21: putchar(int c)
        !            22: {
        !            23:        uint32_t        dev;
        !            24:
        !            25:        dev = USART0_BASE;
        !            26:
        !            27:        /* poll TEMT */
        !            28:        while (((*(volatile uint32_t *)(dev + UART_LSR * 4)) & LSR_TEMT) != 0)
        !            29:                ;
        !            30:
        !            31:        /* write tx fifo */
        !            32:        *(volatile uint32_t *)(dev + UART_DR * 4) = (c & 0x7f);
        !            33: }
        !            34:

CVSweb