RTEMS 6.1-rc1
stm32h7xx_hal_dcmi.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_DCMI_H
21#define STM32H7xx_HAL_DCMI_H
22
23#ifdef __cplusplus
24 extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
30#if defined (DCMI)
40/* Exported types ------------------------------------------------------------*/
48typedef 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
61typedef struct
62{
63 uint8_t FrameStartCode;
64 uint8_t LineStartCode;
65 uint8_t LineEndCode;
66 uint8_t FrameEndCode;
67} DCMI_CodesInitTypeDef;
68
72typedef struct
73{
74 uint8_t FrameStartUnmask;
75 uint8_t LineStartUnmask;
76 uint8_t LineEndUnmask;
77 uint8_t FrameEndUnmask;
78} DCMI_SyncUnmaskTypeDef;
82typedef 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)
125typedef struct __DCMI_HandleTypeDef
126#else
127typedef 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)
164typedef 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
178typedef void (*pDCMI_CallbackTypeDef)(DCMI_HandleTypeDef * hdcmi);
180#endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
184/* Exported constants --------------------------------------------------------*/
185
195#define HAL_DCMI_ERROR_NONE (0x00000000U)
196#define HAL_DCMI_ERROR_OVR (0x00000001U)
197#define HAL_DCMI_ERROR_SYNC (0x00000002U)
198#define HAL_DCMI_ERROR_TIMEOUT (0x00000020U)
199#define HAL_DCMI_ERROR_DMA (0x00000040U)
200#if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
201#define HAL_DCMI_ERROR_INVALID_CALLBACK (0x00000080U)
202#endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
211#define DCMI_MODE_CONTINUOUS (0x00000000U)
213#define DCMI_MODE_SNAPSHOT ((uint32_t)DCMI_CR_CM)
223#define DCMI_SYNCHRO_HARDWARE (0x00000000U)
225#define DCMI_SYNCHRO_EMBEDDED ((uint32_t)DCMI_CR_ESS)
236#define DCMI_PCKPOLARITY_FALLING (0x00000000U)
237#define DCMI_PCKPOLARITY_RISING ((uint32_t)DCMI_CR_PCKPOL)
247#define DCMI_VSPOLARITY_LOW (0x00000000U)
248#define DCMI_VSPOLARITY_HIGH ((uint32_t)DCMI_CR_VSPOL)
258#define DCMI_HSPOLARITY_LOW (0x00000000U)
259#define DCMI_HSPOLARITY_HIGH ((uint32_t)DCMI_CR_HSPOL)
269#define DCMI_JPEG_DISABLE (0x00000000U)
270#define DCMI_JPEG_ENABLE ((uint32_t)DCMI_CR_JPEG)
280#define DCMI_CR_ALL_FRAME (0x00000000U)
281#define DCMI_CR_ALTERNATE_2_FRAME ((uint32_t)DCMI_CR_FCRC_0)
282#define DCMI_CR_ALTERNATE_4_FRAME ((uint32_t)DCMI_CR_FCRC_1)
292#define DCMI_EXTEND_DATA_8B (0x00000000U)
293#define DCMI_EXTEND_DATA_10B ((uint32_t)DCMI_CR_EDM_0)
294#define DCMI_EXTEND_DATA_12B ((uint32_t)DCMI_CR_EDM_1)
295#define DCMI_EXTEND_DATA_14B ((uint32_t)(DCMI_CR_EDM_0 | DCMI_CR_EDM_1))
305#define DCMI_WINDOW_COORDINATE (0x3FFFU)
315#define DCMI_WINDOW_HEIGHT (0x1FFFU)
325#define DCMI_IT_FRAME ((uint32_t)DCMI_IER_FRAME_IE)
326#define DCMI_IT_OVR ((uint32_t)DCMI_IER_OVR_IE)
327#define DCMI_IT_ERR ((uint32_t)DCMI_IER_ERR_IE)
328#define DCMI_IT_VSYNC ((uint32_t)DCMI_IER_VSYNC_IE)
329#define DCMI_IT_LINE ((uint32_t)DCMI_IER_LINE_IE)
342#define DCMI_FLAG_HSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_HSYNC)
343#define DCMI_FLAG_VSYNC ((uint32_t)DCMI_SR_INDEX|DCMI_SR_VSYNC)
344#define DCMI_FLAG_FNE ((uint32_t)DCMI_SR_INDEX|DCMI_SR_FNE)
348#define DCMI_FLAG_FRAMERI ((uint32_t)DCMI_RIS_FRAME_RIS)
349#define DCMI_FLAG_OVRRI ((uint32_t)DCMI_RIS_OVR_RIS)
350#define DCMI_FLAG_ERRRI ((uint32_t)DCMI_RIS_ERR_RIS)
351#define DCMI_FLAG_VSYNCRI ((uint32_t)DCMI_RIS_VSYNC_RIS)
352#define DCMI_FLAG_LINERI ((uint32_t)DCMI_RIS_LINE_RIS)
356#define DCMI_FLAG_FRAMEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_FRAME_MIS)
357#define DCMI_FLAG_OVRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_OVR_MIS )
358#define DCMI_FLAG_ERRMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_ERR_MIS )
359#define DCMI_FLAG_VSYNCMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_VSYNC_MIS)
360#define DCMI_FLAG_LINEMI ((uint32_t)DCMI_MIS_INDEX|DCMI_MIS_LINE_MIS )
369#define DCMI_BSM_ALL (0x00000000U)
370#define DCMI_BSM_OTHER ((uint32_t)DCMI_CR_BSM_0)
371#define DCMI_BSM_ALTERNATE_4 ((uint32_t)DCMI_CR_BSM_1)
372#define DCMI_BSM_ALTERNATE_2 ((uint32_t)(DCMI_CR_BSM_0 | DCMI_CR_BSM_1))
382#define DCMI_OEBS_ODD (0x00000000U)
383#define DCMI_OEBS_EVEN ((uint32_t)DCMI_CR_OEBS)
393#define DCMI_LSM_ALL (0x00000000U)
394#define DCMI_LSM_ALTERNATE_2 ((uint32_t)DCMI_CR_LSM)
404#define DCMI_OELS_ODD (0x00000000U)
405#define DCMI_OELS_EVEN ((uint32_t)DCMI_CR_OELS)
415/* Exported macro ------------------------------------------------------------*/
425#if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
426#define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
427 (__HANDLE__)->State = HAL_DCMI_STATE_RESET; \
428 (__HANDLE__)->MspInitCallback = NULL; \
429 (__HANDLE__)->MspDeInitCallback = NULL; \
430 } while(0)
431#else
432#define __HAL_DCMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DCMI_STATE_RESET)
433#endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
434
440#define __HAL_DCMI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= DCMI_CR_ENABLE)
441
447#define __HAL_DCMI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(DCMI_CR_ENABLE))
448
449/* Interrupt & Flag management */
470#define __HAL_DCMI_GET_FLAG(__HANDLE__, __FLAG__)\
471((((__FLAG__) & (DCMI_SR_INDEX|DCMI_MIS_INDEX)) == 0x0)? ((__HANDLE__)->Instance->RIS & (__FLAG__)) :\
472 (((__FLAG__) & DCMI_SR_INDEX) == 0x0)? ((__HANDLE__)->Instance->MIS & (__FLAG__)) : ((__HANDLE__)->Instance->SR & (__FLAG__)))
473
486#define __HAL_DCMI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
487
500#define __HAL_DCMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
501
514#define __HAL_DCMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
515
528#define __HAL_DCMI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->MISR & (__INTERRUPT__))
529
534/* Exported functions --------------------------------------------------------*/
542/* Initialization and de-initialization functions *****************************/
543HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi);
544HAL_StatusTypeDef HAL_DCMI_DeInit(DCMI_HandleTypeDef *hdcmi);
545void HAL_DCMI_MspInit(DCMI_HandleTypeDef* hdcmi);
546void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef* hdcmi);
547
548/* Callbacks Register/UnRegister functions ***********************************/
549#if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
550HAL_StatusTypeDef HAL_DCMI_RegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID, pDCMI_CallbackTypeDef pCallback);
551HAL_StatusTypeDef HAL_DCMI_UnRegisterCallback(DCMI_HandleTypeDef *hdcmi, HAL_DCMI_CallbackIDTypeDef CallbackID);
552#endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
553
561/* IO operation functions *****************************************************/
562HAL_StatusTypeDef HAL_DCMI_Start_DMA(DCMI_HandleTypeDef* hdcmi, uint32_t DCMI_Mode, uint32_t pData, uint32_t Length);
563HAL_StatusTypeDef HAL_DCMI_Stop(DCMI_HandleTypeDef* hdcmi);
564HAL_StatusTypeDef HAL_DCMI_Suspend(DCMI_HandleTypeDef* hdcmi);
565HAL_StatusTypeDef HAL_DCMI_Resume(DCMI_HandleTypeDef* hdcmi);
566void HAL_DCMI_ErrorCallback(DCMI_HandleTypeDef *hdcmi);
567void HAL_DCMI_LineEventCallback(DCMI_HandleTypeDef *hdcmi);
568void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
569void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
570void HAL_DCMI_IRQHandler(DCMI_HandleTypeDef *hdcmi);
578/* Peripheral Control functions ***********************************************/
579HAL_StatusTypeDef HAL_DCMI_ConfigCrop(DCMI_HandleTypeDef *hdcmi, uint32_t X0, uint32_t Y0, uint32_t XSize, uint32_t YSize);
580HAL_StatusTypeDef HAL_DCMI_EnableCrop(DCMI_HandleTypeDef *hdcmi);
581HAL_StatusTypeDef HAL_DCMI_DisableCrop(DCMI_HandleTypeDef *hdcmi);
582HAL_StatusTypeDef HAL_DCMI_ConfigSyncUnmask(DCMI_HandleTypeDef *hdcmi, DCMI_SyncUnmaskTypeDef *SyncUnmask);
583
591/* Peripheral State functions *************************************************/
592HAL_DCMI_StateTypeDef HAL_DCMI_GetState(DCMI_HandleTypeDef *hdcmi);
593uint32_t HAL_DCMI_GetError(DCMI_HandleTypeDef *hdcmi);
602/* Private types -------------------------------------------------------------*/
603/* Private defines -----------------------------------------------------------*/
611/* Private variables ---------------------------------------------------------*/
612/* Private constants ---------------------------------------------------------*/
617#define DCMI_MIS_INDEX ((uint32_t)0x1000)
618#define DCMI_SR_INDEX ((uint32_t)0x2000)
622/* Private macro -------------------------------------------------------------*/
627#define IS_DCMI_CAPTURE_MODE(MODE)(((MODE) == DCMI_MODE_CONTINUOUS) || \
628 ((MODE) == DCMI_MODE_SNAPSHOT))
629
630#define IS_DCMI_SYNCHRO(MODE)(((MODE) == DCMI_SYNCHRO_HARDWARE) || \
631 ((MODE) == DCMI_SYNCHRO_EMBEDDED))
632
633#define IS_DCMI_PCKPOLARITY(POLARITY)(((POLARITY) == DCMI_PCKPOLARITY_FALLING) || \
634 ((POLARITY) == DCMI_PCKPOLARITY_RISING))
635
636#define IS_DCMI_VSPOLARITY(POLARITY)(((POLARITY) == DCMI_VSPOLARITY_LOW) || \
637 ((POLARITY) == DCMI_VSPOLARITY_HIGH))
638
639#define IS_DCMI_HSPOLARITY(POLARITY)(((POLARITY) == DCMI_HSPOLARITY_LOW) || \
640 ((POLARITY) == DCMI_HSPOLARITY_HIGH))
641
642#define IS_DCMI_MODE_JPEG(JPEG_MODE)(((JPEG_MODE) == DCMI_JPEG_DISABLE) || \
643 ((JPEG_MODE) == DCMI_JPEG_ENABLE))
644
645#define IS_DCMI_CAPTURE_RATE(RATE) (((RATE) == DCMI_CR_ALL_FRAME) || \
646 ((RATE) == DCMI_CR_ALTERNATE_2_FRAME) || \
647 ((RATE) == DCMI_CR_ALTERNATE_4_FRAME))
648
649#define IS_DCMI_EXTENDED_DATA(DATA)(((DATA) == DCMI_EXTEND_DATA_8B) || \
650 ((DATA) == DCMI_EXTEND_DATA_10B) || \
651 ((DATA) == DCMI_EXTEND_DATA_12B) || \
652 ((DATA) == DCMI_EXTEND_DATA_14B))
653
654#define IS_DCMI_WINDOW_COORDINATE(COORDINATE) ((COORDINATE) <= DCMI_WINDOW_COORDINATE)
655
656#define IS_DCMI_WINDOW_HEIGHT(HEIGHT) ((HEIGHT) <= DCMI_WINDOW_HEIGHT)
657
658#define IS_DCMI_BYTE_SELECT_MODE(MODE)(((MODE) == DCMI_BSM_ALL) || \
659 ((MODE) == DCMI_BSM_OTHER) || \
660 ((MODE) == DCMI_BSM_ALTERNATE_4) || \
661 ((MODE) == DCMI_BSM_ALTERNATE_2))
662
663#define IS_DCMI_BYTE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OEBS_ODD) || \
664 ((POLARITY) == DCMI_OEBS_EVEN))
665
666#define IS_DCMI_LINE_SELECT_MODE(MODE)(((MODE) == DCMI_LSM_ALL) || \
667 ((MODE) == DCMI_LSM_ALTERNATE_2))
668
669#define IS_DCMI_LINE_SELECT_START(POLARITY)(((POLARITY) == DCMI_OELS_ODD) || \
670 ((POLARITY) == DCMI_OELS_EVEN))
671
676/* Private functions ---------------------------------------------------------*/
692#endif /* DCMI */
693
694#ifdef __cplusplus
695}
696#endif
697
698#endif /* STM32H7xx_HAL_DCMI_H */
699
#define __IO
Definition: core_cm4.h:239
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
DCMI.
Definition: stm32h723xx.h:561
DMA handle Structure definition.
Definition: stm32h7xx_hal_dma.h:138