Software APIs
dt_alert_handler.h File Reference

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

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

Go to the source code of this file.

Macros

#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_OBSERVE   1
 List of supported hardware features.
 
#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_INTERRUPT   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_ESCALATE   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_PING_TIMER   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_COUNT   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_TIMEOUT   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_PHASES   1
 
#define OPENTITAN_ALERT_HANDLER_HAS_CRASH_DUMP   1
 

Typedefs

typedef enum dt_alert_handler dt_alert_handler_t
 List of instances.
 
typedef enum dt_alert_handler_reg_block dt_alert_handler_reg_block_t
 List of register blocks.
 
typedef enum dt_alert_handler_irq dt_alert_handler_irq_t
 List of IRQs.
 
typedef enum dt_alert_handler_clock dt_alert_handler_clock_t
 List of clock ports.
 
typedef enum dt_alert_handler_reset dt_alert_handler_reset_t
 List of reset ports.
 

Enumerations

enum  dt_alert_handler {
  kDtAlertHandler = 0 ,
  kDtAlertHandlerFirst = 0 ,
  kDtAlertHandlerCount = 1
}
 List of instances. More...
 
enum  dt_alert_handler_reg_block {
  kDtAlertHandlerRegBlockCore = 0 ,
  kDtAlertHandlerRegBlockCount = 1
}
 List of register blocks. More...
 
enum  dt_alert_handler_irq {
  kDtAlertHandlerIrqClassa = 0 ,
  kDtAlertHandlerIrqClassb = 1 ,
  kDtAlertHandlerIrqClassc = 2 ,
  kDtAlertHandlerIrqClassd = 3 ,
  kDtAlertHandlerIrqCount = 4
}
 List of IRQs. More...
 
enum  dt_alert_handler_clock {
  kDtAlertHandlerClockClk = 0 ,
  kDtAlertHandlerClockEdn = 1 ,
  kDtAlertHandlerClockCount = 2
}
 List of clock ports. More...
 
enum  dt_alert_handler_reset {
  kDtAlertHandlerResetRst = 0 ,
  kDtAlertHandlerResetEdn = 1 ,
  kDtAlertHandlerResetCount = 2
}
 List of reset ports. More...
 

Functions

dt_alert_handler_t dt_alert_handler_from_instance_id (dt_instance_id_t inst_id)
 Get the alert_handler instance from an instance ID.
 
dt_instance_id_t dt_alert_handler_instance_id (dt_alert_handler_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_alert_handler_reg_block (dt_alert_handler_t dt, dt_alert_handler_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_plic_irq_id_t dt_alert_handler_irq_to_plic_id (dt_alert_handler_t dt, dt_alert_handler_irq_t irq)
 Get the PLIC ID of a alert_handler IRQ for a given instance.
 
dt_alert_handler_irq_t dt_alert_handler_irq_from_plic_id (dt_alert_handler_t dt, dt_plic_irq_id_t irq)
 Convert a global IRQ ID to a local alert_handler IRQ type.
 
dt_clock_t dt_alert_handler_clock (dt_alert_handler_t dt, dt_alert_handler_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_alert_handler_reset (dt_alert_handler_t dt, dt_alert_handler_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

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

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

Definition in file dt_alert_handler.h.

Macro Definition Documentation

◆ OPENTITAN_ALERT_HANDLER_HAS_ALERT_ESCALATE

#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_ESCALATE   1

Definition at line 82 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_ALERT_INTERRUPT

#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_INTERRUPT   1

Definition at line 81 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_ALERT_OBSERVE

#define OPENTITAN_ALERT_HANDLER_HAS_ALERT_OBSERVE   1

List of supported hardware features.

Definition at line 80 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_CRASH_DUMP

#define OPENTITAN_ALERT_HANDLER_HAS_CRASH_DUMP   1

Definition at line 87 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_COUNT

#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_COUNT   1

Definition at line 84 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_PHASES

#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_PHASES   1

Definition at line 86 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_TIMEOUT

#define OPENTITAN_ALERT_HANDLER_HAS_ESCALATION_TIMEOUT   1

Definition at line 85 of file dt_alert_handler.h.

◆ OPENTITAN_ALERT_HANDLER_HAS_PING_TIMER

#define OPENTITAN_ALERT_HANDLER_HAS_PING_TIMER   1

Definition at line 83 of file dt_alert_handler.h.

Typedef Documentation

◆ dt_alert_handler_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_alert_handler_irq_t

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

◆ dt_alert_handler_reg_block_t

List of register blocks.

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

◆ dt_alert_handler_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ dt_alert_handler

List of instances.

Enumerator
kDtAlertHandler 

alert_handler

Definition at line 23 of file dt_alert_handler.h.

◆ dt_alert_handler_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtAlertHandlerClockClk 

Clock port clk_i.

kDtAlertHandlerClockEdn 

Clock port clk_edn_i.

Definition at line 60 of file dt_alert_handler.h.

◆ dt_alert_handler_irq

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtAlertHandlerIrqClassa 

Interrupt state bit of Class A.

Set by HW in case an alert within this class triggered. Defaults true, write one to clear.

kDtAlertHandlerIrqClassb 

Interrupt state bit of Class B.

Set by HW in case an alert within this class triggered. Defaults true, write one to clear.

kDtAlertHandlerIrqClassc 

Interrupt state bit of Class C.

Set by HW in case an alert within this class triggered. Defaults true, write one to clear.

kDtAlertHandlerIrqClassd 

Interrupt state bit of Class D.

Set by HW in case an alert within this class triggered. Defaults true, write one to clear.

Definition at line 47 of file dt_alert_handler.h.

◆ dt_alert_handler_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_alert_handler.h.

◆ dt_alert_handler_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtAlertHandlerResetRst 

Reset port rst_ni.

kDtAlertHandlerResetEdn 

Reset port rst_edn_ni.

Definition at line 71 of file dt_alert_handler.h.

Function Documentation

◆ dt_alert_handler_clock()

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

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

Definition at line 106 of file dt_alert_handler.c.

◆ dt_alert_handler_from_instance_id()

dt_alert_handler_t dt_alert_handler_from_instance_id ( dt_instance_id_t inst_id)

Get the alert_handler instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A alert_handler instance.

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

Definition at line 60 of file dt_alert_handler.c.

◆ dt_alert_handler_instance_id()

dt_instance_id_t dt_alert_handler_instance_id ( dt_alert_handler_t dt)

Get the instance ID of an instance.

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

Definition at line 67 of file dt_alert_handler.c.

◆ dt_alert_handler_irq_from_plic_id()

dt_alert_handler_irq_t dt_alert_handler_irq_from_plic_id ( dt_alert_handler_t dt,
dt_plic_irq_id_t irq )

Convert a global IRQ ID to a local alert_handler IRQ type.

Parameters
dtInstance of alert_handler.
irqA PLIC ID that belongs to this instance.
Returns
The alert_handler IRQ, or kDtAlertHandlerIrqCount.

Note: This function assumes that the PLIC ID belongs to the instance of alert_handler passed in parameter. In other words, it must be the case that dt_alert_handler_instance_id(dt) == dt_plic_id_to_instance_id(irq). Otherwise, this function will return kDtAlertHandlerIrqCount.

Definition at line 89 of file dt_alert_handler.c.

◆ dt_alert_handler_irq_to_plic_id()

dt_plic_irq_id_t dt_alert_handler_irq_to_plic_id ( dt_alert_handler_t dt,
dt_alert_handler_irq_t irq )

Get the PLIC ID of a alert_handler IRQ for a given instance.

If the instance is not connected to the PLIC, this function will return kDtPlicIrqIdNone.

Parameters
dtInstance of alert_handler.
irqA alert_handler IRQ.
Returns
The PLIC ID of the IRQ of this instance.

Definition at line 79 of file dt_alert_handler.c.

◆ dt_alert_handler_reg_block()

Get the register base address of an instance.

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

Definition at line 72 of file dt_alert_handler.c.

◆ dt_alert_handler_reset()

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

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

Definition at line 113 of file dt_alert_handler.c.