1 // Copyright 2015-2019 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 
17 #define SPI_FUNC_NUM            0
18 #define SPI_IOMUX_PIN_NUM_HD    27
19 #define SPI_IOMUX_PIN_NUM_CS    29
20 #define SPI_IOMUX_PIN_NUM_MOSI  32
21 #define SPI_IOMUX_PIN_NUM_CLK   30
22 #define SPI_IOMUX_PIN_NUM_MISO  31
23 #define SPI_IOMUX_PIN_NUM_WP    28
24 
25 // There are 2 sets of GPIO pins which could be routed to FSPICS0, FSPICLK, FSPID, FSPIQ, FSPIHD, FSPIWP.
26 // However, there is only one set of GPIO pins which could be routed to FSPIIO4, FSPIIO5, FSPIIO6, FSPIIO7.
27 // As default (when we are not going to use Octal SPI), we make use of SPI2_FUNC_NUM to route one of the 2 sets of GPIO pins to FSPICS0 ~ FSPIWP as follows.
28 #define SPI2_FUNC_NUM           4
29 #define SPI2_IOMUX_PIN_NUM_HD   9
30 #define SPI2_IOMUX_PIN_NUM_CS   10
31 #define SPI2_IOMUX_PIN_NUM_MOSI 11
32 #define SPI2_IOMUX_PIN_NUM_CLK  12
33 #define SPI2_IOMUX_PIN_NUM_MISO 13
34 #define SPI2_IOMUX_PIN_NUM_WP   14
35 
36 // When using Octal SPI, we make use of SPI2_FUNC_NUM_OCT to route them as follows.
37 #define SPI2_FUNC_NUM_OCT           2
38 #define SPI2_IOMUX_PIN_NUM_HD_OCT   33
39 #define SPI2_IOMUX_PIN_NUM_CS_OCT   34
40 #define SPI2_IOMUX_PIN_NUM_MOSI_OCT 35
41 #define SPI2_IOMUX_PIN_NUM_CLK_OCT  36
42 #define SPI2_IOMUX_PIN_NUM_MISO_OCT 37
43 #define SPI2_IOMUX_PIN_NUM_WP_OCT   38
44 #define SPI2_IOMUX_PIN_NUM_IO4_OCT  10
45 #define SPI2_IOMUX_PIN_NUM_IO5_OCT  11
46 #define SPI2_IOMUX_PIN_NUM_IO6_OCT  12
47 #define SPI2_IOMUX_PIN_NUM_IO7_OCT  13
48 
49 //SPI3 has no iomux pins
50 
51 //Following Macros are deprecated. Please use the Macros above
52 #define FSPI_FUNC_NUM           SPI2_FUNC_NUM
53 #define FSPI_IOMUX_PIN_NUM_HD   SPI2_IOMUX_PIN_NUM_HD
54 #define FSPI_IOMUX_PIN_NUM_CS   SPI2_IOMUX_PIN_NUM_CS
55 #define FSPI_IOMUX_PIN_NUM_MOSI SPI2_IOMUX_PIN_NUM_MOSI
56 #define FSPI_IOMUX_PIN_NUM_CLK  SPI2_IOMUX_PIN_NUM_CLK
57 #define FSPI_IOMUX_PIN_NUM_MISO SPI2_IOMUX_PIN_NUM_MISO
58 #define FSPI_IOMUX_PIN_NUM_WP   SPI2_IOMUX_PIN_NUM_WP
59