Software APIs
dt_rstmgr.h File Reference

Device Tables (DT) for IP rstmgr and top earlgrey. More...

#include "dt_api.h"
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  dt_rstmgr_reset_req_src
 Description of a reset request source. More...
 

Macros

#define OPENTITAN_RSTMGR_HAS_SW_RST_CHIP_RESET   1
 List of supported hardware features.
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE   1
 
#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR   1
 
#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_CAPTURE   1
 
#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE   1
 
#define OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE   1
 
#define OPENTITAN_RSTMGR_HAS_ALERT_HANDLER_RESET_STATUS   1
 

Typedefs

typedef enum dt_rstmgr dt_rstmgr_t
 List of instances.
 
typedef enum dt_rstmgr_reg_block dt_rstmgr_reg_block_t
 List of register blocks.
 
typedef enum dt_rstmgr_alert dt_rstmgr_alert_t
 List of Alerts.
 
typedef enum dt_rstmgr_clock dt_rstmgr_clock_t
 List of clock ports.
 
typedef enum dt_rstmgr_reset dt_rstmgr_reset_t
 List of reset ports.
 
typedef struct dt_rstmgr_reset_req_src dt_rstmgr_reset_req_src_t
 Description of a reset request source.
 

Enumerations

enum  dt_rstmgr {
  kDtRstmgrAon = 0 ,
  kDtRstmgrFirst = 0 ,
  kDtRstmgrCount = 1
}
 List of instances. More...
 
enum  dt_rstmgr_reg_block {
  kDtRstmgrRegBlockCore = 0 ,
  kDtRstmgrRegBlockCount = 1
}
 List of register blocks. More...
 
enum  dt_rstmgr_alert {
  kDtRstmgrAlertFatalFault = 0 ,
  kDtRstmgrAlertFatalCnstyFault = 1 ,
  kDtRstmgrAlertCount = 2
}
 List of Alerts. More...
 
enum  dt_rstmgr_clock {
  kDtRstmgrClockClk = 0 ,
  kDtRstmgrClockAon = 1 ,
  kDtRstmgrClockIoDiv4 = 2 ,
  kDtRstmgrClockMain = 3 ,
  kDtRstmgrClockIo = 4 ,
  kDtRstmgrClockIoDiv2 = 5 ,
  kDtRstmgrClockUsb = 6 ,
  kDtRstmgrClockPor = 7 ,
  kDtRstmgrClockCount = 8
}
 List of clock ports. More...
 
enum  dt_rstmgr_reset {
  kDtRstmgrResetRst = 0 ,
  kDtRstmgrResetPor = 1 ,
  kDtRstmgrResetCount = 2
}
 List of reset ports. More...
 

Functions

dt_rstmgr_t dt_rstmgr_from_instance_id (dt_instance_id_t inst_id)
 Get the rstmgr instance from an instance ID.
 
dt_instance_id_t dt_rstmgr_instance_id (dt_rstmgr_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_rstmgr_reg_block (dt_rstmgr_t dt, dt_rstmgr_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_alert_id_t dt_rstmgr_alert_to_alert_id (dt_rstmgr_t dt, dt_rstmgr_alert_t alert)
 Get the alert ID of a rstmgr alert for a given instance.
 
dt_rstmgr_alert_t dt_rstmgr_alert_from_alert_id (dt_rstmgr_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local rstmgr alert type.
 
dt_clock_t dt_rstmgr_clock (dt_rstmgr_t dt, dt_rstmgr_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_rstmgr_reset (dt_rstmgr_t dt, dt_rstmgr_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 
size_t dt_rstmgr_sw_reset_count (dt_rstmgr_t dt)
 Get the number of software resets.
 
dt_reset_t dt_rstmgr_sw_reset (dt_rstmgr_t dt, size_t idx)
 Get the reset ID of a software reset.
 
size_t dt_rstmgr_hw_reset_req_src_count (dt_rstmgr_t dt)
 Get the number of hardware reset requests.
 
dt_rstmgr_reset_req_src_t dt_rstmgr_hw_reset_req_src (dt_rstmgr_t dt, size_t idx)
 Get the description of a reset request.
 

Detailed Description

Device Tables (DT) for IP rstmgr and top earlgrey.

This file contains the type definitions and global functions of the rstmgr.

Definition in file dt_rstmgr.h.


Data Structure Documentation

◆ dt_rstmgr_reset_req_src

struct dt_rstmgr_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.

WARNING At the moment, three hardcoded reset requests are treated specially and have their rst_req field set to 0 because there is no corresponding reset request declared by those IPs:

  • the main power glitch reset request, coming from the pwrmgr,
  • the escalation reset request, coming from the alert_handler,
  • the non-debug-module reset request, coming from the rv_dm.

Definition at line 248 of file dt_rstmgr.h.

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.

Macro Definition Documentation

◆ OPENTITAN_RSTMGR_HAS_ALERT_HANDLER_RESET_STATUS

#define OPENTITAN_RSTMGR_HAS_ALERT_HANDLER_RESET_STATUS   1

Definition at line 109 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_ALERT_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_CAPTURE   1

Definition at line 105 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_ALERT_INFO_ENABLE

#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_ENABLE   1

Definition at line 106 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE   1

Definition at line 107 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE

#define OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE   1

Definition at line 108 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE   1

Definition at line 103 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR

#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR   1

Definition at line 104 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_CHIP_RESET

#define OPENTITAN_RSTMGR_HAS_SW_RST_CHIP_RESET   1

List of supported hardware features.

Definition at line 86 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_ENABLE   1

Definition at line 98 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C0_REQUEST   1

Definition at line 97 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_ENABLE   1

Definition at line 100 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C1_REQUEST   1

Definition at line 99 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_ENABLE   1

Definition at line 102 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_I2C2_REQUEST   1

Definition at line 101 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_ENABLE   1

Definition at line 88 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_DEVICE_REQUEST   1

Definition at line 87 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_ENABLE   1

Definition at line 90 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST0_REQUEST   1

Definition at line 89 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_ENABLE   1

Definition at line 92 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_SPI_HOST1_REQUEST   1

Definition at line 91 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_ENABLE   1

Definition at line 96 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_AON_REQUEST   1

Definition at line 95 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE   1

Definition at line 94 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST   1

Definition at line 93 of file dt_rstmgr.h.

Typedef Documentation

◆ dt_rstmgr_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_rstmgr_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_rstmgr_reg_block_t

List of register blocks.

Register blocks are guaranteed to start at 0 and to be consecutively numbered.

◆ dt_rstmgr_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.

WARNING At the moment, three hardcoded reset requests are treated specially and have their rst_req field set to 0 because there is no corresponding reset request declared by those IPs:

  • the main power glitch reset request, coming from the pwrmgr,
  • the escalation reset request, coming from the alert_handler,
  • the non-debug-module reset request, coming from the rv_dm.

◆ dt_rstmgr_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ dt_rstmgr

enum dt_rstmgr

List of instances.

Enumerator
kDtRstmgrAon 

rstmgr_aon

Definition at line 23 of file dt_rstmgr.h.

◆ dt_rstmgr_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRstmgrAlertFatalFault 

This fatal alert is triggered when a fatal structural fault is detected.

Structural faults include errors such as sparse fsm errors and tlul integrity errors.

kDtRstmgrAlertFatalCnstyFault 

This fatal alert is triggered when a reset consistency fault is detected.

It is separated from the category above for clearer error collection and debug.

Definition at line 47 of file dt_rstmgr.h.

◆ dt_rstmgr_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRstmgrClockClk 

Clock port clk_i.

kDtRstmgrClockAon 

Clock port clk_aon_i.

kDtRstmgrClockIoDiv4 

Clock port clk_io_div4_i.

kDtRstmgrClockMain 

Clock port clk_main_i.

kDtRstmgrClockIo 

Clock port clk_io_i.

kDtRstmgrClockIoDiv2 

Clock port clk_io_div2_i.

kDtRstmgrClockUsb 

Clock port clk_usb_i.

kDtRstmgrClockPor 

Clock port clk_por_i.

Definition at line 60 of file dt_rstmgr.h.

◆ dt_rstmgr_reg_block

List of register blocks.

Register blocks are guaranteed to start at 0 and to be consecutively numbered.

Definition at line 34 of file dt_rstmgr.h.

◆ dt_rstmgr_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtRstmgrResetRst 

Reset port rst_ni.

kDtRstmgrResetPor 

Reset port rst_por_ni.

Definition at line 77 of file dt_rstmgr.h.

Function Documentation

◆ dt_rstmgr_alert_from_alert_id()

dt_rstmgr_alert_t dt_rstmgr_alert_from_alert_id ( dt_rstmgr_t dt,
dt_alert_id_t alert )

Convert a global alert ID to a local rstmgr alert type.

Parameters
dtInstance of rstmgr.
alertA global alert ID that belongs to this instance.
Returns
The rstmgr alert, or kDtRstmgrAlertCount.

Note: This function assumes that the global alert ID belongs to the instance of rstmgr passed in parameter. In other words, it must be the case that dt_rstmgr_instance_id(dt) == dt_alert_id_to_instance_id(alert). Otherwise, this function will return kDtRstmgrAlertCount.

Definition at line 132 of file dt_rstmgr.c.

◆ dt_rstmgr_alert_to_alert_id()

dt_alert_id_t dt_rstmgr_alert_to_alert_id ( dt_rstmgr_t dt,
dt_rstmgr_alert_t alert )

Get the alert ID of a rstmgr alert for a given instance.

Note: This function only makes sense if the instance is connected to the Alert Handler. For any instances where the instance is not connected, the return value is unspecified.

Parameters
dtInstance of rstmgr.
alertA rstmgr alert.
Returns
The Alert Handler alert ID of the alert of this instance.

Definition at line 126 of file dt_rstmgr.c.

◆ dt_rstmgr_clock()

Get the clock signal connected to a clock port of an instance.

Parameters
dtInstance of rstmgr.
clkClock port.
Returns
Clock signal.

Definition at line 144 of file dt_rstmgr.c.

◆ dt_rstmgr_from_instance_id()

dt_rstmgr_t dt_rstmgr_from_instance_id ( dt_instance_id_t inst_id)

Get the rstmgr instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A rstmgr instance.

Note: This function only makes sense if the instance ID has device type rstmgr, otherwise the returned value is unspecified.

Definition at line 106 of file dt_rstmgr.c.

◆ dt_rstmgr_hw_reset_req_src()

dt_rstmgr_reset_req_src_t dt_rstmgr_hw_reset_req_src ( dt_rstmgr_t dt,
size_t idx )

Get the description of a reset request.

The reset requests are ordered as they appear in the registers.

Parameters
dtInstance of rstmgr.
idxIndex of the reset request source, between 0 and dt_pwrmgr_hw_reset_req_src_count(dt)-1.
Returns
Description of the reset.

◆ dt_rstmgr_hw_reset_req_src_count()

size_t dt_rstmgr_hw_reset_req_src_count ( dt_rstmgr_t dt)

Get the number of hardware reset requests.

Parameters
dtInstance of rstmgr.
Returns
Number of reset requests.

◆ dt_rstmgr_instance_id()

dt_instance_id_t dt_rstmgr_instance_id ( dt_rstmgr_t dt)

Get the instance ID of an instance.

Parameters
dtInstance of rstmgr.
Returns
The instance ID of that instance.

Definition at line 113 of file dt_rstmgr.c.

◆ dt_rstmgr_reg_block()

Get the register base address of an instance.

Parameters
dtInstance of rstmgr.
reg_blockThe register block requested.
Returns
The register base address of the requested block.

Definition at line 118 of file dt_rstmgr.c.

◆ dt_rstmgr_reset()

Get the reset signal connected to a reset port of an instance.

Parameters
dtInstance of rstmgr.
rstReset port.
Returns
Reset signal.

Definition at line 151 of file dt_rstmgr.c.

◆ dt_rstmgr_sw_reset()

dt_reset_t dt_rstmgr_sw_reset ( dt_rstmgr_t dt,
size_t idx )

Get the reset ID of a software reset.

The resets are ordered in the same way as they appear in the registers.

Parameters
dtInstance of rstmgr.
idxIndex of the software reset, between 0 and dt_rstmgr_sw_reset_count(dt)-1.
Returns
Reset ID, or kDtResetUnknown for invalid parameters.

Definition at line 166 of file dt_rstmgr.c.

◆ dt_rstmgr_sw_reset_count()

size_t dt_rstmgr_sw_reset_count ( dt_rstmgr_t dt)

Get the number of software resets.

Parameters
dtInstance of rstmgr.
Returns
Number of software resets.

Definition at line 162 of file dt_rstmgr.c.