FreeCalypso > hg > freecalypso-tools
comparison target-utils/libbase/serio.S @ 0:e7502631a0f9
initial import from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 11 Jun 2016 00:13:35 +0000 |
parents | |
children | da6df2c626cf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e7502631a0f9 |
---|---|
1 #include "ns16550.h" | |
2 | |
3 @ this module implements the elementary serial I/O operations | |
4 | |
5 .comm uart_base,4,4 | |
6 | |
7 .text | |
8 .code 32 | |
9 .global serial_out | |
10 serial_out: | |
11 ldr r1, =uart_base | |
12 ldr r2, [r1] | |
13 1: ldrb r3, [r2, #NS16550_LSR] | |
14 tst r3, #NS16550_LSR_THRE | |
15 beq 1b | |
16 strb r0, [r2, #NS16550_THR] | |
17 bx lr | |
18 | |
19 .global serial_in_poll | |
20 serial_in_poll: | |
21 ldr r1, =uart_base | |
22 ldr r2, [r1] | |
23 ldrb r3, [r2, #NS16550_LSR] | |
24 tst r3, #NS16550_LSR_DR | |
25 ldrneb r0, [r2, #NS16550_RBR] | |
26 mvneq r0, #0 | |
27 bx lr | |
28 | |
29 .global serial_flush | |
30 serial_flush: | |
31 ldr r1, =uart_base | |
32 ldr r2, [r1] | |
33 1: ldrb r3, [r2, #NS16550_LSR] | |
34 tst r3, #NS16550_LSR_TEMP | |
35 beq 1b | |
36 bx lr |