Device Tables (DT) API for top englishbreakfast. More...
#include <stddef.h>
#include <stdint.h>
#include "hw/top_englishbreakfast/sw/autogen/top_englishbreakfast.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 |
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. | |
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 |
Device Tables (DT) API for top englishbreakfast.
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.
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.
Data Fields | ||
---|---|---|
struct dt_periph_io | __internal | Private fields. |
struct dt_periph_io | __internal | Private fields. |
struct dt_periph_io.__internal | __internal | Private fields. |
struct dt_periph_io.__internal |
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 |
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 |
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 |
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 |
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 |
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 |
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 enum dt_clock dt_clock_t |
List of clocks.
Clocks are guaranteed to be numbered consecutively from 0.
typedef enum dt_device_type dt_device_type_t |
List of device types.
Device types are guaranteed to be numbered consecutively from 0.
typedef enum dt_instance_id dt_instance_id_t |
List of instance IDs.
Instance IDs are guaranteed to be numbered consecutively from 0.
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.
typedef top_englishbreakfast_direct_pads_t dt_pinmux_direct_pad_t |
typedef top_englishbreakfast_pinmux_insel_t dt_pinmux_insel_t |
typedef top_englishbreakfast_pinmux_mio_out_t dt_pinmux_mio_out_t |
typedef top_englishbreakfast_muxed_pads_t dt_pinmux_muxed_pad_t |
typedef top_englishbreakfast_pinmux_outsel_t dt_pinmux_outsel_t |
typedef enum dt_reset dt_reset_t |
List of resets.
Resets are guaranteed to be numbered consecutively from 0.
enum dt_clock |
enum dt_device_type |
List of device types.
Device types are guaranteed to be numbered consecutively from 0.
enum dt_instance_id |
List of instance IDs.
Instance IDs are guaranteed to be numbered consecutively from 0.
enum dt_pad |
List of pads names.
enum dt_pad_type |
enum dt_periph_io_dir |
enum dt_periph_io_type |
enum dt_reset |
List of resets.
Resets are guaranteed to be numbered consecutively from 0.
uint32_t dt_clock_frequency | ( | dt_clock_t | clk | ) |
Get the frequency of a clock.
clk | A clock ID. |
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.
pad | A pad of type kDtPadTypeDio . |
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.
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.
pad | A pad of type kDtPadTypeMio . |
Note: This function only makes sense for pads of type kDtPadTypeMio
. For any other pad, the return value is unspecified.
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).
pad | A pad of type kDtPadTypeMio . |
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.
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).
pad | A pad of type kDtPadTypeMio . |
Note: This function only makes sense for pads of type kDtPadTypeMio
. For any other pad, the return value is unspecified.
dt_pad_type_t dt_pad_type | ( | dt_pad_t | pad | ) |
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.
irq | A PLIC ID. |
kDtInstanceIdUnknown
if the PLIC ID is not valid.
|
extern |
|
extern |
|
extern |