Rev 534 | Rev 575 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 567 | ||
---|---|---|---|
Line 181... | Line 181... | ||
181 | ipl = interrupts_disable(); |
181 | ipl = interrupts_disable(); |
182 | arc_entry->write(1, &ch, 1, &cnt); |
182 | arc_entry->write(1, &ch, 1, &cnt); |
183 | interrupts_restore(ipl); |
183 | interrupts_restore(ipl); |
184 | 184 | ||
185 | } |
185 | } |
- | 186 | ||
- | 187 | /** Try to get character, return character or -1 if not available */ |
|
- | 188 | int arc_getchar(void) |
|
- | 189 | { |
|
- | 190 | char ch; |
|
- | 191 | __u32 count; |
|
- | 192 | long result; |
|
- | 193 | ||
- | 194 | if (arc_entry->getreadstatus(0)) |
|
- | 195 | return -1; |
|
- | 196 | result = arc_entry->read(0, &ch, 1, &count); |
|
- | 197 | if (result || count!=1) { |
|
- | 198 | cpu_halt(); |
|
- | 199 | return -1; |
|
- | 200 | } |
|
- | 201 | if (ch == '\r') |
|
- | 202 | return '\n'; |
|
- | 203 | return ch; |
|
- | 204 | } |