Software APIs
i3c.h File Reference

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

#include "hw/top/dt/api.h"
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef enum dt_i3c dt_i3c_t
 List of instances.
 
typedef enum dt_i3c_reg_block dt_i3c_reg_block_t
 List of register blocks.
 
typedef enum dt_i3c_irq dt_i3c_irq_t
 List of IRQs.
 
typedef enum dt_i3c_alert dt_i3c_alert_t
 List of Alerts.
 
typedef enum dt_i3c_clock dt_i3c_clock_t
 List of clock ports.
 
typedef enum dt_i3c_reset dt_i3c_reset_t
 List of reset ports.
 
typedef enum dt_i3c_periph_io dt_i3c_periph_io_t
 List of peripheral I/O.
 
typedef enum dt_i3c_wakeup dt_i3c_wakeup_t
 List of wakeups.
 

Enumerations

enum  dt_i3c {
  kDtI3cFirst = 0 ,
  kDtI3c0 = 0 ,
  kDtI3c1 = 1
}
 List of instances. More...
 
enum  { kDtI3cCount = 2 }
 
enum  dt_i3c_reg_block { kDtI3cRegBlockCore = 0 }
 List of register blocks. More...
 
enum  { kDtI3cRegBlockCount = 1 }
 
enum  dt_i3c_irq {
  kDtI3cIrqHci = 0 ,
  kDtI3cIrqTarg = 1
}
 List of IRQs. More...
 
enum  { kDtI3cIrqCount = 2 }
 
enum  dt_i3c_alert { kDtI3cAlertFatalFault = 0 }
 List of Alerts. More...
 
enum  { kDtI3cAlertCount = 1 }
 
enum  dt_i3c_clock {
  kDtI3cClockClk = 0 ,
  kDtI3cClockAon = 1
}
 List of clock ports. More...
 
enum  { kDtI3cClockCount = 2 }
 
enum  dt_i3c_reset {
  kDtI3cResetRst = 0 ,
  kDtI3cResetAon = 1
}
 List of reset ports. More...
 
enum  { kDtI3cResetCount = 2 }
 
enum  dt_i3c_periph_io {
  kDtI3cPeriphIoRstdetScl = 0 ,
  kDtI3cPeriphIoRstdetSda = 1 ,
  kDtI3cPeriphIoCtrlSdaPu = 2 ,
  kDtI3cPeriphIoScl = 3 ,
  kDtI3cPeriphIoSda = 4
}
 List of peripheral I/O. More...
 
enum  { kDtI3cPeriphIoCount = 5 }
 
enum  dt_i3c_wakeup { kDtI3cWakeupRstdetWkupReq = 0 }
 List of wakeups. More...
 
enum  { kDtI3cWakeupCount = 1 }
 

Functions

dt_i3c_t dt_i3c_from_instance_id (dt_instance_id_t inst_id)
 Get the i3c instance from an instance ID.
 
dt_instance_id_t dt_i3c_instance_id (dt_i3c_t dt)
 Get the instance ID of an instance.
 
uint32_t dt_i3c_reg_block (dt_i3c_t dt, dt_i3c_reg_block_t reg_block)
 Get the register base address of an instance.
 
dt_plic_irq_id_t dt_i3c_irq_to_plic_id (dt_i3c_t dt, dt_i3c_irq_t irq)
 Get the PLIC ID of a i3c IRQ for a given instance.
 
dt_i3c_irq_t dt_i3c_irq_from_plic_id (dt_i3c_t dt, dt_plic_irq_id_t irq)
 Convert a global IRQ ID to a local i3c IRQ type.
 
dt_alert_id_t dt_i3c_alert_to_alert_id (dt_i3c_t dt, dt_i3c_alert_t alert)
 Get the alert ID of a i3c alert for a given instance.
 
dt_i3c_alert_t dt_i3c_alert_from_alert_id (dt_i3c_t dt, dt_alert_id_t alert)
 Convert a global alert ID to a local i3c alert type.
 
dt_periph_io_t dt_i3c_periph_io (dt_i3c_t dt, dt_i3c_periph_io_t sig)
 Get the peripheral I/O description of an instance.
 
dt_clock_t dt_i3c_clock (dt_i3c_t dt, dt_i3c_clock_t clk)
 Get the clock signal connected to a clock port of an instance.
 
dt_reset_t dt_i3c_reset (dt_i3c_t dt, dt_i3c_reset_t rst)
 Get the reset signal connected to a reset port of an instance.
 

Detailed Description

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

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

Definition in file i3c.h.

Typedef Documentation

◆ dt_i3c_alert_t

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

◆ dt_i3c_clock_t

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

◆ dt_i3c_irq_t

typedef enum dt_i3c_irq dt_i3c_irq_t

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

◆ dt_i3c_periph_io_t

List of peripheral I/O.

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

◆ dt_i3c_reg_block_t

List of register blocks.

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

◆ dt_i3c_reset_t

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

◆ dt_i3c_wakeup_t

List of wakeups.

Wakeups are guaranteed to be numbered consecutively from 0.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cIrqCount 

Number of IRQs.

Definition at line 67 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cCount 

Number of instances.

Definition at line 35 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cResetCount 

Number of reset ports.

Definition at line 111 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cWakeupCount 

Number of wakeups.

Definition at line 143 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cAlertCount 

Number of Alerts.

Definition at line 81 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cRegBlockCount 

Number of register blocks.

Definition at line 49 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cClockCount 

Number of clock ports.

Definition at line 96 of file i3c.h.

◆ anonymous enum

anonymous enum
Enumerator
kDtI3cPeriphIoCount 

Number of peripheral I/O.

Definition at line 129 of file i3c.h.

◆ dt_i3c

enum dt_i3c

List of instances.

Enumerator
kDtI3cFirst 

First instance.

kDtI3c0 

i3c0

kDtI3c1 

i3c1

Definition at line 29 of file i3c.h.

◆ dt_i3c_alert

List of Alerts.

Alerts are guaranteed to be numbered consecutively from 0.

Enumerator
kDtI3cAlertFatalFault 

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

Definition at line 77 of file i3c.h.

◆ dt_i3c_clock

List of clock ports.

Clock ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtI3cClockClk 

Clock port clk_i.

kDtI3cClockAon 

Clock port clk_aon_i.

Definition at line 91 of file i3c.h.

◆ dt_i3c_irq

enum dt_i3c_irq

List of IRQs.

IRQs are guaranteed to be numbered consecutively from 0.

Enumerator
kDtI3cIrqHci 

HCI interrupt.

kDtI3cIrqTarg 

Target interrupt.

Definition at line 62 of file i3c.h.

◆ dt_i3c_periph_io

List of peripheral I/O.

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

Definition at line 121 of file i3c.h.

◆ dt_i3c_reg_block

List of register blocks.

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

Definition at line 45 of file i3c.h.

◆ dt_i3c_reset

List of reset ports.

Reset ports are guaranteed to be numbered consecutively from 0.

Enumerator
kDtI3cResetRst 

Reset port rst_ni.

kDtI3cResetAon 

Reset port rst_aon_ni.

Definition at line 106 of file i3c.h.

◆ dt_i3c_wakeup

List of wakeups.

Wakeups are guaranteed to be numbered consecutively from 0.

Enumerator
kDtI3cWakeupRstdetWkupReq 

Wake-up request on detection of the Target Reset Pattern (running on AON clock).

Definition at line 139 of file i3c.h.

Function Documentation

◆ dt_i3c_alert_from_alert_id()

dt_i3c_alert_t dt_i3c_alert_from_alert_id ( dt_i3c_t dt,
dt_alert_id_t alert )

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

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

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

Definition at line 218 of file i3c.c.

◆ dt_i3c_alert_to_alert_id()

dt_alert_id_t dt_i3c_alert_to_alert_id ( dt_i3c_t dt,
dt_i3c_alert_t alert )

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

Definition at line 212 of file i3c.c.

◆ dt_i3c_clock()

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

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

Definition at line 236 of file i3c.c.

◆ dt_i3c_from_instance_id()

dt_i3c_t dt_i3c_from_instance_id ( dt_instance_id_t inst_id)

Get the i3c instance from an instance ID.

For example, dt_uart_from_instance_id(kDtInstanceIdUart3) == kDtUart3.

Parameters
inst_idInstance ID.
Returns
A i3c instance.

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

Definition at line 168 of file i3c.c.

◆ dt_i3c_instance_id()

dt_instance_id_t dt_i3c_instance_id ( dt_i3c_t dt)

Get the instance ID of an instance.

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

Definition at line 175 of file i3c.c.

◆ dt_i3c_irq_from_plic_id()

dt_i3c_irq_t dt_i3c_irq_from_plic_id ( dt_i3c_t dt,
dt_plic_irq_id_t irq )

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

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

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

Definition at line 197 of file i3c.c.

◆ dt_i3c_irq_to_plic_id()

dt_plic_irq_id_t dt_i3c_irq_to_plic_id ( dt_i3c_t dt,
dt_i3c_irq_t irq )

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

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

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

Definition at line 187 of file i3c.c.

◆ dt_i3c_periph_io()

Get the peripheral I/O description of an instance.

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

Definition at line 229 of file i3c.c.

◆ dt_i3c_reg_block()

uint32_t dt_i3c_reg_block ( dt_i3c_t dt,
dt_i3c_reg_block_t reg_block )

Get the register base address of an instance.

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

Definition at line 180 of file i3c.c.

◆ dt_i3c_reset()

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

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

Definition at line 243 of file i3c.c.