serial.h File Reference

Serial driver functions. More...

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
void serial_putc (int ch)
int serial_getc (void)
int serial_ischar (void)


Detailed Description

Serial driver functions.

Definition in file serial.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

void serial_putc ( int  ch  ) 

Definition at line 100 of file serial.c.

References mdelay(), UART_BASE, UART_LSR, UART_LSR_THRE, uart_readb, UART_TBR, and uart_writeb.

Referenced by gdbserial_send(), and int21().

00100                             {
00101         int i;
00102         int status;
00103         i = 1000; /* timeout */
00104         while(--i > 0) {
00105                 status = uart_readb(UART_BASE + UART_LSR);
00106                 if (status & UART_LSR_THRE) { 
00107                         /* TX buffer emtpy */
00108                         uart_writeb(ch, UART_BASE + UART_TBR);
00109                         break;
00110                 }
00111                 mdelay(2);
00112         }
00113 }

int serial_getc ( void   ) 

Definition at line 119 of file serial.c.

References UART_BASE, UART_LSR, UART_RBR, and uart_readb.

Referenced by gdbserial_recv().

00119                          {
00120         int status;
00121         int ch;
00122         do {
00123                 status = uart_readb(UART_BASE + UART_LSR);
00124         } while((status & 1) == 0);
00125         ch = uart_readb(UART_BASE + UART_RBR);  /* fetch (first) character */
00126         ch &= 0x7f;                             /* remove any parity bits we get */
00127         if (ch == 0x7f) {                       /* Make DEL... look like BS */
00128                 ch = 0x08;
00129         }
00130         return ch;
00131 }

int serial_ischar ( void   ) 

Definition at line 138 of file serial.c.

References UART_BASE, UART_LSR, and uart_readb.

00138                            {
00139         int status;
00140         status = uart_readb(UART_BASE + UART_LSR);      /* line status reg; */
00141         return status & 1;              /* rx char available */
00142 }


Generated on Tue Apr 6 20:01:14 2010 for gPXE by  doxygen 1.5.7.1