@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
resets.h
Go to the documentation of this file.
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _HARDWARE_RESETS_H
#define _HARDWARE_RESETS_H
#include "pico.h"
#include "hardware/structs/resets.h"
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_HARDWARE_RESETS, Enable/disable assertions in the hardware_resets module, type=bool, default=0, group=hardware_adc
#ifndef PARAM_ASSERTIONS_ENABLED_HARDWARE_RESETS
#ifdef PARAM_ASSERTIONS_ENABLED_RESET // backwards compatibility with SDK < 2.0.0
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_RESETS PARAM_ASSERTIONS_ENABLED_RESET
#else
#define PARAM_ASSERTIONS_ENABLED_HARDWARE_RESETS 0
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
static __force_inline void reset_block_reg_mask(io_rw_32 *reset, uint32_t mask) {
hw_set_bits(reset, mask);
}
static __force_inline void unreset_block_reg_mask(io_rw_32 *reset, uint32_t mask) {
hw_clear_bits(reset, mask);
}
static __force_inline void unreset_block_reg_mask_wait_blocking(io_rw_32 *reset, io_ro_32 *reset_done, uint32_t mask) {
hw_clear_bits(reset, mask);
while (~*reset_done & mask)
tight_loop_contents();
}
static __force_inline void reset_block_mask(uint32_t bits) {
reset_block_reg_mask(&resets_hw->reset, bits);
}
static __force_inline void unreset_block_mask(uint32_t bits) {
unreset_block_reg_mask(&resets_hw->reset, bits);
}
static __force_inline void unreset_block_mask_wait_blocking(uint32_t bits) {
unreset_block_reg_mask_wait_blocking(&resets_hw->reset, &resets_hw->reset_done, bits);
}
#ifndef HARDWARE_RESETS_ENABLE_SDK1XX_COMPATIBILITY
#define HARDWARE_RESETS_ENABLE_SDK1XX_COMPATIBILITY 1
#endif
#if HARDWARE_RESETS_ENABLE_SDK1XX_COMPATIBILITY
static __force_inline void reset_block(uint32_t bits) {
reset_block_mask(bits);
}
static __force_inline void unreset_block(uint32_t bits) {
unreset_block_mask(bits);
}
static __force_inline void unreset_block_wait(uint32_t bits) {
return unreset_block_mask_wait_blocking(bits);
}
#endif
static inline void reset_block_num(uint32_t block_num) {
reset_block_reg_mask(&resets_hw->reset, 1u << block_num);
}
static inline void unreset_block_num(uint block_num) {
invalid_params_if(HARDWARE_RESETS, block_num > NUM_RESETS);
unreset_block_reg_mask(&resets_hw->reset, 1u << block_num);
}
static inline void unreset_block_num_wait_blocking(uint block_num) {
invalid_params_if(HARDWARE_RESETS, block_num > NUM_RESETS);
unreset_block_reg_mask_wait_blocking(&resets_hw->reset, &resets_hw->reset_done, 1u << block_num);
}
static inline void reset_unreset_block_num_wait_blocking(uint block_num) {
invalid_params_if(HARDWARE_RESETS, block_num > NUM_RESETS);
reset_block_reg_mask(&resets_hw->reset, 1u << block_num);
unreset_block_reg_mask_wait_blocking(&resets_hw->reset, &resets_hw->reset_done, 1u << block_num);
}
#ifdef __cplusplus
}
#endif
#endif
hw_set_bits
static __force_inline void hw_set_bits(io_rw_32 *addr, uint32_t mask)
Atomically set the specified bits to 1 in a HW register.
Definition address_mapped.h:135
hw_clear_bits
static __force_inline void hw_clear_bits(io_rw_32 *addr, uint32_t mask)
Atomically clear the specified bits to 0 in a HW register.
Definition address_mapped.h:145
unreset_block_num
static void unreset_block_num(uint block_num)
bring specified HW block out of reset
Definition resets.h:186
unreset_block_mask
static __force_inline void unreset_block_mask(uint32_t bits)
bring specified HW blocks out of reset
Definition resets.h:139
reset_block_num
static void reset_block_num(uint32_t block_num)
Reset the specified HW block.
Definition resets.h:177
reset_block_mask
static __force_inline void reset_block_mask(uint32_t bits)
Reset the specified HW blocks.
Definition resets.h:130
reset_unreset_block_num_wait_blocking
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.
Definition resets.h:206
unreset_block_num_wait_blocking
static void unreset_block_num_wait_blocking(uint block_num)
Bring specified HW block out of reset and wait for completion.
Definition resets.h:196
unreset_block_mask_wait_blocking
static __force_inline void unreset_block_mask_wait_blocking(uint32_t bits)
Bring specified HW blocks out of reset and wait for completion.
Definition resets.h:148
__force_inline
#define __force_inline
Attribute to force inlining of a function regardless of optimization level.
Definition compiler.h:128
tight_loop_contents
static __force_inline void tight_loop_contents(void)
No-op function for the body of tight loops.
Definition common.h:74
pico.h