Return to sausart.c CVS log | Up to [local] / funnyos / arch / sam7s64 / dev |
File: [local] / funnyos / arch / sam7s64 / dev / sausart.c (download)
Revision 1.4, Sun Jan 6 18:15:50 2008 UTC (16 years, 4 months ago) by nbrk
no need to include sys/device.h here |
/* * $Id: sausart.c,v 1.4 2008/01/06 18:15:50 nbrk Exp $ */ #include <sys/types.h> #include <arch/sam7s64/dev/at91sam7.h> /* * driver for USART. */ void sausart_early_putchar(char ch) { /* * Put a character into an unconfigured console. * Note that USART1 should be already configured (clocks/un-pio, etc.). * Such configuration is done in config_machineinit(). */ /* wait for previous character to transmit */ while( ((*AT91C_US1_CSR) & AT91C_US_TXRDY) == 0) ; /* if we encounter \n (LF), send \r\n (CRLF) */ if (ch == '\n') { *AT91C_US1_THR = 0x0d; while( ((*AT91C_US1_CSR) & AT91C_US_TXRDY) == 0) ; *AT91C_US1_THR = 0x0a; return; } /* put current character into Transmit Hold Register */ *AT91C_US1_THR = ch; }