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 #endif 35 36 #if CONFIG_IDF_TARGET_ESP32S2 37 #define SPI_FREAD_DIO 0 38 #define SPI_FREAD_QIO 0 39 #define SPI_FWRITE_DIO 0 40 #define SPI_FWRITE_QIO 0 41 #endif 42 43 /* 44 Stores a bunch of per-spi-peripheral data. 45 */ 46 typedef struct { 47 const uint8_t spiclk_out; //GPIO mux output signals 48 const uint8_t spiclk_in; 49 const uint8_t spid_out; 50 const uint8_t spiq_out; 51 const uint8_t spiwp_out; 52 const uint8_t spihd_out; 53 #if SOC_SPI_SUPPORT_OCT 54 const uint8_t spid4_out; 55 const uint8_t spid5_out; 56 const uint8_t spid6_out; 57 const uint8_t spid7_out; 58 #endif // SOC_SPI_SUPPORT_OCT 59 const uint8_t spid_in; //GPIO mux input signals 60 const uint8_t spiq_in; 61 const uint8_t spiwp_in; 62 const uint8_t spihd_in; 63 #if SOC_SPI_SUPPORT_OCT 64 const uint8_t spid4_in; 65 const uint8_t spid5_in; 66 const uint8_t spid6_in; 67 const uint8_t spid7_in; 68 #endif // SOC_SPI_SUPPORT_OCT 69 const uint8_t spics_out[3]; // /CS GPIO output mux signals 70 const uint8_t spics_in; 71 const uint8_t spidqs_out; 72 const uint8_t spicd_out; 73 const uint8_t spiclk_iomux_pin; //IO pins of IO_MUX muxed signals 74 const uint8_t spid_iomux_pin; 75 const uint8_t spiq_iomux_pin; 76 const uint8_t spiwp_iomux_pin; 77 const uint8_t spihd_iomux_pin; 78 const uint8_t spics0_iomux_pin; 79 const uint8_t irq; //irq source for interrupt mux 80 const uint8_t irq_dma; //dma irq source for interrupt mux 81 const periph_module_t module; //peripheral module, for enabling clock etc 82 const int func; //function number for IOMUX 83 spi_dev_t *hw; //Pointer to the hardware registers 84 } spi_signal_conn_t; 85 86 extern const spi_signal_conn_t spi_periph_signal[SOC_SPI_PERIPH_NUM]; 87 88 #ifdef __cplusplus 89 } 90 #endif 91