| 161 | } |
| 162 | |
| 163 | static int |
| 164 | mtk_uart_getc(struct uart_bas *bas, struct mtx *hwmtx) |
| 165 | { |
| 166 | int c; |
| 167 | |
| 168 | uart_lock(hwmtx); |
| 169 | |
| 170 | while (!(uart_getreg(bas, UART_LSR_REG) & UART_LSR_DR)) { |
| 171 | uart_unlock(hwmtx); |
| 172 | DELAY(10); |
| 173 | uart_lock(hwmtx); |
| 174 | } |
| 175 | |
| 176 | c = uart_getreg(bas, UART_RX_REG); |
| 177 | |
| 178 | uart_unlock(hwmtx); |
| 179 | |
| 180 | return (c); |
| 181 | } |
| 182 | |
| 183 | /* |
| 184 | * High-level UART interface. |