Device Tables (DT) API for top earlgrey. More...
#include "hw/top/dt/dt_api.h"#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | dt_pad_desc |
| Pad description. More... | |
Macros | |
| #define | TRY_GET_PAD(pad, default) |
Typedefs | |
| typedef struct dt_pad_desc | dt_pad_desc_t |
| Pad description. | |
Enumerations | |
| enum | { kTopEarlgreyPlicIrqIdCount = kTopEarlgreyPlicIrqIdLast + 1 } |
| enum | { kTopEarlgreyAlertIdCount = kTopEarlgreyAlertIdLast + 1 } |
Functions | |
| 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. | |
| dt_device_type_t | dt_device_type (dt_instance_id_t dev) |
| Get the instance type of a device instance. | |
| 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 earlgrey.
Definition in file dt_api.c.
| struct dt_pad_desc |
Pad description.
A dt_pad_t represents a chip's physical pad.
| Data Fields | ||
|---|---|---|
| uint16_t | insel |
For kDtPadTypeMio pads: MIO pad number. This is the value to put in the MIO_PERIPH_INSEL registers to connect a peripheral to this pad. |
| uint16_t | mio_out_or_direct_pad |
For kDtPadTypeMio pads: MIO out number. This is the index of the MIO_OUTSEL register that controls this pad (or the output part of this pad). For |
| dt_pad_type_t | type | Pad type. |
| #define TRY_GET_PAD | ( | pad, | |
| default ) |
| typedef struct dt_pad_desc dt_pad_desc_t |
Pad description.
A dt_pad_t represents a chip's physical pad.
| 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.
| alert | An alert ID. |
kDtInstanceIdUnknown if the alert ID is not valid. | 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. | const dt_periph_io_t kDtPeriphIoConstantHighZ |
| const dt_periph_io_t kDtPeriphIoConstantOne |
| const dt_periph_io_t kDtPeriphIoConstantZero |