RTEMS 6.1-rc4
Loading...
Searching...
No Matches
stm32h7xx_hal_jpeg.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_JPEG_H
21#define STM32H7xx_HAL_JPEG_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
30#if defined (JPEG)
31
40/* Exported types ------------------------------------------------------------*/
51typedef struct
52{
53 uint32_t ColorSpace;
56 uint32_t ChromaSubsampling;
59 uint32_t ImageHeight;
61 uint32_t ImageWidth;
63 uint32_t ImageQuality;
65} JPEG_ConfTypeDef;
75typedef enum
76{
77 HAL_JPEG_STATE_RESET = 0x00U,
78 HAL_JPEG_STATE_READY = 0x01U,
79 HAL_JPEG_STATE_BUSY = 0x02U,
80 HAL_JPEG_STATE_BUSY_ENCODING = 0x03U,
81 HAL_JPEG_STATE_BUSY_DECODING = 0x04U,
82 HAL_JPEG_STATE_TIMEOUT = 0x05U,
83 HAL_JPEG_STATE_ERROR = 0x06U
84} HAL_JPEG_STATETypeDef;
85
96#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
97typedef struct __JPEG_HandleTypeDef
98#else
99typedef struct
100#endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */
101{
102 JPEG_TypeDef *Instance;
104 JPEG_ConfTypeDef Conf;
106 uint8_t *pJpegInBuffPtr;
108 uint8_t *pJpegOutBuffPtr;
110 __IO uint32_t JpegInCount;
112 __IO uint32_t JpegOutCount;
114 uint32_t InDataLength;
116 uint32_t OutDataLength;
118 MDMA_HandleTypeDef *hdmain;
120 MDMA_HandleTypeDef *hdmaout;
122 uint8_t CustomQuanTable;
124 uint8_t *QuantTable0;
126 uint8_t *QuantTable1;
128 uint8_t *QuantTable2;
130 uint8_t *QuantTable3;
132 HAL_LockTypeDef Lock;
134 __IO HAL_JPEG_STATETypeDef State;
136 __IO uint32_t ErrorCode;
138 __IO uint32_t Context;
140#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
141 void (*InfoReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg,
142 JPEG_ConfTypeDef *pInfo);
143 void (*EncodeCpltCallback)(struct __JPEG_HandleTypeDef
144 *hjpeg);
145 void (*DecodeCpltCallback)(struct __JPEG_HandleTypeDef
146 *hjpeg);
147 void (*ErrorCallback)(struct __JPEG_HandleTypeDef
148 *hjpeg);
149 void (*GetDataCallback)(struct __JPEG_HandleTypeDef *hjpeg,
150 uint32_t NbDecodedData);
151 void (*DataReadyCallback)(struct __JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut,
152 uint32_t OutDataLength);
154 void (* MspInitCallback)(struct __JPEG_HandleTypeDef *hjpeg);
155 void (* MspDeInitCallback)(struct __JPEG_HandleTypeDef
156 *hjpeg);
159#endif /* (USE_HAL_JPEG_REGISTER_CALLBACKS) */
160
161
162} JPEG_HandleTypeDef;
168#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
174typedef enum
175{
176 HAL_JPEG_ENCODE_CPLT_CB_ID = 0x01U,
177 HAL_JPEG_DECODE_CPLT_CB_ID = 0x02U,
178 HAL_JPEG_ERROR_CB_ID = 0x03U,
180 HAL_JPEG_MSPINIT_CB_ID = 0x04U,
181 HAL_JPEG_MSPDEINIT_CB_ID = 0x05U
183} HAL_JPEG_CallbackIDTypeDef;
193typedef void (*pJPEG_CallbackTypeDef)(JPEG_HandleTypeDef *hjpeg);
194typedef void (*pJPEG_InfoReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg,
195 JPEG_ConfTypeDef *pInfo);
196typedef void (*pJPEG_GetDataCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg,
197 uint32_t NbDecodedData);
198typedef void (*pJPEG_DataReadyCallbackTypeDef)(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut,
199 uint32_t OutDataLength);
204#endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
205
210/* Exported constants --------------------------------------------------------*/
211
223#define HAL_JPEG_ERROR_NONE ((uint32_t)0x00000000U)
224#define HAL_JPEG_ERROR_HUFF_TABLE ((uint32_t)0x00000001U)
225#define HAL_JPEG_ERROR_QUANT_TABLE ((uint32_t)0x00000002U)
226#define HAL_JPEG_ERROR_DMA ((uint32_t)0x00000004U)
227#define HAL_JPEG_ERROR_TIMEOUT ((uint32_t)0x00000008U)
228#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
229#define HAL_JPEG_ERROR_INVALID_CALLBACK ((uint32_t)0x00000010U)
230#endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
240#define JPEG_QUANT_TABLE_SIZE ((uint32_t)64U)
251#define JPEG_GRAYSCALE_COLORSPACE ((uint32_t)0x00000000U)
252#define JPEG_YCBCR_COLORSPACE JPEG_CONFR1_COLORSPACE_0
253#define JPEG_CMYK_COLORSPACE JPEG_CONFR1_COLORSPACE
254
255
266#define JPEG_444_SUBSAMPLING ((uint32_t)0x00000000U)
267#define JPEG_420_SUBSAMPLING ((uint32_t)0x00000001U)
268#define JPEG_422_SUBSAMPLING ((uint32_t)0x00000002U)
279#define JPEG_IMAGE_QUALITY_MIN ((uint32_t)1U)
280#define JPEG_IMAGE_QUALITY_MAX ((uint32_t)100U)
291#define JPEG_IT_IFT ((uint32_t)JPEG_CR_IFTIE)
292#define JPEG_IT_IFNF ((uint32_t)JPEG_CR_IFNFIE)
293#define JPEG_IT_OFT ((uint32_t)JPEG_CR_OFTIE)
294#define JPEG_IT_OFNE ((uint32_t)JPEG_CR_OFTIE)
295#define JPEG_IT_EOC ((uint32_t)JPEG_CR_EOCIE)
296#define JPEG_IT_HPD ((uint32_t)JPEG_CR_HPDIE)
306#define JPEG_FLAG_IFTF ((uint32_t)JPEG_SR_IFTF)
307#define JPEG_FLAG_IFNFF ((uint32_t)JPEG_SR_IFNFF)
308#define JPEG_FLAG_OFTF ((uint32_t)JPEG_SR_OFTF)
309#define JPEG_FLAG_OFNEF ((uint32_t)JPEG_SR_OFNEF)
310#define JPEG_FLAG_EOCF ((uint32_t)JPEG_SR_EOCF)
311#define JPEG_FLAG_HPDF ((uint32_t)JPEG_SR_HPDF)
312#define JPEG_FLAG_COF ((uint32_t)JPEG_SR_COF)
314#define JPEG_FLAG_ALL ((uint32_t)0x000000FEU)
324#define JPEG_PAUSE_RESUME_INPUT ((uint32_t)0x00000001U)
325#define JPEG_PAUSE_RESUME_OUTPUT ((uint32_t)0x00000002U)
326#define JPEG_PAUSE_RESUME_INPUT_OUTPUT ((uint32_t)0x00000003U)
334/* Exported macro ------------------------------------------------------------*/
335
345#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
346#define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) do{\
347 (__HANDLE__)->State = HAL_JPEG_STATE_RESET;\
348 (__HANDLE__)->MspInitCallback = NULL;\
349 (__HANDLE__)->MspDeInitCallback = NULL;\
350 }while(0)
351#else
352#define __HAL_JPEG_RESET_HANDLE_STATE(__HANDLE__) ( (__HANDLE__)->State = HAL_JPEG_STATE_RESET)
353#endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
354
355
361#define __HAL_JPEG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= JPEG_CR_JCEN)
362
368#define __HAL_JPEG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~JPEG_CR_JCEN)
369
370
389#define __HAL_JPEG_GET_FLAG(__HANDLE__,__FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)))
390
402#define __HAL_JPEG_CLEAR_FLAG(__HANDLE__,__FLAG__) (((__HANDLE__)->Instance->CFR |= ((__FLAG__) & (JPEG_FLAG_EOCF | JPEG_FLAG_HPDF))))
403
404
419#define __HAL_JPEG_ENABLE_IT(__HANDLE__,__INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__) )
420
437#define __HAL_JPEG_DISABLE_IT(__HANDLE__,__INTERRUPT__) MODIFY_REG((__HANDLE__)->Instance->CR, (__INTERRUPT__), 0UL)
438
439
454#define __HAL_JPEG_GET_IT_SOURCE(__HANDLE__,__INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
455
460/* Exported functions --------------------------------------------------------*/
468/* Initialization/de-initialization functions ********************************/
469HAL_StatusTypeDef HAL_JPEG_Init(JPEG_HandleTypeDef *hjpeg);
470HAL_StatusTypeDef HAL_JPEG_DeInit(JPEG_HandleTypeDef *hjpeg);
471void HAL_JPEG_MspInit(JPEG_HandleTypeDef *hjpeg);
472void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef *hjpeg);
473
474#if (USE_HAL_JPEG_REGISTER_CALLBACKS == 1)
475HAL_StatusTypeDef HAL_JPEG_RegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID,
476 pJPEG_CallbackTypeDef pCallback);
477HAL_StatusTypeDef HAL_JPEG_UnRegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef CallbackID);
478
479HAL_StatusTypeDef HAL_JPEG_RegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg,
480 pJPEG_InfoReadyCallbackTypeDef pCallback);
481HAL_StatusTypeDef HAL_JPEG_UnRegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg);
482
483HAL_StatusTypeDef HAL_JPEG_RegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg, pJPEG_GetDataCallbackTypeDef pCallback);
484HAL_StatusTypeDef HAL_JPEG_UnRegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg);
485
486HAL_StatusTypeDef HAL_JPEG_RegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg,
487 pJPEG_DataReadyCallbackTypeDef pCallback);
488HAL_StatusTypeDef HAL_JPEG_UnRegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg);
489
490#endif /* USE_HAL_JPEG_REGISTER_CALLBACKS */
491
499/* Encoding/Decoding Configuration functions ********************************/
500HAL_StatusTypeDef HAL_JPEG_ConfigEncoding(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pConf);
501HAL_StatusTypeDef HAL_JPEG_GetInfo(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo);
502HAL_StatusTypeDef HAL_JPEG_EnableHeaderParsing(JPEG_HandleTypeDef *hjpeg);
503HAL_StatusTypeDef HAL_JPEG_DisableHeaderParsing(JPEG_HandleTypeDef *hjpeg);
504HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable0, uint8_t *QTable1,
505 uint8_t *QTable2, uint8_t *QTable3);
506
514/* JPEG processing functions **************************************/
515HAL_StatusTypeDef HAL_JPEG_Encode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
516 uint8_t *pDataOut, uint32_t OutDataLength, uint32_t Timeout);
517HAL_StatusTypeDef HAL_JPEG_Decode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
518 uint8_t *pDataOutMCU, uint32_t OutDataLength, uint32_t Timeout);
519HAL_StatusTypeDef HAL_JPEG_Encode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
520 uint8_t *pDataOut, uint32_t OutDataLength);
521HAL_StatusTypeDef HAL_JPEG_Decode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
522 uint8_t *pDataOutMCU, uint32_t OutDataLength);
523HAL_StatusTypeDef HAL_JPEG_Encode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataLength,
524 uint8_t *pDataOut, uint32_t OutDataLength);
525HAL_StatusTypeDef HAL_JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLength,
526 uint8_t *pDataOutMCU, uint32_t OutDataLength);
527HAL_StatusTypeDef HAL_JPEG_Pause(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection);
528HAL_StatusTypeDef HAL_JPEG_Resume(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection);
529void HAL_JPEG_ConfigInputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewInputBuffer, uint32_t InDataLength);
530void HAL_JPEG_ConfigOutputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewOutputBuffer, uint32_t OutDataLength);
531HAL_StatusTypeDef HAL_JPEG_Abort(JPEG_HandleTypeDef *hjpeg);
532
540/* JPEG Decode/Encode callback functions ********************************************************/
541void HAL_JPEG_InfoReadyCallback(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo);
542void HAL_JPEG_EncodeCpltCallback(JPEG_HandleTypeDef *hjpeg);
543void HAL_JPEG_DecodeCpltCallback(JPEG_HandleTypeDef *hjpeg);
544void HAL_JPEG_ErrorCallback(JPEG_HandleTypeDef *hjpeg);
545void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData);
546void HAL_JPEG_DataReadyCallback(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t OutDataLength);
547
555/* JPEG IRQ handler management ******************************************************/
556void HAL_JPEG_IRQHandler(JPEG_HandleTypeDef *hjpeg);
557
565/* Peripheral State and Error functions ************************************************/
566HAL_JPEG_STATETypeDef HAL_JPEG_GetState(JPEG_HandleTypeDef *hjpeg);
567uint32_t HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg);
568
577/* Private types -------------------------------------------------------------*/
587/* Private defines -----------------------------------------------------------*/
597/* Private variables ---------------------------------------------------------*/
607/* Private constants ---------------------------------------------------------*/
617/* Private macros ------------------------------------------------------------*/
623#define IS_JPEG_CHROMASUBSAMPLING(SUBSAMPLING) (((SUBSAMPLING) == JPEG_444_SUBSAMPLING) || \
624 ((SUBSAMPLING) == JPEG_420_SUBSAMPLING) || \
625 ((SUBSAMPLING) == JPEG_422_SUBSAMPLING))
626
627#define IS_JPEG_IMAGE_QUALITY(NUMBER) (((NUMBER) >= JPEG_IMAGE_QUALITY_MIN) && ((NUMBER) <= JPEG_IMAGE_QUALITY_MAX))
628
629#define IS_JPEG_COLORSPACE(COLORSPACE) (((COLORSPACE) == JPEG_GRAYSCALE_COLORSPACE) || \
630 ((COLORSPACE) == JPEG_YCBCR_COLORSPACE) || \
631 ((COLORSPACE) == JPEG_CMYK_COLORSPACE))
632
633#define IS_JPEG_PAUSE_RESUME_STATE(VALUE) (((VALUE) == JPEG_PAUSE_RESUME_INPUT) || \
634 ((VALUE) == JPEG_PAUSE_RESUME_OUTPUT)|| \
635 ((VALUE) == JPEG_PAUSE_RESUME_INPUT_OUTPUT))
636
641/* Private functions prototypes ----------------------------------------------*/
651/* Private functions ---------------------------------------------------------*/
669#endif /* JPEG */
670
671#ifdef __cplusplus
672}
673#endif
674
675#endif /* STM32H7xx_HAL_JPEG_H */
676
#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
JPEG Codec.
Definition: stm32h743xx.h:1125
Test context for spec:/rtems/barrier/req/create test case.
Definition: tc-barrier-create.c:144
MDMA handle Structure definition.
Definition: stm32h7xx_hal_mdma.h:204