hardware_resets

Hardware Reset API. More...

Typedefs

typedef enum reset_num_rp2040 reset_num_t
 Resettable component numbers on RP2040 (used as typedef reset_num_t)
 
typedef enum reset_num_rp2350 reset_num_t
 Resettable component numbers on RP2350 (used as typedef reset_num_t)
 

Enumerations

enum  reset_num_rp2040 {
  RESET_ADC = 0 , RESET_BUSCTRL = 1 , RESET_DMA = 2 , RESET_I2C0 = 3 ,
  RESET_I2C1 = 4 , RESET_IO_BANK0 = 5 , RESET_IO_QSPI = 6 , RESET_JTAG = 7 ,
  RESET_PADS_BANK0 = 8 , RESET_PADS_QSPI = 9 , RESET_PIO0 = 10 , RESET_PIO1 = 11 ,
  RESET_PLL_SYS = 12 , RESET_PLL_USB = 13 , RESET_PWM = 14 , RESET_RTC = 15 ,
  RESET_SPI0 = 16 , RESET_SPI1 = 17 , RESET_SYSCFG = 18 , RESET_SYSINFO = 19 ,
  RESET_TBMAN = 20 , RESET_TIMER = 21 , RESET_UART0 = 22 , RESET_UART1 = 23 ,
  RESET_USBCTRL = 24 , RESET_COUNT
}
 Resettable component numbers on RP2040 (used as typedef reset_num_t) More...
 
enum  reset_num_rp2350 {
  RESET_ADC = 0 , RESET_BUSCTRL = 1 , RESET_DMA = 2 , RESET_HSTX = 3 ,
  RESET_I2C0 = 4 , RESET_I2C1 = 5 , RESET_IO_BANK0 = 6 , RESET_IO_QSPI = 7 ,
  RESET_JTAG = 8 , RESET_PADS_BANK0 = 9 , RESET_PADS_QSPI = 10 , RESET_PIO0 = 11 ,
  RESET_PIO1 = 12 , RESET_PIO2 = 13 , RESET_PLL_SYS = 14 , RESET_PLL_USB = 15 ,
  RESET_PWM = 16 , RESET_SHA256 = 17 , RESET_SPI0 = 18 , RESET_SPI1 = 19 ,
  RESET_SYSCFG = 20 , RESET_SYSINFO = 21 , RESET_TBMAN = 22 , RESET_TIMER0 = 23 ,
  RESET_TIMER1 = 24 , RESET_TRNG = 25 , RESET_UART0 = 26 , RESET_UART1 = 27 ,
  RESET_USBCTRL = 28 , RESET_COUNT
}
 Resettable component numbers on RP2350 (used as typedef reset_num_t) More...
 

Functions

static __force_inline void reset_block_mask (uint32_t bits)
 Reset the specified HW blocks. More...
 
static __force_inline void unreset_block_mask (uint32_t bits)
 bring specified HW blocks out of reset More...
 
static __force_inline void unreset_block_mask_wait_blocking (uint32_t bits)
 Bring specified HW blocks out of reset and wait for completion. More...
 
static void reset_block_num (uint32_t block_num)
 Reset the specified HW block. More...
 
static void unreset_block_num (uint block_num)
 bring specified HW block out of reset More...
 
static void unreset_block_num_wait_blocking (uint block_num)
 Bring specified HW block out of reset and wait for completion. More...
 
static void reset_unreset_block_num_wait_blocking (uint block_num)
 Reset the specified HW block, and then bring at back out of reset and wait for completion. More...
 

Detailed Description

Hardware Reset API.

The reset controller allows software control of the resets to all of the peripherals that are not critical to boot the processor in the RP-series microcontroller.

reset_bitmask

Multiple blocks are referred to using a bitmask as follows:

Block to reset Bit
USB 24
UART 1 23
UART 0 22
Timer 21
TB Manager 20
SysInfo 19
System Config 18
SPI 1 17
SPI 0 16
RTC 15
PWM 14
PLL USB 13
PLL System 12
PIO 1 11
PIO 0 10
Pads - QSPI 9
Pads - bank 0 8
JTAG 7
IO Bank 1 6
IO Bank 0 5
I2C 1 4
I2C 0 3
DMA 2
Bus Control 1
ADC 0 0

Example

#include <stdio.h>
#include "pico/stdlib.h"
int main() {
printf("Hello, reset!\n");
// Put the PWM block into reset
reset_block(RESETS_RESET_PWM_BITS);
// And bring it out
unreset_block_wait(RESETS_RESET_PWM_BITS);
// Put the PWM and RTC block into reset
reset_block(RESETS_RESET_PWM_BITS | RESETS_RESET_RTC_BITS);
// Wait for both to come out of reset
unreset_block_wait(RESETS_RESET_PWM_BITS | RESETS_RESET_RTC_BITS);
return 0;
}
bool stdio_init_all(void)
Initialize all of the present standard stdio types that are linked into the binary.
Definition: stdio.c:200

Enumeration Type Documentation

◆ reset_num_rp2040

Resettable component numbers on RP2040 (used as typedef reset_num_t)

Enumerator
RESET_ADC 

Select ADC to be reset.

RESET_BUSCTRL 

Select BUSCTRL to be reset.

RESET_DMA 

Select DMA to be reset.

RESET_I2C0 

Select I2C0 to be reset.

RESET_I2C1 

Select I2C1 to be reset.

RESET_IO_BANK0 

Select IO_BANK0 to be reset.

RESET_IO_QSPI 

Select IO_QSPI to be reset.

RESET_JTAG 

Select JTAG to be reset.

RESET_PADS_BANK0 

Select PADS_BANK0 to be reset.

RESET_PADS_QSPI 

Select PADS_QSPI to be reset.

RESET_PIO0 

Select PIO0 to be reset.

RESET_PIO1 

Select PIO1 to be reset.

RESET_PLL_SYS 

Select PLL_SYS to be reset.

RESET_PLL_USB 

Select PLL_USB to be reset.

RESET_PWM 

Select PWM to be reset.

RESET_RTC 

Select RTC to be reset.

RESET_SPI0 

Select SPI0 to be reset.

RESET_SPI1 

Select SPI1 to be reset.

RESET_SYSCFG 

Select SYSCFG to be reset.

RESET_SYSINFO 

Select SYSINFO to be reset.

RESET_TBMAN 

Select TBMAN to be reset.

RESET_TIMER 

Select TIMER to be reset.

RESET_UART0 

Select UART0 to be reset.

RESET_UART1 

Select UART1 to be reset.

RESET_USBCTRL 

Select USBCTRL to be reset.

◆ reset_num_rp2350

Resettable component numbers on RP2350 (used as typedef reset_num_t)

Enumerator
RESET_ADC 

Select ADC to be reset.

RESET_BUSCTRL 

Select BUSCTRL to be reset.

RESET_DMA 

Select DMA to be reset.

RESET_HSTX 

Select HSTX to be reset.

RESET_I2C0 

Select I2C0 to be reset.

RESET_I2C1 

Select I2C1 to be reset.

RESET_IO_BANK0 

Select IO_BANK0 to be reset.

RESET_IO_QSPI 

Select IO_QSPI to be reset.

RESET_JTAG 

Select JTAG to be reset.

RESET_PADS_BANK0 

Select PADS_BANK0 to be reset.

RESET_PADS_QSPI 

Select PADS_QSPI to be reset.

RESET_PIO0 

Select PIO0 to be reset.

RESET_PIO1 

Select PIO1 to be reset.

RESET_PIO2 

Select PIO2 to be reset.

RESET_PLL_SYS 

Select PLL_SYS to be reset.

RESET_PLL_USB 

Select PLL_USB to be reset.

RESET_PWM 

Select PWM to be reset.

RESET_SHA256 

Select SHA256 to be reset.

RESET_SPI0 

Select SPI0 to be reset.

RESET_SPI1 

Select SPI1 to be reset.

RESET_SYSCFG 

Select SYSCFG to be reset.

RESET_SYSINFO 

Select SYSINFO to be reset.

RESET_TBMAN 

Select TBMAN to be reset.

RESET_TIMER0 

Select TIMER0 to be reset.

RESET_TIMER1 

Select TIMER1 to be reset.

RESET_TRNG 

Select TRNG to be reset.

RESET_UART0 

Select UART0 to be reset.

RESET_UART1 

Select UART1 to be reset.

RESET_USBCTRL 

Select USBCTRL to be reset.

Function Documentation

◆ reset_block_mask()

static __force_inline void reset_block_mask ( uint32_t  bits)
static

Reset the specified HW blocks.

Parameters
bitsBit pattern indicating blocks to reset. See reset_bitmask

◆ reset_block_num()

static void reset_block_num ( uint32_t  block_num)
inlinestatic

Reset the specified HW block.

Parameters
block_numthe block number

◆ reset_unreset_block_num_wait_blocking()

static void reset_unreset_block_num_wait_blocking ( uint  block_num)
inlinestatic

Reset the specified HW block, and then bring at back out of reset and wait for completion.

Parameters
block_numthe block number

◆ unreset_block_mask()

static __force_inline void unreset_block_mask ( uint32_t  bits)
static

bring specified HW blocks out of reset

Parameters
bitsBit pattern indicating blocks to unreset. See reset_bitmask

◆ unreset_block_mask_wait_blocking()

static __force_inline void unreset_block_mask_wait_blocking ( uint32_t  bits)
static

Bring specified HW blocks out of reset and wait for completion.

Parameters
bitsBit pattern indicating blocks to unreset. See reset_bitmask

◆ unreset_block_num()

static void unreset_block_num ( uint  block_num)
inlinestatic

bring specified HW block out of reset

Parameters
block_numthe block number

◆ unreset_block_num_wait_blocking()

static void unreset_block_num_wait_blocking ( uint  block_num)
inlinestatic

Bring specified HW block out of reset and wait for completion.

Parameters
block_numthe block number