| /* |
| * Copyright 2023 Google LLC |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| #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_ |