Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Inc / stm32f3xx_hal_pccard.h
blobfe633cc44f6d4c46b5d4988c5b10da06678746c9
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_hal_pccard.h
4 * @author MCD Application Team
5 * @brief Header file of PCCARD HAL module.
6 ******************************************************************************
7 * @attention
9 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ******************************************************************************
34 */
36 /* Define to prevent recursive inclusion -------------------------------------*/
37 #ifndef __STM32F3xx_HAL_PCCARD_H
38 #define __STM32F3xx_HAL_PCCARD_H
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* Includes ------------------------------------------------------------------*/
45 #if defined(STM32F302xE) || defined(STM32F303xE) || defined(STM32F398xx)
46 #include "stm32f3xx_ll_fmc.h"
48 /** @addtogroup STM32F3xx_HAL_Driver
49 * @{
52 /** @addtogroup PCCARD
53 * @{
54 */
56 /** @addtogroup PCCARD_Private_Constants
57 * @{
60 #define PCCARD_DEVICE_ADDRESS FMC_BANK4
61 #define PCCARD_ATTRIBUTE_SPACE_ADDRESS ((uint32_t)(FMC_BANK4 + 0x08000000U)) /* Attribute space size to @0x9BFF FFFF */
62 #define PCCARD_COMMON_SPACE_ADDRESS PCCARD_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */
63 #define PCCARD_IO_SPACE_ADDRESS ((uint32_t)(FMC_BANK4 + 0x0C000000U)) /* IO space size to @0x9FFF FFFF */
64 #define PCCARD_IO_SPACE_PRIMARY_ADDR ((uint32_t)(FMC_BANK4 + 0x0C0001F0U)) /* IO space size to @0x9FFF FFFF */
66 /* Compact Flash-ATA registers description */
67 #define ATA_DATA ((uint8_t)0x00U) /* Data register */
68 #define ATA_SECTOR_COUNT ((uint8_t)0x02U) /* Sector Count register */
69 #define ATA_SECTOR_NUMBER ((uint8_t)0x03U) /* Sector Number register */
70 #define ATA_CYLINDER_LOW ((uint8_t)0x04U) /* Cylinder low register */
71 #define ATA_CYLINDER_HIGH ((uint8_t)0x05U) /* Cylinder high register */
72 #define ATA_CARD_HEAD ((uint8_t)0x06U) /* Card/Head register */
73 #define ATA_STATUS_CMD ((uint8_t)0x07U) /* Status(read)/Command(write) register */
74 #define ATA_STATUS_CMD_ALTERNATE ((uint8_t)0x0EU) /* Alternate Status(read)/Command(write) register */
75 #define ATA_COMMON_DATA_AREA ((uint16_t)0x0400U) /* Start of data area (for Common access only!) */
76 #define ATA_CARD_CONFIGURATION ((uint16_t)0x0202U) /* Card Configuration and Status Register */
78 /* Compact Flash-ATA commands */
79 #define ATA_READ_SECTOR_CMD ((uint8_t)0x20U)
80 #define ATA_WRITE_SECTOR_CMD ((uint8_t)0x30U)
81 #define ATA_ERASE_SECTOR_CMD ((uint8_t)0xC0U)
82 #define ATA_IDENTIFY_CMD ((uint8_t)0xECU)
84 /* Compact Flash status */
85 #define PCCARD_TIMEOUT_ERROR ((uint8_t)0x60U)
86 #define PCCARD_BUSY ((uint8_t)0x80U)
87 #define PCCARD_PROGR ((uint8_t)0x01U)
88 #define PCCARD_READY ((uint8_t)0x40U)
90 #define PCCARD_SECTOR_SIZE (255U) /* In half words */
93 /* Compact Flash redefinition */
94 #define HAL_CF_Read_ID HAL_PCCARD_Read_ID
95 #define HAL_CF_Write_Sector HAL_PCCARD_Write_Sector
96 #define HAL_CF_Read_Sector HAL_PCCARD_Read_Sector
97 #define HAL_CF_Erase_Sector HAL_PCCARD_Erase_Sector
98 #define HAL_CF_Reset HAL_PCCARD_Reset
100 #define HAL_CF_GetStatus HAL_PCCARD_GetStatus
101 #define HAL_CF_ReadStatus HAL_PCCARD_ReadStatus
103 #define CF_SUCCESS HAL_PCCARD_STATUS_SUCCESS
104 #define CF_ONGOING HAL_PCCARD_STATUS_ONGOING
105 #define CF_ERROR HAL_PCCARD_STATUS_ERROR
106 #define CF_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT
107 #define HAL_PCCARD_StatusTypeDef HAL_PCCARD_StatusTypeDef
110 #define CF_DEVICE_ADDRESS PCCARD_DEVICE_ADDRESS
111 #define CF_ATTRIBUTE_SPACE_ADDRESS PCCARD_ATTRIBUTE_SPACE_ADDRESS
112 #define CF_COMMON_SPACE_ADDRESS PCCARD_COMMON_SPACE_ADDRESS
113 #define CF_IO_SPACE_ADDRESS PCCARD_IO_SPACE_ADDRESS
114 #define CF_IO_SPACE_PRIMARY_ADDR PCCARD_IO_SPACE_PRIMARY_ADDR
116 #define CF_TIMEOUT_ERROR PCCARD_TIMEOUT_ERROR
117 #define CF_BUSY PCCARD_BUSY
118 #define CF_PROGR PCCARD_PROGR
119 #define CF_READY PCCARD_READY
121 #define CF_SECTOR_SIZE PCCARD_SECTOR_SIZE
124 * @}
127 /* Exported typedef ----------------------------------------------------------*/
128 /** @defgroup PCCARD_Exported_Types PCCARD Exported Types
129 * @{
132 /**
133 * @brief HAL PCCARD State structures definition
135 typedef enum
137 HAL_PCCARD_STATE_RESET = 0x00U, /*!< PCCARD peripheral not yet initialized or disabled */
138 HAL_PCCARD_STATE_READY = 0x01U, /*!< PCCARD peripheral ready */
139 HAL_PCCARD_STATE_BUSY = 0x02U, /*!< PCCARD peripheral busy */
140 HAL_PCCARD_STATE_ERROR = 0x04 /*!< PCCARD peripheral error */
141 }HAL_PCCARD_StateTypeDef;
143 typedef enum
145 HAL_PCCARD_STATUS_SUCCESS = 0U,
146 HAL_PCCARD_STATUS_ONGOING,
147 HAL_PCCARD_STATUS_ERROR,
148 HAL_PCCARD_STATUS_TIMEOUT
149 }HAL_PCCARD_StatusTypeDef;
151 /**
152 * @brief FMC_PCCARD handle Structure definition
154 typedef struct
156 FMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */
158 FMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */
160 __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */
162 HAL_LockTypeDef Lock; /*!< PCCARD Lock */
164 }PCCARD_HandleTypeDef;
166 * @}
169 /* Exported constants --------------------------------------------------------*/
170 /* Exported macro ------------------------------------------------------------*/
171 /** @defgroup PCCARD_Exported_Macros PCCARD Exported Macros
172 * @{
175 /** @brief Reset PCCARD handle state
176 * @param __HANDLE__ specifies the PCCARD handle.
177 * @retval None
179 #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PCCARD_STATE_RESET)
181 * @}
184 /* Exported functions --------------------------------------------------------*/
185 /** @addtogroup PCCARD_Exported_Functions PCCARD Exported Functions
186 * @{
189 /** @addtogroup PCCARD_Exported_Functions_Group1 Initialization and de-initialization functions
190 * @{
192 /* Initialization/de-initialization functions **********************************/
193 HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming);
194 HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard);
195 void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard);
196 void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard);
198 * @}
201 /** @addtogroup PCCARD_Exported_Functions_Group2 Input Output and memory functions
202 * @{
204 /* IO operation functions *****************************************************/
205 HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus);
206 HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
207 HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
208 HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus);
209 HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard);
210 void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard);
211 void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard);
214 * @}
217 /** @defgroup PCCARD_Exported_Functions_Group3 Peripheral State functions
218 * @{
220 /* PCCARD State functions *******************************************************/
221 HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard);
222 HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard);
223 HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard);
225 * @}
229 * @}
232 * @}
236 * @}
239 #endif /* STM32F302xE || STM32F303xE || STM32F398xx */
241 #ifdef __cplusplus
243 #endif
245 #endif /* __STM32F3xx_HAL_PCCARD_H */
247 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/