Software APIs
dt_sram_ctrl.h File Reference

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

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

Go to the source code of this file.

Macros

#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY   1
 List of supported hardware features.
 
#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED   1
 
#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR   1
 
#define OPENTITAN_SRAM_CTRL_HAS_MEMSET   1
 
#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW   1
 
#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS   1
 
#define OPENTITAN_SRAM_CTRL_HAS_REGWEN   1
 

Typedefs

typedef enum dt_sram_ctrl dt_sram_ctrl_t
 List of instances.
 
typedef enum dt_sram_ctrl_reg_block dt_sram_ctrl_reg_block_t
 List of register blocks.
 
typedef enum dt_sram_ctrl_alert dt_sram_ctrl_alert_t
 List of Alerts.
 
typedef enum dt_sram_ctrl_clock dt_sram_ctrl_clock_t
 List of clock ports.
 
typedef enum dt_sram_ctrl_reset dt_sram_ctrl_reset_t
 List of reset ports.
 

Enumerations

enum  dt_sram_ctrl {
  kDtSramCtrlRetAon = 0 ,
  kDtSramCtrlMain = 1 ,
  kDtSramCtrlFirst = 0 ,
  kDtSramCtrlCount = 2
}
 List of instances. More...
 
enum  dt_sram_ctrl_reg_block {
  kDtSramCtrlRegBlockRegs = 0 ,
  kDtSramCtrlRegBlockRam = 1 ,
  kDtSramCtrlRegBlockCount = 2
}
 List of register blocks. More...
 
enum  dt_sram_ctrl_alert {
  kDtSramCtrlAlertFatalError = 0 ,
  kDtSramCtrlAlertCount = 1
}
 List of Alerts. More...
 
enum  dt_sram_ctrl_clock {
  kDtSramCtrlClockClk = 0 ,
  kDtSramCtrlClockOtp = 1 ,
  kDtSramCtrlClockCount = 2
}
 List of clock ports. More...
 
enum  dt_sram_ctrl_reset {
  kDtSramCtrlResetRst = 0 ,
  kDtSramCtrlResetOtp = 1 ,
  kDtSramCtrlResetCount = 2
}
 List of reset ports. More...
 

Functions

dt_sram_ctrl_t dt_sram_ctrl_from_instance_id (dt_instance_id_t inst_id)
 Get the sram_ctrl instance from an instance ID.
 
dt_instance_id_t dt_sram_ctrl_instance_id (dt_sram_ctrl_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_sram_ctrl_reg_block (dt_sram_ctrl_t dt, dt_sram_ctrl_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_alert_id_t dt_sram_ctrl_alert_to_alert_id (dt_sram_ctrl_t dt, dt_sram_ctrl_alert_t alert)
 Get the alert ID of a sram_ctrl alert for a given instance.
 
dt_sram_ctrl_alert_t dt_sram_ctrl_alert_from_alert_id (dt_sram_ctrl_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local sram_ctrl alert type.
 
dt_clock_t dt_sram_ctrl_clock (dt_sram_ctrl_t dt, dt_sram_ctrl_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_sram_ctrl_reset (dt_sram_ctrl_t dt, dt_sram_ctrl_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

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

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

Definition in file dt_sram_ctrl.h.

Macro Definition Documentation

◆ OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW

#define OPENTITAN_SRAM_CTRL_HAS_FETCH_ALLOW   1

Definition at line 84 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_INTEGRITY

#define OPENTITAN_SRAM_CTRL_HAS_INTEGRITY   1

List of supported hardware features.

Definition at line 80 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR

#define OPENTITAN_SRAM_CTRL_HAS_LOCK_ON_ERROR   1

Definition at line 82 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_MEMSET

#define OPENTITAN_SRAM_CTRL_HAS_MEMSET   1

Definition at line 83 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_REGWEN

#define OPENTITAN_SRAM_CTRL_HAS_REGWEN   1

Definition at line 86 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED

#define OPENTITAN_SRAM_CTRL_HAS_SCRAMBLED   1

Definition at line 81 of file dt_sram_ctrl.h.

◆ OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS

#define OPENTITAN_SRAM_CTRL_HAS_SUBWORD_ACCESS   1

Definition at line 85 of file dt_sram_ctrl.h.

Typedef Documentation

◆ dt_sram_ctrl_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_sram_ctrl_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_sram_ctrl_reg_block_t

List of register blocks.

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

◆ dt_sram_ctrl_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ dt_sram_ctrl

List of instances.

Enumerator
kDtSramCtrlRetAon 

sram_ctrl_ret_aon

kDtSramCtrlMain 

sram_ctrl_main

Definition at line 23 of file dt_sram_ctrl.h.

◆ dt_sram_ctrl_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtSramCtrlAlertFatalError 

This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected, or if the initialization mechanism has reached an invalid state.

Definition at line 49 of file dt_sram_ctrl.h.

◆ dt_sram_ctrl_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtSramCtrlClockClk 

Clock port clk_i.

kDtSramCtrlClockOtp 

Clock port clk_otp_i.

Definition at line 60 of file dt_sram_ctrl.h.

◆ dt_sram_ctrl_reg_block

List of register blocks.

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

Definition at line 35 of file dt_sram_ctrl.h.

◆ dt_sram_ctrl_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtSramCtrlResetRst 

Reset port rst_ni.

kDtSramCtrlResetOtp 

Reset port rst_otp_ni.

Definition at line 71 of file dt_sram_ctrl.h.

Function Documentation

◆ dt_sram_ctrl_alert_from_alert_id()

dt_sram_ctrl_alert_t dt_sram_ctrl_alert_from_alert_id ( dt_sram_ctrl_t dt,
dt_alert_id_t alert )

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

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

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

Definition at line 103 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_alert_to_alert_id()

dt_alert_id_t dt_sram_ctrl_alert_to_alert_id ( dt_sram_ctrl_t dt,
dt_sram_ctrl_alert_t alert )

Get the alert ID of a sram_ctrl 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 sram_ctrl.
alertA sram_ctrl alert.
Returns
The Alert Handler alert ID of the alert of this instance.

Definition at line 97 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_clock()

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

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

Definition at line 115 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_from_instance_id()

dt_sram_ctrl_t dt_sram_ctrl_from_instance_id ( dt_instance_id_t inst_id)

Get the sram_ctrl instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A sram_ctrl instance.

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

Definition at line 77 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_instance_id()

dt_instance_id_t dt_sram_ctrl_instance_id ( dt_sram_ctrl_t dt)

Get the instance ID of an instance.

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

Definition at line 84 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_reg_block()

Get the register base address of an instance.

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

Definition at line 89 of file dt_sram_ctrl.c.

◆ dt_sram_ctrl_reset()

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

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

Definition at line 122 of file dt_sram_ctrl.c.