Mercurial > public > ostc4
comparison Common/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pccard.h @ 160:e3ca52b8e7fa
Merge with FlipDisplay
author | heinrichsweikamp |
---|---|
date | Thu, 07 Mar 2019 15:06:43 +0100 |
parents | c78bcbd5deda |
children |
comparison
equal
deleted
inserted
replaced
80:cc2bb7bb8456 | 160:e3ca52b8e7fa |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file stm32f4xx_hal_pccard.h | |
4 * @author MCD Application Team | |
5 * @brief Header file of PCCARD HAL module. | |
6 ****************************************************************************** | |
7 * @attention | |
8 * | |
9 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> | |
10 * | |
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. | |
21 * | |
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. | |
32 * | |
33 ****************************************************************************** | |
34 */ | |
35 | |
36 /* Define to prevent recursive inclusion -------------------------------------*/ | |
37 #ifndef __STM32F4xx_HAL_PCCARD_H | |
38 #define __STM32F4xx_HAL_PCCARD_H | |
39 | |
40 #ifdef __cplusplus | |
41 extern "C" { | |
42 #endif | |
43 | |
44 /* Includes ------------------------------------------------------------------*/ | |
45 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) | |
46 #include "stm32f4xx_ll_fsmc.h" | |
47 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ | |
48 | |
49 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) | |
50 #include "stm32f4xx_ll_fmc.h" | |
51 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ | |
52 | |
53 /** @addtogroup STM32F4xx_HAL_Driver | |
54 * @{ | |
55 */ | |
56 | |
57 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ | |
58 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) | |
59 | |
60 /** @addtogroup PCCARD | |
61 * @{ | |
62 */ | |
63 | |
64 /* Exported typedef ----------------------------------------------------------*/ | |
65 /** @defgroup PCCARD_Exported_Types PCCARD Exported Types | |
66 * @{ | |
67 */ | |
68 | |
69 /** | |
70 * @brief HAL PCCARD State structures definition | |
71 */ | |
72 typedef enum | |
73 { | |
74 HAL_PCCARD_STATE_RESET = 0x00U, /*!< PCCARD peripheral not yet initialized or disabled */ | |
75 HAL_PCCARD_STATE_READY = 0x01U, /*!< PCCARD peripheral ready */ | |
76 HAL_PCCARD_STATE_BUSY = 0x02U, /*!< PCCARD peripheral busy */ | |
77 HAL_PCCARD_STATE_ERROR = 0x04U /*!< PCCARD peripheral error */ | |
78 }HAL_PCCARD_StateTypeDef; | |
79 | |
80 typedef enum | |
81 { | |
82 HAL_PCCARD_STATUS_SUCCESS = 0U, | |
83 HAL_PCCARD_STATUS_ONGOING, | |
84 HAL_PCCARD_STATUS_ERROR, | |
85 HAL_PCCARD_STATUS_TIMEOUT | |
86 }HAL_PCCARD_StatusTypeDef; | |
87 | |
88 /** | |
89 * @brief FMC_PCCARD handle Structure definition | |
90 */ | |
91 typedef struct | |
92 { | |
93 FMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */ | |
94 | |
95 FMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */ | |
96 | |
97 __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */ | |
98 | |
99 HAL_LockTypeDef Lock; /*!< PCCARD Lock */ | |
100 | |
101 }PCCARD_HandleTypeDef; | |
102 /** | |
103 * @} | |
104 */ | |
105 | |
106 /* Exported constants --------------------------------------------------------*/ | |
107 /* Exported macro ------------------------------------------------------------*/ | |
108 /** @defgroup PCCARD_Exported_Macros PCCARD Exported Macros | |
109 * @{ | |
110 */ | |
111 /** @brief Reset PCCARD handle state | |
112 * @param __HANDLE__ specifies the PCCARD handle. | |
113 * @retval None | |
114 */ | |
115 #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PCCARD_STATE_RESET) | |
116 /** | |
117 * @} | |
118 */ | |
119 | |
120 /* Exported functions --------------------------------------------------------*/ | |
121 /** @addtogroup PCCARD_Exported_Functions | |
122 * @{ | |
123 */ | |
124 | |
125 /** @addtogroup PCCARD_Exported_Functions_Group1 | |
126 * @{ | |
127 */ | |
128 /* Initialization/de-initialization functions **********************************/ | |
129 HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming); | |
130 HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard); | |
131 void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard); | |
132 void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard); | |
133 /** | |
134 * @} | |
135 */ | |
136 | |
137 /** @addtogroup PCCARD_Exported_Functions_Group2 | |
138 * @{ | |
139 */ | |
140 /* IO operation functions *****************************************************/ | |
141 HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus); | |
142 HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); | |
143 HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); | |
144 HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus); | |
145 HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard); | |
146 void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard); | |
147 void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard); | |
148 | |
149 /** | |
150 * @} | |
151 */ | |
152 | |
153 /** @addtogroup PCCARD_Exported_Functions_Group3 | |
154 * @{ | |
155 */ | |
156 /* PCCARD State functions *******************************************************/ | |
157 HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard); | |
158 HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard); | |
159 HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard); | |
160 /** | |
161 * @} | |
162 */ | |
163 | |
164 /** | |
165 * @} | |
166 */ | |
167 /* Private types -------------------------------------------------------------*/ | |
168 /* Private variables ---------------------------------------------------------*/ | |
169 /* Private constants ---------------------------------------------------------*/ | |
170 /** @defgroup PCCARD_Private_Constants PCCARD Private Constants | |
171 * @{ | |
172 */ | |
173 #define PCCARD_DEVICE_ADDRESS 0x90000000U | |
174 #define PCCARD_ATTRIBUTE_SPACE_ADDRESS 0x98000000U /* Attribute space size to @0x9BFF FFFF */ | |
175 #define PCCARD_COMMON_SPACE_ADDRESS PCCARD_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */ | |
176 #define PCCARD_IO_SPACE_ADDRESS 0x9C000000U /* IO space size to @0x9FFF FFFF */ | |
177 #define PCCARD_IO_SPACE_PRIMARY_ADDR 0x9C0001F0U /* IO space size to @0x9FFF FFFF */ | |
178 | |
179 /* Flash-ATA registers description */ | |
180 #define ATA_DATA ((uint8_t)0x00) /* Data register */ | |
181 #define ATA_SECTOR_COUNT ((uint8_t)0x02) /* Sector Count register */ | |
182 #define ATA_SECTOR_NUMBER ((uint8_t)0x03) /* Sector Number register */ | |
183 #define ATA_CYLINDER_LOW ((uint8_t)0x04) /* Cylinder low register */ | |
184 #define ATA_CYLINDER_HIGH ((uint8_t)0x05) /* Cylinder high register */ | |
185 #define ATA_CARD_HEAD ((uint8_t)0x06) /* Card/Head register */ | |
186 #define ATA_STATUS_CMD ((uint8_t)0x07) /* Status(read)/Command(write) register */ | |
187 #define ATA_STATUS_CMD_ALTERNATE ((uint8_t)0x0E) /* Alternate Status(read)/Command(write) register */ | |
188 #define ATA_COMMON_DATA_AREA ((uint16_t)0x0400) /* Start of data area (for Common access only!) */ | |
189 #define ATA_CARD_CONFIGURATION ((uint16_t)0x0202) /* Card Configuration and Status Register */ | |
190 | |
191 /* Flash-ATA commands */ | |
192 #define ATA_READ_SECTOR_CMD ((uint8_t)0x20) | |
193 #define ATA_WRITE_SECTOR_CMD ((uint8_t)0x30) | |
194 #define ATA_ERASE_SECTOR_CMD ((uint8_t)0xC0) | |
195 #define ATA_IDENTIFY_CMD ((uint8_t)0xEC) | |
196 | |
197 /* PC Card/Compact Flash status */ | |
198 #define PCCARD_TIMEOUT_ERROR ((uint8_t)0x60) | |
199 #define PCCARD_BUSY ((uint8_t)0x80) | |
200 #define PCCARD_PROGR ((uint8_t)0x01) | |
201 #define PCCARD_READY ((uint8_t)0x40) | |
202 | |
203 #define PCCARD_SECTOR_SIZE 255U /* In half words */ | |
204 | |
205 /** | |
206 * @} | |
207 */ | |
208 /* Compact Flash redefinition */ | |
209 #define HAL_CF_Init HAL_PCCARD_Init | |
210 #define HAL_CF_DeInit HAL_PCCARD_DeInit | |
211 #define HAL_CF_MspInit HAL_PCCARD_MspInit | |
212 #define HAL_CF_MspDeInit HAL_PCCARD_MspDeInit | |
213 | |
214 #define HAL_CF_Read_ID HAL_PCCARD_Read_ID | |
215 #define HAL_CF_Write_Sector HAL_PCCARD_Write_Sector | |
216 #define HAL_CF_Read_Sector HAL_PCCARD_Read_Sector | |
217 #define HAL_CF_Erase_Sector HAL_PCCARD_Erase_Sector | |
218 #define HAL_CF_Reset HAL_PCCARD_Reset | |
219 #define HAL_CF_IRQHandler HAL_PCCARD_IRQHandler | |
220 #define HAL_CF_ITCallback HAL_PCCARD_ITCallback | |
221 | |
222 #define HAL_CF_GetState HAL_PCCARD_GetState | |
223 #define HAL_CF_GetStatus HAL_PCCARD_GetStatus | |
224 #define HAL_CF_ReadStatus HAL_PCCARD_ReadStatus | |
225 | |
226 #define HAL_CF_STATUS_SUCCESS HAL_PCCARD_STATUS_SUCCESS | |
227 #define HAL_CF_STATUS_ONGOING HAL_PCCARD_STATUS_ONGOING | |
228 #define HAL_CF_STATUS_ERROR HAL_PCCARD_STATUS_ERROR | |
229 #define HAL_CF_STATUS_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT | |
230 #define HAL_CF_StatusTypeDef HAL_PCCARD_StatusTypeDef | |
231 | |
232 #define CF_DEVICE_ADDRESS PCCARD_DEVICE_ADDRESS | |
233 #define CF_ATTRIBUTE_SPACE_ADDRESS PCCARD_ATTRIBUTE_SPACE_ADDRESS | |
234 #define CF_COMMON_SPACE_ADDRESS PCCARD_COMMON_SPACE_ADDRESS | |
235 #define CF_IO_SPACE_ADDRESS PCCARD_IO_SPACE_ADDRESS | |
236 #define CF_IO_SPACE_PRIMARY_ADDR PCCARD_IO_SPACE_PRIMARY_ADDR | |
237 | |
238 #define CF_TIMEOUT_ERROR PCCARD_TIMEOUT_ERROR | |
239 #define CF_BUSY PCCARD_BUSY | |
240 #define CF_PROGR PCCARD_PROGR | |
241 #define CF_READY PCCARD_READY | |
242 | |
243 #define CF_SECTOR_SIZE PCCARD_SECTOR_SIZE | |
244 | |
245 /* Private macros ------------------------------------------------------------*/ | |
246 /** | |
247 * @} | |
248 */ | |
249 | |
250 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ | |
251 STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ | |
252 | |
253 | |
254 /** | |
255 * @} | |
256 */ | |
257 | |
258 #ifdef __cplusplus | |
259 } | |
260 #endif | |
261 | |
262 #endif /* __STM32F4xx_HAL_PCCARD_H */ | |
263 | |
264 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |