Software APIs
dt_alert_handler.c File Reference

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

#include "dt/dt_alert_handler.h"

Go to the source code of this file.

Data Structures

struct  dt_desc_alert_handler
 Description of instances. More...
 

Macros

#define TRY_GET_DT(dt, default)
 Return a pointer to the dt_alert_handler_desc_t structure of the requested dt if it's a valid index.
 

Typedefs

typedef struct dt_desc_alert_handler dt_desc_alert_handler_t
 Description of instances.
 

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.

Definition in file dt_alert_handler.c.


Data Structure Documentation

◆ dt_desc_alert_handler

struct dt_desc_alert_handler

Description of instances.

Definition at line 19 of file dt_alert_handler.c.

Data Fields
uint32_t base_addr[kDtAlertHandlerRegBlockCount] Base address of each register block.
dt_clock_t clock[kDtAlertHandlerClockCount] Clock signal connected to each clock port.
top_darjeeling_plic_irq_id_t first_irq PLIC ID of the first IRQ of this instance.

This can be kDtPlicIrqIdNone if the block is not connected to the PLIC.

top_earlgrey_plic_irq_id_t first_irq PLIC ID of the first IRQ of this instance.

This can be kDtPlicIrqIdNone if the block is not connected to the PLIC.

dt_instance_id_t inst_id Instance ID.
dt_reset_t reset[kDtAlertHandlerResetCount] Reset signal connected to each reset port.

Macro Definition Documentation

◆ TRY_GET_DT

#define TRY_GET_DT ( dt,
default )
Value:
({ if ((dt) < (dt_alert_handler_t)0 || (dt) >= kDtAlertHandlerCount) return (default); &alert_handler_desc[dt]; })

Return a pointer to the dt_alert_handler_desc_t structure of the requested dt if it's a valid index.

Otherwise, this macro will return (i.e. exit the function) with the provided default value.

Definition at line 58 of file dt_alert_handler.c.

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.