summaryrefslogtreecommitdiffstats
path: root/cpu/at91rm9200/serial.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2004-03-15 09:00:01 +0000
committerwdenk <wdenk>2004-03-15 09:00:01 +0000
commitd9df1f4e662441c487f96a4e1f91caa9297afdd9 (patch)
tree7408e1e41bdc282ace7e881cd5450fb1ef14ef7d /cpu/at91rm9200/serial.c
parent42dfe7a1844cbad7114038aaf03828acb7a84414 (diff)
downloadu-boot-d9df1f4e662441c487f96a4e1f91caa9297afdd9.tar.gz
u-boot-d9df1f4e662441c487f96a4e1f91caa9297afdd9.tar.xz
u-boot-d9df1f4e662441c487f96a4e1f91caa9297afdd9.zip
* Patch by Steven Scholz, 27 Feb 2004:LABEL_2004_03_16_2330
- Adding get_ticks() and get_tbclk() for AT91RM9200 - Many white space fixes in cpu/at91rm9200/interrupts.c * Patches by Steven Scholz, 20 Feb 2004: some cleanup in AT91RM9200 related code
Diffstat (limited to 'cpu/at91rm9200/serial.c')
-rw-r--r--cpu/at91rm9200/serial.c89
1 files changed, 44 insertions, 45 deletions
diff --git a/cpu/at91rm9200/serial.c b/cpu/at91rm9200/serial.c
index f80fd4320c..43e15535e6 100644
--- a/cpu/at91rm9200/serial.c
+++ b/cpu/at91rm9200/serial.c
@@ -36,55 +36,54 @@
/* ggi thunder */
AT91PS_USART us = (AT91PS_USART) AT91C_BASE_DBGU;
-void serial_setbrg(void)
- {
- DECLARE_GLOBAL_DATA_PTR;
- int baudrate;
+void serial_setbrg (void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ int baudrate;
- if ((baudrate = gd->bd->bi_baudrate) <= 0)
- baudrate = CONFIG_BAUDRATE;
- us->US_BRGR = 33 /* AT91C_MASTER_CLOCK / baudrate / 16 */; /* hardcode so no __divsi3 */
- }
+ if ((baudrate = gd->bd->bi_baudrate) <= 0)
+ baudrate = CONFIG_BAUDRATE;
+ us->US_BRGR = CFG_AT91C_BRGR_DIVISOR; /* hardcode so no __divsi3 */
+}
-int serial_init(void)
- {
- /* make any port initializations specific to this port */
- *AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; /* PA 31 & 30 */
- *AT91C_PMC_PCER = 1 << AT91C_ID_SYS; /* enable clock */
- serial_setbrg();
+int serial_init (void)
+{
+ /* make any port initializations specific to this port */
+ *AT91C_PIOA_PDR = AT91C_PA31_DTXD | AT91C_PA30_DRXD; /* PA 31 & 30 */
+ *AT91C_PMC_PCER = 1 << AT91C_ID_SYS; /* enable clock */
+ serial_setbrg ();
- us->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;
- us->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
- us->US_MR = ( AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS | AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT );
- us->US_IMR = ~0ul;
- return (0);
- }
+ us->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;
+ us->US_CR = AT91C_US_RXEN | AT91C_US_TXEN;
+ us->US_MR =
+ (AT91C_US_CLKS_CLOCK | AT91C_US_CHRL_8_BITS |
+ AT91C_US_PAR_NONE | AT91C_US_NBSTOP_1_BIT);
+ us->US_IMR = ~0ul;
+ return (0);
+}
-void serial_putc(const char c)
- {
- if (c == '\n')
- serial_putc('\r');
- while( (us->US_CSR & AT91C_US_TXRDY) == 0 )
- ;
- us->US_THR=c;
- }
+void serial_putc (const char c)
+{
+ if (c == '\n')
+ serial_putc ('\r');
+ while ((us->US_CSR & AT91C_US_TXRDY) == 0);
+ us->US_THR = c;
+}
-void
-serial_puts (const char *s)
- {
- while (*s)
- {
- serial_putc (*s++);
- }
- }
+void serial_puts (const char *s)
+{
+ while (*s) {
+ serial_putc (*s++);
+ }
+}
-int serial_getc(void)
- {
- while( (us->US_CSR & AT91C_US_RXRDY) == 0 );
- return us->US_RHR;
- }
+int serial_getc (void)
+{
+ while ((us->US_CSR & AT91C_US_RXRDY) == 0);
+ return us->US_RHR;
+}
-int serial_tstc(void)
- {
- return ((us->US_CSR & AT91C_US_RXRDY) == AT91C_US_RXRDY);
- }
+int serial_tstc (void)
+{
+ return ((us->US_CSR & AT91C_US_RXRDY) == AT91C_US_RXRDY);
+}