comparison target-utils/libbase/serio.S @ 991:5cff3579814c

target-utils: libbase factored out of libcommon The library dependency order is now strictly unidirectional
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Wed, 30 Dec 2015 20:48:12 +0000
parents target-utils/libcommon/serio.S@d7591faa1258
children a7b0b426f9ca
comparison
equal deleted inserted replaced
990:2a867e5768e9 991:5cff3579814c
1 #include "ns16550.h"
2
3 @ this module implements the elementary serial I/O operations
4
5 .text
6 .code 32
7 .global serial_out
8 serial_out:
9 ldr r1, =uart_base
10 ldr r2, [r1]
11 1: ldrb r3, [r2, #NS16550_LSR]
12 tst r3, #NS16550_LSR_THRE
13 beq 1b
14 strb r0, [r2, #NS16550_THR]
15 bx lr
16
17 .global serial_in_poll
18 serial_in_poll:
19 ldr r1, =uart_base
20 ldr r2, [r1]
21 ldrb r3, [r2, #NS16550_LSR]
22 tst r3, #NS16550_LSR_DR
23 ldrneb r0, [r2, #NS16550_RBR]
24 mvneq r0, #0
25 bx lr
26
27 .global serial_flush
28 serial_flush:
29 ldr r1, =uart_base
30 ldr r2, [r1]
31 1: ldrb r3, [r2, #NS16550_LSR]
32 tst r3, #NS16550_LSR_TEMP
33 beq 1b
34 bx lr