/* ================================================================== >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< ------------------------------------------------------------------ Copyright (c) 2006-2018 by Lattice Semiconductor Corporation ALL RIGHTS RESERVED ------------------------------------------------------------------ IMPORTANT: THIS FILE IS AUTO-GENERATED BY LATTICE RADIANT Software. Permission: Lattice grants permission to use this code pursuant to the terms of the Lattice Corporation Open Source License Agreement. Disclaimer: Lattice provides no warranty regarding the use or functionality of this code. It is the user's responsibility to verify the user Software design for consistency and functionality through the use of formal Software validation methods. ------------------------------------------------------------------ Lattice Semiconductor Corporation 111 SW Fifth Avenue, Suite 700 Portland, OR 97204 U.S.A Email: techsupport@latticesemi.com Web: http://www.latticesemi.com/Home/Support/SubmitSupportTicket.aspx ================================================================== */ #ifndef SPI_SLAVE_H #define SPI_SLAVE_H #include #include enum { SPI_SLAVE_IDLE=0, SPI_SLAVE_READY, SPI_SLAVE_READ, SPI_SLAVE_WRITE }; struct spis_instance { uint32_t base_addr; uint32_t data_width; uint8_t daisy_chain; uint8_t spi_cpol; uint8_t spi_cpha; uint32_t fifo_width; uint8_t ss_polarity; uint32_t *tx_buffer; uint32_t tx_size; uint8_t tx_start_flag; uint32_t *rx_buffer; uint32_t rx_size; uint8_t rx_start_flag; uint8_t status; }; static uint8_t spi_complete; uint8_t spi_slave_get_status(struct spis_instance *this_spis,uint8_t *status); uint8_t spi_slave_init(struct spis_instance *this_spis, uint32_t base_addr, uint32_t data_width, uint8_t clock_polarity, uint8_t clock_phase, uint32_t fifo_width, uint8_t daisy_chain, uint8_t ss_polarity,uint32_t *slave_tx_buf,uint32_t *slave_rx_buf); uint8_t spi_slave_config(struct spis_instance *this_spis, uint32_t data_width, uint8_t clock_polarity, uint8_t clock_phase, uint8_t daisy_chain, uint8_t ss_polarity); void spi_slave_callback(struct spis_instance *this_spis); void spi_slave_isr(void *ctx); uint8_t spi_slave_data_read(struct spis_instance *this_spis,uint32_t *data,uint8_t length); uint8_t spi_slave_data_write(struct spis_instance *this_spis,uint32_t *data,uint8_t length); #endif