[BACK]Return to sausart.c CVS log [TXT][DIR] Up to [local] / funnyos / arch / sam7s64 / dev

Annotation of funnyos/arch/sam7s64/dev/sausart.c, Revision 1.2

1.1       nbrk        1: /*
1.2     ! nbrk        2:  * $Id: sausart.c,v 1.1 2007/11/24 15:04:49 nbrk Exp $
1.1       nbrk        3:  */
                      4: #include <sys/types.h>
                      5: #include <sys/device.h>
                      6:
                      7: #include <arch/sam7s64/dev/at91sam7.h>
                      8:
                      9: /*
                     10:  * driver for USART.
                     11:  */
                     12:
                     13: void
                     14: sausart_early_putchar(char ch)
                     15: {
                     16:        /*
                     17:         * Put a character into an unconfigured console.
                     18:         * Note that USART0 (DBGU) should be already configured (clocks/un-pio, etc.).
                     19:         * Such configuration is done in config_machineinit().
                     20:         */
                     21:
                     22:        /* wait for previous character to transmit */
                     23:        while( ((*AT91C_US0_CSR) & AT91C_US_TXRDY) == 0)
                     24:                ;
                     25:
1.2     ! nbrk       26:        /* if we encounter \n (LF), send \r\n (CRLF) */
        !            27:        if (ch == '\n') {
        !            28:
        !            29:                *AT91C_US0_THR = 0x0d;
        !            30:                while( ((*AT91C_US0_CSR) & AT91C_US_TXRDY) == 0)
        !            31:                        ;
        !            32:
        !            33:                *AT91C_US0_THR = 0x0a;
        !            34:
        !            35:                return;
        !            36:        }
        !            37:
1.1       nbrk       38:        /* put current character into Transmit Hold Register */
1.2     ! nbrk       39:        *AT91C_US0_THR = ch;
1.1       nbrk       40: }
                     41:

CVSweb