--- /dev/null
+/**\r
+ ******************************************************************************\r
+ * @file stm32f7xx_hal_dcmi_ex.c\r
+ * @author MCD Application Team\r
+ * @version V0.3.0\r
+ * @date 06-March-2015\r
+ * @brief DCMI Extension HAL module driver.\r
+ * This file provides firmware functions to manage the following \r
+ * functionalities of DCMI extension peripheral:\r
+ * + Extension features functions \r
+ * \r
+ @verbatim \r
+ ==============================================================================\r
+ ##### DCMI peripheral extension features #####\r
+ ==============================================================================\r
+ \r
+ [..] Support of Black and White cameras \r
+ \r
+ ##### How to use this driver #####\r
+ ==============================================================================\r
+ [..] This driver provides functions to manage the Black and White feature\r
+ \r
+ @endverbatim\r
+ ******************************************************************************\r
+ * @attention\r
+ *\r
+ * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without modification,\r
+ * are permitted provided that the following conditions are met:\r
+ * 1. Redistributions of source code must retain the above copyright notice,\r
+ * this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright notice,\r
+ * this list of conditions and the following disclaimer in the documentation\r
+ * and/or other materials provided with the distribution.\r
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors\r
+ * may be used to endorse or promote products derived from this software\r
+ * without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\r
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ *\r
+ ******************************************************************************\r
+ */ \r
+\r
+/* Includes ------------------------------------------------------------------*/\r
+#include "stm32f7xx_hal.h"\r
+\r
+/** @addtogroup STM32F7xx_HAL_Driver\r
+ * @{\r
+ */\r
+/** @defgroup DCMI DCMI\r
+ * @brief DCMI HAL module driver\r
+ * @{\r
+ */\r
+\r
+#ifdef HAL_DCMI_MODULE_ENABLED\r
+\r
+#if defined(STM32F746xx) || defined(STM32F756xx)\r
+/* Private typedef -----------------------------------------------------------*/\r
+/* Private define ------------------------------------------------------------*/\r
+/* Private macro -------------------------------------------------------------*/\r
+/* Private variables ---------------------------------------------------------*/\r
+/* Private function prototypes -----------------------------------------------*/\r
+/* Exported functions --------------------------------------------------------*/\r
+\r
+/** @defgroup DCMIEx_Exported_Functions DCMI Extended Exported Functions\r
+ * @{\r
+ */\r
+\r
+/** @defgroup DCMIEx_Exported_Functions_Group1 Initialization and Configuration functions\r
+ * @brief Initialization and Configuration functions\r
+ *\r
+@verbatim \r
+ ===============================================================================\r
+ ##### Initialization and Configuration functions #####\r
+ =============================================================================== \r
+ [..] This section provides functions allowing to:\r
+ (+) Initialize and configure the DCMI\r
+ (+) De-initialize the DCMI \r
+\r
+@endverbatim\r
+ * @{\r
+ */\r
+ \r
+/**\r
+ * @brief Initializes the DCMI according to the specified\r
+ * parameters in the DCMI_InitTypeDef and create the associated handle.\r
+ * @param hdcmi: pointer to a DCMI_HandleTypeDef structure that contains\r
+ * the configuration information for DCMI.\r
+ * @retval HAL status\r
+ */\r
+HAL_StatusTypeDef HAL_DCMI_Init(DCMI_HandleTypeDef *hdcmi)\r
+{ \r
+ /* Check the DCMI peripheral state */\r
+ if(hdcmi == NULL)\r
+ {\r
+ return HAL_ERROR;\r
+ }\r
+ \r
+ /* Check function parameters */\r
+ assert_param(IS_DCMI_ALL_INSTANCE(hdcmi->Instance));\r
+ assert_param(IS_DCMI_PCKPOLARITY(hdcmi->Init.PCKPolarity));\r
+ assert_param(IS_DCMI_VSPOLARITY(hdcmi->Init.VSPolarity));\r
+ assert_param(IS_DCMI_HSPOLARITY(hdcmi->Init.HSPolarity));\r
+ assert_param(IS_DCMI_SYNCHRO(hdcmi->Init.SynchroMode));\r
+ assert_param(IS_DCMI_CAPTURE_RATE(hdcmi->Init.CaptureRate));\r
+ assert_param(IS_DCMI_EXTENDED_DATA(hdcmi->Init.ExtendedDataMode));\r
+ assert_param(IS_DCMI_MODE_JPEG(hdcmi->Init.JPEGMode));\r
+\r
+ assert_param(IS_DCMI_BYTE_SELECT_MODE(hdcmi->Init.ByteSelectMode));\r
+ assert_param(IS_DCMI_BYTE_SELECT_START(hdcmi->Init.ByteSelectStart));\r
+ assert_param(IS_DCMI_LINE_SELECT_MODE(hdcmi->Init.LineSelectMode));\r
+ assert_param(IS_DCMI_LINE_SELECT_START(hdcmi->Init.LineSelectStart));\r
+ \r
+ if(hdcmi->State == HAL_DCMI_STATE_RESET)\r
+ {\r
+ /* Init the low level hardware */\r
+ HAL_DCMI_MspInit(hdcmi);\r
+ } \r
+ \r
+ /* Change the DCMI state */\r
+ hdcmi->State = HAL_DCMI_STATE_BUSY; \r
+ /* Configures the HS, VS, DE and PC polarity */\r
+ hdcmi->Instance->CR &= ~(DCMI_CR_PCKPOL | DCMI_CR_HSPOL | DCMI_CR_VSPOL | DCMI_CR_EDM_0 |\\r
+ DCMI_CR_EDM_1 | DCMI_CR_FCRC_0 | DCMI_CR_FCRC_1 | DCMI_CR_JPEG |\\r
+ DCMI_CR_ESS | DCMI_CR_BSM_0 | DCMI_CR_BSM_1 | DCMI_CR_OEBS |\\r
+ DCMI_CR_LSM | DCMI_CR_OELS);\r
+\r
+ hdcmi->Instance->CR |= (uint32_t)(hdcmi->Init.SynchroMode | hdcmi->Init.CaptureRate |\\r
+ hdcmi->Init.VSPolarity | hdcmi->Init.HSPolarity |\\r
+ hdcmi->Init.PCKPolarity | hdcmi->Init.ExtendedDataMode |\\r
+ hdcmi->Init.JPEGMode | hdcmi->Init.ByteSelectMode |\\r
+ hdcmi->Init.ByteSelectStart | hdcmi->Init.LineSelectMode |\\r
+ hdcmi->Init.LineSelectStart);\r
+ \r
+ if(hdcmi->Init.SynchroMode == DCMI_SYNCHRO_EMBEDDED)\r
+ {\r
+ DCMI->ESCR = (((uint32_t)hdcmi->Init.SyncroCode.FrameStartCode) |\r
+ ((uint32_t)hdcmi->Init.SyncroCode.LineStartCode << 8)|\r
+ ((uint32_t)hdcmi->Init.SyncroCode.LineEndCode << 16) |\r
+ ((uint32_t)hdcmi->Init.SyncroCode.FrameEndCode << 24));\r
+\r
+ }\r
+\r
+ /* Enable the Line interrupt */\r
+ __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_LINE);\r
+\r
+ /* Enable the VSYNC interrupt */\r
+ __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_VSYNC);\r
+\r
+ /* Enable the Frame capture complete interrupt */\r
+ __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_FRAME);\r
+\r
+ /* Enable the Synchronization error interrupt */\r
+ __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_ERR);\r
+\r
+ /* Enable the Overflow interrupt */\r
+ __HAL_DCMI_ENABLE_IT(hdcmi, DCMI_IT_OVF);\r
+\r
+ /* Enable DCMI by setting DCMIEN bit */\r
+ __HAL_DCMI_ENABLE(hdcmi);\r
+\r
+ /* Update error code */\r
+ hdcmi->ErrorCode = HAL_DCMI_ERROR_NONE;\r
+ \r
+ /* Initialize the DCMI state*/\r
+ hdcmi->State = HAL_DCMI_STATE_READY;\r
+\r
+ return HAL_OK;\r
+}\r
+\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+ \r
+/**\r
+ * @}\r
+ */\r
+#endif /* STM32F746xx || STM32F756xx */\r
+#endif /* HAL_DCMI_MODULE_ENABLED */\r
+/**\r
+ * @}\r
+ */\r
+\r
+/**\r
+ * @}\r
+ */\r
+\r
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r