/[grub]/grub/stage2/serial.c
ViewVC logotype

Diff of /grub/stage2/serial.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by okuji, Tue Jul 2 21:23:28 2002 UTC revision 1.9 by okuji, Tue Jul 2 23:39:14 2002 UTC
# Line 64  static inline unsigned char Line 64  static inline unsigned char
64  inb (unsigned short port)  inb (unsigned short port)
65  {  {
66    unsigned char value;    unsigned char value;
67      
68    asm volatile ("inb    %w1, %0" : "=a" (value) : "Nd" (port));    asm volatile ("inb    %w1, %0" : "=a" (value) : "Nd" (port));
69      asm volatile ("outb   %%al, $0x80" : : );
70      
71    return value;    return value;
72  }  }
73    
# Line 74  static inline void Line 76  static inline void
76  outb (unsigned short port, unsigned char value)  outb (unsigned short port, unsigned char value)
77  {  {
78    asm volatile ("outb   %b0, %w1" : : "a" (value), "Nd" (port));    asm volatile ("outb   %b0, %w1" : : "a" (value), "Nd" (port));
79      asm volatile ("outb   %%al, $0x80" : : );
80  }  }
81    
82  /* Fetch a key.  */  /* Fetch a key.  */
# Line 90  serial_hw_fetch (void) Line 93  serial_hw_fetch (void)
93  void  void
94  serial_hw_put (int c)  serial_hw_put (int c)
95  {  {
96    int timeout = 10000;    int timeout = 100000;
97    
98    /* Wait until the transmitter holding register is empty.  */    /* Wait until the transmitter holding register is empty.  */
99    while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0)    while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0)
# Line 98  serial_hw_put (int c) Line 101  serial_hw_put (int c)
101        if (--timeout == 0)        if (--timeout == 0)
102          /* There is something wrong. But what can I do?  */          /* There is something wrong. But what can I do?  */
103          return;          return;
         
       /* Insert a delay.  */  
       serial_hw_delay ();  
104      }      }
105      
106    outb (serial_hw_port + UART_TX, c);    outb (serial_hw_port + UART_TX, c);
107  }  }
108    
# Line 263  static Line 263  static
263  int fill_input_buf (void)  int fill_input_buf (void)
264  {  {
265    int i;    int i;
266      
267    for (i = 0; i < 1000 && npending < sizeof (input_buf); i++)    for (i = 0; i < 10000 && npending < sizeof (input_buf); i++)
268      {      {
269        int c;        int c;
270    
271        c = serial_hw_fetch ();        c = serial_hw_fetch ();
272        if (c >= 0)        if (c >= 0)
273          input_buf[npending++] = c;          {
274              input_buf[npending++] = c;
275    
276        /* Insert a delay.  */            /* Reset the counter to zero, to wait for the same interval.  */
277        serial_hw_delay ();            i = 0;
278            }
279      }      }
280    
281    /* Translate some key sequences.  */    /* Translate some key sequences.  */

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26