Software APIs
dt_rstmgr.h File Reference

Device Tables (DT) for IP rstmgr and top englishbreakfast. 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_USB_REQUEST   1
 
#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_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_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_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_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 englishbreakfast.

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 86 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_ALERT_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_CAPTURE   1

Definition at line 82 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_ALERT_INFO_ENABLE

#define OPENTITAN_RSTMGR_HAS_ALERT_INFO_ENABLE   1

Definition at line 83 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_CPU_INFO_CAPTURE   1

Definition at line 84 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE

#define OPENTITAN_RSTMGR_HAS_CPU_INFO_ENABLE   1

Definition at line 85 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE

#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CAPTURE   1

Definition at line 80 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR

#define OPENTITAN_RSTMGR_HAS_RESET_INFO_CLEAR   1

Definition at line 81 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 73 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 75 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 74 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 77 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 76 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_ENABLE   1

Definition at line 79 of file dt_rstmgr.h.

◆ OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST

#define OPENTITAN_RSTMGR_HAS_SW_RST_USB_REQUEST   1

Definition at line 78 of file dt_rstmgr.h.

Typedef Documentation

◆ 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_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 47 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 64 of file dt_rstmgr.h.

Function Documentation

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