FreeCalypso > hg > freecalypso-sw
annotate target-utils/libbase/serio.S @ 992:a7b0b426f9ca
target-utils: boot ROM UART autodetection revamped
The new implementation should work with both the familiar Calypso C035
boot ROM version found in our regular targets as well as the older
Calypso F741979B version found on the vintage D-Sample board.
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Wed, 30 Dec 2015 21:28:41 +0000 |
parents | 5cff3579814c |
children |
rev | line source |
---|---|
1
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 #include "ns16550.h" |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 @ this module implements the elementary serial I/O operations |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
992
a7b0b426f9ca
target-utils: boot ROM UART autodetection revamped
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
991
diff
changeset
|
5 .comm uart_base,4,4 |
a7b0b426f9ca
target-utils: boot ROM UART autodetection revamped
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
991
diff
changeset
|
6 |
1
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 .text |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 .code 32 |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 .global serial_out |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 serial_out: |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 ldr r1, =uart_base |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 ldr r2, [r1] |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 1: ldrb r3, [r2, #NS16550_LSR] |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 tst r3, #NS16550_LSR_THRE |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 beq 1b |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 strb r0, [r2, #NS16550_THR] |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 bx lr |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 .global serial_in_poll |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 serial_in_poll: |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 ldr r1, =uart_base |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 ldr r2, [r1] |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 ldrb r3, [r2, #NS16550_LSR] |
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 tst r3, #NS16550_LSR_DR |
393
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
25 ldrneb r0, [r2, #NS16550_RBR] |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
26 mvneq r0, #0 |
1
da98dc08f575
loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 bx lr |
393
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
28 |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
29 .global serial_flush |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
30 serial_flush: |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
31 ldr r1, =uart_base |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
32 ldr r2, [r1] |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
33 1: ldrb r3, [r2, #NS16550_LSR] |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
34 tst r3, #NS16550_LSR_TEMP |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
35 beq 1b |
d7591faa1258
target-utils serial I/O made consistent with other projects
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
11
diff
changeset
|
36 bx lr |