1 // Copyright 2015-2018 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 #include <stdint.h> 17 #include "sdkconfig.h" 18 #include "soc/soc.h" 19 #include "soc/periph_defs.h" 20 21 //include soc related (generated) definitions 22 #include "soc/soc_caps.h" 23 #include "soc/soc_pins.h" 24 #include "soc/spi_reg.h" 25 #include "soc/spi_struct.h" 26 #include "soc/gpio_sig_map.h" 27 #if SOC_MEMSPI_IS_INDEPENDENT 28 #include "soc/spi_mem_struct.h" 29 #include "soc/spi_mem_reg.h" 30 #endif 31 32 #ifdef __cplusplus 33 extern "C" 34 { 35 #endif 36 37 #if CONFIG_IDF_TARGET_ESP32S2 38 #define SPI_FREAD_DIO 0 39 #define SPI_FREAD_QIO 0 40 #define SPI_FWRITE_DIO 0 41 #define SPI_FWRITE_QIO 0 42 #endif 43 44 45 46 /* 47 Stores a bunch of per-spi-peripheral data. 48 */ 49 typedef struct { 50 const uint8_t spiclk_out; //GPIO mux output signals 51 const uint8_t spiclk_in; 52 const uint8_t spid_out; 53 const uint8_t spiq_out; 54 const uint8_t spiwp_out; 55 const uint8_t spihd_out; 56 const uint8_t spid_in; //GPIO mux input signals 57 const uint8_t spiq_in; 58 const uint8_t spiwp_in; 59 const uint8_t spihd_in; 60 const uint8_t spics_out[3]; // /CS GPIO output mux signals 61 const uint8_t spics_in; 62 const uint8_t spidqs_out; 63 const uint8_t spicd_out; 64 const uint8_t spiclk_iomux_pin; //IO pins of IO_MUX muxed signals 65 const uint8_t spid_iomux_pin; 66 const uint8_t spiq_iomux_pin; 67 const uint8_t spiwp_iomux_pin; 68 const uint8_t spihd_iomux_pin; 69 const uint8_t spics0_iomux_pin; 70 const uint8_t irq; //irq source for interrupt mux 71 const uint8_t irq_dma; //dma irq source for interrupt mux 72 const periph_module_t module; //peripheral module, for enabling clock etc 73 const int func; //function number for IOMUX 74 spi_dev_t *hw; //Pointer to the hardware registers 75 } spi_signal_conn_t; 76 77 extern const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM]; 78 79 #ifdef __cplusplus 80 } 81 #endif 82