| // Copyright 2023 Google LLC |
| #ifndef SW_DEVICE_LIB_SPI_TO_HOST_SPI_TO_HOST_H_ |
| #define SW_DEVICE_LIB_SPI_TO_HOST_SPI_TO_HOST_H_ |
| |
| #include "sw/device/lib/dif/dif_gpio.h" |
| #include "sw/device/lib/dif/dif_rv_plic.h" |
| #include "sw/device/lib/dif/dif_spi_device.h" |
| #include "sw/device/lib/testing/test_framework/check.h" |
| |
| #if defined(__cplusplus) |
| extern "C" { |
| #endif |
| |
| typedef struct spi_to_host { |
| dif_spi_device_handle_t* spi_device; |
| dif_gpio_t* gpio; |
| dif_gpio_pin_t gpio_pin; |
| } spi_to_host_t; |
| |
| dif_result_t spi_to_host_init(spi_to_host_t* spi_to_host, |
| dif_spi_device_handle_t* spi_device, |
| dif_gpio_t* gpio, dif_gpio_pin_t gpio_pin); |
| dif_result_t spi_to_host_irq_init(spi_to_host_t* spi_to_host, |
| dif_rv_plic_t* rv_plic, |
| dif_rv_plic_target_t target); |
| dif_result_t spi_to_host_irq_handler(spi_to_host_t* spi_to_host, |
| dif_rv_plic_irq_id_t plic_irq_id); |
| |
| #if defined(__cplusplus) |
| } |
| #endif |
| |
| #endif // SW_DEVICE_LIB_SPI_TO_HOST_SPI_TO_HOST_H_ |