rp2040

RP2040 Programming without SDK
Log | Files | Refs

commit ea5f607f16c3400d06888bcf8b3b0dedbb569b6d
parent ed18e260d3d14d394181cd66221c0bd3b488c547
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Wed, 28 Feb 2024 09:01:27 +0900

add unreset subroutine

Diffstat:
Mex3/main.s | 28++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/ex3/main.s b/ex3/main.s @@ -25,13 +25,7 @@ vectors: reset: // unreset gpio, pll_sys, timer ldr r0, =(1 << 21 | 1 << 12 | 1 << 5) // | timer | pll_sys | io_bank0 - ldr r3, resets_base - ldr r1, atomic_clr - str r0, [r3, r1] // RESETS: RESET -unreset_chk: - ldr r1, [r3, #0x8] // RESETS: RESET_DONE - bic r0, r1 - bne unreset_chk + bl unreset // set gpio functions ldr r3, io_bank0_base @@ -89,13 +83,7 @@ wait_vco: // unreset uart0 ldr r0, =(1 << 22) - ldr r3, resets_base - ldr r1, atomic_clr - str r0, [r3, r1] // RESETS: RESET -unreset_chk1: - ldr r1, [r3, #0x8] // RESETS: RESET_DONE - bic r0, r1 - bne unreset_chk1 + bl unreset // disable rosc ldr r3, rosc_base @@ -194,6 +182,18 @@ isr_alarm: bl set_alarm pop {pc} + // unreset deasserts reset bit of subsystems specified by r0 + // and wait for them complete unreset. +unreset: + ldr r3, resets_base + ldr r1, atomic_clr + str r0, [r3, r1] // RESETS: RESET +unreset_chk: + ldr r1, [r3, #0x8] // RESETS: RESET_DONE + bic r0, r1 + bne unreset_chk + bx lr + // set_alarm sets alarm_0 to fire after r0 us. set_alarm: ldr r3, timer_base