Software APIs
dt_api.h File Reference

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

#include <stddef.h>
#include <stdint.h>
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.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_earlgrey_plic_irq_id_t dt_plic_irq_id_t
 PLIC IRQ ID type.
 
typedef top_earlgrey_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_earlgrey_pinmux_peripheral_in_t dt_pinmux_peripheral_in_t
 Pinmux types.
 
typedef top_earlgrey_pinmux_insel_t dt_pinmux_insel_t
 
typedef top_earlgrey_pinmux_outsel_t dt_pinmux_outsel_t
 
typedef top_earlgrey_pinmux_mio_out_t dt_pinmux_mio_out_t
 
typedef top_earlgrey_direct_pads_t dt_pinmux_direct_pad_t
 
typedef top_earlgrey_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 ,
  kDtDeviceTypeAdcCtrl = 1 ,
  kDtDeviceTypeAes = 2 ,
  kDtDeviceTypeAlertHandler = 3 ,
  kDtDeviceTypeAonTimer = 4 ,
  kDtDeviceTypeAst = 5 ,
  kDtDeviceTypeClkmgr = 6 ,
  kDtDeviceTypeCsrng = 7 ,
  kDtDeviceTypeEdn = 8 ,
  kDtDeviceTypeEntropySrc = 9 ,
  kDtDeviceTypeFlashCtrl = 10 ,
  kDtDeviceTypeGpio = 11 ,
  kDtDeviceTypeHmac = 12 ,
  kDtDeviceTypeI2c = 13 ,
  kDtDeviceTypeKeymgr = 14 ,
  kDtDeviceTypeKmac = 15 ,
  kDtDeviceTypeLcCtrl = 16 ,
  kDtDeviceTypeOtbn = 17 ,
  kDtDeviceTypeOtpCtrl = 18 ,
  kDtDeviceTypeOtpMacro = 19 ,
  kDtDeviceTypePattgen = 20 ,
  kDtDeviceTypePinmux = 21 ,
  kDtDeviceTypePwm = 22 ,
  kDtDeviceTypePwrmgr = 23 ,
  kDtDeviceTypeRomCtrl = 24 ,
  kDtDeviceTypeRstmgr = 25 ,
  kDtDeviceTypeRvCoreIbex = 26 ,
  kDtDeviceTypeRvDm = 27 ,
  kDtDeviceTypeRvPlic = 28 ,
  kDtDeviceTypeRvTimer = 29 ,
  kDtDeviceTypeSensorCtrl = 30 ,
  kDtDeviceTypeSpiDevice = 31 ,
  kDtDeviceTypeSpiHost = 32 ,
  kDtDeviceTypeSramCtrl = 33 ,
  kDtDeviceTypeSysrstCtrl = 34 ,
  kDtDeviceTypeUart = 35 ,
  kDtDeviceTypeUsbdev = 36 ,
  kDtDeviceTypeCount = 37
}
 List of device types. More...
 
enum  dt_instance_id {
  kDtInstanceIdUnknown = 0 ,
  kDtInstanceIdAdcCtrlAon = 1 ,
  kDtInstanceIdAes = 2 ,
  kDtInstanceIdAlertHandler = 3 ,
  kDtInstanceIdAonTimerAon = 4 ,
  kDtInstanceIdAst = 5 ,
  kDtInstanceIdClkmgrAon = 6 ,
  kDtInstanceIdCsrng = 7 ,
  kDtInstanceIdEdn0 = 8 ,
  kDtInstanceIdEdn1 = 9 ,
  kDtInstanceIdEntropySrc = 10 ,
  kDtInstanceIdFlashCtrl = 11 ,
  kDtInstanceIdGpio = 12 ,
  kDtInstanceIdHmac = 13 ,
  kDtInstanceIdI2c0 = 14 ,
  kDtInstanceIdI2c1 = 15 ,
  kDtInstanceIdI2c2 = 16 ,
  kDtInstanceIdKeymgr = 17 ,
  kDtInstanceIdKmac = 18 ,
  kDtInstanceIdLcCtrl = 19 ,
  kDtInstanceIdOtbn = 20 ,
  kDtInstanceIdOtpCtrl = 21 ,
  kDtInstanceIdOtpMacro = 22 ,
  kDtInstanceIdPattgen = 23 ,
  kDtInstanceIdPinmuxAon = 24 ,
  kDtInstanceIdPwmAon = 25 ,
  kDtInstanceIdPwrmgrAon = 26 ,
  kDtInstanceIdRomCtrl = 27 ,
  kDtInstanceIdRstmgrAon = 28 ,
  kDtInstanceIdRvCoreIbex = 29 ,
  kDtInstanceIdRvDm = 30 ,
  kDtInstanceIdRvPlic = 31 ,
  kDtInstanceIdRvTimer = 32 ,
  kDtInstanceIdSensorCtrlAon = 33 ,
  kDtInstanceIdSpiDevice = 34 ,
  kDtInstanceIdSpiHost0 = 35 ,
  kDtInstanceIdSpiHost1 = 36 ,
  kDtInstanceIdSramCtrlRetAon = 37 ,
  kDtInstanceIdSramCtrlMain = 38 ,
  kDtInstanceIdSysrstCtrlAon = 39 ,
  kDtInstanceIdUart0 = 40 ,
  kDtInstanceIdUart1 = 41 ,
  kDtInstanceIdUart2 = 42 ,
  kDtInstanceIdUart3 = 43 ,
  kDtInstanceIdUsbdev = 44 ,
  kDtInstanceIdCount = 45
}
 List of instance IDs. More...
 
enum  { kDtAlertCount = kTopEarlgreyAlertIdLast + 1 }
 Number of alerts. More...
 
enum  dt_clock {
  kDtClockMain = 0 ,
  kDtClockIo = 1 ,
  kDtClockUsb = 2 ,
  kDtClockAon = 3 ,
  kDtClockIoDiv2 = 4 ,
  kDtClockIoDiv4 = 5 ,
  kDtClockCount = 6
}
 List of clocks. More...
 
enum  dt_reset {
  kDtResetUnknown = 0 ,
  kDtResetPorAon = 1 ,
  kDtResetLcSrc = 2 ,
  kDtResetSysSrc = 3 ,
  kDtResetPor = 4 ,
  kDtResetPorIo = 5 ,
  kDtResetPorIoDiv2 = 6 ,
  kDtResetPorIoDiv4 = 7 ,
  kDtResetPorUsb = 8 ,
  kDtResetLc = 9 ,
  kDtResetLcAon = 10 ,
  kDtResetLcIo = 11 ,
  kDtResetLcIoDiv2 = 12 ,
  kDtResetLcIoDiv4 = 13 ,
  kDtResetLcUsb = 14 ,
  kDtResetSys = 15 ,
  kDtResetSysIoDiv4 = 16 ,
  kDtResetSpiDevice = 17 ,
  kDtResetSpiHost0 = 18 ,
  kDtResetSpiHost1 = 19 ,
  kDtResetUsb = 20 ,
  kDtResetUsbAon = 21 ,
  kDtResetI2c0 = 22 ,
  kDtResetI2c1 = 23 ,
  kDtResetI2c2 = 24 ,
  kDtResetCount = 25
}
 List of resets. More...
 
enum  dt_pad {
  kDtPadIoa0 = 0 ,
  kDtPadIoa1 = 1 ,
  kDtPadIoa2 = 2 ,
  kDtPadIoa3 = 3 ,
  kDtPadIoa4 = 4 ,
  kDtPadIoa5 = 5 ,
  kDtPadIoa6 = 6 ,
  kDtPadIoa7 = 7 ,
  kDtPadIoa8 = 8 ,
  kDtPadIob0 = 9 ,
  kDtPadIob1 = 10 ,
  kDtPadIob2 = 11 ,
  kDtPadIob3 = 12 ,
  kDtPadIob4 = 13 ,
  kDtPadIob5 = 14 ,
  kDtPadIob6 = 15 ,
  kDtPadIob7 = 16 ,
  kDtPadIob8 = 17 ,
  kDtPadIob9 = 18 ,
  kDtPadIob10 = 19 ,
  kDtPadIob11 = 20 ,
  kDtPadIob12 = 21 ,
  kDtPadIoc0 = 22 ,
  kDtPadIoc1 = 23 ,
  kDtPadIoc2 = 24 ,
  kDtPadIoc3 = 25 ,
  kDtPadIoc4 = 26 ,
  kDtPadIoc5 = 27 ,
  kDtPadIoc6 = 28 ,
  kDtPadIoc7 = 29 ,
  kDtPadIoc8 = 30 ,
  kDtPadIoc9 = 31 ,
  kDtPadIoc10 = 32 ,
  kDtPadIoc11 = 33 ,
  kDtPadIoc12 = 34 ,
  kDtPadIor0 = 35 ,
  kDtPadIor1 = 36 ,
  kDtPadIor2 = 37 ,
  kDtPadIor3 = 38 ,
  kDtPadIor4 = 39 ,
  kDtPadIor5 = 40 ,
  kDtPadIor6 = 41 ,
  kDtPadIor7 = 42 ,
  kDtPadIor10 = 43 ,
  kDtPadIor11 = 44 ,
  kDtPadIor12 = 45 ,
  kDtPadIor13 = 46 ,
  kDtPadUsbdevUsbDp = 47 ,
  kDtPadUsbdevUsbDn = 48 ,
  kDtPadSpiHost0Sd0 = 49 ,
  kDtPadSpiHost0Sd1 = 50 ,
  kDtPadSpiHost0Sd2 = 51 ,
  kDtPadSpiHost0Sd3 = 52 ,
  kDtPadSpiDeviceSd0 = 53 ,
  kDtPadSpiDeviceSd1 = 54 ,
  kDtPadSpiDeviceSd2 = 55 ,
  kDtPadSpiDeviceSd3 = 56 ,
  kDtPadSysrstCtrlAonEcRstL = 57 ,
  kDtPadSysrstCtrlAonFlashWpL = 58 ,
  kDtPadSpiDeviceSck = 59 ,
  kDtPadSpiDeviceCsb = 60 ,
  kDtPadSpiHost0Sck = 61 ,
  kDtPadSpiHost0Csb = 62 ,
  kDtPadCount = 63
}
 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 earlgrey.

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 168 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_earlgrey_direct_pads_t dt_pinmux_direct_pad_t

Definition at line 325 of file dt_api.h.

◆ dt_pinmux_insel_t

typedef top_earlgrey_pinmux_insel_t dt_pinmux_insel_t

Definition at line 322 of file dt_api.h.

◆ dt_pinmux_mio_out_t

typedef top_earlgrey_pinmux_mio_out_t dt_pinmux_mio_out_t

Definition at line 324 of file dt_api.h.

◆ dt_pinmux_muxed_pad_t

typedef top_earlgrey_muxed_pads_t dt_pinmux_muxed_pad_t

Definition at line 326 of file dt_api.h.

◆ dt_pinmux_outsel_t

typedef top_earlgrey_pinmux_outsel_t dt_pinmux_outsel_t

Definition at line 323 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 321 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 143 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 171 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

kDtClockUsb 

clock usb

kDtClockAon 

clock aon

kDtClockIoDiv2 

clock io_div2

kDtClockIoDiv4 

clock io_div4

Definition at line 193 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.

kDtDeviceTypeAdcCtrl 

instance of adc_ctrl

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

kDtDeviceTypeEdn 

instance of edn

kDtDeviceTypeEntropySrc 

instance of entropy_src

kDtDeviceTypeFlashCtrl 

instance of flash_ctrl

kDtDeviceTypeGpio 

instance of gpio

kDtDeviceTypeHmac 

instance of hmac

kDtDeviceTypeI2c 

instance of i2c

kDtDeviceTypeKeymgr 

instance of keymgr

kDtDeviceTypeKmac 

instance of kmac

kDtDeviceTypeLcCtrl 

instance of lc_ctrl

kDtDeviceTypeOtbn 

instance of otbn

kDtDeviceTypeOtpCtrl 

instance of otp_ctrl

kDtDeviceTypeOtpMacro 

instance of otp_macro

kDtDeviceTypePattgen 

instance of pattgen

kDtDeviceTypePinmux 

instance of pinmux

kDtDeviceTypePwm 

instance of pwm

kDtDeviceTypePwrmgr 

instance of pwrmgr

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

kDtDeviceTypeSensorCtrl 

instance of sensor_ctrl

kDtDeviceTypeSpiDevice 

instance of spi_device

kDtDeviceTypeSpiHost 

instance of spi_host

kDtDeviceTypeSramCtrl 

instance of sram_ctrl

kDtDeviceTypeSysrstCtrl 

instance of sysrst_ctrl

kDtDeviceTypeUart 

instance of uart

kDtDeviceTypeUsbdev 

instance of usbdev

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.

kDtInstanceIdAdcCtrlAon 

instance adc_ctrl_aon of adc_ctrl

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

kDtInstanceIdEdn0 

instance edn0 of edn

kDtInstanceIdEdn1 

instance edn1 of edn

kDtInstanceIdEntropySrc 

instance entropy_src of entropy_src

kDtInstanceIdFlashCtrl 

instance flash_ctrl of flash_ctrl

kDtInstanceIdGpio 

instance gpio of gpio

kDtInstanceIdHmac 

instance hmac of hmac

kDtInstanceIdI2c0 

instance i2c0 of i2c

kDtInstanceIdI2c1 

instance i2c1 of i2c

kDtInstanceIdI2c2 

instance i2c2 of i2c

kDtInstanceIdKeymgr 

instance keymgr of keymgr

kDtInstanceIdKmac 

instance kmac of kmac

kDtInstanceIdLcCtrl 

instance lc_ctrl of lc_ctrl

kDtInstanceIdOtbn 

instance otbn of otbn

kDtInstanceIdOtpCtrl 

instance otp_ctrl of otp_ctrl

kDtInstanceIdOtpMacro 

instance otp_macro of otp_macro

kDtInstanceIdPattgen 

instance pattgen of pattgen

kDtInstanceIdPinmuxAon 

instance pinmux_aon of pinmux

kDtInstanceIdPwmAon 

instance pwm_aon of pwm

kDtInstanceIdPwrmgrAon 

instance pwrmgr_aon of pwrmgr

kDtInstanceIdRomCtrl 

instance rom_ctrl 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

kDtInstanceIdSensorCtrlAon 

instance sensor_ctrl_aon of sensor_ctrl

kDtInstanceIdSpiDevice 

instance spi_device of spi_device

kDtInstanceIdSpiHost0 

instance spi_host0 of spi_host

kDtInstanceIdSpiHost1 

instance spi_host1 of spi_host

kDtInstanceIdSramCtrlRetAon 

instance sram_ctrl_ret_aon of sram_ctrl

kDtInstanceIdSramCtrlMain 

instance sram_ctrl_main of sram_ctrl

kDtInstanceIdSysrstCtrlAon 

instance sysrst_ctrl_aon of sysrst_ctrl

kDtInstanceIdUart0 

instance uart0 of uart

kDtInstanceIdUart1 

instance uart1 of uart

kDtInstanceIdUart2 

instance uart2 of uart

kDtInstanceIdUart3 

instance uart3 of uart

kDtInstanceIdUsbdev 

instance usbdev of usbdev

Definition at line 77 of file dt_api.h.

◆ dt_pad

enum dt_pad

List of pads names.

Enumerator
kDtPadIoa0 

Muxed IO pad.

kDtPadIoa1 

Muxed IO pad.

kDtPadIoa2 

Muxed IO pad.

kDtPadIoa3 

Muxed IO pad.

kDtPadIoa4 

Muxed IO pad.

kDtPadIoa5 

Muxed IO pad.

kDtPadIoa6 

Muxed IO pad.

kDtPadIoa7 

Muxed IO pad.

kDtPadIoa8 

Muxed IO pad.

kDtPadIob0 

Muxed IO pad.

kDtPadIob1 

Muxed IO pad.

kDtPadIob2 

Muxed IO pad.

kDtPadIob3 

Muxed IO pad.

kDtPadIob4 

Muxed IO pad.

kDtPadIob5 

Muxed IO pad.

kDtPadIob6 

Muxed IO pad.

kDtPadIob7 

Muxed IO pad.

kDtPadIob8 

Muxed IO pad.

kDtPadIob9 

Muxed IO pad.

kDtPadIob10 

Muxed IO pad.

kDtPadIob11 

Muxed IO pad.

kDtPadIob12 

Muxed IO pad.

kDtPadIoc0 

Muxed IO pad.

kDtPadIoc1 

Muxed IO pad.

kDtPadIoc2 

Muxed IO pad.

kDtPadIoc3 

Muxed IO pad.

kDtPadIoc4 

Muxed IO pad.

kDtPadIoc5 

Muxed IO pad.

kDtPadIoc6 

Muxed IO pad.

kDtPadIoc7 

Muxed IO pad.

kDtPadIoc8 

Muxed IO pad.

kDtPadIoc9 

Muxed IO pad.

kDtPadIoc10 

Muxed IO pad.

kDtPadIoc11 

Muxed IO pad.

kDtPadIoc12 

Muxed IO pad.

kDtPadIor0 

Muxed IO pad.

kDtPadIor1 

Muxed IO pad.

kDtPadIor2 

Muxed IO pad.

kDtPadIor3 

Muxed IO pad.

kDtPadIor4 

Muxed IO pad.

kDtPadIor5 

Muxed IO pad.

kDtPadIor6 

Muxed IO pad.

kDtPadIor7 

Muxed IO pad.

kDtPadIor10 

Muxed IO pad.

kDtPadIor11 

Muxed IO pad.

kDtPadIor12 

Muxed IO pad.

kDtPadIor13 

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.

kDtPadSysrstCtrlAonEcRstL 

Dedicated sysrst_ctrl output (ec_rst_l)

kDtPadSysrstCtrlAonFlashWpL 

Dedicated sysrst_ctrl output (flash_wp_l))

kDtPadSpiDeviceSck 

SPI device clock.

kDtPadSpiDeviceCsb 

SPI device chip select.

kDtPadSpiHost0Sck 

SPI host clock.

kDtPadSpiHost0Csb 

SPI host chip select.

Definition at line 248 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 476 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 340 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 329 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.

kDtResetPorUsb 

Reset node por_usb.

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.

kDtResetLcUsb 

Reset node lc_usb.

kDtResetSys 

Reset node sys.

kDtResetSysIoDiv4 

Reset node sys_io_div4.

kDtResetSpiDevice 

Reset node spi_device.

kDtResetSpiHost0 

Reset node spi_host0.

kDtResetSpiHost1 

Reset node spi_host1.

kDtResetUsb 

Reset node usb.

kDtResetUsbAon 

Reset node usb_aon.

kDtResetI2c0 

Reset node i2c0.

kDtResetI2c1 

Reset node i2c1.

kDtResetI2c2 

Reset node i2c2.

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.