Subversion Repositories HelenOS-historic

Rev

Rev 606 | Rev 958 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 606 Rev 607
Line 69... Line 69...
69
        i++;
69
        i++;
70
    }
70
    }
71
    return i;
71
    return i;
72
}
72
}
73
 
73
 
-
 
74
/** Read character from serial port, wait until available */
74
static chardev_operations_t serial_ops = {
75
static char serial_do_read(chardev_t *dev)
-
 
76
{
75
    .resume = serial_enable,
77
    serial_t *sd = (serial_t *)dev->data;
-
 
78
    char ch;
-
 
79
 
-
 
80
    while (!(SERIAL_READ_LSR(sd->port) & 1))
-
 
81
        ;
76
    .suspend = serial_disable,
82
    ch = SERIAL_READ(sd->port);
-
 
83
 
77
    .write = serial_write
84
    if (ch =='\r')
-
 
85
        ch = '\n';
-
 
86
    return ch;
78
};
87
}
-
 
88
 
79
 
89
 
80
/** Process keyboard interrupt. Does not work in simics? */
90
/** Process keyboard interrupt. Does not work in simics? */
81
static void serial_interrupt(int n, void *stack)
91
static void serial_interrupt(int n, void *stack)
82
{
92
{
83
    serial_t *sd = (serial_t *)console.data;
93
    serial_t *sd = (serial_t *)console.data;
Line 91... Line 101...
91
        ch = '\n';
101
        ch = '\n';
92
    chardev_push_character(&console, ch);
102
    chardev_push_character(&console, ch);
93
}
103
}
94
 
104
 
95
 
105
 
-
 
106
 
-
 
107
static chardev_operations_t serial_ops = {
-
 
108
    .resume = serial_enable,
-
 
109
    .suspend = serial_disable,
-
 
110
    .write = serial_write,
-
 
111
    .read = serial_do_read
-
 
112
};
-
 
113
 
96
iroutine old_timer;
114
iroutine old_timer;
97
/** Do polling on timer interrupt */
115
/** Do polling on timer interrupt */
98
static void timer_replace(int n, void *stack)
116
static void timer_replace(int n, void *stack)
99
{
117
{
100
    old_timer(n, stack);
118
    old_timer(n, stack);