Device Tables (DT) for IP pwrmgr and top englishbreakfast. More...
#include "hw/top/dt/api.h"#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | dt_pwrmgr_wakeup_src |
| Description of a wakeup source. More... | |
| struct | dt_pwrmgr_reset_req_src |
| Description of a reset request source. More... | |
Typedefs | |
| typedef enum dt_pwrmgr | dt_pwrmgr_t |
| List of instances. | |
| typedef enum dt_pwrmgr_reg_block | dt_pwrmgr_reg_block_t |
| List of register blocks. | |
| typedef enum dt_pwrmgr_memory | dt_pwrmgr_memory_t |
| List of memories. | |
| typedef enum dt_pwrmgr_irq | dt_pwrmgr_irq_t |
| List of IRQs. | |
| typedef enum dt_pwrmgr_clock | dt_pwrmgr_clock_t |
| List of clock ports. | |
| typedef enum dt_pwrmgr_reset | dt_pwrmgr_reset_t |
| List of reset ports. | |
| typedef struct dt_pwrmgr_wakeup_src | dt_pwrmgr_wakeup_src_t |
| Description of a wakeup source. | |
| typedef struct dt_pwrmgr_reset_req_src | dt_pwrmgr_reset_req_src_t |
| Description of a reset request source. | |
Enumerations | |
| enum | dt_pwrmgr { kDtPwrmgrAon = 0 , kDtPwrmgrFirst = 0 , kDtPwrmgrCount = 1 } |
| List of instances. More... | |
| enum | dt_pwrmgr_reg_block { kDtPwrmgrRegBlockCore = 0 , kDtPwrmgrRegBlockCount = 1 } |
| List of register blocks. More... | |
| enum | dt_pwrmgr_memory { kDtPwrmgrMemoryCount = 0 } |
| List of memories. More... | |
| enum | dt_pwrmgr_irq { kDtPwrmgrIrqWakeup = 0 , kDtPwrmgrIrqCount = 1 } |
| List of IRQs. More... | |
| enum | dt_pwrmgr_clock { kDtPwrmgrClockClk = 0 , kDtPwrmgrClockSlow = 1 , kDtPwrmgrClockLc = 2 , kDtPwrmgrClockEsc = 3 , kDtPwrmgrClockCount = 4 } |
| List of clock ports. More... | |
| enum | dt_pwrmgr_reset { kDtPwrmgrResetRst = 0 , kDtPwrmgrResetMain = 1 , kDtPwrmgrResetSlow = 2 , kDtPwrmgrResetLc = 3 , kDtPwrmgrResetEsc = 4 , kDtPwrmgrResetCount = 5 } |
| List of reset ports. More... | |
Functions | |
| dt_pwrmgr_t | dt_pwrmgr_from_instance_id (dt_instance_id_t inst_id) |
| Get the pwrmgr instance from an instance ID. | |
| dt_instance_id_t | dt_pwrmgr_instance_id (dt_pwrmgr_t dt) |
| Get the instance ID of an instance. | |
| uint32_t | dt_pwrmgr_reg_block (dt_pwrmgr_t dt, dt_pwrmgr_reg_block_t reg_block) |
| Get the register base address of an instance. | |
| uint32_t | dt_pwrmgr_memory_base (dt_pwrmgr_t dt, dt_pwrmgr_memory_t mem) |
| Get the base address of a memory. | |
| uint32_t | dt_pwrmgr_memory_size (dt_pwrmgr_t dt, dt_pwrmgr_memory_t mem) |
| Get the size of a memory. | |
| dt_plic_irq_id_t | dt_pwrmgr_irq_to_plic_id (dt_pwrmgr_t dt, dt_pwrmgr_irq_t irq) |
| Get the PLIC ID of a pwrmgr IRQ for a given instance. | |
| dt_pwrmgr_irq_t | dt_pwrmgr_irq_from_plic_id (dt_pwrmgr_t dt, dt_plic_irq_id_t irq) |
| Convert a global IRQ ID to a local pwrmgr IRQ type. | |
| dt_clock_t | dt_pwrmgr_clock (dt_pwrmgr_t dt, dt_pwrmgr_clock_t clk) |
| Get the clock signal connected to a clock port of an instance. | |
| dt_reset_t | dt_pwrmgr_reset (dt_pwrmgr_t dt, dt_pwrmgr_reset_t rst) |
| Get the reset signal connected to a reset port of an instance. | |
| size_t | dt_pwrmgr_wakeup_src_count (dt_pwrmgr_t dt) |
| Get the number of wakeup sources. | |
| dt_pwrmgr_wakeup_src_t | dt_pwrmgr_wakeup_src (dt_pwrmgr_t dt, size_t idx) |
| Get the description of a wakeup source. | |
| size_t | dt_pwrmgr_reset_request_src_count (dt_pwrmgr_t dt) |
| Get the number of peripheral reset requests. | |
| dt_pwrmgr_reset_req_src_t | dt_pwrmgr_reset_request_src (dt_pwrmgr_t dt, size_t idx) |
| Get the description of a reset request. | |
Device Tables (DT) for IP pwrmgr and top englishbreakfast.
This file contains the type definitions and global functions of the pwrmgr.
Definition in file pwrmgr.h.
| struct dt_pwrmgr_wakeup_src |
Description of a wakeup source.
A wakeup source is always identified by the instance ID of the module where it comes from. Some instances can have several wakeup signals, e.g. the pinmux has two (pin and usb). For such IPs, it is not sufficient to know the instance, we also need to know which signal triggered the wakeup. The wakeup index can be used to distinguish between those. This value should be casted to the dt_<ip>_wakeup_t type of the corresponding IP. For example, if the pwrmgr has two pinmux wakeup sources as described above, it's two wakeup sources will be described as follows:
| Data Fields | ||
|---|---|---|
| dt_instance_id_t | inst_id | Instance ID of the source of this wakeup. |
| size_t | wakeup | Index of the wakeup signal for that instance. |
| struct dt_pwrmgr_reset_req_src |
Description of a reset request source.
A reset request source is always identified by the instance ID of the module where it comes from. In principle, some instances could have several reset requests. If this is the case, the rst_req can be used to distinguish between those. It should be cast to the dt_<ip>_reset_req_t type of the corresponding IP.
| Data Fields | ||
|---|---|---|
| dt_instance_id_t | inst_id | Instance ID of the source of this reset request. |
| size_t | reset_req | Index of the reset request signal for that instance. |
| #define OPENTITAN_PWRMGR_HAS_CLOCK_CONTROL_IO_IN_LOW_POWER 1 |
| #define OPENTITAN_PWRMGR_HAS_CLOCK_CONTROL_MAIN_IN_LOW_POWER 1 |
| #define OPENTITAN_PWRMGR_HAS_CLOCK_CONTROL_USB_IN_LOW_POWER 1 |
| #define OPENTITAN_PWRMGR_HAS_CLOCK_CONTROL_USB_WHEN_ACTIVE 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_AON_TIMER_AON_WKUP_REQ_WAKEUP_ENABLE 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_AON_TIMER_AON_WKUP_REQ_WAKEUP_REQUEST 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_PINMUX_AON_PIN_WKUP_REQ_WAKEUP_ENABLE 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_PINMUX_AON_PIN_WKUP_REQ_WAKEUP_REQUEST 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_PINMUX_AON_USB_WKUP_REQ_WAKEUP_ENABLE 1 |
| #define OPENTITAN_PWRMGR_HAS_LOW_POWER_PINMUX_AON_USB_WKUP_REQ_WAKEUP_REQUEST 1 |
| #define OPENTITAN_PWRMGR_HAS_RESET_AON_TIMER_AON_AON_TIMER_RST_REQ_ENABLE 1 |
| #define OPENTITAN_PWRMGR_HAS_RESET_AON_TIMER_AON_AON_TIMER_RST_REQ_REQUEST 1 |
| #define OPENTITAN_PWRMGR_HAS_RESET_MAIN_POWER_GLITCH_RESET 1 |
| #define OPENTITAN_PWRMGR_HAS_STARTUP_LIFE_CYCLE_INITIALIZATION 1 |
| typedef enum dt_pwrmgr_clock dt_pwrmgr_clock_t |
List of clock ports.
Clock ports are guaranteed to be numbered consecutively from 0.
| typedef enum dt_pwrmgr_irq dt_pwrmgr_irq_t |
List of IRQs.
IRQs are guaranteed to be numbered consecutively from 0.
| typedef enum dt_pwrmgr_memory dt_pwrmgr_memory_t |
List of memories.
Memories are guaranteed to start at 0 and to be consecutively numbered.
| typedef enum dt_pwrmgr_reg_block dt_pwrmgr_reg_block_t |
List of register blocks.
Register blocks are guaranteed to start at 0 and to be consecutively numbered.
| typedef struct dt_pwrmgr_reset_req_src dt_pwrmgr_reset_req_src_t |
Description of a reset request source.
A reset request source is always identified by the instance ID of the module where it comes from. In principle, some instances could have several reset requests. If this is the case, the rst_req can be used to distinguish between those. It should be cast to the dt_<ip>_reset_req_t type of the corresponding IP.
| typedef enum dt_pwrmgr_reset dt_pwrmgr_reset_t |
List of reset ports.
Reset ports are guaranteed to be numbered consecutively from 0.
| typedef struct dt_pwrmgr_wakeup_src dt_pwrmgr_wakeup_src_t |
Description of a wakeup source.
A wakeup source is always identified by the instance ID of the module where it comes from. Some instances can have several wakeup signals, e.g. the pinmux has two (pin and usb). For such IPs, it is not sufficient to know the instance, we also need to know which signal triggered the wakeup. The wakeup index can be used to distinguish between those. This value should be casted to the dt_<ip>_wakeup_t type of the corresponding IP. For example, if the pwrmgr has two pinmux wakeup sources as described above, it's two wakeup sources will be described as follows:
| enum dt_pwrmgr |
| enum dt_pwrmgr_clock |
| enum dt_pwrmgr_irq |
| enum dt_pwrmgr_memory |
| enum dt_pwrmgr_reg_block |
| enum dt_pwrmgr_reset |
| dt_clock_t dt_pwrmgr_clock | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_clock_t | clk ) |
| dt_pwrmgr_t dt_pwrmgr_from_instance_id | ( | dt_instance_id_t | inst_id | ) |
Get the pwrmgr instance from an instance ID.
For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.
| inst_id | Instance ID. |
Note: This function only makes sense if the instance ID has device type pwrmgr, otherwise the returned value is unspecified.
| dt_instance_id_t dt_pwrmgr_instance_id | ( | dt_pwrmgr_t | dt | ) |
| dt_pwrmgr_irq_t dt_pwrmgr_irq_from_plic_id | ( | dt_pwrmgr_t | dt, |
| dt_plic_irq_id_t | irq ) |
Convert a global IRQ ID to a local pwrmgr IRQ type.
| dt | Instance of pwrmgr. |
| irq | A PLIC ID that belongs to this instance. |
kDtPwrmgrIrqCount.Note: This function assumes that the PLIC ID belongs to the instance of pwrmgr passed in parameter. In other words, it must be the case that dt_pwrmgr_instance_id(dt) == dt_plic_id_to_instance_id(irq). Otherwise, this function will return kDtPwrmgrIrqCount.
| dt_plic_irq_id_t dt_pwrmgr_irq_to_plic_id | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_irq_t | irq ) |
| uint32_t dt_pwrmgr_memory_base | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_memory_t | mem ) |
| uint32_t dt_pwrmgr_memory_size | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_memory_t | mem ) |
| uint32_t dt_pwrmgr_reg_block | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_reg_block_t | reg_block ) |
| dt_reset_t dt_pwrmgr_reset | ( | dt_pwrmgr_t | dt, |
| dt_pwrmgr_reset_t | rst ) |
| dt_pwrmgr_reset_req_src_t dt_pwrmgr_reset_request_src | ( | dt_pwrmgr_t | dt, |
| size_t | idx ) |
Get the description of a reset request.
The reset requests are ordered as they appear in the registers.
| dt | Instance of pwrmgr. |
| idx | Index of the reset request source, between 0 and dt_pwrmgr_reset_request_src_count(dt)-1. |
| size_t dt_pwrmgr_reset_request_src_count | ( | dt_pwrmgr_t | dt | ) |
| dt_pwrmgr_wakeup_src_t dt_pwrmgr_wakeup_src | ( | dt_pwrmgr_t | dt, |
| size_t | idx ) |
| size_t dt_pwrmgr_wakeup_src_count | ( | dt_pwrmgr_t | dt | ) |