From 20fa8584e31d55b7f2953f917adcc190adab236f Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Tue, 31 Aug 2021 08:31:10 -0700 Subject: Initial Commit --- src/uart.S | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/uart.S (limited to 'src/uart.S') diff --git a/src/uart.S b/src/uart.S new file mode 100644 index 0000000..bd98bac --- /dev/null +++ b/src/uart.S @@ -0,0 +1,46 @@ +.section ".text" + +.globl uart_init +uart_init: + //*UART0_IMSC = 1 << 4; + mov r2, #0x1038 + movt r2, #0x3F20 + mov r3, #0b10000 + str r3, [r2] + //*IRQ_ENABLE2 = 1 << 25; + mov r2, #0xB214 + movt r2, #0x3F00 + mov r3, #0 + movt r3, #0b1000000000 + str r3, [r2] + //*GPU_INTERRUPTS_ROUTING = 0x00; + mov r2, #0x000C + movt r2, #0x4000 + eor r3, r3 + str r3, [r2] + bx lr + +.globl uart_char +uart_char: + mov r2, #0x1000 + movt r2, #0x3f20 +uart_char.loop: + ldr r3, [r2, #24] + tst r3, #0b100000 + bne uart_char.loop + str r0, [r2] + bx lr + +.globl uart_string +uart_string: + push {r4, lr} + mov r4, r0 + ldrb r0, [r0] + cmp r0, #0 + popeq {r4, pc} +uart_string.loop: + bl uart_char + ldrb r0, [r4, #1]! + cmp r0, #0 + bne uart_string.loop + pop {r4, pc} -- cgit v1.2.1