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

Annotation of prex-old/boot/arm/cats/cons_footbridge.c, Revision 1.1

1.1     ! nbrk        1: /*
        !             2:  * $Id$
        !             3:  */
        !             4: /*
        !             5:  * DC21285 'footbridge' USART for bootldr boot messages.
        !             6:  * TODO: baud rate.
        !             7:  */
        !             8: #include <sys/types.h>
        !             9:
        !            10: #define CSR_BASE       0x42000000
        !            11: #define  UARTDR        0x160   /* data register */
        !            12: #define  H_UBRLCR      0x168   /* baud rate, line control register */
        !            13: #define  M_UBRLCR      0x16c   /* baud rate divisor (high) */
        !            14: #define  L_UBRLCR      0x170   /* baud rate divisor (low) */
        !            15: #define  UARTCON       0x174   /* control register */
        !            16: #define  UARTFLG       0x178   /* FIFO status */
        !            17:
        !            18: void   fuart_write(uint16_t reg, uint8_t data);
        !            19: uint8_t        fuart_read(uint16_t reg);
        !            20:
        !            21:
        !            22: void
        !            23: fuart_write(uint16_t reg, uint8_t data)
        !            24: {
        !            25:        *(volatile uint32_t *)(CSR_BASE + reg) = data;
        !            26: }
        !            27:
        !            28:
        !            29: uint8_t
        !            30: fuart_read(uint16_t reg)
        !            31: {
        !            32:        return( *(volatile uint32_t *)(CSR_BASE + reg));
        !            33: }
        !            34:
        !            35:
        !            36: int
        !            37: bootcons_init(void)
        !            38: {
        !            39:        /* XXX set operation mode */
        !            40:        fuart_write(H_UBRLCR, 0x60 /*8bits*/);
        !            41:
        !            42:        /* enable UART */
        !            43:        fuart_write(UARTCON, 1);
        !            44:
        !            45:        return(0);
        !            46: }
        !            47:
        !            48:
        !            49: void
        !            50: bootcons_putc(int uartno, int c)
        !            51: {
        !            52:        while(fuart_read(UARTFLG) & 0x08 /*TXBSY*/)
        !            53:                ;
        !            54:
        !            55:        fuart_write(UARTDR, (uint8_t)c);
        !            56: }
        !            57:

CVSweb