stm32f4xx_hal_pccard.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F4xx_HAL_PCCARD_H
22 #define __STM32F4xx_HAL_PCCARD_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx)
30  #include "stm32f4xx_ll_fsmc.h"
31 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
32 
33 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
34  #include "stm32f4xx_ll_fmc.h"
35 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
36 
41 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
42  defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
43 
48 /* Exported typedef ----------------------------------------------------------*/
56 typedef enum
57 {
58  HAL_PCCARD_STATE_RESET = 0x00U,
59  HAL_PCCARD_STATE_READY = 0x01U,
60  HAL_PCCARD_STATE_BUSY = 0x02U,
61  HAL_PCCARD_STATE_ERROR = 0x04U
62 }HAL_PCCARD_StateTypeDef;
63 
64 typedef enum
65 {
66  HAL_PCCARD_STATUS_SUCCESS = 0U,
67  HAL_PCCARD_STATUS_ONGOING,
68  HAL_PCCARD_STATUS_ERROR,
69  HAL_PCCARD_STATUS_TIMEOUT
70 }HAL_PCCARD_StatusTypeDef;
71 
75 #if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
76 typedef struct __PCCARD_HandleTypeDef
77 #else
78 typedef struct
79 #endif /* USE_HAL_PCCARD_REGISTER_CALLBACKS */
80 {
81  FMC_PCCARD_TypeDef *Instance;
83  FMC_PCCARD_InitTypeDef Init;
85  __IO HAL_PCCARD_StateTypeDef State;
87  HAL_LockTypeDef Lock;
89 #if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
90  void (* MspInitCallback) ( struct __PCCARD_HandleTypeDef * hpccard);
91  void (* MspDeInitCallback) ( struct __PCCARD_HandleTypeDef * hpccard);
92  void (* ItCallback) ( struct __PCCARD_HandleTypeDef * hpccard);
93 #endif
94 } PCCARD_HandleTypeDef;
95 
96 #if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
97 
100 typedef enum
101 {
102  HAL_PCCARD_MSP_INIT_CB_ID = 0x00U,
103  HAL_PCCARD_MSP_DEINIT_CB_ID = 0x01U,
104  HAL_PCCARD_IT_CB_ID = 0x02U
105 }HAL_PCCARD_CallbackIDTypeDef;
106 
110 typedef void (*pPCCARD_CallbackTypeDef)(PCCARD_HandleTypeDef *hpccard);
111 #endif
112 
116 /* Exported constants --------------------------------------------------------*/
117 /* Exported macro ------------------------------------------------------------*/
125 #if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
126 #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) do { \
127  (__HANDLE__)->State = HAL_PCCARD_STATE_RESET; \
128  (__HANDLE__)->MspInitCallback = NULL; \
129  (__HANDLE__)->MspDeInitCallback = NULL; \
130  } while(0)
131 #else
132 #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PCCARD_STATE_RESET)
133 #endif
134 
138 /* Exported functions --------------------------------------------------------*/
146 /* Initialization/de-initialization functions **********************************/
147 HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming);
148 HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard);
149 void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard);
150 void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard);
158 /* IO operation functions *****************************************************/
159 HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus);
160 HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
161 HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
162 HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus);
163 HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard);
164 void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard);
165 void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard);
166 
167 #if (USE_HAL_PCCARD_REGISTER_CALLBACKS == 1)
168 /* PCCARD callback registering/unregistering */
169 HAL_StatusTypeDef HAL_PCCARD_RegisterCallback(PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId, pPCCARD_CallbackTypeDef pCallback);
170 HAL_StatusTypeDef HAL_PCCARD_UnRegisterCallback(PCCARD_HandleTypeDef *hpccard, HAL_PCCARD_CallbackIDTypeDef CallbackId);
171 #endif
172 
179 /* PCCARD State functions *******************************************************/
180 HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard);
181 HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard);
182 HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard);
190 /* Private types -------------------------------------------------------------*/
191 /* Private variables ---------------------------------------------------------*/
192 /* Private constants ---------------------------------------------------------*/
196 #define PCCARD_DEVICE_ADDRESS 0x90000000U
197 #define PCCARD_ATTRIBUTE_SPACE_ADDRESS 0x98000000U /* Attribute space size to @0x9BFF FFFF */
198 #define PCCARD_COMMON_SPACE_ADDRESS PCCARD_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */
199 #define PCCARD_IO_SPACE_ADDRESS 0x9C000000U /* IO space size to @0x9FFF FFFF */
200 #define PCCARD_IO_SPACE_PRIMARY_ADDR 0x9C0001F0U /* IO space size to @0x9FFF FFFF */
201 
202 /* Flash-ATA registers description */
203 #define ATA_DATA ((uint8_t)0x00) /* Data register */
204 #define ATA_SECTOR_COUNT ((uint8_t)0x02) /* Sector Count register */
205 #define ATA_SECTOR_NUMBER ((uint8_t)0x03) /* Sector Number register */
206 #define ATA_CYLINDER_LOW ((uint8_t)0x04) /* Cylinder low register */
207 #define ATA_CYLINDER_HIGH ((uint8_t)0x05) /* Cylinder high register */
208 #define ATA_CARD_HEAD ((uint8_t)0x06) /* Card/Head register */
209 #define ATA_STATUS_CMD ((uint8_t)0x07) /* Status(read)/Command(write) register */
210 #define ATA_STATUS_CMD_ALTERNATE ((uint8_t)0x0E) /* Alternate Status(read)/Command(write) register */
211 #define ATA_COMMON_DATA_AREA ((uint16_t)0x0400) /* Start of data area (for Common access only!) */
212 #define ATA_CARD_CONFIGURATION ((uint16_t)0x0202) /* Card Configuration and Status Register */
213 
214 /* Flash-ATA commands */
215 #define ATA_READ_SECTOR_CMD ((uint8_t)0x20)
216 #define ATA_WRITE_SECTOR_CMD ((uint8_t)0x30)
217 #define ATA_ERASE_SECTOR_CMD ((uint8_t)0xC0)
218 #define ATA_IDENTIFY_CMD ((uint8_t)0xEC)
219 
220 /* PC Card/Compact Flash status */
221 #define PCCARD_TIMEOUT_ERROR ((uint8_t)0x60)
222 #define PCCARD_BUSY ((uint8_t)0x80)
223 #define PCCARD_PROGR ((uint8_t)0x01)
224 #define PCCARD_READY ((uint8_t)0x40)
225 
226 #define PCCARD_SECTOR_SIZE 255U /* In half words */
227 
231 /* Compact Flash redefinition */
232 #define HAL_CF_Init HAL_PCCARD_Init
233 #define HAL_CF_DeInit HAL_PCCARD_DeInit
234 #define HAL_CF_MspInit HAL_PCCARD_MspInit
235 #define HAL_CF_MspDeInit HAL_PCCARD_MspDeInit
236 
237 #define HAL_CF_Read_ID HAL_PCCARD_Read_ID
238 #define HAL_CF_Write_Sector HAL_PCCARD_Write_Sector
239 #define HAL_CF_Read_Sector HAL_PCCARD_Read_Sector
240 #define HAL_CF_Erase_Sector HAL_PCCARD_Erase_Sector
241 #define HAL_CF_Reset HAL_PCCARD_Reset
242 #define HAL_CF_IRQHandler HAL_PCCARD_IRQHandler
243 #define HAL_CF_ITCallback HAL_PCCARD_ITCallback
244 
245 #define HAL_CF_GetState HAL_PCCARD_GetState
246 #define HAL_CF_GetStatus HAL_PCCARD_GetStatus
247 #define HAL_CF_ReadStatus HAL_PCCARD_ReadStatus
248 
249 #define HAL_CF_STATUS_SUCCESS HAL_PCCARD_STATUS_SUCCESS
250 #define HAL_CF_STATUS_ONGOING HAL_PCCARD_STATUS_ONGOING
251 #define HAL_CF_STATUS_ERROR HAL_PCCARD_STATUS_ERROR
252 #define HAL_CF_STATUS_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT
253 #define HAL_CF_StatusTypeDef HAL_PCCARD_StatusTypeDef
254 
255 #define CF_DEVICE_ADDRESS PCCARD_DEVICE_ADDRESS
256 #define CF_ATTRIBUTE_SPACE_ADDRESS PCCARD_ATTRIBUTE_SPACE_ADDRESS
257 #define CF_COMMON_SPACE_ADDRESS PCCARD_COMMON_SPACE_ADDRESS
258 #define CF_IO_SPACE_ADDRESS PCCARD_IO_SPACE_ADDRESS
259 #define CF_IO_SPACE_PRIMARY_ADDR PCCARD_IO_SPACE_PRIMARY_ADDR
260 
261 #define CF_TIMEOUT_ERROR PCCARD_TIMEOUT_ERROR
262 #define CF_BUSY PCCARD_BUSY
263 #define CF_PROGR PCCARD_PROGR
264 #define CF_READY PCCARD_READY
265 
266 #define CF_SECTOR_SIZE PCCARD_SECTOR_SIZE
267 
268 /* Private macros ------------------------------------------------------------*/
273 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\
274  STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
275 
276 
281 #ifdef __cplusplus
282 }
283 #endif
284 
285 #endif /* __STM32F4xx_HAL_PCCARD_H */
286 
287 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
Init
napi_value Init(napi_env env, napi_value exports)
Definition: porcupine/demo/c/pvrecorder/node/pv_recorder_napi.c:197
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
FMC_NAND_PCC_TimingTypeDef
FMC NAND Timing parameters structure definition.
Definition: stm32f7xx_ll_fmc.h:532


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:52