1 /**
2   ******************************************************************************
3   * @file    stm32f7xx_hal_jpeg.h
4   * @author  MCD Application Team
5   * @brief   Header file of JPEG HAL module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2017 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32F7xx_HAL_JPEG_H
21 #define STM32F7xx_HAL_JPEG_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32f7xx_hal_def.h"
29 
30 #if defined (JPEG)
31 
32 /** @addtogroup STM32F7xx_HAL_Driver
33   * @{
34   */
35 
36 /** @addtogroup JPEG
37   * @{
38   */
39 
40 /* Exported types ------------------------------------------------------------*/
41 /** @defgroup JPEG_Exported_Types JPEG Exported Types
42   * @{
43   */
44 
45 /** @defgroup JPEG_Configuration_Structure_definition JPEG Configuration for encoding Structure definition
46   * @brief  JPEG encoding configuration Structure definition
47   * @{
48   */
49 typedef struct
50 {
51   uint32_t ColorSpace;               /*!< Image Color space : gray-scale, YCBCR, RGB or CMYK
52                                            This parameter can be a value of @ref JPEG_ColorSpace */
53 
54   uint32_t ChromaSubsampling;        /*!< Chroma Subsampling in case of YCBCR or CMYK color space, 0-> 4:4:4 , 1-> 4:2:2, 2 -> 4:1:1, 3 -> 4:2:0
55                                            This parameter can be a value of @ref JPEG_ChromaSubsampling */
56 
57   uint32_t ImageHeight;              /*!< Image height : number of lines */
58 
59   uint32_t ImageWidth;               /*!< Image width : number of pixels per line */
60 
61   uint32_t ImageQuality;             /*!< Quality of the JPEG encoding : from 1 to 100 */
62 
63 } JPEG_ConfTypeDef;
64 /**
65   * @}
66   */
67 
68 /** @defgroup HAL_JPEG_state_structure_definition HAL JPEG state structure definition
69   * @brief  HAL JPEG State structure definition
70   * @{
71   */
72 typedef enum
73 {
74   HAL_JPEG_STATE_RESET              = 0x00U,  /*!< JPEG not yet initialized or disabled  */
75   HAL_JPEG_STATE_READY              = 0x01U,  /*!< JPEG initialized and ready for use    */
76   HAL_JPEG_STATE_BUSY               = 0x02U,  /*!< JPEG internal processing is ongoing   */
77   HAL_JPEG_STATE_BUSY_ENCODING      = 0x03U,  /*!< JPEG encoding processing is ongoing   */
78   HAL_JPEG_STATE_BUSY_DECODING      = 0x04U,  /*!< JPEG decoding processing is ongoing   */
79   HAL_JPEG_STATE_TIMEOUT            = 0x05U,  /*!< JPEG timeout state                    */
80   HAL_JPEG_STATE_ERROR              = 0x06U   /*!< JPEG error state                      */
81 } HAL_JPEG_STATETypeDef;
82 
83 /**
84   * @}
85   */
86 
87 
88 /** @defgroup JPEG_handle_Structure_definition JPEG handle Structure definition
89   * @brief  JPEG handle Structure definition
90   * @{
91   */
92 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
93 typedef struct __JPEG_HandleTypeDef
94 #else
95 typedef struct
96 #endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */
97 {
98   JPEG_TypeDef             *Instance;        /*!< JPEG peripheral register base address */
99 
100   JPEG_ConfTypeDef         Conf;             /*!< Current JPEG encoding/decoding parameters */
101 
102   uint8_t                  *pJpegInBuffPtr;  /*!< Pointer to JPEG processing (encoding, decoding,...) input buffer */
103 
104   uint8_t                  *pJpegOutBuffPtr; /*!< Pointer to JPEG processing (encoding, decoding,...) output buffer */
105 
106   __IO uint32_t            JpegInCount;      /*!< Internal Counter of input data */
107 
108   __IO uint32_t            JpegOutCount;     /*!< Internal Counter of output data */
109 
110   uint32_t                 InDataLength;     /*!< Input Buffer Length in Bytes */
111 
112   uint32_t                 OutDataLength;    /*!< Output Buffer Length in Bytes */
113 
114   DMA_HandleTypeDef        *hdmain;          /*!< JPEG In DMA handle parameters */
115 
116   DMA_HandleTypeDef        *hdmaout;         /*!< JPEG Out DMA handle parameters */
117 
118   uint8_t                  CustomQuanTable;  /*!< If set to 1 specify that user customized quantization tables are used */
119 
120   uint8_t                  *QuantTable0;     /*!< Basic Quantization Table for component 0 */
121 
122   uint8_t                  *QuantTable1;     /*!< Basic Quantization Table for component 1 */
123 
124   uint8_t                  *QuantTable2;     /*!< Basic Quantization Table for component 2 */
125 
126   uint8_t                  *QuantTable3;     /*!< Basic Quantization Table for component 3 */
127 
128   HAL_LockTypeDef          Lock;             /*!< JPEG locking object */
129 
130   __IO  HAL_JPEG_STATETypeDef State;         /*!< JPEG peripheral state */
131 
132   __IO  uint32_t           ErrorCode;        /*!< JPEG Error code */
133 
134   __IO uint32_t Context;                     /*!< JPEG Internal context */
135 
136 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
137   void (*InfoReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg,
138                             JPEG_ConfTypeDef *pInfo);  /*!< JPEG Info ready callback      */
139   void (*EncodeCpltCallback)(struct __JPEG_HandleTypeDef
140                              *hjpeg);                          /*!< JPEG Encode complete callback */
141   void (*DecodeCpltCallback)(struct __JPEG_HandleTypeDef
142                              *hjpeg);                          /*!< JPEG Decode complete callback */
143   void (*ErrorCallback)(struct __JPEG_HandleTypeDef
144                         *hjpeg);                               /*!< JPEG Error callback           */
145   void (*GetDataCallback)(struct __JPEG_HandleTypeDef *hjpeg,
146                           uint32_t NbDecodedData);     /*!< JPEG Get Data callback        */
147   void (*DataReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut,
148                             uint32_t OutDataLength);   /*!< JPEG Data ready callback */
149 
150   void (* MspInitCallback)(struct __JPEG_HandleTypeDef *hjpeg);                            /*!< JPEG Msp Init callback  */
151   void (* MspDeInitCallback)(struct __JPEG_HandleTypeDef
152                              *hjpeg);                          /*!< JPEG Msp DeInit callback  */
153 
154 
155 #endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */
156 
157 
158 } JPEG_HandleTypeDef;
159 /**
160   * @}
161   */
162 
163 
164 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
165 /** @defgroup HAL_JPEG_Callback_ID_enumeration_definition HAL JPEG Callback ID enumeration definition
166   * @brief  HAL JPEG Callback ID enumeration definition
167   * @{
168   */
169 typedef enum
170 {
171   HAL_JPEG_ENCODE_CPLT_CB_ID    = 0x01U,    /*!< JPEG Encode Complete callback ID */
172   HAL_JPEG_DECODE_CPLT_CB_ID    = 0x02U,    /*!< JPEG Decode Complete callback ID */
173   HAL_JPEG_ERROR_CB_ID          = 0x03U,    /*!< JPEG Error callback ID           */
174 
175   HAL_JPEG_MSPINIT_CB_ID        = 0x04U,    /*!< JPEG MspInit callback ID         */
176   HAL_JPEG_MSPDEINIT_CB_ID      = 0x05U     /*!< JPEG MspDeInit callback ID       */
177 
178 } HAL_JPEG_CallbackIDTypeDef;
179 /**
180   * @}
181   */
182 
183 /** @defgroup HAL_JPEG_Callback_pointer_definition HAL JPEG Callback pointer definition
184   * @brief  HAL JPEG Callback pointer definition
185   * @{
186   */
187 typedef  void (*pJPEG_CallbackTypeDef)(JPEG_HandleTypeDef *hjpeg);    /*!< pointer to a common JPEG callback function */
188 typedef  void (*pJPEG_InfoReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg,
189                                                 JPEG_ConfTypeDef *pInfo);  /*!< pointer to an Info ready JPEG callback function */
190 typedef  void (*pJPEG_GetDataCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg,
191                                               uint32_t NbDecodedData);     /*!< pointer to a Get data JPEG callback function */
192 typedef  void (*pJPEG_DataReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut,
193                                                 uint32_t OutDataLength);  /*!< pointer to a Data ready JPEG callback function */
194 /**
195   * @}
196   */
197 
198 #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
199 
200 /**
201   * @}
202   */
203 
204 /* Exported constants --------------------------------------------------------*/
205 
206 /** @defgroup JPEG_Exported_Constants JPEG Exported Constants
207   * @{
208   */
209 
210 /** @defgroup JPEG_Error_Code_definition JPEG Error Code definition
211   * @brief  JPEG Error Code definition
212   * @{
213   */
214 
215 #define  HAL_JPEG_ERROR_NONE        ((uint32_t)0x00000000U)    /*!< No error             */
216 #define  HAL_JPEG_ERROR_HUFF_TABLE  ((uint32_t)0x00000001U)    /*!< HUffman Table programming error */
217 #define  HAL_JPEG_ERROR_QUANT_TABLE ((uint32_t)0x00000002U)    /*!< Quantization Table programming error */
218 #define  HAL_JPEG_ERROR_DMA         ((uint32_t)0x00000004U)    /*!< DMA transfer error   */
219 #define  HAL_JPEG_ERROR_TIMEOUT     ((uint32_t)0x00000008U)    /*!< Timeout error        */
220 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
221 #define  HAL_JPEG_ERROR_INVALID_CALLBACK ((uint32_t)0x00000010U)    /*!< Invalid Callback error  */
222 #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
223 /**
224   * @}
225   */
226 
227 /** @defgroup JPEG_Quantization_Table_Size JPEG Quantization Table Size
228   * @brief  JPEG Quantization Table Size
229   * @{
230   */
231 #define JPEG_QUANT_TABLE_SIZE  ((uint32_t)64U) /*!< JPEG Quantization Table Size in bytes  */
232 /**
233   * @}
234   */
235 
236 
237 /** @defgroup JPEG_ColorSpace JPEG ColorSpace
238   * @brief  JPEG Color Space
239   * @{
240   */
241 #define JPEG_GRAYSCALE_COLORSPACE     ((uint32_t)0x00000000U)
242 #define JPEG_YCBCR_COLORSPACE         JPEG_CONFR1_COLORSPACE_0
243 #define JPEG_CMYK_COLORSPACE          JPEG_CONFR1_COLORSPACE
244 
245 
246 /**
247   * @}
248   */
249 
250 
251 /** @defgroup JPEG_ChromaSubsampling JPEG Chrominance Sampling
252   * @brief  JPEG Chrominance Sampling
253   * @{
254   */
255 #define JPEG_444_SUBSAMPLING     ((uint32_t)0x00000000U)   /*!< Chroma Subsampling 4:4:4 */
256 #define JPEG_420_SUBSAMPLING     ((uint32_t)0x00000001U)   /*!< Chroma Subsampling 4:2:0 */
257 #define JPEG_422_SUBSAMPLING     ((uint32_t)0x00000002U)   /*!< Chroma Subsampling 4:2:2 */
258 
259 /**
260   * @}
261   */
262 
263 /** @defgroup JPEG_ImageQuality JPEG Image Quality
264   * @brief  JPEG Min and Max Image Quality
265   * @{
266   */
267 #define JPEG_IMAGE_QUALITY_MIN     ((uint32_t)1U)     /*!< Minimum JPEG quality */
268 #define JPEG_IMAGE_QUALITY_MAX     ((uint32_t)100U)   /*!< Maximum JPEG quality */
269 
270 /**
271   * @}
272   */
273 
274 /** @defgroup JPEG_Interrupt_configuration_definition JPEG Interrupt configuration definition
275   * @brief JPEG Interrupt definition
276   * @{
277   */
278 #define JPEG_IT_IFT     ((uint32_t)JPEG_CR_IFTIE)   /*!< Input FIFO Threshold Interrupt */
279 #define JPEG_IT_IFNF    ((uint32_t)JPEG_CR_IFNFIE)  /*!< Input FIFO Not Full Interrupt */
280 #define JPEG_IT_OFT     ((uint32_t)JPEG_CR_OFTIE)   /*!< Output FIFO Threshold Interrupt */
281 #define JPEG_IT_OFNE    ((uint32_t)JPEG_CR_OFTIE)   /*!< Output FIFO Not Empty Interrupt */
282 #define JPEG_IT_EOC     ((uint32_t)JPEG_CR_EOCIE)   /*!< End of Conversion Interrupt */
283 #define JPEG_IT_HPD     ((uint32_t)JPEG_CR_HPDIE)   /*!< Header Parsing Done Interrupt */
284 /**
285   * @}
286   */
287 
288 /** @defgroup JPEG_Flag_definition JPEG Flag definition
289   * @brief JPEG Flags definition
290   * @{
291   */
292 #define JPEG_FLAG_IFTF     ((uint32_t)JPEG_SR_IFTF)   /*!< Input FIFO is not full and is bellow its threshold flag */
293 #define JPEG_FLAG_IFNFF    ((uint32_t)JPEG_SR_IFNFF)  /*!< Input FIFO Not Full Flag, a data can be written */
294 #define JPEG_FLAG_OFTF     ((uint32_t)JPEG_SR_OFTF)   /*!< Output FIFO is not empty and has reach its threshold */
295 #define JPEG_FLAG_OFNEF    ((uint32_t)JPEG_SR_OFNEF)  /*!< Output FIFO is not empty, a data is available  */
296 #define JPEG_FLAG_EOCF     ((uint32_t)JPEG_SR_EOCF)   /*!< JPEG Codec core has finished the encoding or the decoding process and than last data has been sent to the output FIFO  */
297 #define JPEG_FLAG_HPDF     ((uint32_t)JPEG_SR_HPDF)   /*!< JPEG Codec has finished the parsing of the headers and the internal registers have been updated  */
298 #define JPEG_FLAG_COF      ((uint32_t)JPEG_SR_COF)    /*!< JPEG Codec operation on going  flag*/
299 
300 #define JPEG_FLAG_ALL      ((uint32_t)0x000000FEU)     /*!< JPEG Codec All previous flag*/
301 /**
302   * @}
303   */
304 
305 /** @defgroup JPEG_PROCESS_PAUSE_RESUME_definition JPEG Process Pause Resume definition
306   * @brief JPEG process pause, resume definition
307   * @{
308   */
309 #define JPEG_PAUSE_RESUME_INPUT          ((uint32_t)0x00000001U)     /*!< Pause/Resume Input FIFO Xfer*/
310 #define JPEG_PAUSE_RESUME_OUTPUT         ((uint32_t)0x00000002U)     /*!< Pause/Resume Output FIFO Xfer*/
311 #define JPEG_PAUSE_RESUME_INPUT_OUTPUT   ((uint32_t)0x00000003U)     /*!< Pause/Resume Input and Output FIFO Xfer*/
312 /**
313   * @}
314   */
315 
316 /**
317   * @}
318   */
319 /* Exported macro ------------------------------------------------------------*/
320 
321 /** @defgroup JPEG_Exported_Macros JPEG Exported Macros
322   * @{
323   */
324 
325 /** @brief Reset JPEG handle state
326   * @param  __HANDLE__ specifies the JPEG handle.
327   * @retval None
328   */
329 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
330 #define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) do{\
331                                                       (__HANDLE__)->State = HAL_JPEG_STATE_RESET;\
332                                                       (__HANDLE__)->MspInitCallback = NULL;\
333                                                       (__HANDLE__)->MspDeInitCallback = NULL;\
334                                                       }while(0)
335 #else
336 #define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_JPEG_STATE_RESET)
337 #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
338 
339 
340 /**
341   * @brief  Enable the JPEG peripheral.
342   * @param  __HANDLE__ specifies the JPEG handle.
343   * @retval None
344   */
345 #define __HAL_JPEG_ENABLE(__HANDLE__)  ((__HANDLE__)->Instance->CR |=  JPEG_CR_JCEN)
346 
347 /**
348   * @brief Disable the JPEG peripheral.
349   * @param  __HANDLE__ specifies the JPEG handle.
350   * @retval None
351   */
352 #define __HAL_JPEG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &=  ~JPEG_CR_JCEN)
353 
354 
355 /**
356   * @brief  Check the specified JPEG status flag.
357   * @param  __HANDLE__ specifies the JPEG handle.
358   * @param  __FLAG__  specifies the flag to check
359   *         This parameter can be one of the following values:
360   *         @arg JPEG_FLAG_IFTF  : The input FIFO is not full and is bellow its threshold flag
361   *         @arg JPEG_FLAG_IFNFF : The input FIFO Not Full Flag, a data can be written
362   *         @arg JPEG_FLAG_OFTF  : The output FIFO is not empty and has reach its threshold
363   *         @arg JPEG_FLAG_OFNEF : The output FIFO is not empty, a data is available
364   *         @arg JPEG_FLAG_EOCF  : JPEG Codec core has finished the encoding or the decoding process
365   *                                and than last data has been sent to the output FIFO
366   *         @arg JPEG_FLAG_HPDF  : JPEG Codec has finished the parsing of the headers
367   *                                and the internal registers have been updated
368   *         @arg JPEG_FLAG_COF   : JPEG Codec operation on going  flag
369   *
370   * @retval __HAL_JPEG_GET_FLAG : returns The new state of __FLAG__ (TRUE or FALSE)
371   */
372 
373 #define __HAL_JPEG_GET_FLAG(__HANDLE__,__FLAG__)  (((__HANDLE__)->Instance->SR & (__FLAG__)))
374 
375 /**
376   * @brief  Clear the specified JPEG status flag.
377   * @param  __HANDLE__ specifies the JPEG handle.
378   * @param  __FLAG__  specifies the flag to clear
379   *         This parameter can be one of the following values:
380   *         @arg JPEG_FLAG_EOCF  : JPEG Codec core has finished the encoding or the decoding process
381   *                                and than last data has been sent to the output FIFO
382   *         @arg JPEG_FLAG_HPDF  : JPEG Codec has finished the parsing of the headers
383   * @retval None
384   */
385 
386 #define __HAL_JPEG_CLEAR_FLAG(__HANDLE__,__FLAG__)  (((__HANDLE__)->Instance->CFR |= ((__FLAG__) & (JPEG_FLAG_EOCF | JPEG_FLAG_HPDF))))
387 
388 
389 /**
390   * @brief  Enable Interrupt.
391   * @param   __HANDLE__ specifies the JPEG handle.
392   * @param  __INTERRUPT__  specifies the interrupt to enable
393   *         This parameter can be one of the following values:
394   *         @arg JPEG_IT_IFT   : Input FIFO Threshold Interrupt
395   *         @arg JPEG_IT_IFNF  : Input FIFO Not Full Interrupt
396   *         @arg JPEG_IT_OFT   : Output FIFO Threshold Interrupt
397   *         @arg JPEG_IT_OFNE  : Output FIFO Not empty Interrupt
398   *         @arg JPEG_IT_EOC   : End of Conversion Interrupt
399   *         @arg JPEG_IT_HPD   : Header Parsing Done Interrupt
400   *
401   * @retval No return
402   */
403 #define __HAL_JPEG_ENABLE_IT(__HANDLE__,__INTERRUPT__)  ((__HANDLE__)->Instance->CR |= (__INTERRUPT__) )
404 
405 /**
406   * @brief  Disable Interrupt.
407   * @param   __HANDLE__ specifies the JPEG handle.
408   * @param  __INTERRUPT__ specifies the interrupt to disable
409   *         This parameter can be one of the following values:
410   *         @arg JPEG_IT_IFT   : Input FIFO Threshold Interrupt
411   *         @arg JPEG_IT_IFNF  : Input FIFO Not Full Interrupt
412   *         @arg JPEG_IT_OFT   : Output FIFO Threshold Interrupt
413   *         @arg JPEG_IT_OFNE  : Output FIFO Not empty Interrupt
414   *         @arg JPEG_IT_EOC   : End of Conversion Interrupt
415   *         @arg JPEG_IT_HPD   : Header Parsing Done Interrupt
416   *
417   * @note    To disable an IT we must use MODIFY_REG macro to avoid writing "1" to the FIFO flush bits
418   *          located in the same IT enable register (CR register).
419   * @retval  No return
420   */
421 #define __HAL_JPEG_DISABLE_IT(__HANDLE__,__INTERRUPT__) MODIFY_REG((__HANDLE__)->Instance->CR, (__INTERRUPT__), 0UL)
422 
423 
424 /**
425   * @brief  Get Interrupt state.
426   * @param   __HANDLE__ specifies the JPEG handle.
427   * @param  __INTERRUPT__  specifies the interrupt to check
428   *         This parameter can be one of the following values:
429   *         @arg JPEG_IT_IFT   : Input FIFO Threshold Interrupt
430   *         @arg JPEG_IT_IFNF  : Input FIFO Not Full Interrupt
431   *         @arg JPEG_IT_OFT   : Output FIFO Threshold Interrupt
432   *         @arg JPEG_IT_OFNE  : Output FIFO Not empty Interrupt
433   *         @arg JPEG_IT_EOC   : End of Conversion Interrupt
434   *         @arg JPEG_IT_HPD   : Header Parsing Done Interrupt
435   *
436   * @retval returns The new state of __INTERRUPT__ (Enabled or disabled)
437   */
438 #define __HAL_JPEG_GET_IT_SOURCE(__HANDLE__,__INTERRUPT__)     ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
439 
440 /**
441   * @}
442   */
443 
444 /* Exported functions --------------------------------------------------------*/
445 /** @addtogroup JPEG_Exported_Functions
446   * @{
447   */
448 
449 /** @addtogroup JPEG_Exported_Functions_Group1
450   * @{
451   */
452 /* Initialization/de-initialization functions  ********************************/
453 HAL_StatusTypeDef HAL_JPEG_Init(JPEG_HandleTypeDef *hjpeg);
454 HAL_StatusTypeDef HAL_JPEG_DeInit(JPEG_HandleTypeDef *hjpeg);
455 void HAL_JPEG_MspInit(JPEG_HandleTypeDef *hjpeg);
456 void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef *hjpeg);
457 
458 #if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
459 HAL_StatusTypeDef HAL_JPEG_RegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID,
460                                             pJPEG_CallbackTypeDef pCallback);
461 HAL_StatusTypeDef HAL_JPEG_UnRegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID);
462 
463 HAL_StatusTypeDef HAL_JPEG_RegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg,
464                                                      pJPEG_InfoReadyCallbackTypeDef pCallback);
465 HAL_StatusTypeDef HAL_JPEG_UnRegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg);
466 
467 HAL_StatusTypeDef HAL_JPEG_RegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg, pJPEG_GetDataCallbackTypeDef pCallback);
468 HAL_StatusTypeDef HAL_JPEG_UnRegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg);
469 
470 HAL_StatusTypeDef HAL_JPEG_RegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg,
471                                                      pJPEG_DataReadyCallbackTypeDef pCallback);
472 HAL_StatusTypeDef HAL_JPEG_UnRegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg);
473 
474 #endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
475 
476 /**
477   * @}
478   */
479 
480 /** @addtogroup JPEG_Exported_Functions_Group2
481   * @{
482   */
483 /* Encoding/Decoding Configuration functions  ********************************/
484 HAL_StatusTypeDef HAL_JPEG_ConfigEncoding(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pConf);
485 HAL_StatusTypeDef HAL_JPEG_GetInfo(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo);
486 HAL_StatusTypeDef HAL_JPEG_EnableHeaderParsing(JPEG_HandleTypeDef *hjpeg);
487 HAL_StatusTypeDef HAL_JPEG_DisableHeaderParsing(JPEG_HandleTypeDef *hjpeg);
488 HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable0, uint8_t *QTable1,
489                                               uint8_t *QTable2, uint8_t *QTable3);
490 
491 /**
492   * @}
493   */
494 
495 /** @addtogroup JPEG_Exported_Functions_Group3
496   * @{
497   */
498 /* JPEG processing functions  **************************************/
499 HAL_StatusTypeDef  HAL_JPEG_Encode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
500                                    uint8_t *pDataOut, uint32_t OutDataLength, uint32_t Timeout);
501 HAL_StatusTypeDef  HAL_JPEG_Decode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
502                                    uint8_t *pDataOutMCU, uint32_t OutDataLength, uint32_t Timeout);
503 HAL_StatusTypeDef  HAL_JPEG_Encode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
504                                       uint8_t *pDataOut, uint32_t OutDataLength);
505 HAL_StatusTypeDef  HAL_JPEG_Decode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
506                                       uint8_t *pDataOutMCU, uint32_t OutDataLength);
507 HAL_StatusTypeDef  HAL_JPEG_Encode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
508                                        uint8_t *pDataOut, uint32_t OutDataLength);
509 HAL_StatusTypeDef  HAL_JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
510                                        uint8_t *pDataOutMCU, uint32_t OutDataLength);
511 HAL_StatusTypeDef  HAL_JPEG_Pause(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection);
512 HAL_StatusTypeDef  HAL_JPEG_Resume(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection);
513 void HAL_JPEG_ConfigInputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewInputBuffer, uint32_t InDataLength);
514 void HAL_JPEG_ConfigOutputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewOutputBuffer, uint32_t OutDataLength);
515 HAL_StatusTypeDef HAL_JPEG_Abort(JPEG_HandleTypeDef *hjpeg);
516 
517 /**
518   * @}
519   */
520 
521 /** @addtogroup JPEG_Exported_Functions_Group4
522   * @{
523   */
524 /* JPEG Decode/Encode callback functions  ********************************************************/
525 void HAL_JPEG_InfoReadyCallback(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo);
526 void HAL_JPEG_EncodeCpltCallback(JPEG_HandleTypeDef *hjpeg);
527 void HAL_JPEG_DecodeCpltCallback(JPEG_HandleTypeDef *hjpeg);
528 void HAL_JPEG_ErrorCallback(JPEG_HandleTypeDef *hjpeg);
529 void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData);
530 void HAL_JPEG_DataReadyCallback(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t OutDataLength);
531 
532 /**
533   * @}
534   */
535 
536 /** @addtogroup JPEG_Exported_Functions_Group5
537   * @{
538   */
539 /* JPEG IRQ handler management  ******************************************************/
540 void HAL_JPEG_IRQHandler(JPEG_HandleTypeDef *hjpeg);
541 
542 /**
543   * @}
544   */
545 
546 /** @addtogroup JPEG_Exported_Functions_Group6
547   * @{
548   */
549 /* Peripheral State and Error functions  ************************************************/
550 HAL_JPEG_STATETypeDef  HAL_JPEG_GetState(JPEG_HandleTypeDef *hjpeg);
551 uint32_t               HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg);
552 
553 /**
554   * @}
555   */
556 
557 /**
558   * @}
559   */
560 
561 /* Private types -------------------------------------------------------------*/
562 /** @defgroup JPEG_Private_Types JPEG Private Types
563   * @{
564   */
565 
566 /**
567   * @}
568   */
569 
570 /* Private defines -----------------------------------------------------------*/
571 /** @defgroup JPEG_Private_Defines JPEG Private Defines
572   * @{
573   */
574 
575 /**
576   * @}
577   */
578 
579 /* Private variables ---------------------------------------------------------*/
580 /** @defgroup JPEG_Private_Variables JPEG Private Variables
581   * @{
582   */
583 
584 /**
585   * @}
586   */
587 
588 /* Private constants ---------------------------------------------------------*/
589 /** @defgroup JPEG_Private_Constants JPEG Private Constants
590   * @{
591   */
592 
593 /**
594   * @}
595   */
596 
597 /* Private macros ------------------------------------------------------------*/
598 /** @defgroup JPEG_Private_Macros JPEG Private Macros
599   * @{
600   */
601 
602 #define IS_JPEG_CHROMASUBSAMPLING(SUBSAMPLING) (((SUBSAMPLING) == JPEG_444_SUBSAMPLING) || \
603                                                 ((SUBSAMPLING) == JPEG_420_SUBSAMPLING) || \
604                                                 ((SUBSAMPLING) == JPEG_422_SUBSAMPLING))
605 
606 #define IS_JPEG_IMAGE_QUALITY(NUMBER) (((NUMBER) >= JPEG_IMAGE_QUALITY_MIN) && ((NUMBER) <= JPEG_IMAGE_QUALITY_MAX))
607 
608 #define IS_JPEG_COLORSPACE(COLORSPACE) (((COLORSPACE) == JPEG_GRAYSCALE_COLORSPACE) || \
609                                         ((COLORSPACE) == JPEG_YCBCR_COLORSPACE)     || \
610                                         ((COLORSPACE) == JPEG_CMYK_COLORSPACE))
611 
612 #define IS_JPEG_PAUSE_RESUME_STATE(VALUE) (((VALUE) == JPEG_PAUSE_RESUME_INPUT) || \
613                                            ((VALUE) == JPEG_PAUSE_RESUME_OUTPUT)|| \
614                                            ((VALUE) == JPEG_PAUSE_RESUME_INPUT_OUTPUT))
615 
616 /**
617   * @}
618   */
619 
620 /* Private functions prototypes ----------------------------------------------*/
621 /** @defgroup JPEG_Private_Functions_Prototypes JPEG Private Functions Prototypes
622   * @{
623   */
624 
625 /**
626   * @}
627   */
628 
629 /* Private functions ---------------------------------------------------------*/
630 /** @defgroup JPEG_Private_Functions JPEG Private Functions
631   * @{
632   */
633 
634 /**
635   * @}
636   */
637 
638 /**
639   * @}
640   */
641 
642 /**
643   * @}
644   */
645 
646 #endif /* JPEG */
647 
648 #ifdef __cplusplus
649 }
650 #endif
651 
652 #endif /* STM32F7xx_HAL_JPEG_H */
653 
654