aboutsummaryrefslogtreecommitdiff
path: root/uart.s
diff options
context:
space:
mode:
Diffstat (limited to 'uart.s')
-rw-r--r--uart.s10
1 files changed, 10 insertions, 0 deletions
diff --git a/uart.s b/uart.s
index 5b03024..39e631b 100644
--- a/uart.s
+++ b/uart.s
@@ -19,6 +19,10 @@
.equ UARTLCR_H_OFST, 0x2c
.equ UARTCR_OFST, 0x30
+.equ IO_BANK0_BASE, 0x40014000
+.equ GPIO0_CTRL_OFST, 0x04
+.equ GPIO1_CTRL_OFST, 0x0c
+
.equ ATOMIC_CLEAR, 0x3000
.type setup_uart, %function
@@ -26,6 +30,12 @@
setup_uart:
+ // Configure GPIO 0 and 1 as UART0
+ ldr r1, =IO_BANK0_BASE
+ movs r0, 2 // UART function = 2
+ str r0, [r1, GPIO0_CTRL_OFST]
+ str r0, [r1, GPIO1_CTRL_OFST]
+
// Deassert the reset
ldr r1, =(RESETS_BASE + ATOMIC_CLEAR)
movs r0, 1