Files
Embedded-Hacking/drivers/0x01_uart_asm_arm/reset.s
2026-03-27 11:19:24 -04:00

51 lines
1.7 KiB
ArmAsm

/**
* FILE: reset.s
*
* DESCRIPTION:
* RP2350 Reset Controller Functions.
*
* BRIEF:
* Provides functions to initialize subsystems by clearing their
* reset bits in the Reset controller.
*
* AUTHOR: Kevin Thomas
* CREATION DATE: November 27, 2025
* UPDATE DATE: November 27, 2025
*/
.syntax unified // use unified assembly syntax
.cpu cortex-m33 // target Cortex-M33 core
.thumb // use Thumb instruction set
.include "constants.s"
/**
* Initialize the .text section.
* The .text section contains executable code.
*/
.section .text // code section
.align 2 // align to 4-byte boundary
/**
* @brief Init subsystem.
*
* @details Initiates the various subsystems by clearing their reset bits.
*
* @param None
* @retval None
*/
.global Init_Subsystem
.type Init_Subsystem, %function
Init_Subsystem:
.GPIO_Subsystem_Reset:
ldr r0, =RESETS_RESET // load RESETS->RESET address
ldr r1, [r0] // read RESETS->RESET value
bic r1, r1, #(1<<6) // clear IO_BANK0 bit
str r1, [r0] // store value into RESETS->RESET address
.GPIO_Subsystem_Reset_Wait:
ldr r0, =RESETS_RESET_DONE // load RESETS->RESET_DONE address
ldr r1, [r0] // read RESETS->RESET_DONE value
tst r1, #(1<<6) // test IO_BANK0 reset done
beq .GPIO_Subsystem_Reset_Wait // wait until done
bx lr // return