From aae8818fbc80281699f085d0fffbab659f184387 Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Sat, 23 Dec 2023 22:50:04 -0600 Subject: Select UART function for GPIO 0 and 1 --- uart.s | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'uart.s') 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 -- cgit v1.2.3