stm32h7xx_hal_dcmi.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32H7xx_HAL_DCMI_H
22 #define STM32H7xx_HAL_DCMI_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32h7xx_hal_def.h"
30 
31 #if defined (DCMI)
32 
41 /* Exported types ------------------------------------------------------------*/
48 typedef enum
49 {
50  HAL_DCMI_STATE_RESET = 0x00U,
51  HAL_DCMI_STATE_READY = 0x01U,
52  HAL_DCMI_STATE_BUSY = 0x02U,
53  HAL_DCMI_STATE_TIMEOUT = 0x03U,
54  HAL_DCMI_STATE_ERROR = 0x04U,
55  HAL_DCMI_STATE_SUSPENDED = 0x05U
56 } HAL_DCMI_StateTypeDef;
57 
61 typedef struct
62 {
63  uint8_t FrameStartCode;
64  uint8_t LineStartCode;
65  uint8_t LineEndCode;
66  uint8_t FrameEndCode;
67 } DCMI_CodesInitTypeDef;
68 
72 typedef struct
73 {
74  uint8_t FrameStartUnmask;
75  uint8_t LineStartUnmask;
76  uint8_t LineEndUnmask;
77  uint8_t FrameEndUnmask;
78 } DCMI_SyncUnmaskTypeDef;
82 typedef struct
83 {
84  uint32_t SynchroMode;
87  uint32_t PCKPolarity;
90  uint32_t VSPolarity;
93  uint32_t HSPolarity;
96  uint32_t CaptureRate;
99  uint32_t ExtendedDataMode;
102  DCMI_CodesInitTypeDef SyncroCode;
105  uint32_t JPEGMode;
108  uint32_t ByteSelectMode;
111  uint32_t ByteSelectStart;
114  uint32_t LineSelectMode;
117  uint32_t LineSelectStart;
119 } DCMI_InitTypeDef;
120 
124 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
125 typedef struct __DCMI_HandleTypeDef
126 #else
127 typedef struct
128 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
129 {
130  DCMI_TypeDef *Instance;
132  DCMI_InitTypeDef Init;
134  HAL_LockTypeDef Lock;
136  __IO HAL_DCMI_StateTypeDef State;
138  __IO uint32_t XferCount;
140  __IO uint32_t XferSize;
142  uint32_t XferTransferNumber;
144  uint32_t pBuffPtr;
146  DMA_HandleTypeDef *DMA_Handle;
148  __IO uint32_t ErrorCode;
150 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
151  void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
152  void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
153  void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
154  void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi);
155  void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);
156  void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);
157 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
158 } DCMI_HandleTypeDef;
159 
160 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
161 
164 typedef enum
165 {
166  HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U,
167  HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U,
168  HAL_DCMI_LINE_EVENT_CB_ID = 0x02U,
169  HAL_DCMI_ERROR_CB_ID = 0x03U,
170  HAL_DCMI_MSPINIT_CB_ID = 0x04U,
171  HAL_DCMI_MSPDEINIT_CB_ID = 0x05U
173 } HAL_DCMI_CallbackIDTypeDef;
174 
178 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi);
180 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
181 
184 /* Exported constants --------------------------------------------------------*/
185 
193 #define HAL_DCMI_ERROR_NONE (0x00000000U)
194 #define HAL_DCMI_ERROR_OVR (0x00000001U)
195 #define HAL_DCMI_ERROR_SYNC (0x00000002U)
196 #define HAL_DCMI_ERROR_TIMEOUT (0x00000020U)
197 #define HAL_DCMI_ERROR_DMA (0x00000040U)
198 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
199 #define HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U)
200 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
201 
208 #define DCMI_MODE_CONTINUOUS (0x00000000U)
210 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM)
219 #define DCMI_SYNCHRO_HARDWARE (0x00000000U)
221 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS)
231 #define DCMI_PCKPOLARITY_FALLING (0x00000000U)
232 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL)
241 #define DCMI_VSPOLARITY_LOW (0x00000000U)
242 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL)
251 #define DCMI_HSPOLARITY_LOW (0x00000000U)
252 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL)
261 #define DCMI_JPEG_DISABLE (0x00000000U)
262 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG)
271 #define DCMI_CR_ALL_FRAME (0x00000000U)
272 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0)
273 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1)
282 #define DCMI_EXTEND_DATA_8B (0x00000000U)
283 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0)
284 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1)
285 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))
294 #define DCMI_WINDOW_COORDINATE (0x3FFFU)
303 #define DCMI_WINDOW_HEIGHT (0x1FFFU)
312 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE)
313 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE)
314 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE)
315 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE)
316 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE)
328 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC)
329 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC)
330 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)
334 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS)
335 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS)
336 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS)
337 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS)
338 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS)
342 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)
343 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS )
344 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS )
345 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)
346 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )
354 #define DCMI_BSM_ALL (0x00000000U)
355 #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0)
356 #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1)
357 #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1))
366 #define DCMI_OEBS_ODD (0x00000000U)
367 #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS)
376 #define DCMI_LSM_ALL (0x00000000U)
377 #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM)
386 #define DCMI_OELS_ODD (0x00000000U)
387 #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS)
397 /* Exported macro ------------------------------------------------------------*/
398 
406 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
407 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
408  (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
409  (__HANDLE__)->MspInitCallback = NULL; \
410  (__HANDLE__)->MspDeInitCallback = NULL; \
411  } while(0)
412 #else
413 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
414 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
415 
421 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
422 
428 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
429 
430 /* Interrupt & Flag management */
451 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
452 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
453  (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
454 
467 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
468 
481 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
482 
495 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
496 
509 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
510 
515 /* Exported functions --------------------------------------------------------*/
523 /* Initialization and de-initialization functions *****************************/
524 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
525 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
526 void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
527 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
528 
529 /* Callbacks Register/UnRegister functions ***********************************/
530 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
531 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
532 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
533 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
534 
542 /* IO operation functions *****************************************************/
543 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
544 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
545 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
546 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
547 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
548 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
549 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
550 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
551 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
559 /* Peripheral Control functions ***********************************************/
560 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
561 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
562 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
563 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
564 
572 /* Peripheral State functions *************************************************/
573 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
574 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
583 /* Private types -------------------------------------------------------------*/
584 /* Private variables ---------------------------------------------------------*/
585 /* Private constants ---------------------------------------------------------*/
589 #define DCMI_MIS_INDEX ((uint32_t)0x1000)
590 #define DCMI_SR_INDEX ((uint32_t)0x2000)
594 /* Private macro -------------------------------------------------------------*/
595 
598 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
599  ((MODE) == DCMI_MODE_SNAPSHOT))
600 
601 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
602  ((MODE) == DCMI_SYNCHRO_EMBEDDED))
603 
604 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
605  ((POLARITY) == DCMI_PCKPOLARITY_RISING))
606 
607 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
608  ((POLARITY) == DCMI_VSPOLARITY_HIGH))
609 
610 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
611  ((POLARITY) == DCMI_HSPOLARITY_HIGH))
612 
613 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
614  ((JPEG_MODE) == DCMI_JPEG_ENABLE))
615 
616 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
617  ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
618  ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
619 
620 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
621  ((DATA) == DCMI_EXTEND_DATA_10B) || \
622  ((DATA) == DCMI_EXTEND_DATA_12B) || \
623  ((DATA) == DCMI_EXTEND_DATA_14B))
624 
625 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
626 
627 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
628 
629 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
630  ((MODE) == DCMI_BSM_OTHER) || \
631  ((MODE) == DCMI_BSM_ALTERNATE_4) || \
632  ((MODE) == DCMI_BSM_ALTERNATE_2))
633 
634 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
635  ((POLARITY) == DCMI_OEBS_EVEN))
636 
637 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
638  ((MODE) == DCMI_LSM_ALTERNATE_2))
639 
640 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
641  ((POLARITY) == DCMI_OELS_EVEN))
642 
647 /* Private functions ---------------------------------------------------------*/
663 #endif /* DCMI */
664 
665 #ifdef __cplusplus
666 }
667 #endif
668 
669 #endif /* STM32H7xx_HAL_DCMI_H */
670 
671 /************************ (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
stm32h7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
DCMI_TypeDef
DCMI.
Definition: stm32f407xx.h:327


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