72 lines
2.0 KiB
C
72 lines
2.0 KiB
C
#ifndef __HARDWARE_RESET_H__
|
|
#define __HARDWARE_RESET_H__
|
|
|
|
#include "resets_reg.h"
|
|
|
|
#define RESETS_BLOCK_ADC (1 << 0)
|
|
#define RESETS_BLOCK_BUSCTRL (1 << 1)
|
|
#define RESETS_BLOCK_DMA (1 << 2)
|
|
#define RESETS_BLOCK_I2C0 (1 << 3)
|
|
#define RESETS_BLOCK_I2C1 (1 << 4)
|
|
#define RESETS_BLOCK_IO_BANK0 (1 << 5)
|
|
#define RESETS_BLOCK_IO_QSPI (1 << 6)
|
|
#define RESETS_BLOCK_JTAG (1 << 7)
|
|
#define RESETS_BLOCK_PADS_BANK0 (1 << 8)
|
|
#define RESETS_BLOCK_PADS_QSPI (1 << 9)
|
|
#define RESETS_BLOCK_PIO0 (1 << 10)
|
|
#define RESETS_BLOCK_PIO1 (1 << 11)
|
|
#define RESETS_BLOCK_SYSPLL (1 << 12)
|
|
#define RESETS_BLOCK_USBPLL (1 << 13)
|
|
#define RESETS_BLOCK_PWM (1 << 14)
|
|
#define RESETS_BLOCK_RTC (1 << 15)
|
|
#define RESETS_BLOCK_SPI0 (1 << 16)
|
|
#define RESETS_BLOCK_SPI1 (1 << 17)
|
|
#define RESETS_BLOCK_SYSCFG (1 << 18)
|
|
#define RESETS_BLOCK_SYSINFO (1 << 19)
|
|
#define RESETS_BLOCK_TBMAN (1 << 20)
|
|
#define RESETS_BLOCK_TIMER (1 << 21)
|
|
#define RESETS_BLOCK_UART0 (1 << 22)
|
|
#define RESETS_BLOCK_UART1 (1 << 23)
|
|
#define RESETS_BLOCK_USBCTRL (1 << 24)
|
|
#define RESETS_BLOCK_ALL ((1 << 25) - 1)
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
static inline void reset_blocks(uint32_t bits) {
|
|
hw_set_bits(&resets_hw->reset, bits);
|
|
}
|
|
|
|
static inline void unreset_blocks(uint32_t bits) {
|
|
hw_clear_bits(&resets_hw->reset, bits);
|
|
}
|
|
|
|
static inline void unreset_blocks_wait(uint32_t bits) {
|
|
hw_clear_bits(&resets_hw->reset, bits);
|
|
while (!(resets_hw->reset_done & bits));
|
|
}
|
|
|
|
static inline void reset_unreset_blocks_wait(uint32_t bits) {
|
|
reset_blocks(bits);
|
|
unreset_blocks_wait(bits);
|
|
}
|
|
|
|
static inline void reset_watchdog_bound(uint32_t bits) {
|
|
hw_set_bits(&resets_hw->wdsel, bits);
|
|
}
|
|
|
|
static inline void reset_watchdog_unbound(uint32_t bits) {
|
|
hw_clear_bits(&resets_hw->wdsel, bits);
|
|
}
|
|
|
|
static inline uint32_t reset_watchdog_get_bound_state(void) {
|
|
return resets_hw->wdsel;
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __HARDWARE_RESET_H__ */
|