Software APIs
dt_pattgen.h File Reference

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

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

Go to the source code of this file.

Macros

#define OPENTITAN_PATTGEN_HAS_CHANNEL_ONE   1
 List of supported hardware features.
 
#define OPENTITAN_PATTGEN_HAS_CHANNEL_TWO   1
 
#define OPENTITAN_PATTGEN_HAS_CONFIG_PATTERN   1
 
#define OPENTITAN_PATTGEN_HAS_CONFIG_DIVIDER   1
 
#define OPENTITAN_PATTGEN_HAS_CONFIG_REPEAT   1
 
#define OPENTITAN_PATTGEN_HAS_CONFIG_POLARITY   1
 
#define OPENTITAN_PATTGEN_HAS_CONFIG_INACTIVE_LEVEL   1
 
#define OPENTITAN_PATTGEN_HAS_COMPLETE   1
 

Typedefs

typedef enum dt_pattgen dt_pattgen_t
 List of instances.
 
typedef enum dt_pattgen_reg_block dt_pattgen_reg_block_t
 List of register blocks.
 
typedef enum dt_pattgen_irq dt_pattgen_irq_t
 List of IRQs.
 
typedef enum dt_pattgen_alert dt_pattgen_alert_t
 List of Alerts.
 
typedef enum dt_pattgen_clock dt_pattgen_clock_t
 List of clock ports.
 
typedef enum dt_pattgen_reset dt_pattgen_reset_t
 List of reset ports.
 
typedef enum dt_pattgen_periph_io dt_pattgen_periph_io_t
 List of peripheral I/O.
 

Enumerations

enum  dt_pattgen {
  kDtPattgen = 0 ,
  kDtPattgenFirst = 0 ,
  kDtPattgenCount = 1
}
 List of instances. More...
 
enum  dt_pattgen_reg_block {
  kDtPattgenRegBlockCore = 0 ,
  kDtPattgenRegBlockCount = 1
}
 List of register blocks. More...
 
enum  dt_pattgen_irq {
  kDtPattgenIrqDoneCh0 = 0 ,
  kDtPattgenIrqDoneCh1 = 1 ,
  kDtPattgenIrqCount = 2
}
 List of IRQs. More...
 
enum  dt_pattgen_alert {
  kDtPattgenAlertFatalFault = 0 ,
  kDtPattgenAlertCount = 1
}
 List of Alerts. More...
 
enum  dt_pattgen_clock {
  kDtPattgenClockClk = 0 ,
  kDtPattgenClockCount = 1
}
 List of clock ports. More...
 
enum  dt_pattgen_reset {
  kDtPattgenResetRst = 0 ,
  kDtPattgenResetCount = 1
}
 List of reset ports. More...
 
enum  dt_pattgen_periph_io {
  kDtPattgenPeriphIoPda0Tx = 0 ,
  kDtPattgenPeriphIoPcl0Tx = 1 ,
  kDtPattgenPeriphIoPda1Tx = 2 ,
  kDtPattgenPeriphIoPcl1Tx = 3 ,
  kDtPattgenPeriphIoCount = 4
}
 List of peripheral I/O. More...
 

Functions

dt_pattgen_t dt_pattgen_from_instance_id (dt_instance_id_t inst_id)
 Get the pattgen instance from an instance ID.
 
dt_instance_id_t dt_pattgen_instance_id (dt_pattgen_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_pattgen_reg_block (dt_pattgen_t dt, dt_pattgen_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_plic_irq_id_t dt_pattgen_irq_to_plic_id (dt_pattgen_t dt, dt_pattgen_irq_t irq)
 Get the PLIC ID of a pattgen IRQ for a given instance.
 
dt_pattgen_irq_t dt_pattgen_irq_from_plic_id (dt_pattgen_t dt, dt_plic_irq_id_t irq)
 Convert a global IRQ ID to a local pattgen IRQ type.
 
dt_alert_id_t dt_pattgen_alert_to_alert_id (dt_pattgen_t dt, dt_pattgen_alert_t alert)
 Get the alert ID of a pattgen alert for a given instance.
 
dt_pattgen_alert_t dt_pattgen_alert_from_alert_id (dt_pattgen_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local pattgen alert type.
 
dt_periph_io_t dt_pattgen_periph_io (dt_pattgen_t dt, dt_pattgen_periph_io_t sig)
 Get the peripheral I/O description of an instance.
 
dt_clock_t dt_pattgen_clock (dt_pattgen_t dt, dt_pattgen_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_pattgen_reset (dt_pattgen_t dt, dt_pattgen_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

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

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

Definition in file dt_pattgen.h.

Macro Definition Documentation

◆ OPENTITAN_PATTGEN_HAS_CHANNEL_ONE

#define OPENTITAN_PATTGEN_HAS_CHANNEL_ONE   1

List of supported hardware features.

Definition at line 99 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CHANNEL_TWO

#define OPENTITAN_PATTGEN_HAS_CHANNEL_TWO   1

Definition at line 100 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_COMPLETE

#define OPENTITAN_PATTGEN_HAS_COMPLETE   1

Definition at line 106 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CONFIG_DIVIDER

#define OPENTITAN_PATTGEN_HAS_CONFIG_DIVIDER   1

Definition at line 102 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CONFIG_INACTIVE_LEVEL

#define OPENTITAN_PATTGEN_HAS_CONFIG_INACTIVE_LEVEL   1

Definition at line 105 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CONFIG_PATTERN

#define OPENTITAN_PATTGEN_HAS_CONFIG_PATTERN   1

Definition at line 101 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CONFIG_POLARITY

#define OPENTITAN_PATTGEN_HAS_CONFIG_POLARITY   1

Definition at line 104 of file dt_pattgen.h.

◆ OPENTITAN_PATTGEN_HAS_CONFIG_REPEAT

#define OPENTITAN_PATTGEN_HAS_CONFIG_REPEAT   1

Definition at line 103 of file dt_pattgen.h.

Typedef Documentation

◆ dt_pattgen_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_pattgen_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_pattgen_irq_t

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

◆ dt_pattgen_periph_io_t

List of peripheral I/O.

Peripheral I/O are guaranteed to be numbered consecutively from 0.

◆ dt_pattgen_reg_block_t

List of register blocks.

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

◆ dt_pattgen_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ dt_pattgen

enum dt_pattgen

List of instances.

Enumerator
kDtPattgen 

pattgen

Definition at line 23 of file dt_pattgen.h.

◆ dt_pattgen_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtPattgenAlertFatalFault 

This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.

Definition at line 58 of file dt_pattgen.h.

◆ dt_pattgen_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtPattgenClockClk 

Clock port clk_i.

Definition at line 68 of file dt_pattgen.h.

◆ dt_pattgen_irq

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtPattgenIrqDoneCh0 

raise if pattern generation on Channel 0 is complete

kDtPattgenIrqDoneCh1 

raise if pattern generation on Channel 1 is complete

Definition at line 47 of file dt_pattgen.h.

◆ dt_pattgen_periph_io

List of peripheral I/O.

Peripheral I/O are guaranteed to be numbered consecutively from 0.

Definition at line 88 of file dt_pattgen.h.

◆ dt_pattgen_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_pattgen.h.

◆ dt_pattgen_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtPattgenResetRst 

Reset port rst_ni.

Definition at line 78 of file dt_pattgen.h.

Function Documentation

◆ dt_pattgen_alert_from_alert_id()

dt_pattgen_alert_t dt_pattgen_alert_from_alert_id ( dt_pattgen_t dt,
dt_alert_id_t alert )

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

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

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

Definition at line 150 of file dt_pattgen.c.

◆ dt_pattgen_alert_to_alert_id()

dt_alert_id_t dt_pattgen_alert_to_alert_id ( dt_pattgen_t dt,
dt_pattgen_alert_t alert )

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

Definition at line 144 of file dt_pattgen.c.

◆ dt_pattgen_clock()

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

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

Definition at line 168 of file dt_pattgen.c.

◆ dt_pattgen_from_instance_id()

dt_pattgen_t dt_pattgen_from_instance_id ( dt_instance_id_t inst_id)

Get the pattgen instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A pattgen instance.

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

Definition at line 100 of file dt_pattgen.c.

◆ dt_pattgen_instance_id()

dt_instance_id_t dt_pattgen_instance_id ( dt_pattgen_t dt)

Get the instance ID of an instance.

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

Definition at line 107 of file dt_pattgen.c.

◆ dt_pattgen_irq_from_plic_id()

dt_pattgen_irq_t dt_pattgen_irq_from_plic_id ( dt_pattgen_t dt,
dt_plic_irq_id_t irq )

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

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

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

Definition at line 129 of file dt_pattgen.c.

◆ dt_pattgen_irq_to_plic_id()

dt_plic_irq_id_t dt_pattgen_irq_to_plic_id ( dt_pattgen_t dt,
dt_pattgen_irq_t irq )

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

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

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

Definition at line 119 of file dt_pattgen.c.

◆ dt_pattgen_periph_io()

Get the peripheral I/O description of an instance.

Parameters
dtInstance of pattgen.
sigRequested peripheral I/O.
Returns
Description of the requested peripheral I/O for this instance.

Definition at line 161 of file dt_pattgen.c.

◆ dt_pattgen_reg_block()

Get the register base address of an instance.

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

Definition at line 112 of file dt_pattgen.c.

◆ dt_pattgen_reset()

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

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

Definition at line 175 of file dt_pattgen.c.