stm32f7xx_hal_dcmi.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_DCMI_H
22 #define STM32F7xx_HAL_DCMI_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
31 #if defined (DCMI)
32 
42 /* Exported types ------------------------------------------------------------*/
49 typedef enum
50 {
51  HAL_DCMI_STATE_RESET = 0x00U,
52  HAL_DCMI_STATE_READY = 0x01U,
53  HAL_DCMI_STATE_BUSY = 0x02U,
54  HAL_DCMI_STATE_TIMEOUT = 0x03U,
55  HAL_DCMI_STATE_ERROR = 0x04U,
56  HAL_DCMI_STATE_SUSPENDED = 0x05U
57 } HAL_DCMI_StateTypeDef;
58 
62 typedef struct
63 {
64  uint8_t FrameStartCode;
65  uint8_t LineStartCode;
66  uint8_t LineEndCode;
67  uint8_t FrameEndCode;
68 } DCMI_CodesInitTypeDef;
69 
73 typedef struct
74 {
75  uint8_t FrameStartUnmask;
76  uint8_t LineStartUnmask;
77  uint8_t LineEndUnmask;
78  uint8_t FrameEndUnmask;
79 } DCMI_SyncUnmaskTypeDef;
83 typedef struct
84 {
85  uint32_t SynchroMode;
88  uint32_t PCKPolarity;
91  uint32_t VSPolarity;
94  uint32_t HSPolarity;
97  uint32_t CaptureRate;
100  uint32_t ExtendedDataMode;
103  DCMI_CodesInitTypeDef SyncroCode;
106  uint32_t JPEGMode;
109 #ifdef DCMI_CR_BSM
110  uint32_t ByteSelectMode;
113  uint32_t ByteSelectStart;
116  uint32_t LineSelectMode;
119  uint32_t LineSelectStart;
121 #endif
122 } DCMI_InitTypeDef;
123 
127 typedef struct __DCMI_HandleTypeDef
128 {
129  DCMI_TypeDef *Instance;
131  DCMI_InitTypeDef Init;
133  HAL_LockTypeDef Lock;
135  __IO HAL_DCMI_StateTypeDef State;
137  __IO uint32_t XferCount;
139  __IO uint32_t XferSize;
141  uint32_t XferTransferNumber;
143  uint32_t pBuffPtr;
145  DMA_HandleTypeDef *DMA_Handle;
147  __IO uint32_t ErrorCode;
148 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
149  void (* FrameEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
150  void (* VsyncEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
151  void (* LineEventCallback)(struct __DCMI_HandleTypeDef *hdcmi);
152  void (* ErrorCallback)(struct __DCMI_HandleTypeDef *hdcmi);
153  void (* MspInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);
154  void (* MspDeInitCallback)(struct __DCMI_HandleTypeDef *hdcmi);
155 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
156 } DCMI_HandleTypeDef;
157 
158 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
159 typedef enum
160 {
161  HAL_DCMI_FRAME_EVENT_CB_ID = 0x00U,
162  HAL_DCMI_VSYNC_EVENT_CB_ID = 0x01U,
163  HAL_DCMI_LINE_EVENT_CB_ID = 0x02U,
164  HAL_DCMI_ERROR_CB_ID = 0x03U,
165  HAL_DCMI_MSPINIT_CB_ID = 0x04U,
166  HAL_DCMI_MSPDEINIT_CB_ID = 0x05U
168 } HAL_DCMI_CallbackIDTypeDef;
169 
170 typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef *hdcmi);
171 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
172 
173 
177 /* Exported constants --------------------------------------------------------*/
178 
186 #define HAL_DCMI_ERROR_NONE ((uint32_t)0x00000000U)
187 #define HAL_DCMI_ERROR_OVR ((uint32_t)0x00000001U)
188 #define HAL_DCMI_ERROR_SYNC ((uint32_t)0x00000002U)
189 #define HAL_DCMI_ERROR_TIMEOUT ((uint32_t)0x00000020U)
190 #define HAL_DCMI_ERROR_DMA ((uint32_t)0x00000040U)
191 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
192 #define HAL_DCMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000080U)
193 #endif
194 
201 #define DCMI_MODE_CONTINUOUS ((uint32_t)0x00000000U)
203 #define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM)
212 #define DCMI_SYNCHRO_HARDWARE ((uint32_t)0x00000000U)
214 #define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS)
224 #define DCMI_PCKPOLARITY_FALLING ((uint32_t)0x00000000U)
225 #define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL)
234 #define DCMI_VSPOLARITY_LOW ((uint32_t)0x00000000U)
235 #define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL)
244 #define DCMI_HSPOLARITY_LOW ((uint32_t)0x00000000U)
245 #define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL)
254 #define DCMI_JPEG_DISABLE ((uint32_t)0x00000000U)
255 #define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG)
264 #define DCMI_CR_ALL_FRAME ((uint32_t)0x00000000U)
265 #define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0)
266 #define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1)
275 #define DCMI_EXTEND_DATA_8B ((uint32_t)0x00000000U)
276 #define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0)
277 #define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1)
278 #define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))
287 #define DCMI_WINDOW_COORDINATE ((uint32_t)0x3FFFU)
296 #define DCMI_WINDOW_HEIGHT ((uint32_t)0x1FFFU)
305 #define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE)
306 #define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE)
307 #define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE)
308 #define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE)
309 #define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE)
321 #define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC)
322 #define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC)
323 #define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)
327 #define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS)
328 #define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS)
329 #define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS)
330 #define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS)
331 #define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS)
335 #define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)
336 #define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS )
337 #define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS )
338 #define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)
339 #define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )
347 #define DCMI_BSM_ALL ((uint32_t)0x00000000U)
348 #define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0)
349 #define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1)
350 #define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1))
359 #define DCMI_OEBS_ODD ((uint32_t)0x00000000U)
360 #define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS)
369 #define DCMI_LSM_ALL ((uint32_t)0x00000000U)
370 #define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM)
379 #define DCMI_OELS_ODD ((uint32_t)0x00000000U)
380 #define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS)
390 /* Exported macro ------------------------------------------------------------*/
391 
399 #define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
400  (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
401  (__HANDLE__)->MspInitCallback = NULL; \
402  (__HANDLE__)->MspDeInitCallback = NULL; \
403  } while(0)
404 
410 #define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
411 
417 #define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
418 
419 /* Interrupt & Flag management */
440 #define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
441 ((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
442  (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
443 
456 #define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
457 
470 #define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
471 
484 #define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
485 
498 #define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
499 
504 /* Exported functions --------------------------------------------------------*/
512 /* Initialization and de-initialization functions *****************************/
513 HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
514 HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
515 void HAL_DCMI_MspInit(DCMI_HandleTypeDef *hdcmi);
516 void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi);
517 
518 /* Callbacks Register/UnRegister functions ***********************************/
519 #if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
520 HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
521 HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
522 #endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
523 
530 /* IO operation functions *****************************************************/
531 HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef *hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
532 HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef *hdcmi);
533 HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef *hdcmi);
534 HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef *hdcmi);
535 void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
536 void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
537 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
538 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
539 void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
547 /* Peripheral Control functions ***********************************************/
548 HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
549 HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
550 HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
551 HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
552 
560 /* Peripheral State functions *************************************************/
561 HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
562 uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
571 /* Private types -------------------------------------------------------------*/
572 /* Private variables ---------------------------------------------------------*/
573 /* Private constants ---------------------------------------------------------*/
577 #define DCMI_MIS_INDEX ((uint32_t)0x1000)
578 #define DCMI_SR_INDEX ((uint32_t)0x2000)
582 /* Private macro -------------------------------------------------------------*/
583 
586 #define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
587  ((MODE) == DCMI_MODE_SNAPSHOT))
588 
589 #define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
590  ((MODE) == DCMI_SYNCHRO_EMBEDDED))
591 
592 #define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
593  ((POLARITY) == DCMI_PCKPOLARITY_RISING))
594 
595 #define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
596  ((POLARITY) == DCMI_VSPOLARITY_HIGH))
597 
598 #define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
599  ((POLARITY) == DCMI_HSPOLARITY_HIGH))
600 
601 #define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
602  ((JPEG_MODE) == DCMI_JPEG_ENABLE))
603 
604 #define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
605  ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
606  ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
607 
608 #define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
609  ((DATA) == DCMI_EXTEND_DATA_10B) || \
610  ((DATA) == DCMI_EXTEND_DATA_12B) || \
611  ((DATA) == DCMI_EXTEND_DATA_14B))
612 
613 #define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
614 
615 #define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
616 
617 #define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
618  ((MODE) == DCMI_BSM_OTHER) || \
619  ((MODE) == DCMI_BSM_ALTERNATE_4) || \
620  ((MODE) == DCMI_BSM_ALTERNATE_2))
621 
622 #define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
623  ((POLARITY) == DCMI_OEBS_EVEN))
624 
625 #define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
626  ((MODE) == DCMI_LSM_ALTERNATE_2))
627 
628 #define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
629  ((POLARITY) == DCMI_OELS_EVEN))
630 
635 /* Private functions ---------------------------------------------------------*/
650 #endif /* DCMI */
651 
652 #ifdef __cplusplus
653 }
654 #endif
655 
656 #endif /* STM32F7xx_HAL_DCMI_H */
657 
658 /************************ (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
stm32f7xx_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:53