From f2f186c3594a922e51abf25b24052c61f833a2bf Mon Sep 17 00:00:00 2001 From: Jacques Comeaux Date: Tue, 4 Jun 2024 19:28:25 -0500 Subject: Rename stage 0 editor --- octedit/uart.s | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 octedit/uart.s (limited to 'octedit/uart.s') diff --git a/octedit/uart.s b/octedit/uart.s new file mode 100644 index 0000000..e79cbdc --- /dev/null +++ b/octedit/uart.s @@ -0,0 +1,33 @@ +.syntax unified +.cpu cortex-m0plus +.thumb + +.equ UART0_BASE, 0x40034000 +.equ UARTDR_OFST, 0x00 +.equ UARTFR_OFST, 0x18 + +.type uart_send, %function +.global uart_send + +uart_send: + ldr r1, =UART0_BASE + movs r3, 0b1 << 5 // TX FIFO full +1: + ldr r2, [r1, UARTFR_OFST] + tst r2, r3 + bne 1b + strb r0, [r1, UARTDR_OFST] + bx lr + +.type uart_recv, %function +.global uart_recv + +uart_recv: + ldr r1, =UART0_BASE + movs r3, 0b1 << 4 // RX FIFO empty +1: + ldr r2, [r1, UARTFR_OFST] + tst r2, r3 + bne 1b + ldrb r0, [r1, UARTDR_OFST] + bx lr -- cgit v1.2.3