1 // THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2 
3 /**
4  * Copyright (c) 2024 Raspberry Pi Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 #ifndef _HARDWARE_STRUCTS_VREG_AND_CHIP_RESET_H
9 #define _HARDWARE_STRUCTS_VREG_AND_CHIP_RESET_H
10 
11 /**
12  * \file rp2040/vreg_and_chip_reset.h
13  */
14 
15 #include "hardware/address_mapped.h"
16 #include "hardware/regs/vreg_and_chip_reset.h"
17 
18 // Reference to datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#tab-registerlist_vreg_and_chip_reset
19 //
20 // The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
21 // _REG_(x) will link to the corresponding register in hardware/regs/vreg_and_chip_reset.h.
22 //
23 // Bit-field descriptions are of the form:
24 // BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
25 
26 typedef struct {
27     _REG_(VREG_AND_CHIP_RESET_VREG_OFFSET) // VREG_AND_CHIP_RESET_VREG
28     // Voltage regulator control and status
29     // 0x00001000 [12]    ROK          (0) regulation status +
30     // 0x000000f0 [7:4]   VSEL         (0xb) output voltage select +
31     // 0x00000002 [1]     HIZ          (0) high impedance mode select +
32     // 0x00000001 [0]     EN           (1) enable +
33     io_rw_32 vreg;
34 
35     _REG_(VREG_AND_CHIP_RESET_BOD_OFFSET) // VREG_AND_CHIP_RESET_BOD
36     // brown-out detection control
37     // 0x000000f0 [7:4]   VSEL         (0x9) threshold select +
38     // 0x00000001 [0]     EN           (1) enable +
39     io_rw_32 bod;
40 
41     _REG_(VREG_AND_CHIP_RESET_CHIP_RESET_OFFSET) // VREG_AND_CHIP_RESET_CHIP_RESET
42     // Chip reset control and status
43     // 0x01000000 [24]    PSM_RESTART_FLAG (0) This is set by psm_restart from the debugger
44     // 0x00100000 [20]    HAD_PSM_RESTART (0) Last reset was from the debug port
45     // 0x00010000 [16]    HAD_RUN      (0) Last reset was from the RUN pin
46     // 0x00000100 [8]     HAD_POR      (0) Last reset was from the power-on reset or brown-out...
47     io_rw_32 chip_reset;
48 } vreg_and_chip_reset_hw_t;
49 
50 #define vreg_and_chip_reset_hw ((vreg_and_chip_reset_hw_t *)VREG_AND_CHIP_RESET_BASE)
51 static_assert(sizeof (vreg_and_chip_reset_hw_t) == 0x000c, "");
52 
53 #endif // _HARDWARE_STRUCTS_VREG_AND_CHIP_RESET_H
54 
55