Software APIs
dt_api.h File Reference

Device Tables (DT) API for top darjeeling. More...

#include <stddef.h>
#include <stdint.h>
#include "hw/top_darjeeling/sw/autogen/top_darjeeling.h"

Go to the source code of this file.

Data Structures

struct  dt_periph_io
 Peripheral I/O description. More...
 
struct  dt_periph_io.__internal
 

Typedefs

typedef enum dt_device_type dt_device_type_t
 List of device types.
 
typedef enum dt_instance_id dt_instance_id_t
 List of instance IDs.
 
typedef top_darjeeling_plic_irq_id_t dt_plic_irq_id_t
 PLIC IRQ ID type.
 
typedef top_darjeeling_alert_id_t dt_alert_id_t
 Alert ID type.
 
typedef enum dt_clock dt_clock_t
 List of clocks.
 
typedef enum dt_reset dt_reset_t
 List of resets.
 
typedef enum dt_pad dt_pad_t
 List of pads names.
 
typedef top_darjeeling_pinmux_peripheral_in_t dt_pinmux_peripheral_in_t
 Pinmux types.
 
typedef top_darjeeling_pinmux_insel_t dt_pinmux_insel_t
 
typedef top_darjeeling_pinmux_outsel_t dt_pinmux_outsel_t
 
typedef top_darjeeling_pinmux_mio_out_t dt_pinmux_mio_out_t
 
typedef top_darjeeling_direct_pads_t dt_pinmux_direct_pad_t
 
typedef top_darjeeling_muxed_pads_t dt_pinmux_muxed_pad_t
 
typedef enum dt_periph_io_type dt_periph_io_type_t
 Type of peripheral I/O.
 
typedef enum dt_periph_io_dir dt_periph_io_dir_t
 Direction of a peripheral I/O.
 
typedef struct dt_periph_io dt_periph_io_t
 Peripheral I/O description.
 
typedef enum dt_pad_type dt_pad_type_t
 Type of a pad.
 

Enumerations

enum  dt_device_type {
  kDtDeviceTypeUnknown = 0 ,
  kDtDeviceTypeAcRangeCheck = 1 ,
  kDtDeviceTypeAes = 2 ,
  kDtDeviceTypeAlertHandler = 3 ,
  kDtDeviceTypeAonTimer = 4 ,
  kDtDeviceTypeAst = 5 ,
  kDtDeviceTypeClkmgr = 6 ,
  kDtDeviceTypeCsrng = 7 ,
  kDtDeviceTypeDma = 8 ,
  kDtDeviceTypeEdn = 9 ,
  kDtDeviceTypeGpio = 10 ,
  kDtDeviceTypeHmac = 11 ,
  kDtDeviceTypeI2c = 12 ,
  kDtDeviceTypeKeymgrDpe = 13 ,
  kDtDeviceTypeKmac = 14 ,
  kDtDeviceTypeLcCtrl = 15 ,
  kDtDeviceTypeMbx = 16 ,
  kDtDeviceTypeOtbn = 17 ,
  kDtDeviceTypeOtpCtrl = 18 ,
  kDtDeviceTypeOtpMacro = 19 ,
  kDtDeviceTypePinmux = 20 ,
  kDtDeviceTypePwrmgr = 21 ,
  kDtDeviceTypeRaclCtrl = 22 ,
  kDtDeviceTypeRomCtrl = 23 ,
  kDtDeviceTypeRstmgr = 24 ,
  kDtDeviceTypeRvCoreIbex = 25 ,
  kDtDeviceTypeRvDm = 26 ,
  kDtDeviceTypeRvPlic = 27 ,
  kDtDeviceTypeRvTimer = 28 ,
  kDtDeviceTypeSocDbgCtrl = 29 ,
  kDtDeviceTypeSocProxy = 30 ,
  kDtDeviceTypeSpiDevice = 31 ,
  kDtDeviceTypeSpiHost = 32 ,
  kDtDeviceTypeSramCtrl = 33 ,
  kDtDeviceTypeUart = 34 ,
  kDtDeviceTypeCount = 35
}
 List of device types. More...
 
enum  dt_instance_id {
  kDtInstanceIdUnknown = 0 ,
  kDtInstanceIdAcRangeCheck = 1 ,
  kDtInstanceIdAes = 2 ,
  kDtInstanceIdAlertHandler = 3 ,
  kDtInstanceIdAonTimerAon = 4 ,
  kDtInstanceIdAst = 5 ,
  kDtInstanceIdClkmgrAon = 6 ,
  kDtInstanceIdCsrng = 7 ,
  kDtInstanceIdDma = 8 ,
  kDtInstanceIdEdn0 = 9 ,
  kDtInstanceIdEdn1 = 10 ,
  kDtInstanceIdGpio = 11 ,
  kDtInstanceIdHmac = 12 ,
  kDtInstanceIdI2c0 = 13 ,
  kDtInstanceIdKeymgrDpe = 14 ,
  kDtInstanceIdKmac = 15 ,
  kDtInstanceIdLcCtrl = 16 ,
  kDtInstanceIdMbx0 = 17 ,
  kDtInstanceIdMbx1 = 18 ,
  kDtInstanceIdMbx2 = 19 ,
  kDtInstanceIdMbx3 = 20 ,
  kDtInstanceIdMbx4 = 21 ,
  kDtInstanceIdMbx5 = 22 ,
  kDtInstanceIdMbx6 = 23 ,
  kDtInstanceIdMbxJtag = 24 ,
  kDtInstanceIdMbxPcie0 = 25 ,
  kDtInstanceIdMbxPcie1 = 26 ,
  kDtInstanceIdOtbn = 27 ,
  kDtInstanceIdOtpCtrl = 28 ,
  kDtInstanceIdOtpMacro = 29 ,
  kDtInstanceIdPinmuxAon = 30 ,
  kDtInstanceIdPwrmgrAon = 31 ,
  kDtInstanceIdRaclCtrl = 32 ,
  kDtInstanceIdRomCtrl0 = 33 ,
  kDtInstanceIdRomCtrl1 = 34 ,
  kDtInstanceIdRstmgrAon = 35 ,
  kDtInstanceIdRvCoreIbex = 36 ,
  kDtInstanceIdRvDm = 37 ,
  kDtInstanceIdRvPlic = 38 ,
  kDtInstanceIdRvTimer = 39 ,
  kDtInstanceIdSocDbgCtrl = 40 ,
  kDtInstanceIdSocProxy = 41 ,
  kDtInstanceIdSpiDevice = 42 ,
  kDtInstanceIdSpiHost0 = 43 ,
  kDtInstanceIdSramCtrlRetAon = 44 ,
  kDtInstanceIdSramCtrlMain = 45 ,
  kDtInstanceIdSramCtrlMbox = 46 ,
  kDtInstanceIdUart0 = 47 ,
  kDtInstanceIdCount = 48
}
 List of instance IDs. More...
 
enum  { kDtAlertCount = kTopDarjeelingAlertIdLast + 1 }
 Number of alerts. More...
 
enum  dt_clock {
  kDtClockMain = 0 ,
  kDtClockIo = 1 ,
  kDtClockAon = 2 ,
  kDtClockIoDiv2 = 3 ,
  kDtClockIoDiv4 = 4 ,
  kDtClockCount = 5
}
 List of clocks. More...
 
enum  dt_reset {
  kDtResetUnknown = 0 ,
  kDtResetPorAon = 1 ,
  kDtResetLcSrc = 2 ,
  kDtResetSysSrc = 3 ,
  kDtResetPor = 4 ,
  kDtResetPorIo = 5 ,
  kDtResetPorIoDiv2 = 6 ,
  kDtResetPorIoDiv4 = 7 ,
  kDtResetLc = 8 ,
  kDtResetLcAon = 9 ,
  kDtResetLcIo = 10 ,
  kDtResetLcIoDiv2 = 11 ,
  kDtResetLcIoDiv4 = 12 ,
  kDtResetSys = 13 ,
  kDtResetSysIoDiv4 = 14 ,
  kDtResetSpiDevice = 15 ,
  kDtResetSpiHost0 = 16 ,
  kDtResetI2c0 = 17 ,
  kDtResetCount = 18
}
 List of resets. More...
 
enum  dt_pad {
  kDtPadMio0 = 0 ,
  kDtPadMio1 = 1 ,
  kDtPadMio2 = 2 ,
  kDtPadMio3 = 3 ,
  kDtPadMio4 = 4 ,
  kDtPadMio5 = 5 ,
  kDtPadMio6 = 6 ,
  kDtPadMio7 = 7 ,
  kDtPadMio8 = 8 ,
  kDtPadMio9 = 9 ,
  kDtPadMio10 = 10 ,
  kDtPadMio11 = 11 ,
  kDtPadSpiHost0Sd0 = 12 ,
  kDtPadSpiHost0Sd1 = 13 ,
  kDtPadSpiHost0Sd2 = 14 ,
  kDtPadSpiHost0Sd3 = 15 ,
  kDtPadSpiDeviceSd0 = 16 ,
  kDtPadSpiDeviceSd1 = 17 ,
  kDtPadSpiDeviceSd2 = 18 ,
  kDtPadSpiDeviceSd3 = 19 ,
  kDtPadI2c0Scl = 20 ,
  kDtPadI2c0Sda = 21 ,
  kDtPadGpioGpio0 = 22 ,
  kDtPadGpioGpio1 = 23 ,
  kDtPadGpioGpio2 = 24 ,
  kDtPadGpioGpio3 = 25 ,
  kDtPadGpioGpio4 = 26 ,
  kDtPadGpioGpio5 = 27 ,
  kDtPadGpioGpio6 = 28 ,
  kDtPadGpioGpio7 = 29 ,
  kDtPadGpioGpio8 = 30 ,
  kDtPadGpioGpio9 = 31 ,
  kDtPadGpioGpio10 = 32 ,
  kDtPadGpioGpio11 = 33 ,
  kDtPadGpioGpio12 = 34 ,
  kDtPadGpioGpio13 = 35 ,
  kDtPadGpioGpio14 = 36 ,
  kDtPadGpioGpio15 = 37 ,
  kDtPadGpioGpio16 = 38 ,
  kDtPadGpioGpio17 = 39 ,
  kDtPadGpioGpio18 = 40 ,
  kDtPadGpioGpio19 = 41 ,
  kDtPadGpioGpio20 = 42 ,
  kDtPadGpioGpio21 = 43 ,
  kDtPadGpioGpio22 = 44 ,
  kDtPadGpioGpio23 = 45 ,
  kDtPadGpioGpio24 = 46 ,
  kDtPadGpioGpio25 = 47 ,
  kDtPadGpioGpio26 = 48 ,
  kDtPadGpioGpio27 = 49 ,
  kDtPadGpioGpio28 = 50 ,
  kDtPadGpioGpio29 = 51 ,
  kDtPadGpioGpio30 = 52 ,
  kDtPadGpioGpio31 = 53 ,
  kDtPadSpiDeviceSck = 54 ,
  kDtPadSpiDeviceCsb = 55 ,
  kDtPadSpiDeviceTpmCsb = 56 ,
  kDtPadUart0Rx = 57 ,
  kDtPadSocProxySocGpi0 = 58 ,
  kDtPadSocProxySocGpi1 = 59 ,
  kDtPadSocProxySocGpi2 = 60 ,
  kDtPadSocProxySocGpi3 = 61 ,
  kDtPadSocProxySocGpi4 = 62 ,
  kDtPadSocProxySocGpi5 = 63 ,
  kDtPadSocProxySocGpi6 = 64 ,
  kDtPadSocProxySocGpi7 = 65 ,
  kDtPadSocProxySocGpi8 = 66 ,
  kDtPadSocProxySocGpi9 = 67 ,
  kDtPadSocProxySocGpi10 = 68 ,
  kDtPadSocProxySocGpi11 = 69 ,
  kDtPadSpiHost0Sck = 70 ,
  kDtPadSpiHost0Csb = 71 ,
  kDtPadUart0Tx = 72 ,
  kDtPadSocProxySocGpo0 = 73 ,
  kDtPadSocProxySocGpo1 = 74 ,
  kDtPadSocProxySocGpo2 = 75 ,
  kDtPadSocProxySocGpo3 = 76 ,
  kDtPadSocProxySocGpo4 = 77 ,
  kDtPadSocProxySocGpo5 = 78 ,
  kDtPadSocProxySocGpo6 = 79 ,
  kDtPadSocProxySocGpo7 = 80 ,
  kDtPadSocProxySocGpo8 = 81 ,
  kDtPadSocProxySocGpo9 = 82 ,
  kDtPadSocProxySocGpo10 = 83 ,
  kDtPadSocProxySocGpo11 = 84 ,
  kDtPadCount = 85
}
 List of pads names. More...
 
enum  dt_periph_io_type {
  kDtPeriphIoTypeMio ,
  kDtPeriphIoTypeDio ,
  kDtPeriphIoTypeUnspecified
}
 Type of peripheral I/O. More...
 
enum  dt_periph_io_dir {
  kDtPeriphIoDirIn ,
  kDtPeriphIoDirOut ,
  kDtPeriphIoDirInout
}
 Direction of a peripheral I/O. More...
 
enum  dt_pad_type {
  kDtPadTypeMio ,
  kDtPadTypeDio ,
  kDtPadTypeUnspecified
}
 Type of a pad. More...
 

Functions

dt_device_type_t dt_device_type (dt_instance_id_t id)
 Get the instance type of a device instance.
 
dt_instance_id_t dt_plic_id_to_instance_id (dt_plic_irq_id_t irq)
 Get the instance ID for a given PLIC IRQ ID.
 
dt_instance_id_t dt_alert_id_to_instance_id (dt_alert_id_t alert)
 Get the instance ID for a given alert ID.
 
uint32_t dt_clock_frequency (dt_clock_t clk)
 Get the frequency of a clock.
 
dt_pad_type_t dt_pad_type (dt_pad_t pad)
 Return the type of a dt_pad_t.
 
dt_pinmux_mio_out_t dt_pad_mio_out (dt_pad_t pad)
 Return the pad out number for an MIO pad.
 
dt_pinmux_muxed_pad_t dt_pad_mio_pad_index (dt_pad_t pad)
 Return the pad out number for an MIO pad.
 
dt_pinmux_insel_t dt_pad_mio_insel (dt_pad_t pad)
 Return the insel for an MIO pad.
 
dt_pinmux_direct_pad_t dt_pad_dio_pad_index (dt_pad_t pad)
 Return the direct pad number of a DIO pad.
 

Variables

const dt_periph_io_t kDtPeriphIoConstantHighZ
 
const dt_periph_io_t kDtPeriphIoConstantZero
 
const dt_periph_io_t kDtPeriphIoConstantOne
 

Detailed Description

Device Tables (DT) API for top darjeeling.

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

The DT models the chip as a collection of instances. Each instance has a type (the IP block) and a number of attributes such as I/Os, IRQs and so on. The DT also provides top-specific lists of global resources such as I/O pads, clocks and interrupts.

Definition in file dt_api.h.


Data Structure Documentation

◆ dt_periph_io

struct dt_periph_io

Peripheral I/O description.

A dt_periph_io_t represents a HW IP block peripheral I/O, which can be an input, output or both. Importantly, this only represents how the block peripheral I/O is wired, i.e. whether it is connected a MIO or a direct IO on the pinmux, and the relevant information necessary to configure it.

Note: The fields of this structure are internal, use the dt_periph_io_* functions to access them.

Definition at line 358 of file dt_api.h.

Data Fields
struct dt_periph_io __internal Private fields.
struct dt_periph_io __internal Private fields.
struct dt_periph_io.__internal __internal Private fields.

◆ dt_periph_io.__internal

struct dt_periph_io.__internal

Definition at line 278 of file dt_api.h.

Data Fields
dt_periph_io_dir_t dir Peripheral I/O direction.
dt_periph_io_dir_t dir Peripheral I/O direction.
dt_periph_io_dir_t dir Peripheral I/O direction.
uint16_t outsel_or_dt_pad For kDtPeriphIoTypeMio: peripheral output number.

This is the value to put in the MIO_OUTSEL registers to connect an output to this peripheral I/O. For kDtPeriphIoTypeDio: the pad index (dt_pad_t) to which this I/O is connected.

uint16_t outsel_or_dt_pad For kDtPeriphIoTypeMio: peripheral output number.

This is the value to put in the MIO_OUTSEL registers to connect an output to this peripheral I/O. For kDtPeriphIoTypeDio: the pad index (dt_pad_t) to which this I/O is connected.

uint16_t outsel_or_dt_pad For kDtPeriphIoTypeMio: peripheral output number.

This is the value to put in the MIO_OUTSEL registers to connect an output to this peripheral I/O. For kDtPeriphIoTypeDio: the pad index (dt_pad_t) to which this I/O is connected.

uint16_t periph_input_or_direct_pad For kDtPeriphIoTypeMio: peripheral input number.

This is the index of the MIO_PERIPH_INSEL register that controls this peripheral I/O.

For kDtPeriphIoTypeDio: DIO pad number. This is the index of the various DIO_PAD_* registers that control this peripheral I/O.

uint16_t periph_input_or_direct_pad For kDtPeriphIoTypeMio: peripheral input number.

This is the index of the MIO_PERIPH_INSEL register that controls this peripheral I/O.

For kDtPeriphIoTypeDio: DIO pad number. This is the index of the various DIO_PAD_* registers that control this peripheral I/O.

uint16_t periph_input_or_direct_pad For kDtPeriphIoTypeMio: peripheral input number.

This is the index of the MIO_PERIPH_INSEL register that controls this peripheral I/O.

For kDtPeriphIoTypeDio: DIO pad number. This is the index of the various DIO_PAD_* registers that control this peripheral I/O.

dt_periph_io_type_t type Peripheral I/O type.
dt_periph_io_type_t type Peripheral I/O type.
dt_periph_io_type_t type Peripheral I/O type.

Typedef Documentation

◆ dt_alert_id_t

Alert ID type.

This type represents a raw alert ID from the Alert Handler.

This is an alias to the top's alert_id_t type for backward compatability with existing code.

Definition at line 169 of file dt_api.h.

◆ dt_clock_t

typedef enum dt_clock dt_clock_t

List of clocks.

Clocks are guaranteed to be numbered consecutively from 0.

◆ dt_device_type_t

List of device types.

Device types are guaranteed to be numbered consecutively from 0.

◆ dt_instance_id_t

List of instance IDs.

Instance IDs are guaranteed to be numbered consecutively from 0.

◆ dt_periph_io_t

typedef struct dt_periph_io dt_periph_io_t

Peripheral I/O description.

A dt_periph_io_t represents a HW IP block peripheral I/O, which can be an input, output or both. Importantly, this only represents how the block peripheral I/O is wired, i.e. whether it is connected a MIO or a direct IO on the pinmux, and the relevant information necessary to configure it.

Note: The fields of this structure are internal, use the dt_periph_io_* functions to access them.

◆ dt_pinmux_direct_pad_t

typedef top_darjeeling_direct_pads_t dt_pinmux_direct_pad_t

Definition at line 340 of file dt_api.h.

◆ dt_pinmux_insel_t

typedef top_darjeeling_pinmux_insel_t dt_pinmux_insel_t

Definition at line 337 of file dt_api.h.

◆ dt_pinmux_mio_out_t

typedef top_darjeeling_pinmux_mio_out_t dt_pinmux_mio_out_t

Definition at line 339 of file dt_api.h.

◆ dt_pinmux_muxed_pad_t

typedef top_darjeeling_muxed_pads_t dt_pinmux_muxed_pad_t

Definition at line 341 of file dt_api.h.

◆ dt_pinmux_outsel_t

typedef top_darjeeling_pinmux_outsel_t dt_pinmux_outsel_t

Definition at line 338 of file dt_api.h.

◆ dt_pinmux_peripheral_in_t

Pinmux types.

These types are aliases to top-level types for backward compatibility with existing code.

Definition at line 336 of file dt_api.h.

◆ dt_plic_irq_id_t

PLIC IRQ ID type.

This type represents a raw IRQ ID from the PLIC.

This is an alias to the top's plic_irq_id_t type for backward compatibility with existing code.

Definition at line 144 of file dt_api.h.

◆ dt_reset_t

typedef enum dt_reset dt_reset_t

List of resets.

Resets are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Number of alerts.

Enumerator
kDtAlertCount 

Total number of alert IDs.

Definition at line 172 of file dt_api.h.

◆ dt_clock

enum dt_clock

List of clocks.

Clocks are guaranteed to be numbered consecutively from 0.

Enumerator
kDtClockMain 

clock main

kDtClockIo 

clock io

kDtClockAon 

clock aon

kDtClockIoDiv2 

clock io_div2

kDtClockIoDiv4 

clock io_div4

Definition at line 194 of file dt_api.h.

◆ dt_device_type

List of device types.

Device types are guaranteed to be numbered consecutively from 0.

Enumerator
kDtDeviceTypeUnknown 

Instance of unknown type.

kDtDeviceTypeAcRangeCheck 

instance of ac_range_check

kDtDeviceTypeAes 

instance of aes

kDtDeviceTypeAlertHandler 

instance of alert_handler

kDtDeviceTypeAonTimer 

instance of aon_timer

kDtDeviceTypeAst 

instance of ast

kDtDeviceTypeClkmgr 

instance of clkmgr

kDtDeviceTypeCsrng 

instance of csrng

kDtDeviceTypeDma 

instance of dma

kDtDeviceTypeEdn 

instance of edn

kDtDeviceTypeGpio 

instance of gpio

kDtDeviceTypeHmac 

instance of hmac

kDtDeviceTypeI2c 

instance of i2c

kDtDeviceTypeKeymgrDpe 

instance of keymgr_dpe

kDtDeviceTypeKmac 

instance of kmac

kDtDeviceTypeLcCtrl 

instance of lc_ctrl

kDtDeviceTypeMbx 

instance of mbx

kDtDeviceTypeOtbn 

instance of otbn

kDtDeviceTypeOtpCtrl 

instance of otp_ctrl

kDtDeviceTypeOtpMacro 

instance of otp_macro

kDtDeviceTypePinmux 

instance of pinmux

kDtDeviceTypePwrmgr 

instance of pwrmgr

kDtDeviceTypeRaclCtrl 

instance of racl_ctrl

kDtDeviceTypeRomCtrl 

instance of rom_ctrl

kDtDeviceTypeRstmgr 

instance of rstmgr

kDtDeviceTypeRvCoreIbex 

instance of rv_core_ibex

kDtDeviceTypeRvDm 

instance of rv_dm

kDtDeviceTypeRvPlic 

instance of rv_plic

kDtDeviceTypeRvTimer 

instance of rv_timer

kDtDeviceTypeSocDbgCtrl 

instance of soc_dbg_ctrl

kDtDeviceTypeSocProxy 

instance of soc_proxy

kDtDeviceTypeSpiDevice 

instance of spi_device

kDtDeviceTypeSpiHost 

instance of spi_host

kDtDeviceTypeSramCtrl 

instance of sram_ctrl

kDtDeviceTypeUart 

instance of uart

Definition at line 31 of file dt_api.h.

◆ dt_instance_id

List of instance IDs.

Instance IDs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtInstanceIdUnknown 

Unknown instance.

kDtInstanceIdAcRangeCheck 

instance ac_range_check of ac_range_check

kDtInstanceIdAes 

instance aes of aes

kDtInstanceIdAlertHandler 

instance alert_handler of alert_handler

kDtInstanceIdAonTimerAon 

instance aon_timer_aon of aon_timer

kDtInstanceIdAst 

instance ast of ast

kDtInstanceIdClkmgrAon 

instance clkmgr_aon of clkmgr

kDtInstanceIdCsrng 

instance csrng of csrng

kDtInstanceIdDma 

instance dma of dma

kDtInstanceIdEdn0 

instance edn0 of edn

kDtInstanceIdEdn1 

instance edn1 of edn

kDtInstanceIdGpio 

instance gpio of gpio

kDtInstanceIdHmac 

instance hmac of hmac

kDtInstanceIdI2c0 

instance i2c0 of i2c

kDtInstanceIdKeymgrDpe 

instance keymgr_dpe of keymgr_dpe

kDtInstanceIdKmac 

instance kmac of kmac

kDtInstanceIdLcCtrl 

instance lc_ctrl of lc_ctrl

kDtInstanceIdMbx0 

instance mbx0 of mbx

kDtInstanceIdMbx1 

instance mbx1 of mbx

kDtInstanceIdMbx2 

instance mbx2 of mbx

kDtInstanceIdMbx3 

instance mbx3 of mbx

kDtInstanceIdMbx4 

instance mbx4 of mbx

kDtInstanceIdMbx5 

instance mbx5 of mbx

kDtInstanceIdMbx6 

instance mbx6 of mbx

kDtInstanceIdMbxJtag 

instance mbx_jtag of mbx

kDtInstanceIdMbxPcie0 

instance mbx_pcie0 of mbx

kDtInstanceIdMbxPcie1 

instance mbx_pcie1 of mbx

kDtInstanceIdOtbn 

instance otbn of otbn

kDtInstanceIdOtpCtrl 

instance otp_ctrl of otp_ctrl

kDtInstanceIdOtpMacro 

instance otp_macro of otp_macro

kDtInstanceIdPinmuxAon 

instance pinmux_aon of pinmux

kDtInstanceIdPwrmgrAon 

instance pwrmgr_aon of pwrmgr

kDtInstanceIdRaclCtrl 

instance racl_ctrl of racl_ctrl

kDtInstanceIdRomCtrl0 

instance rom_ctrl0 of rom_ctrl

kDtInstanceIdRomCtrl1 

instance rom_ctrl1 of rom_ctrl

kDtInstanceIdRstmgrAon 

instance rstmgr_aon of rstmgr

kDtInstanceIdRvCoreIbex 

instance rv_core_ibex of rv_core_ibex

kDtInstanceIdRvDm 

instance rv_dm of rv_dm

kDtInstanceIdRvPlic 

instance rv_plic of rv_plic

kDtInstanceIdRvTimer 

instance rv_timer of rv_timer

kDtInstanceIdSocDbgCtrl 

instance soc_dbg_ctrl of soc_dbg_ctrl

kDtInstanceIdSocProxy 

instance soc_proxy of soc_proxy

kDtInstanceIdSpiDevice 

instance spi_device of spi_device

kDtInstanceIdSpiHost0 

instance spi_host0 of spi_host

kDtInstanceIdSramCtrlRetAon 

instance sram_ctrl_ret_aon of sram_ctrl

kDtInstanceIdSramCtrlMain 

instance sram_ctrl_main of sram_ctrl

kDtInstanceIdSramCtrlMbox 

instance sram_ctrl_mbox of sram_ctrl

kDtInstanceIdUart0 

instance uart0 of uart

Definition at line 75 of file dt_api.h.

◆ dt_pad

enum dt_pad

List of pads names.

Enumerator
kDtPadMio0 

Muxed IO pad.

kDtPadMio1 

Muxed IO pad.

kDtPadMio2 

Muxed IO pad.

kDtPadMio3 

Muxed IO pad.

kDtPadMio4 

Muxed IO pad.

kDtPadMio5 

Muxed IO pad.

kDtPadMio6 

Muxed IO pad.

kDtPadMio7 

Muxed IO pad.

kDtPadMio8 

Muxed IO pad.

kDtPadMio9 

Muxed IO pad.

kDtPadMio10 

Muxed IO pad.

kDtPadMio11 

Muxed IO pad.

kDtPadSpiHost0Sd0 

SPI host data.

kDtPadSpiHost0Sd1 

SPI host data.

kDtPadSpiHost0Sd2 

SPI host data.

kDtPadSpiHost0Sd3 

SPI host data.

kDtPadSpiDeviceSd0 

SPI device data.

kDtPadSpiDeviceSd1 

SPI device data.

kDtPadSpiDeviceSd2 

SPI device data.

kDtPadSpiDeviceSd3 

SPI device data.

kDtPadI2c0Scl 

I2C clock.

kDtPadI2c0Sda 

I2C data.

kDtPadGpioGpio0 

GPIO pad.

kDtPadGpioGpio1 

GPIO pad.

kDtPadGpioGpio2 

GPIO pad.

kDtPadGpioGpio3 

GPIO pad.

kDtPadGpioGpio4 

GPIO pad.

kDtPadGpioGpio5 

GPIO pad.

kDtPadGpioGpio6 

GPIO pad.

kDtPadGpioGpio7 

GPIO pad.

kDtPadGpioGpio8 

GPIO pad.

kDtPadGpioGpio9 

GPIO pad.

kDtPadGpioGpio10 

GPIO pad.

kDtPadGpioGpio11 

GPIO pad.

kDtPadGpioGpio12 

GPIO pad.

kDtPadGpioGpio13 

GPIO pad.

kDtPadGpioGpio14 

GPIO pad.

kDtPadGpioGpio15 

GPIO pad.

kDtPadGpioGpio16 

GPIO pad.

kDtPadGpioGpio17 

GPIO pad.

kDtPadGpioGpio18 

GPIO pad.

kDtPadGpioGpio19 

GPIO pad.

kDtPadGpioGpio20 

GPIO pad.

kDtPadGpioGpio21 

GPIO pad.

kDtPadGpioGpio22 

GPIO pad.

kDtPadGpioGpio23 

GPIO pad.

kDtPadGpioGpio24 

GPIO pad.

kDtPadGpioGpio25 

GPIO pad.

kDtPadGpioGpio26 

GPIO pad.

kDtPadGpioGpio27 

GPIO pad.

kDtPadGpioGpio28 

GPIO pad.

kDtPadGpioGpio29 

GPIO pad.

kDtPadGpioGpio30 

GPIO pad.

kDtPadGpioGpio31 

GPIO pad.

kDtPadSpiDeviceSck 

SPI device clock.

kDtPadSpiDeviceCsb 

SPI device chip select.

kDtPadSpiDeviceTpmCsb 

SPI device TPM chip select.

kDtPadUart0Rx 

UART receive.

kDtPadSocProxySocGpi0 

SoC general purpose input.

kDtPadSocProxySocGpi1 

SoC general purpose input.

kDtPadSocProxySocGpi2 

SoC general purpose input.

kDtPadSocProxySocGpi3 

SoC general purpose input.

kDtPadSocProxySocGpi4 

SoC general purpose input.

kDtPadSocProxySocGpi5 

SoC general purpose input.

kDtPadSocProxySocGpi6 

SoC general purpose input.

kDtPadSocProxySocGpi7 

SoC general purpose input.

kDtPadSocProxySocGpi8 

SoC general purpose input.

kDtPadSocProxySocGpi9 

SoC general purpose input.

kDtPadSocProxySocGpi10 

SoC general purpose input.

kDtPadSocProxySocGpi11 

SoC general purpose input.

kDtPadSpiHost0Sck 

SPI host clock.

kDtPadSpiHost0Csb 

SPI host chip select.

kDtPadUart0Tx 

UART transmit.

kDtPadSocProxySocGpo0 

SoC general purpose output.

kDtPadSocProxySocGpo1 

SoC general purpose output.

kDtPadSocProxySocGpo2 

SoC general purpose output.

kDtPadSocProxySocGpo3 

SoC general purpose output.

kDtPadSocProxySocGpo4 

SoC general purpose output.

kDtPadSocProxySocGpo5 

SoC general purpose output.

kDtPadSocProxySocGpo6 

SoC general purpose output.

kDtPadSocProxySocGpo7 

SoC general purpose output.

kDtPadSocProxySocGpo8 

SoC general purpose output.

kDtPadSocProxySocGpo9 

SoC general purpose output.

kDtPadSocProxySocGpo10 

SoC general purpose output.

kDtPadSocProxySocGpo11 

SoC general purpose output.

Definition at line 241 of file dt_api.h.

◆ dt_pad_type

Type of a pad.

Enumerator
kDtPadTypeMio 

This pad is a muxed IO (MIO).

kDtPadTypeDio 

This pad is a direct IO (DIO).

kDtPadTypeUnspecified 

This pad is not an MIO or a DIO.

Definition at line 491 of file dt_api.h.

◆ dt_periph_io_dir

Direction of a peripheral I/O.

Enumerator
kDtPeriphIoDirIn 

This peripheral I/O is an input.

kDtPeriphIoDirOut 

This peripheral I/O is an output.

kDtPeriphIoDirInout 

This peripheral I/O is an input-output.

Definition at line 355 of file dt_api.h.

◆ dt_periph_io_type

Type of peripheral I/O.

Enumerator
kDtPeriphIoTypeMio 

This peripheral I/O is connected to a muxed IO (MIO).

kDtPeriphIoTypeDio 

This peripheral I/O is connected to a direct IO (DIO).

kDtPeriphIoTypeUnspecified 

This peripheral I/O is not connected to either a MIO or a DIO.

Definition at line 344 of file dt_api.h.

◆ dt_reset

enum dt_reset

List of resets.

Resets are guaranteed to be numbered consecutively from 0.

Enumerator
kDtResetUnknown 

Unknown reset.

kDtResetPorAon 

Reset node por_aon.

kDtResetLcSrc 

Reset node lc_src.

kDtResetSysSrc 

Reset node sys_src.

kDtResetPor 

Reset node por.

kDtResetPorIo 

Reset node por_io.

kDtResetPorIoDiv2 

Reset node por_io_div2.

kDtResetPorIoDiv4 

Reset node por_io_div4.

kDtResetLc 

Reset node lc.

kDtResetLcAon 

Reset node lc_aon.

kDtResetLcIo 

Reset node lc_io.

kDtResetLcIoDiv2 

Reset node lc_io_div2.

kDtResetLcIoDiv4 

Reset node lc_io_div4.

kDtResetSys 

Reset node sys.

kDtResetSysIoDiv4 

Reset node sys_io_div4.

kDtResetSpiDevice 

Reset node spi_device.

kDtResetSpiHost0 

Reset node spi_host0.

kDtResetI2c0 

Reset node i2c0.

Definition at line 216 of file dt_api.h.

Function Documentation

◆ dt_alert_id_to_instance_id()

dt_instance_id_t dt_alert_id_to_instance_id ( dt_alert_id_t alert)

Get the instance ID for a given alert ID.

For example, on earlgrey, the instance ID of kTopEarlgreyAlertIdUart0FatalFault is kDtInstanceIdUart0. One can then use the type specific function to retrieve the alert name, for example dt_uart_alert_from_alert_id for the UART.

Parameters
alertAn alert ID.
Returns
The instance ID, or kDtInstanceIdUnknown if the alert ID is not valid.

Definition at line 291 of file dt_api.c.

◆ dt_clock_frequency()

uint32_t dt_clock_frequency ( dt_clock_t clk)

Get the frequency of a clock.

Parameters
clkA clock ID.
Returns
Clock frequency in Hz.

◆ dt_device_type()

Get the instance type of a device instance.

For example the instance type of kDtUart0 is kDtInstanceTypeUart.

Parameters
idAn instance ID.
Returns
The instance type, or kDtInstanceIdUnknown if the ID is not valid.

Definition at line 345 of file dt_api.c.

◆ dt_pad_dio_pad_index()

dt_pinmux_direct_pad_t dt_pad_dio_pad_index ( dt_pad_t pad)

Return the direct pad number of a DIO pad.

This is the index of the various DIO_PAD_* registers that control this pad.

Parameters
padA pad of type kDtPadTypeDio.
Returns
The direct pad number of the DID that this pad is connected to.

Note: This function only makes sense for pads of type kDtPeriphIoTypeDio which are either outputs or inouts. For any other pad type, the return value is unspecified.

Definition at line 716 of file dt_api.c.

◆ dt_pad_mio_insel()

dt_pinmux_insel_t dt_pad_mio_insel ( dt_pad_t pad)

Return the insel for an MIO pad.

This is the value to put in the MIO_PERIPH_INSEL registers to connect a peripheral I/O to this pad.

Parameters
padA pad of type kDtPadTypeMio.
Returns
The insel of the MIO that this pad is connected to.

Note: This function only makes sense for pads of type kDtPadTypeMio. For any other pad, the return value is unspecified.

Definition at line 712 of file dt_api.c.

◆ dt_pad_mio_out()

dt_pinmux_mio_out_t dt_pad_mio_out ( dt_pad_t pad)

Return the pad out number for an MIO pad.

This is the index of the MIO_OUT registers that control this pad (or the output part of this pad).

Parameters
padA pad of type kDtPadTypeMio.
Returns
The pad out number of the MIO.

Note: This function only makes sense for pads of type kDtPadTypeMio which are either inputs or inouts. For any other pad, the return value is unspecified.

Definition at line 703 of file dt_api.c.

◆ dt_pad_mio_pad_index()

dt_pinmux_muxed_pad_t dt_pad_mio_pad_index ( dt_pad_t pad)

Return the pad out number for an MIO pad.

This is the index of the MIO_PAD registers that control this pad (or the output part of this pad).

Parameters
padA pad of type kDtPadTypeMio.
Returns
The pad out number of the MIO.

Note: This function only makes sense for pads of type kDtPadTypeMio. For any other pad, the return value is unspecified.

Definition at line 707 of file dt_api.c.

◆ dt_pad_type()

Return the type of a dt_pad_t.

Parameters
padA pad description.
Returns
The pad type (MIO, DIO, etc).

Definition at line 699 of file dt_api.c.

◆ dt_plic_id_to_instance_id()

dt_instance_id_t dt_plic_id_to_instance_id ( dt_plic_irq_id_t irq)

Get the instance ID for a given PLIC IRQ ID.

For example, on earlgrey, the instance ID of kTopEarlgreyPlicIrqIdUart0TxWatermark is kDtInstanceIdUart0. One can then use the type specific function to retrieve the IRQ name, for example dt_uart_irq_from_plic_id for the UART.

Parameters
irqA PLIC ID.
Returns
The instance ID, or kDtInstanceIdUnknown if the PLIC ID is not valid.

Definition at line 211 of file dt_api.c.

Variable Documentation

◆ kDtPeriphIoConstantHighZ

const dt_periph_io_t kDtPeriphIoConstantHighZ
extern

Definition at line 721 of file dt_api.c.

◆ kDtPeriphIoConstantOne

const dt_periph_io_t kDtPeriphIoConstantOne
extern

Definition at line 739 of file dt_api.c.

◆ kDtPeriphIoConstantZero

const dt_periph_io_t kDtPeriphIoConstantZero
extern

Definition at line 730 of file dt_api.c.