stm32f4xx_hal_dcmi.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32F4xx_HAL_DCMI_H
22 #define __STM32F4xx_HAL_DCMI_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 #if defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) ||\
29  defined(STM32F429xx) || defined(STM32F439xx) || defined(STM32F446xx) || defined(STM32F469xx) ||\
30  defined(STM32F479xx)
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32f4xx_hal_def.h"
33 
34 /* Include DCMI HAL Extended module */
35 /* (include on top of file since DCMI structures are defined in extended file) */
36 #include "stm32f4xx_hal_dcmi_ex.h"
37 
47 /* Exported types ------------------------------------------------------------*/
54 typedef struct
55 {
56  uint8_t FrameStartUnmask;
57  uint8_t LineStartUnmask;
58  uint8_t LineEndUnmask;
59  uint8_t FrameEndUnmask;
60 }DCMI_SyncUnmaskTypeDef;
64 typedef enum
65 {
66  HAL_DCMI_STATE_RESET = 0x00U,
67  HAL_DCMI_STATE_READY = 0x01U,
68  HAL_DCMI_STATE_BUSY = 0x02U,
69  HAL_DCMI_STATE_TIMEOUT = 0x03U,
70  HAL_DCMI_STATE_ERROR = 0x04U,
71  HAL_DCMI_STATE_SUSPENDED = 0x05U
72 }HAL_DCMI_StateTypeDef;
73 
77 typedef struct __DCMI_HandleTypeDef
78 {
79  DCMI_TypeDef *Instance;
81  DCMI_InitTypeDef Init;
83  HAL_LockTypeDef Lock;
85  __IO HAL_DCMI_StateTypeDef State;
87  __IO uint32_t XferCount;
89  __IO uint32_t XferSize;
91  uint32_t XferTransferNumber;
93  uint32_t pBuffPtr;
95  DMA_HandleTypeDef *DMA_Handle;
97  __IO uint32_t ErrorCode;
98 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
99  void (* FrameEventCallback) ( struct __DCMI_HandleTypeDef *hdcmi);
100  void (* VsyncEventCallback) ( struct __DCMI_HandleTypeDef *hdcmi);
101  void (* LineEventCallback ) ( struct __DCMI_HandleTypeDef *hdcmi);
102  void (* ErrorCallback) ( struct __DCMI_HandleTypeDef *hdcmi);
103  void (* MspInitCallback) ( struct __DCMI_HandleTypeDef *hdcmi);
104  void (* MspDeInitCallback) ( struct __DCMI_HandleTypeDef *hdcmi);
105 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
106 }DCMI_HandleTypeDef;
107 
108 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
109 typedef enum
110 {
111  HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U,
112  HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U,
113  HAL_DCMI_LINE_EVENT_CB_ID = 0x02U,
114  HAL_DCMI_ERROR_CB_ID = 0x03U,
115  HAL_DCMI_MSPINIT_CB_ID = 0x04U,
116  HAL_DCMI_MSPDEINIT_CB_ID = 0x05U
118 }HAL_DCMI_CallbackIDTypeDef;
119 
120 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef *hdcmi);
121 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
122 
123 
128 /* Exported constants --------------------------------------------------------*/
136 #define HAL_DCMI_ERROR_NONE 0x00000000U
137 #define HAL_DCMI_ERROR_OVR 0x00000001U
138 #define HAL_DCMI_ERROR_SYNC 0x00000002U
139 #define HAL_DCMI_ERROR_TIMEOUT 0x00000020U
140 #define HAL_DCMI_ERROR_DMA 0x00000040U
141 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
142 #define HAL_DCMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U)
143 #endif
144 
151 #define DCMI_MODE_CONTINUOUS 0x00000000U
153 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM)
162 #define DCMI_SYNCHRO_HARDWARE 0x00000000U
164 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS)
174 #define DCMI_PCKPOLARITY_FALLING 0x00000000U
175 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL)
184 #define DCMI_VSPOLARITY_LOW 0x00000000U
185 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL)
194 #define DCMI_HSPOLARITY_LOW 0x00000000U
195 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL)
204 #define DCMI_JPEG_DISABLE 0x00000000U
205 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG)
214 #define DCMI_CR_ALL_FRAME 0x00000000U
215 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0)
216 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1)
225 #define DCMI_EXTEND_DATA_8B 0x00000000U
226 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0)
227 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1)
228 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))
237 #define DCMI_WINDOW_COORDINATE 0x3FFFU
246 #define DCMI_WINDOW_HEIGHT 0x1FFFU
255 #define DCMI_POSITION_CWSIZE_VLINE (uint32_t)DCMI_CWSIZE_VLINE_Pos
256 #define DCMI_POSITION_CWSTRT_VST (uint32_t)DCMI_CWSTRT_VST_Pos
265 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE)
266 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE)
267 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE)
268 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE)
269 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE)
281 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC)
282 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC)
283 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)
287 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RISR_FRAME_RIS)
288 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RISR_OVR_RIS)
289 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RISR_ERR_RIS)
290 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RISR_VSYNC_RIS)
291 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RISR_LINE_RIS)
295 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)
296 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS )
297 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS )
298 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)
299 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )
308 /* Exported macro ------------------------------------------------------------*/
309 
317 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
318  (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
319  (__HANDLE__)->MspInitCallback = NULL; \
320  (__HANDLE__)->MspDeInitCallback = NULL; \
321  } while(0)
322 
328 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
329 
335 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
336 
337 /* Interrupt & Flag management */
358 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
359 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0U)? ((__HANDLE__)->Instance->RISR & (__FLAG__)) :\
360  (((__FLAG__) & DCMI_SR_INDEX) == 0x0U)? ((__HANDLE__)->Instance->MISR & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
361 
374 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
375 
388 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
389 
402 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
403 
416 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
417 
422 /* Exported functions --------------------------------------------------------*/
430 /* Initialization and de-initialization functions *****************************/
431 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
432 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
433 void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
434 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
435 
436 /* Callbacks Register/UnRegister functions ***********************************/
437 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
438 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
439 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
440 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
441 
448 /* IO operation functions *****************************************************/
449 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
450 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
451 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
452 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
453 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
454 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
455 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
456 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
457 void HAL_DCMI_VsyncCallback(DCMI_HandleTypeDef *hdcmi);
458 void HAL_DCMI_HsyncCallback(DCMI_HandleTypeDef *hdcmi);
459 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
467 /* Peripheral Control functions ***********************************************/
468 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
469 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
470 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
471 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
479 /* Peripheral State functions *************************************************/
480 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
481 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
490 /* Private types -------------------------------------------------------------*/
491 /* Private variables ---------------------------------------------------------*/
492 /* Private constants ---------------------------------------------------------*/
496 #define DCMI_MIS_INDEX 0x1000U
497 #define DCMI_SR_INDEX 0x2000U
501 /* Private macro -------------------------------------------------------------*/
502 
505 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
506  ((MODE) == DCMI_MODE_SNAPSHOT))
507 
508 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
509  ((MODE) == DCMI_SYNCHRO_EMBEDDED))
510 
511 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
512  ((POLARITY) == DCMI_PCKPOLARITY_RISING))
513 
514 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
515  ((POLARITY) == DCMI_VSPOLARITY_HIGH))
516 
517 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
518  ((POLARITY) == DCMI_HSPOLARITY_HIGH))
519 
520 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
521  ((JPEG_MODE) == DCMI_JPEG_ENABLE))
522 
523 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
524  ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
525  ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
526 
527 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
528  ((DATA) == DCMI_EXTEND_DATA_10B) || \
529  ((DATA) == DCMI_EXTEND_DATA_12B) || \
530  ((DATA) == DCMI_EXTEND_DATA_14B))
531 
532 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
533 
534 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
535 
540 /* Private functions ---------------------------------------------------------*/
549 #endif /* STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
550  STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx ||\
551  STM32F479xx */
552 
561 #ifdef __cplusplus
562 }
563 #endif
564 
565 #endif /* __STM32F4xx_HAL_DCMI_H */
566 
567 /************************ (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
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
stm32f4xx_hal_dcmi_ex.h
Header file of DCMI Extension HAL module.
DCMI_TypeDef
DCMI.
Definition: stm32f407xx.h:327


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