Logging of the S -term values in blackbox for Fixed wings. (#14012)
[betaflight.git] / src / main / drivers / bus_quadspi_impl.h
blobeda709b9186766c517de255455eb28e9c3ad8f31
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
20 * Author: Dominic Clifton
23 #pragma once
25 typedef struct quadSpiPinDef_s {
26 ioTag_t pin;
27 #if defined(STM32H7)
28 uint8_t af;
29 #endif
30 } quadSpiPinDef_t;
32 #if defined(STM32H7)
33 #define MAX_QUADSPI_PIN_SEL 3
34 #endif
36 typedef struct quadSpiHardware_s {
37 QUADSPIDevice device;
38 QUADSPI_TypeDef *reg;
39 quadSpiPinDef_t clkPins[MAX_QUADSPI_PIN_SEL];
40 quadSpiPinDef_t bk1IO0Pins[MAX_QUADSPI_PIN_SEL];
41 quadSpiPinDef_t bk1IO1Pins[MAX_QUADSPI_PIN_SEL];
42 quadSpiPinDef_t bk1IO2Pins[MAX_QUADSPI_PIN_SEL];
43 quadSpiPinDef_t bk1IO3Pins[MAX_QUADSPI_PIN_SEL];
44 quadSpiPinDef_t bk1CSPins[MAX_QUADSPI_PIN_SEL];
45 quadSpiPinDef_t bk2IO0Pins[MAX_QUADSPI_PIN_SEL];
46 quadSpiPinDef_t bk2IO1Pins[MAX_QUADSPI_PIN_SEL];
47 quadSpiPinDef_t bk2IO2Pins[MAX_QUADSPI_PIN_SEL];
48 quadSpiPinDef_t bk2IO3Pins[MAX_QUADSPI_PIN_SEL];
49 quadSpiPinDef_t bk2CSPins[MAX_QUADSPI_PIN_SEL];
51 rccPeriphTag_t rcc;
52 } quadSpiHardware_t;
54 extern const quadSpiHardware_t quadSpiHardware[];
56 typedef struct QUADSPIDevice_s {
57 QUADSPI_TypeDef *dev;
58 ioTag_t clk;
59 ioTag_t bk1IO0;
60 ioTag_t bk1IO1;
61 ioTag_t bk1IO2;
62 ioTag_t bk1IO3;
63 ioTag_t bk1CS;
64 ioTag_t bk2IO0;
65 ioTag_t bk2IO1;
66 ioTag_t bk2IO2;
67 ioTag_t bk2IO3;
68 ioTag_t bk2CS;
69 #if defined(STM32H7)
70 uint8_t bk1IO0AF;
71 uint8_t bk1IO1AF;
72 uint8_t bk1IO2AF;
73 uint8_t bk1IO3AF;
74 uint8_t bk1CSAF;
75 uint8_t bk2IO0AF;
76 uint8_t bk2IO1AF;
77 uint8_t bk2IO2AF;
78 uint8_t bk2IO3AF;
79 uint8_t bk2CSAF;
80 #endif
81 rccPeriphTag_t rcc;
82 volatile uint16_t errorCount;
83 #if defined(USE_HAL_DRIVER)
84 QSPI_HandleTypeDef hquadSpi;
85 #endif
86 } quadSpiDevice_t;
88 extern quadSpiDevice_t quadSpiDevice[QUADSPIDEV_COUNT];
90 void quadSpiInitDevice(QUADSPIDevice device);
91 uint32_t quadSpiTimeoutUserCallback(QUADSPI_TypeDef *instance);