aboutsummaryrefslogtreecommitdiff
path: root/uart.s
diff options
context:
space:
mode:
authorJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-23 22:50:04 -0600
committerJacques Comeaux <jacquesrcomeaux@protonmail.com>2023-12-23 22:50:04 -0600
commitaae8818fbc80281699f085d0fffbab659f184387 (patch)
tree31295b343643d33e7f8e60a03a9a15d2eaecc193 /uart.s
parent4399fed38456dfa15c57ad0def67e25c40c8338c (diff)
Select UART function for GPIO 0 and 1
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