Lines Matching refs:hjpeg
427 static HAL_StatusTypeDef JPEG_Set_HuffDC_Mem(JPEG_HandleTypeDef *hjpeg, JPEG_DCHuffTableTypeDef *Hu…
429 static HAL_StatusTypeDef JPEG_Set_HuffAC_Mem(JPEG_HandleTypeDef *hjpeg, JPEG_ACHuffTableTypeDef *Hu…
431 static HAL_StatusTypeDef JPEG_Set_HuffEnc_Mem(JPEG_HandleTypeDef *hjpeg);
432 static void JPEG_Set_Huff_DHTMem(JPEG_HandleTypeDef *hjpeg);
433 static uint32_t JPEG_Set_Quantization_Mem(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable,
435 static void JPEG_SetColorYCBCR(JPEG_HandleTypeDef *hjpeg);
436 static void JPEG_SetColorGrayScale(JPEG_HandleTypeDef *hjpeg);
437 static void JPEG_SetColorCMYK(JPEG_HandleTypeDef *hjpeg);
439 static void JPEG_Init_Process(JPEG_HandleTypeDef *hjpeg);
440 static uint32_t JPEG_Process(JPEG_HandleTypeDef *hjpeg);
441 static void JPEG_ReadInputData(JPEG_HandleTypeDef *hjpeg, uint32_t nbRequestWords);
442 static void JPEG_StoreOutputData(JPEG_HandleTypeDef *hjpeg, uint32_t nbOutputWords);
443 static uint32_t JPEG_GetQuality(JPEG_HandleTypeDef *hjpeg);
445 static HAL_StatusTypeDef JPEG_DMA_StartProcess(JPEG_HandleTypeDef *hjpeg);
446 static void JPEG_DMA_ContinueProcess(JPEG_HandleTypeDef *hjpeg);
447 static void JPEG_DMA_EndProcess(JPEG_HandleTypeDef *hjpeg);
448 static void JPEG_DMA_PollResidualData(JPEG_HandleTypeDef *hjpeg);
484 HAL_StatusTypeDef HAL_JPEG_Init(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_Init() argument
511 if (hjpeg == NULL) in HAL_JPEG_Init()
517 if (hjpeg->State == HAL_JPEG_STATE_RESET) in HAL_JPEG_Init()
520 hjpeg->Lock = HAL_UNLOCKED; in HAL_JPEG_Init()
522 hjpeg->InfoReadyCallback = HAL_JPEG_InfoReadyCallback; /* Legacy weak InfoReadyCallback */ in HAL_JPEG_Init()
523 hjpeg->EncodeCpltCallback = HAL_JPEG_EncodeCpltCallback; /* Legacy weak EncodeCpltCallback */ in HAL_JPEG_Init()
524 hjpeg->DecodeCpltCallback = HAL_JPEG_DecodeCpltCallback; /* Legacy weak DecodeCpltCallback */ in HAL_JPEG_Init()
525 hjpeg->ErrorCallback = HAL_JPEG_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_JPEG_Init()
526 hjpeg->GetDataCallback = HAL_JPEG_GetDataCallback; /* Legacy weak GetDataCallback */ in HAL_JPEG_Init()
527 hjpeg->DataReadyCallback = HAL_JPEG_DataReadyCallback; /* Legacy weak DataReadyCallback */ in HAL_JPEG_Init()
529 if (hjpeg->MspInitCallback == NULL) in HAL_JPEG_Init()
531 hjpeg->MspInitCallback = HAL_JPEG_MspInit; /* Legacy weak MspInit */ in HAL_JPEG_Init()
535 hjpeg->MspInitCallback(hjpeg); in HAL_JPEG_Init()
538 if (hjpeg->State == HAL_JPEG_STATE_RESET) in HAL_JPEG_Init()
541 hjpeg->Lock = HAL_UNLOCKED; in HAL_JPEG_Init()
544 HAL_JPEG_MspInit(hjpeg); in HAL_JPEG_Init()
549 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_Init()
552 __HAL_JPEG_ENABLE(hjpeg); in HAL_JPEG_Init()
555 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in HAL_JPEG_Init()
558 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in HAL_JPEG_Init()
562 hjpeg->Instance->CR |= JPEG_CR_IFF; in HAL_JPEG_Init()
563 hjpeg->Instance->CR |= JPEG_CR_OFF; in HAL_JPEG_Init()
566 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_ALL); in HAL_JPEG_Init()
569 hjpeg->QuantTable0 = (uint8_t *)((uint32_t)JPEG_LUM_QuantTable); in HAL_JPEG_Init()
570 hjpeg->QuantTable1 = (uint8_t *)((uint32_t)JPEG_CHROM_QuantTable); in HAL_JPEG_Init()
571 hjpeg->QuantTable2 = NULL; in HAL_JPEG_Init()
572 hjpeg->QuantTable3 = NULL; in HAL_JPEG_Init()
575 if (JPEG_Set_HuffEnc_Mem(hjpeg) != HAL_OK) in HAL_JPEG_Init()
577 hjpeg->ErrorCode = HAL_JPEG_ERROR_HUFF_TABLE; in HAL_JPEG_Init()
583 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_HDR; in HAL_JPEG_Init()
586 hjpeg->JpegInCount = 0; in HAL_JPEG_Init()
587 hjpeg->JpegOutCount = 0; in HAL_JPEG_Init()
590 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Init()
593 hjpeg->ErrorCode = HAL_JPEG_ERROR_NONE; in HAL_JPEG_Init()
596 hjpeg->Context = 0; in HAL_JPEG_Init()
608 HAL_StatusTypeDef HAL_JPEG_DeInit(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_DeInit() argument
611 if (hjpeg == NULL) in HAL_JPEG_DeInit()
617 if (hjpeg->MspDeInitCallback == NULL) in HAL_JPEG_DeInit()
619 hjpeg->MspDeInitCallback = HAL_JPEG_MspDeInit; /* Legacy weak MspDeInit */ in HAL_JPEG_DeInit()
623 hjpeg->MspDeInitCallback(hjpeg); in HAL_JPEG_DeInit()
627 HAL_JPEG_MspDeInit(hjpeg); in HAL_JPEG_DeInit()
631 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_DeInit()
634 hjpeg->ErrorCode = HAL_JPEG_ERROR_NONE; in HAL_JPEG_DeInit()
637 hjpeg->JpegInCount = 0; in HAL_JPEG_DeInit()
638 hjpeg->JpegOutCount = 0; in HAL_JPEG_DeInit()
641 hjpeg->State = HAL_JPEG_STATE_RESET; in HAL_JPEG_DeInit()
644 hjpeg->Context = 0; in HAL_JPEG_DeInit()
647 __HAL_UNLOCK(hjpeg); in HAL_JPEG_DeInit()
659 __weak void HAL_JPEG_MspInit(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_MspInit() argument
662 UNUSED(hjpeg); in HAL_JPEG_MspInit()
675 __weak void HAL_JPEG_MspDeInit(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_MspDeInit() argument
678 UNUSED(hjpeg); in HAL_JPEG_MspDeInit()
700 HAL_StatusTypeDef HAL_JPEG_RegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef C… in HAL_JPEG_RegisterCallback() argument
708 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterCallback()
712 __HAL_LOCK(hjpeg); in HAL_JPEG_RegisterCallback()
714 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_RegisterCallback()
719 hjpeg->EncodeCpltCallback = pCallback; in HAL_JPEG_RegisterCallback()
723 hjpeg->DecodeCpltCallback = pCallback; in HAL_JPEG_RegisterCallback()
727 hjpeg->ErrorCallback = pCallback; in HAL_JPEG_RegisterCallback()
731 hjpeg->MspInitCallback = pCallback; in HAL_JPEG_RegisterCallback()
735 hjpeg->MspDeInitCallback = pCallback; in HAL_JPEG_RegisterCallback()
740 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterCallback()
746 else if (HAL_JPEG_STATE_RESET == hjpeg->State) in HAL_JPEG_RegisterCallback()
751 hjpeg->MspInitCallback = pCallback; in HAL_JPEG_RegisterCallback()
755 hjpeg->MspDeInitCallback = pCallback; in HAL_JPEG_RegisterCallback()
760 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterCallback()
769 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterCallback()
775 __HAL_UNLOCK(hjpeg); in HAL_JPEG_RegisterCallback()
793 HAL_StatusTypeDef HAL_JPEG_UnRegisterCallback(JPEG_HandleTypeDef *hjpeg, HAL_JPEG_CallbackIDTypeDef… in HAL_JPEG_UnRegisterCallback() argument
798 __HAL_LOCK(hjpeg); in HAL_JPEG_UnRegisterCallback()
800 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_UnRegisterCallback()
805 … hjpeg->EncodeCpltCallback = HAL_JPEG_EncodeCpltCallback; /* Legacy weak EncodeCpltCallback */ in HAL_JPEG_UnRegisterCallback()
809 … hjpeg->DecodeCpltCallback = HAL_JPEG_DecodeCpltCallback; /* Legacy weak DecodeCpltCallback */ in HAL_JPEG_UnRegisterCallback()
813 hjpeg->ErrorCallback = HAL_JPEG_ErrorCallback; /* Legacy weak ErrorCallback */ in HAL_JPEG_UnRegisterCallback()
817 hjpeg->MspInitCallback = HAL_JPEG_MspInit; /* Legacy weak MspInit */ in HAL_JPEG_UnRegisterCallback()
821 hjpeg->MspDeInitCallback = HAL_JPEG_MspDeInit; /* Legacy weak MspDeInit */ in HAL_JPEG_UnRegisterCallback()
826 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterCallback()
832 else if (HAL_JPEG_STATE_RESET == hjpeg->State) in HAL_JPEG_UnRegisterCallback()
837 hjpeg->MspInitCallback = HAL_JPEG_MspInit; /* Legacy weak MspInit */ in HAL_JPEG_UnRegisterCallback()
841 hjpeg->MspDeInitCallback = HAL_JPEG_MspDeInit; /* Legacy weak MspInit */ in HAL_JPEG_UnRegisterCallback()
846 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterCallback()
855 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterCallback()
861 __HAL_UNLOCK(hjpeg); in HAL_JPEG_UnRegisterCallback()
872 HAL_StatusTypeDef HAL_JPEG_RegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg, in HAL_JPEG_RegisterInfoReadyCallback() argument
880 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterInfoReadyCallback()
884 __HAL_LOCK(hjpeg); in HAL_JPEG_RegisterInfoReadyCallback()
886 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_RegisterInfoReadyCallback()
888 hjpeg->InfoReadyCallback = pCallback; in HAL_JPEG_RegisterInfoReadyCallback()
893 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterInfoReadyCallback()
899 __HAL_UNLOCK(hjpeg); in HAL_JPEG_RegisterInfoReadyCallback()
909 HAL_StatusTypeDef HAL_JPEG_UnRegisterInfoReadyCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_UnRegisterInfoReadyCallback() argument
914 __HAL_LOCK(hjpeg); in HAL_JPEG_UnRegisterInfoReadyCallback()
916 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_UnRegisterInfoReadyCallback()
918 hjpeg->InfoReadyCallback = HAL_JPEG_InfoReadyCallback; /* Legacy weak InfoReadyCallback */ in HAL_JPEG_UnRegisterInfoReadyCallback()
923 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterInfoReadyCallback()
929 __HAL_UNLOCK(hjpeg); in HAL_JPEG_UnRegisterInfoReadyCallback()
940 HAL_StatusTypeDef HAL_JPEG_RegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg, pJPEG_GetDataCallback… in HAL_JPEG_RegisterGetDataCallback() argument
947 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterGetDataCallback()
951 __HAL_LOCK(hjpeg); in HAL_JPEG_RegisterGetDataCallback()
953 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_RegisterGetDataCallback()
955 hjpeg->GetDataCallback = pCallback; in HAL_JPEG_RegisterGetDataCallback()
960 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterGetDataCallback()
966 __HAL_UNLOCK(hjpeg); in HAL_JPEG_RegisterGetDataCallback()
976 HAL_StatusTypeDef HAL_JPEG_UnRegisterGetDataCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_UnRegisterGetDataCallback() argument
981 __HAL_LOCK(hjpeg); in HAL_JPEG_UnRegisterGetDataCallback()
983 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_UnRegisterGetDataCallback()
985 hjpeg->GetDataCallback = HAL_JPEG_GetDataCallback; /* Legacy weak GetDataCallback */ in HAL_JPEG_UnRegisterGetDataCallback()
990 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterGetDataCallback()
996 __HAL_UNLOCK(hjpeg); in HAL_JPEG_UnRegisterGetDataCallback()
1007 HAL_StatusTypeDef HAL_JPEG_RegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg, in HAL_JPEG_RegisterDataReadyCallback() argument
1015 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterDataReadyCallback()
1019 __HAL_LOCK(hjpeg); in HAL_JPEG_RegisterDataReadyCallback()
1021 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_RegisterDataReadyCallback()
1023 hjpeg->DataReadyCallback = pCallback; in HAL_JPEG_RegisterDataReadyCallback()
1028 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_RegisterDataReadyCallback()
1034 __HAL_UNLOCK(hjpeg); in HAL_JPEG_RegisterDataReadyCallback()
1044 HAL_StatusTypeDef HAL_JPEG_UnRegisterDataReadyCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_UnRegisterDataReadyCallback() argument
1049 __HAL_LOCK(hjpeg); in HAL_JPEG_UnRegisterDataReadyCallback()
1051 if (HAL_JPEG_STATE_READY == hjpeg->State) in HAL_JPEG_UnRegisterDataReadyCallback()
1053 hjpeg->DataReadyCallback = HAL_JPEG_DataReadyCallback; /* Legacy weak DataReadyCallback */ in HAL_JPEG_UnRegisterDataReadyCallback()
1058 hjpeg->ErrorCode |= HAL_JPEG_ERROR_INVALID_CALLBACK; in HAL_JPEG_UnRegisterDataReadyCallback()
1064 __HAL_UNLOCK(hjpeg); in HAL_JPEG_UnRegisterDataReadyCallback()
1100 HAL_StatusTypeDef HAL_JPEG_ConfigEncoding(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pConf) in HAL_JPEG_ConfigEncoding() argument
1110 if ((hjpeg == NULL) || (pConf == NULL)) in HAL_JPEG_ConfigEncoding()
1122 __HAL_LOCK(hjpeg); in HAL_JPEG_ConfigEncoding()
1124 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_ConfigEncoding()
1126 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_ConfigEncoding()
1128 hjpeg->Conf.ColorSpace = pConf->ColorSpace; in HAL_JPEG_ConfigEncoding()
1129 hjpeg->Conf.ChromaSubsampling = pConf->ChromaSubsampling; in HAL_JPEG_ConfigEncoding()
1130 hjpeg->Conf.ImageHeight = pConf->ImageHeight; in HAL_JPEG_ConfigEncoding()
1131 hjpeg->Conf.ImageWidth = pConf->ImageWidth; in HAL_JPEG_ConfigEncoding()
1132 hjpeg->Conf.ImageQuality = pConf->ImageQuality; in HAL_JPEG_ConfigEncoding()
1135 hjpeg->Instance->CONFR1 &= ~JPEG_CONFR1_COLORSPACE; in HAL_JPEG_ConfigEncoding()
1138 if (hjpeg->Conf.ColorSpace == JPEG_GRAYSCALE_COLORSPACE) in HAL_JPEG_ConfigEncoding()
1141 hjpeg->Conf.ChromaSubsampling = JPEG_444_SUBSAMPLING; in HAL_JPEG_ConfigEncoding()
1143 JPEG_SetColorGrayScale(hjpeg); in HAL_JPEG_ConfigEncoding()
1145 error = JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable0, (hjpeg->Instance->QMEM0)); in HAL_JPEG_ConfigEncoding()
1147 else if (hjpeg->Conf.ColorSpace == JPEG_YCBCR_COLORSPACE) in HAL_JPEG_ConfigEncoding()
1153 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_COLORSPACE_0; in HAL_JPEG_ConfigEncoding()
1155 JPEG_SetColorYCBCR(hjpeg); in HAL_JPEG_ConfigEncoding()
1158 error = JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable0, (hjpeg->Instance->QMEM0)); in HAL_JPEG_ConfigEncoding()
1160 error |= JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable1, (hjpeg->Instance->QMEM1)); in HAL_JPEG_ConfigEncoding()
1162 if ((hjpeg->Context & JPEG_CONTEXT_CUSTOM_TABLES) != 0UL) in HAL_JPEG_ConfigEncoding()
1166 hjpeg->Instance->CONFR1 &= (~JPEG_CONFR1_COLORSPACE); in HAL_JPEG_ConfigEncoding()
1167 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_COLORSPACE_1; in HAL_JPEG_ConfigEncoding()
1169 error |= JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable2, (hjpeg->Instance->QMEM2)); in HAL_JPEG_ConfigEncoding()
1172 hjpeg->Instance->CONFR5 &= (~JPEG_CONFR5_QT); in HAL_JPEG_ConfigEncoding()
1173 hjpeg->Instance->CONFR5 |= JPEG_CONFR5_QT_0; in HAL_JPEG_ConfigEncoding()
1176 hjpeg->Instance->CONFR6 &= (~JPEG_CONFR6_QT); in HAL_JPEG_ConfigEncoding()
1177 hjpeg->Instance->CONFR6 |= JPEG_CONFR6_QT_1; in HAL_JPEG_ConfigEncoding()
1182 JPEG_SetColorCMYK(hjpeg); in HAL_JPEG_ConfigEncoding()
1185 error = JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable0, (hjpeg->Instance->QMEM0)); in HAL_JPEG_ConfigEncoding()
1188 if ((hjpeg->Context & JPEG_CONTEXT_CUSTOM_TABLES) != 0UL) in HAL_JPEG_ConfigEncoding()
1192 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_COLORSPACE; in HAL_JPEG_ConfigEncoding()
1194 error |= JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable1, (hjpeg->Instance->QMEM1)); in HAL_JPEG_ConfigEncoding()
1195 error |= JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable2, (hjpeg->Instance->QMEM2)); in HAL_JPEG_ConfigEncoding()
1196 error |= JPEG_Set_Quantization_Mem(hjpeg, hjpeg->QuantTable3, (hjpeg->Instance->QMEM3)); in HAL_JPEG_ConfigEncoding()
1199 hjpeg->Instance->CONFR5 |= JPEG_CONFR5_QT_0; in HAL_JPEG_ConfigEncoding()
1202 hjpeg->Instance->CONFR6 |= JPEG_CONFR6_QT_1; in HAL_JPEG_ConfigEncoding()
1205 hjpeg->Instance->CONFR7 |= JPEG_CONFR7_QT; in HAL_JPEG_ConfigEncoding()
1211 hjpeg->ErrorCode = HAL_JPEG_ERROR_QUANT_TABLE; in HAL_JPEG_ConfigEncoding()
1214 __HAL_UNLOCK(hjpeg); in HAL_JPEG_ConfigEncoding()
1217 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_ConfigEncoding()
1223 …MODIFY_REG(hjpeg->Instance->CONFR1, JPEG_CONFR1_YSIZE, ((hjpeg->Conf.ImageHeight & 0x0000FFFFUL) <… in HAL_JPEG_ConfigEncoding()
1225 …MODIFY_REG(hjpeg->Instance->CONFR3, JPEG_CONFR3_XSIZE, ((hjpeg->Conf.ImageWidth & 0x0000FFFFUL) <<… in HAL_JPEG_ConfigEncoding()
1228 if (hjpeg->Conf.ChromaSubsampling == JPEG_420_SUBSAMPLING) /* 4:2:0*/ in HAL_JPEG_ConfigEncoding()
1233 else if (hjpeg->Conf.ChromaSubsampling == JPEG_422_SUBSAMPLING) /* 4:2:2*/ in HAL_JPEG_ConfigEncoding()
1244 hMCU = (hjpeg->Conf.ImageWidth / hfactor); in HAL_JPEG_ConfigEncoding()
1245 if ((hjpeg->Conf.ImageWidth % hfactor) != 0UL) in HAL_JPEG_ConfigEncoding()
1250 vMCU = (hjpeg->Conf.ImageHeight / vfactor); in HAL_JPEG_ConfigEncoding()
1251 if ((hjpeg->Conf.ImageHeight % vfactor) != 0UL) in HAL_JPEG_ConfigEncoding()
1258 hjpeg->Instance->CONFR2 = (numberMCU & JPEG_CONFR2_NMCU); in HAL_JPEG_ConfigEncoding()
1260 hjpeg->Context |= JPEG_CONTEXT_CONF_ENCODING; in HAL_JPEG_ConfigEncoding()
1263 __HAL_UNLOCK(hjpeg); in HAL_JPEG_ConfigEncoding()
1266 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_ConfigEncoding()
1274 __HAL_UNLOCK(hjpeg); in HAL_JPEG_ConfigEncoding()
1290 HAL_StatusTypeDef HAL_JPEG_GetInfo(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo) in HAL_JPEG_GetInfo() argument
1297 if ((hjpeg == NULL) || (pInfo == NULL)) in HAL_JPEG_GetInfo()
1303 if ((hjpeg->Instance->CONFR1 & JPEG_CONFR1_NF) == JPEG_CONFR1_NF_1) in HAL_JPEG_GetInfo()
1307 else if ((hjpeg->Instance->CONFR1 & JPEG_CONFR1_NF) == 0UL) in HAL_JPEG_GetInfo()
1311 else if ((hjpeg->Instance->CONFR1 & JPEG_CONFR1_NF) == JPEG_CONFR1_NF) in HAL_JPEG_GetInfo()
1320 pInfo->ImageHeight = (hjpeg->Instance->CONFR1 & 0xFFFF0000UL) >> 16; in HAL_JPEG_GetInfo()
1321 pInfo->ImageWidth = (hjpeg->Instance->CONFR3 & 0xFFFF0000UL) >> 16; in HAL_JPEG_GetInfo()
1325 yblockNb = (hjpeg->Instance->CONFR4 & JPEG_CONFR4_NB) >> 4; in HAL_JPEG_GetInfo()
1326 cBblockNb = (hjpeg->Instance->CONFR5 & JPEG_CONFR5_NB) >> 4; in HAL_JPEG_GetInfo()
1327 cRblockNb = (hjpeg->Instance->CONFR6 & JPEG_CONFR6_NB) >> 4; in HAL_JPEG_GetInfo()
1351 pInfo->ImageQuality = JPEG_GetQuality(hjpeg); in HAL_JPEG_GetInfo()
1363 HAL_StatusTypeDef HAL_JPEG_EnableHeaderParsing(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_EnableHeaderParsing() argument
1366 __HAL_LOCK(hjpeg); in HAL_JPEG_EnableHeaderParsing()
1368 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_EnableHeaderParsing()
1371 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_EnableHeaderParsing()
1374 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_HDR; in HAL_JPEG_EnableHeaderParsing()
1377 __HAL_UNLOCK(hjpeg); in HAL_JPEG_EnableHeaderParsing()
1380 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_EnableHeaderParsing()
1387 __HAL_UNLOCK(hjpeg); in HAL_JPEG_EnableHeaderParsing()
1399 HAL_StatusTypeDef HAL_JPEG_DisableHeaderParsing(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_DisableHeaderParsing() argument
1402 __HAL_LOCK(hjpeg); in HAL_JPEG_DisableHeaderParsing()
1404 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_DisableHeaderParsing()
1407 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_DisableHeaderParsing()
1410 hjpeg->Instance->CONFR1 &= ~JPEG_CONFR1_HDR; in HAL_JPEG_DisableHeaderParsing()
1413 __HAL_UNLOCK(hjpeg); in HAL_JPEG_DisableHeaderParsing()
1416 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_DisableHeaderParsing()
1423 __HAL_UNLOCK(hjpeg); in HAL_JPEG_DisableHeaderParsing()
1446 HAL_StatusTypeDef HAL_JPEG_SetUserQuantTables(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable0, uint8_t… in HAL_JPEG_SetUserQuantTables() argument
1450 __HAL_LOCK(hjpeg); in HAL_JPEG_SetUserQuantTables()
1452 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_SetUserQuantTables()
1455 hjpeg->State = HAL_JPEG_STATE_BUSY; in HAL_JPEG_SetUserQuantTables()
1457 hjpeg->Context |= JPEG_CONTEXT_CUSTOM_TABLES; in HAL_JPEG_SetUserQuantTables()
1459 hjpeg->QuantTable0 = QTable0; in HAL_JPEG_SetUserQuantTables()
1460 hjpeg->QuantTable1 = QTable1; in HAL_JPEG_SetUserQuantTables()
1461 hjpeg->QuantTable2 = QTable2; in HAL_JPEG_SetUserQuantTables()
1462 hjpeg->QuantTable3 = QTable3; in HAL_JPEG_SetUserQuantTables()
1465 __HAL_UNLOCK(hjpeg); in HAL_JPEG_SetUserQuantTables()
1468 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_SetUserQuantTables()
1476 __HAL_UNLOCK(hjpeg); in HAL_JPEG_SetUserQuantTables()
1521 HAL_StatusTypeDef HAL_JPEG_Encode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDataL… in HAL_JPEG_Encode() argument
1531 if ((hjpeg == NULL) || (pDataInMCU == NULL) || (pDataOut == NULL)) in HAL_JPEG_Encode()
1536 __HAL_LOCK(hjpeg); in HAL_JPEG_Encode()
1538 if (hjpeg->State != HAL_JPEG_STATE_READY) in HAL_JPEG_Encode()
1541 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode()
1546 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_Encode()
1548 if ((hjpeg->Context & JPEG_CONTEXT_CONF_ENCODING) == JPEG_CONTEXT_CONF_ENCODING) in HAL_JPEG_Encode()
1551 hjpeg->State = HAL_JPEG_STATE_BUSY_ENCODING; in HAL_JPEG_Encode()
1554 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Encode()
1555 hjpeg->Context |= (JPEG_CONTEXT_ENCODE | JPEG_CONTEXT_POLLING); in HAL_JPEG_Encode()
1561 hjpeg->pJpegInBuffPtr = pDataInMCU; in HAL_JPEG_Encode()
1562 hjpeg->pJpegOutBuffPtr = pDataOut; in HAL_JPEG_Encode()
1563 …hjpeg->InDataLength = InDataLength - (InDataLength % 4UL); /* In Data length must be multiple o… in HAL_JPEG_Encode()
1564 …hjpeg->OutDataLength = OutDataLength - (OutDataLength % 4UL); /* Out Data length must be multiple … in HAL_JPEG_Encode()
1567 hjpeg->JpegInCount = 0; in HAL_JPEG_Encode()
1568 hjpeg->JpegOutCount = 0; in HAL_JPEG_Encode()
1571 JPEG_Init_Process(hjpeg); in HAL_JPEG_Encode()
1574 while ((JPEG_Process(hjpeg) == JPEG_PROCESS_ONGOING)) in HAL_JPEG_Encode()
1582 hjpeg->ErrorCode |= HAL_JPEG_ERROR_TIMEOUT; in HAL_JPEG_Encode()
1585 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode()
1588 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Encode()
1596 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode()
1599 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Encode()
1605 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode()
1625 HAL_StatusTypeDef HAL_JPEG_Decode(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataLeng… in HAL_JPEG_Decode() argument
1635 if ((hjpeg == NULL) || (pDataIn == NULL) || (pDataOutMCU == NULL)) in HAL_JPEG_Decode()
1641 __HAL_LOCK(hjpeg); in HAL_JPEG_Decode()
1646 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_Decode()
1649 hjpeg->State = HAL_JPEG_STATE_BUSY_DECODING; in HAL_JPEG_Decode()
1653 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Decode()
1654 hjpeg->Context |= (JPEG_CONTEXT_DECODE | JPEG_CONTEXT_POLLING); in HAL_JPEG_Decode()
1657 hjpeg->pJpegInBuffPtr = pDataIn; in HAL_JPEG_Decode()
1658 hjpeg->pJpegOutBuffPtr = pDataOutMCU; in HAL_JPEG_Decode()
1659 …hjpeg->InDataLength = InDataLength - (InDataLength % 4UL); /*In Data length must be multiple of… in HAL_JPEG_Decode()
1660 …hjpeg->OutDataLength = OutDataLength - (OutDataLength % 4UL); /*Out Data length must be multiple o… in HAL_JPEG_Decode()
1663 hjpeg->JpegInCount = 0; in HAL_JPEG_Decode()
1664 hjpeg->JpegOutCount = 0; in HAL_JPEG_Decode()
1667 JPEG_Init_Process(hjpeg); in HAL_JPEG_Decode()
1670 while ((JPEG_Process(hjpeg) == JPEG_PROCESS_ONGOING)) in HAL_JPEG_Decode()
1678 hjpeg->ErrorCode |= HAL_JPEG_ERROR_TIMEOUT; in HAL_JPEG_Decode()
1681 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode()
1684 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Decode()
1692 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode()
1695 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Decode()
1701 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode()
1719 HAL_StatusTypeDef HAL_JPEG_Encode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InDa… in HAL_JPEG_Encode_IT() argument
1727 if ((hjpeg == NULL) || (pDataInMCU == NULL) || (pDataOut == NULL)) in HAL_JPEG_Encode_IT()
1733 __HAL_LOCK(hjpeg); in HAL_JPEG_Encode_IT()
1735 if (hjpeg->State != HAL_JPEG_STATE_READY) in HAL_JPEG_Encode_IT()
1738 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode_IT()
1744 if ((hjpeg->Context & JPEG_CONTEXT_CONF_ENCODING) == JPEG_CONTEXT_CONF_ENCODING) in HAL_JPEG_Encode_IT()
1747 hjpeg->State = HAL_JPEG_STATE_BUSY_ENCODING; in HAL_JPEG_Encode_IT()
1750 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Encode_IT()
1751 hjpeg->Context |= (JPEG_CONTEXT_ENCODE | JPEG_CONTEXT_IT); in HAL_JPEG_Encode_IT()
1754 hjpeg->pJpegInBuffPtr = pDataInMCU; in HAL_JPEG_Encode_IT()
1755 hjpeg->pJpegOutBuffPtr = pDataOut; in HAL_JPEG_Encode_IT()
1756 …hjpeg->InDataLength = InDataLength - (InDataLength % 4UL); /*In Data length must be multiple of… in HAL_JPEG_Encode_IT()
1757 …hjpeg->OutDataLength = OutDataLength - (OutDataLength % 4UL); /*Out Data length must be multiple o… in HAL_JPEG_Encode_IT()
1760 hjpeg->JpegInCount = 0; in HAL_JPEG_Encode_IT()
1761 hjpeg->JpegOutCount = 0; in HAL_JPEG_Encode_IT()
1764 JPEG_Init_Process(hjpeg); in HAL_JPEG_Encode_IT()
1770 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode_IT()
1789 HAL_StatusTypeDef HAL_JPEG_Decode_IT(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InDataL… in HAL_JPEG_Decode_IT() argument
1797 if ((hjpeg == NULL) || (pDataIn == NULL) || (pDataOutMCU == NULL)) in HAL_JPEG_Decode_IT()
1803 __HAL_LOCK(hjpeg); in HAL_JPEG_Decode_IT()
1805 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_Decode_IT()
1808 hjpeg->State = HAL_JPEG_STATE_BUSY_DECODING; in HAL_JPEG_Decode_IT()
1811 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Decode_IT()
1812 hjpeg->Context |= (JPEG_CONTEXT_DECODE | JPEG_CONTEXT_IT); in HAL_JPEG_Decode_IT()
1815 hjpeg->pJpegInBuffPtr = pDataIn; in HAL_JPEG_Decode_IT()
1816 hjpeg->pJpegOutBuffPtr = pDataOutMCU; in HAL_JPEG_Decode_IT()
1817 …hjpeg->InDataLength = InDataLength - (InDataLength % 4UL); /*In Data length must be multiple of… in HAL_JPEG_Decode_IT()
1818 …hjpeg->OutDataLength = OutDataLength - (OutDataLength % 4UL); /*Out Data length must be multiple o… in HAL_JPEG_Decode_IT()
1821 hjpeg->JpegInCount = 0; in HAL_JPEG_Decode_IT()
1822 hjpeg->JpegOutCount = 0; in HAL_JPEG_Decode_IT()
1825 JPEG_Init_Process(hjpeg); in HAL_JPEG_Decode_IT()
1831 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode_IT()
1849 HAL_StatusTypeDef HAL_JPEG_Encode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataInMCU, uint32_t InD… in HAL_JPEG_Encode_DMA() argument
1857 if ((hjpeg == NULL) || (pDataInMCU == NULL) || (pDataOut == NULL)) in HAL_JPEG_Encode_DMA()
1863 __HAL_LOCK(hjpeg); in HAL_JPEG_Encode_DMA()
1865 if (hjpeg->State != HAL_JPEG_STATE_READY) in HAL_JPEG_Encode_DMA()
1868 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode_DMA()
1874 if ((hjpeg->Context & JPEG_CONTEXT_CONF_ENCODING) == JPEG_CONTEXT_CONF_ENCODING) in HAL_JPEG_Encode_DMA()
1877 hjpeg->State = HAL_JPEG_STATE_BUSY_ENCODING; in HAL_JPEG_Encode_DMA()
1880 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Encode_DMA()
1881 hjpeg->Context |= (JPEG_CONTEXT_ENCODE | JPEG_CONTEXT_DMA); in HAL_JPEG_Encode_DMA()
1884 hjpeg->pJpegInBuffPtr = pDataInMCU; in HAL_JPEG_Encode_DMA()
1885 hjpeg->pJpegOutBuffPtr = pDataOut; in HAL_JPEG_Encode_DMA()
1886 hjpeg->InDataLength = InDataLength; in HAL_JPEG_Encode_DMA()
1887 hjpeg->OutDataLength = OutDataLength; in HAL_JPEG_Encode_DMA()
1890 hjpeg->JpegInCount = 0; in HAL_JPEG_Encode_DMA()
1891 hjpeg->JpegOutCount = 0; in HAL_JPEG_Encode_DMA()
1894 JPEG_Init_Process(hjpeg); in HAL_JPEG_Encode_DMA()
1897 if (JPEG_DMA_StartProcess(hjpeg) != HAL_OK) in HAL_JPEG_Encode_DMA()
1900 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Encode_DMA()
1902 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode_DMA()
1911 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Encode_DMA()
1930 HAL_StatusTypeDef HAL_JPEG_Decode_DMA(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataIn, uint32_t InData… in HAL_JPEG_Decode_DMA() argument
1938 if ((hjpeg == NULL) || (pDataIn == NULL) || (pDataOutMCU == NULL)) in HAL_JPEG_Decode_DMA()
1944 __HAL_LOCK(hjpeg); in HAL_JPEG_Decode_DMA()
1946 if (hjpeg->State == HAL_JPEG_STATE_READY) in HAL_JPEG_Decode_DMA()
1949 hjpeg->State = HAL_JPEG_STATE_BUSY_DECODING; in HAL_JPEG_Decode_DMA()
1952 hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK); in HAL_JPEG_Decode_DMA()
1953 hjpeg->Context |= (JPEG_CONTEXT_DECODE | JPEG_CONTEXT_DMA); in HAL_JPEG_Decode_DMA()
1956 hjpeg->pJpegInBuffPtr = pDataIn; in HAL_JPEG_Decode_DMA()
1957 hjpeg->pJpegOutBuffPtr = pDataOutMCU; in HAL_JPEG_Decode_DMA()
1958 hjpeg->InDataLength = InDataLength; in HAL_JPEG_Decode_DMA()
1959 hjpeg->OutDataLength = OutDataLength; in HAL_JPEG_Decode_DMA()
1962 hjpeg->JpegInCount = 0; in HAL_JPEG_Decode_DMA()
1963 hjpeg->JpegOutCount = 0; in HAL_JPEG_Decode_DMA()
1966 JPEG_Init_Process(hjpeg); in HAL_JPEG_Decode_DMA()
1969 if (JPEG_DMA_StartProcess(hjpeg) != HAL_OK) in HAL_JPEG_Decode_DMA()
1972 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Decode_DMA()
1974 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode_DMA()
1982 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Decode_DMA()
2000 HAL_StatusTypeDef HAL_JPEG_Pause(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection) in HAL_JPEG_Pause() argument
2006 if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_DMA) in HAL_JPEG_Pause()
2010 hjpeg->Context |= JPEG_CONTEXT_PAUSE_INPUT; in HAL_JPEG_Pause()
2014 hjpeg->Context |= JPEG_CONTEXT_PAUSE_OUTPUT; in HAL_JPEG_Pause()
2018 else if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_IT) in HAL_JPEG_Pause()
2023 hjpeg->Context |= JPEG_CONTEXT_PAUSE_INPUT; in HAL_JPEG_Pause()
2028 hjpeg->Context |= JPEG_CONTEXT_PAUSE_OUTPUT; in HAL_JPEG_Pause()
2031 __HAL_JPEG_DISABLE_IT(hjpeg, mask); in HAL_JPEG_Pause()
2053 HAL_StatusTypeDef HAL_JPEG_Resume(JPEG_HandleTypeDef *hjpeg, uint32_t XferSelection) in HAL_JPEG_Resume() argument
2060 if ((hjpeg->Context & (JPEG_CONTEXT_PAUSE_INPUT | JPEG_CONTEXT_PAUSE_OUTPUT)) == 0UL) in HAL_JPEG_Resume()
2066 if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_DMA) in HAL_JPEG_Resume()
2071 hjpeg->Context &= (~JPEG_CONTEXT_PAUSE_INPUT); in HAL_JPEG_Resume()
2078 xfrSize = hjpeg->hdmain->Init.BufferTransferLength; in HAL_JPEG_Resume()
2082 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Resume()
2083 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Resume()
2087 hjpeg->InDataLength = hjpeg->InDataLength - (hjpeg->InDataLength % xfrSize); in HAL_JPEG_Resume()
2090 if (hjpeg->InDataLength > 0UL) in HAL_JPEG_Resume()
2093 …if (HAL_MDMA_Start_IT(hjpeg->hdmain, (uint32_t)hjpeg->pJpegInBuffPtr, (uint32_t)&hjpeg->Instance->… in HAL_JPEG_Resume()
2094 hjpeg->InDataLength, 1) != HAL_OK) in HAL_JPEG_Resume()
2096 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Resume()
2097 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Resume()
2104 hjpeg->Context &= (~JPEG_CONTEXT_PAUSE_OUTPUT); in HAL_JPEG_Resume()
2106 if ((hjpeg->Context & JPEG_CONTEXT_ENDING_DMA) != 0UL) in HAL_JPEG_Resume()
2108 JPEG_DMA_PollResidualData(hjpeg); in HAL_JPEG_Resume()
2117 xfrSize = hjpeg->hdmaout->Init.BufferTransferLength; in HAL_JPEG_Resume()
2121 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Resume()
2122 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Resume()
2126 hjpeg->OutDataLength = hjpeg->OutDataLength - (hjpeg->OutDataLength % xfrSize); in HAL_JPEG_Resume()
2129 …if (HAL_MDMA_Start_IT(hjpeg->hdmaout, (uint32_t)&hjpeg->Instance->DOR, (uint32_t)hjpeg->pJpegOutBu… in HAL_JPEG_Resume()
2130 hjpeg->OutDataLength, 1) != HAL_OK) in HAL_JPEG_Resume()
2132 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Resume()
2133 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Resume()
2141 else if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_IT) in HAL_JPEG_Resume()
2145 hjpeg->Context &= (~JPEG_CONTEXT_PAUSE_INPUT); in HAL_JPEG_Resume()
2150 hjpeg->Context &= (~JPEG_CONTEXT_PAUSE_OUTPUT); in HAL_JPEG_Resume()
2153 __HAL_JPEG_ENABLE_IT(hjpeg, mask); in HAL_JPEG_Resume()
2173 void HAL_JPEG_ConfigInputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewInputBuffer, uint32_t InDat… in HAL_JPEG_ConfigInputBuffer() argument
2175 hjpeg->pJpegInBuffPtr = pNewInputBuffer; in HAL_JPEG_ConfigInputBuffer()
2176 hjpeg->InDataLength = InDataLength; in HAL_JPEG_ConfigInputBuffer()
2187 void HAL_JPEG_ConfigOutputBuffer(JPEG_HandleTypeDef *hjpeg, uint8_t *pNewOutputBuffer, uint32_t Out… in HAL_JPEG_ConfigOutputBuffer() argument
2189 hjpeg->pJpegOutBuffPtr = pNewOutputBuffer; in HAL_JPEG_ConfigOutputBuffer()
2190 hjpeg->OutDataLength = OutDataLength; in HAL_JPEG_ConfigOutputBuffer()
2199 HAL_StatusTypeDef HAL_JPEG_Abort(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_Abort() argument
2203 tmpContext = hjpeg->Context; in HAL_JPEG_Abort()
2206 …hjpeg->Context &= ~(JPEG_CONTEXT_OPERATION_MASK | JPEG_CONTEXT_METHOD_MASK | JPEG_CONTEXT_ENDING_D… in HAL_JPEG_Abort()
2211 if (HAL_MDMA_Abort(hjpeg->hdmaout) != HAL_OK) in HAL_JPEG_Abort()
2213 if (hjpeg->hdmaout->ErrorCode == HAL_MDMA_ERROR_TIMEOUT) in HAL_JPEG_Abort()
2215 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Abort()
2218 if (HAL_MDMA_Abort(hjpeg->hdmain) != HAL_OK) in HAL_JPEG_Abort()
2220 if (hjpeg->hdmain->ErrorCode == HAL_MDMA_ERROR_TIMEOUT) in HAL_JPEG_Abort()
2222 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in HAL_JPEG_Abort()
2229 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in HAL_JPEG_Abort()
2235 while (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_COF) != 0UL) in HAL_JPEG_Abort()
2241 hjpeg->ErrorCode |= HAL_JPEG_ERROR_TIMEOUT; in HAL_JPEG_Abort()
2244 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Abort()
2250 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in HAL_JPEG_Abort()
2254 hjpeg->Instance->CR |= JPEG_CR_IFF; in HAL_JPEG_Abort()
2255 hjpeg->Instance->CR |= JPEG_CR_OFF; in HAL_JPEG_Abort()
2258 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_ALL); in HAL_JPEG_Abort()
2261 hjpeg->JpegInCount = 0; in HAL_JPEG_Abort()
2262 hjpeg->JpegOutCount = 0; in HAL_JPEG_Abort()
2265 hjpeg->Context &= ~(JPEG_CONTEXT_PAUSE_INPUT | JPEG_CONTEXT_PAUSE_OUTPUT); in HAL_JPEG_Abort()
2268 if (hjpeg->ErrorCode != HAL_JPEG_ERROR_NONE) in HAL_JPEG_Abort()
2270 hjpeg->State = HAL_JPEG_STATE_ERROR; in HAL_JPEG_Abort()
2272 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Abort()
2278 hjpeg->State = HAL_JPEG_STATE_READY; in HAL_JPEG_Abort()
2280 __HAL_UNLOCK(hjpeg); in HAL_JPEG_Abort()
2319 __weak void HAL_JPEG_InfoReadyCallback(JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *pInfo) in HAL_JPEG_InfoReadyCallback() argument
2322 UNUSED(hjpeg); in HAL_JPEG_InfoReadyCallback()
2336 __weak void HAL_JPEG_EncodeCpltCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_EncodeCpltCallback() argument
2339 UNUSED(hjpeg); in HAL_JPEG_EncodeCpltCallback()
2352 __weak void HAL_JPEG_DecodeCpltCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_DecodeCpltCallback() argument
2355 UNUSED(hjpeg); in HAL_JPEG_DecodeCpltCallback()
2368 __weak void HAL_JPEG_ErrorCallback(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_ErrorCallback() argument
2371 UNUSED(hjpeg); in HAL_JPEG_ErrorCallback()
2385 __weak void HAL_JPEG_GetDataCallback(JPEG_HandleTypeDef *hjpeg, uint32_t NbDecodedData) in HAL_JPEG_GetDataCallback() argument
2388 UNUSED(hjpeg); in HAL_JPEG_GetDataCallback()
2404 __weak void HAL_JPEG_DataReadyCallback(JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t OutDa… in HAL_JPEG_DataReadyCallback() argument
2407 UNUSED(hjpeg); in HAL_JPEG_DataReadyCallback()
2441 void HAL_JPEG_IRQHandler(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_IRQHandler() argument
2443 switch (hjpeg->State) in HAL_JPEG_IRQHandler()
2449 if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_IT) in HAL_JPEG_IRQHandler()
2451 (void) JPEG_Process(hjpeg); in HAL_JPEG_IRQHandler()
2453 else if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_DMA) in HAL_JPEG_IRQHandler()
2455 JPEG_DMA_ContinueProcess(hjpeg); in HAL_JPEG_IRQHandler()
2493 HAL_JPEG_STATETypeDef HAL_JPEG_GetState(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_GetState() argument
2495 return hjpeg->State; in HAL_JPEG_GetState()
2504 uint32_t HAL_JPEG_GetError(JPEG_HandleTypeDef *hjpeg) in HAL_JPEG_GetError() argument
2506 return hjpeg->ErrorCode; in HAL_JPEG_GetError()
2697 static HAL_StatusTypeDef JPEG_Set_HuffDC_Mem(JPEG_HandleTypeDef *hjpeg, JPEG_DCHuffTableTypeDef *Hu… in JPEG_Set_HuffDC_Mem() argument
2707 if (DCTableAddress == (hjpeg->Instance->HUFFENC_DC0)) in JPEG_Set_HuffDC_Mem()
2709 address = (hjpeg->Instance->HUFFENC_DC0 + (JPEG_DC_HUFF_TABLE_SIZE / 2UL)); in JPEG_Set_HuffDC_Mem()
2711 else if (DCTableAddress == (hjpeg->Instance->HUFFENC_DC1)) in JPEG_Set_HuffDC_Mem()
2713 address = (hjpeg->Instance->HUFFENC_DC1 + (JPEG_DC_HUFF_TABLE_SIZE / 2UL)); in JPEG_Set_HuffDC_Mem()
2759 static HAL_StatusTypeDef JPEG_Set_HuffAC_Mem(JPEG_HandleTypeDef *hjpeg, JPEG_ACHuffTableTypeDef *Hu… in JPEG_Set_HuffAC_Mem() argument
2767 if (ACTableAddress == (hjpeg->Instance->HUFFENC_AC0)) in JPEG_Set_HuffAC_Mem()
2769 address = (hjpeg->Instance->HUFFENC_AC0 + (JPEG_AC_HUFF_TABLE_SIZE / 2UL)); in JPEG_Set_HuffAC_Mem()
2771 else if (ACTableAddress == (hjpeg->Instance->HUFFENC_AC1)) in JPEG_Set_HuffAC_Mem()
2773 address = (hjpeg->Instance->HUFFENC_AC1 + (JPEG_AC_HUFF_TABLE_SIZE / 2UL)); in JPEG_Set_HuffAC_Mem()
2832 static HAL_StatusTypeDef JPEG_Set_HuffEnc_Mem(JPEG_HandleTypeDef *hjpeg) in JPEG_Set_HuffEnc_Mem() argument
2836 JPEG_Set_Huff_DHTMem(hjpeg); in JPEG_Set_HuffEnc_Mem()
2837 error = JPEG_Set_HuffAC_Mem(hjpeg, (JPEG_ACHuffTableTypeDef *)(uint32_t)&JPEG_ACLUM_HuffTable, in JPEG_Set_HuffEnc_Mem()
2838 (hjpeg->Instance->HUFFENC_AC0)); in JPEG_Set_HuffEnc_Mem()
2844 error = JPEG_Set_HuffAC_Mem(hjpeg, (JPEG_ACHuffTableTypeDef *)(uint32_t)&JPEG_ACCHROM_HuffTable, in JPEG_Set_HuffEnc_Mem()
2845 (hjpeg->Instance->HUFFENC_AC1)); in JPEG_Set_HuffEnc_Mem()
2851 error = JPEG_Set_HuffDC_Mem(hjpeg, (JPEG_DCHuffTableTypeDef *)(uint32_t)&JPEG_DCLUM_HuffTable, in JPEG_Set_HuffEnc_Mem()
2852 hjpeg->Instance->HUFFENC_DC0); in JPEG_Set_HuffEnc_Mem()
2858 error = JPEG_Set_HuffDC_Mem(hjpeg, (JPEG_DCHuffTableTypeDef *)(uint32_t)&JPEG_DCCHROM_HuffTable, in JPEG_Set_HuffEnc_Mem()
2859 hjpeg->Instance->HUFFENC_DC1); in JPEG_Set_HuffEnc_Mem()
2875 static void JPEG_Set_Huff_DHTMem(JPEG_HandleTypeDef *hjpeg) in JPEG_Set_Huff_DHTMem() argument
2886 address = (hjpeg->Instance->DHTMEM + 3); in JPEG_Set_Huff_DHTMem()
2901 address = (hjpeg->Instance->DHTMEM + 6); in JPEG_Set_Huff_DHTMem()
2915 address = (hjpeg->Instance->DHTMEM + 10UL); in JPEG_Set_Huff_DHTMem()
2931 address = (hjpeg->Instance->DHTMEM + 51); in JPEG_Set_Huff_DHTMem()
2952 address = (hjpeg->Instance->DHTMEM + 51); in JPEG_Set_Huff_DHTMem()
2958 address = (hjpeg->Instance->DHTMEM + 55); in JPEG_Set_Huff_DHTMem()
2980 address = (hjpeg->Instance->DHTMEM + 55); in JPEG_Set_Huff_DHTMem()
2987 address = (hjpeg->Instance->DHTMEM + 58); in JPEG_Set_Huff_DHTMem()
3008 address = (hjpeg->Instance->DHTMEM + 58); in JPEG_Set_Huff_DHTMem()
3014 address = (hjpeg->Instance->DHTMEM + 62); in JPEG_Set_Huff_DHTMem()
3036 address = (hjpeg->Instance->DHTMEM + 62); in JPEG_Set_Huff_DHTMem()
3043 address = (hjpeg->Instance->DHTMEM + 102); in JPEG_Set_Huff_DHTMem()
3066 static uint32_t JPEG_Set_Quantization_Mem(JPEG_HandleTypeDef *hjpeg, uint8_t *QTable, in JPEG_Set_Quantization_Mem() argument
3078 if ((hjpeg->Conf.ImageQuality >= 50UL) && (hjpeg->Conf.ImageQuality <= 100UL)) in JPEG_Set_Quantization_Mem()
3080 ScaleFactor = 200UL - (hjpeg->Conf.ImageQuality * 2UL); in JPEG_Set_Quantization_Mem()
3082 else if (hjpeg->Conf.ImageQuality > 0UL) in JPEG_Set_Quantization_Mem()
3084 ScaleFactor = ((uint32_t) 5000) / ((uint32_t) hjpeg->Conf.ImageQuality); in JPEG_Set_Quantization_Mem()
3132 static void JPEG_SetColorYCBCR(JPEG_HandleTypeDef *hjpeg) in JPEG_SetColorYCBCR() argument
3139 hjpeg->Instance->CONFR1 &= ~JPEG_CONFR1_NF; in JPEG_SetColorYCBCR()
3140 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_NF_1; in JPEG_SetColorYCBCR()
3143 if (hjpeg->Conf.ChromaSubsampling == JPEG_420_SUBSAMPLING) in JPEG_SetColorYCBCR()
3150 else if (hjpeg->Conf.ChromaSubsampling == JPEG_422_SUBSAMPLING) in JPEG_SetColorYCBCR()
3165 hjpeg->Instance->CONFR1 &= ~(JPEG_CONFR1_NF | JPEG_CONFR1_NS); in JPEG_SetColorYCBCR()
3166 hjpeg->Instance->CONFR1 |= (JPEG_CONFR1_NF_1 | JPEG_CONFR1_NS_1); in JPEG_SetColorYCBCR()
3169 hjpeg->Instance->CONFR4 = 0; in JPEG_SetColorYCBCR()
3171 hjpeg->Instance->CONFR4 |= (ySamplingH | ySamplingV | (yblockNb & JPEG_CONFR4_NB)); in JPEG_SetColorYCBCR()
3174 hjpeg->Instance->CONFR5 = 0; in JPEG_SetColorYCBCR()
3176 …hjpeg->Instance->CONFR5 |= (JPEG_CONFR5_HSF_0 | JPEG_CONFR5_VSF_0 | JPEG_CONFR5_QT_0 | JPEG_CONFR5… in JPEG_SetColorYCBCR()
3179 hjpeg->Instance->CONFR6 = 0; in JPEG_SetColorYCBCR()
3183 …hjpeg->Instance->CONFR6 |= (JPEG_CONFR6_HSF_0 | JPEG_CONFR6_VSF_0 | JPEG_CONFR6_QT_0 | JPEG_CONFR6… in JPEG_SetColorYCBCR()
3193 static void JPEG_SetColorGrayScale(JPEG_HandleTypeDef *hjpeg) in JPEG_SetColorGrayScale() argument
3196 hjpeg->Instance->CONFR1 &= ~(JPEG_CONFR1_NF | JPEG_CONFR1_NS); in JPEG_SetColorGrayScale()
3202 hjpeg->Instance->CONFR4 = 0; in JPEG_SetColorGrayScale()
3204 hjpeg->Instance->CONFR4 |= JPEG_CONFR4_HSF_0 | JPEG_CONFR4_VSF_0 ; in JPEG_SetColorGrayScale()
3213 static void JPEG_SetColorCMYK(JPEG_HandleTypeDef *hjpeg) in JPEG_SetColorCMYK() argument
3220 hjpeg->Instance->CONFR1 |= (JPEG_CONFR1_NF | JPEG_CONFR1_NS); in JPEG_SetColorCMYK()
3223 if (hjpeg->Conf.ChromaSubsampling == JPEG_420_SUBSAMPLING) in JPEG_SetColorCMYK()
3230 else if (hjpeg->Conf.ChromaSubsampling == JPEG_422_SUBSAMPLING) in JPEG_SetColorCMYK()
3246 hjpeg->Instance->CONFR4 = 0; in JPEG_SetColorCMYK()
3248 hjpeg->Instance->CONFR4 |= (ySamplingH | ySamplingV | (yblockNb & JPEG_CONFR4_NB)); in JPEG_SetColorCMYK()
3251 hjpeg->Instance->CONFR5 = 0; in JPEG_SetColorCMYK()
3253 hjpeg->Instance->CONFR5 |= (JPEG_CONFR5_HSF_0 | JPEG_CONFR5_VSF_0); in JPEG_SetColorCMYK()
3256 hjpeg->Instance->CONFR6 = 0; in JPEG_SetColorCMYK()
3258 hjpeg->Instance->CONFR6 |= (JPEG_CONFR6_HSF_0 | JPEG_CONFR6_VSF_0); in JPEG_SetColorCMYK()
3261 hjpeg->Instance->CONFR7 = 0; in JPEG_SetColorCMYK()
3263 hjpeg->Instance->CONFR7 |= (JPEG_CONFR7_HSF_0 | JPEG_CONFR7_VSF_0); in JPEG_SetColorCMYK()
3272 static void JPEG_Init_Process(JPEG_HandleTypeDef *hjpeg) in JPEG_Init_Process() argument
3275 hjpeg->Context &= (~(JPEG_CONTEXT_PAUSE_INPUT | JPEG_CONTEXT_PAUSE_OUTPUT)); in JPEG_Init_Process()
3277 if ((hjpeg->Context & JPEG_CONTEXT_OPERATION_MASK) == JPEG_CONTEXT_DECODE) in JPEG_Init_Process()
3280 hjpeg->Instance->CONFR1 |= JPEG_CONFR1_DE; in JPEG_Init_Process()
3285 hjpeg->Instance->CONFR1 &= ~JPEG_CONFR1_DE; in JPEG_Init_Process()
3289 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_Init_Process()
3292 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_Init_Process()
3295 hjpeg->Instance->CR |= JPEG_CR_IFF; in JPEG_Init_Process()
3296 hjpeg->Instance->CR |= JPEG_CR_OFF; in JPEG_Init_Process()
3299 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_ALL); in JPEG_Init_Process()
3302 hjpeg->Instance->CONFR0 |= JPEG_CONFR0_START; in JPEG_Init_Process()
3304 if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_IT) in JPEG_Init_Process()
3307 …__HAL_JPEG_ENABLE_IT(hjpeg, JPEG_IT_IFT | JPEG_IT_IFNF | JPEG_IT_OFT | JPEG_IT_OFNE | JPEG_IT_EOC … in JPEG_Init_Process()
3309 else if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_DMA) in JPEG_Init_Process()
3312 __HAL_JPEG_ENABLE_IT(hjpeg, JPEG_IT_EOC | JPEG_IT_HPD); in JPEG_Init_Process()
3327 static uint32_t JPEG_Process(JPEG_HandleTypeDef *hjpeg) in JPEG_Process() argument
3332 if ((hjpeg->Context & JPEG_CONTEXT_OPERATION_MASK) == JPEG_CONTEXT_DECODE) in JPEG_Process()
3334 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_HPDF) != 0UL) in JPEG_Process()
3337 (void) HAL_JPEG_GetInfo(hjpeg, &hjpeg->Conf); in JPEG_Process()
3339 hjpeg->Conf.ImageQuality = 0; in JPEG_Process()
3345 hjpeg->InfoReadyCallback(hjpeg, &hjpeg->Conf); in JPEG_Process()
3347 HAL_JPEG_InfoReadyCallback(hjpeg, &hjpeg->Conf); in JPEG_Process()
3350 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_IT_HPD); in JPEG_Process()
3353 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_HPDF); in JPEG_Process()
3358 if ((hjpeg->Context & JPEG_CONTEXT_PAUSE_INPUT) == 0UL) in JPEG_Process()
3360 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_IFTF) != 0UL) in JPEG_Process()
3364 JPEG_ReadInputData(hjpeg, JPEG_FIFO_TH_SIZE); in JPEG_Process()
3366 else if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_IFNFF) != 0UL) in JPEG_Process()
3370 JPEG_ReadInputData(hjpeg, 1); in JPEG_Process()
3380 if ((hjpeg->Context & JPEG_CONTEXT_PAUSE_OUTPUT) == 0UL) in JPEG_Process()
3382 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_OFTF) != 0UL) in JPEG_Process()
3386 JPEG_StoreOutputData(hjpeg, JPEG_FIFO_TH_SIZE); in JPEG_Process()
3388 else if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_OFNEF) != 0UL) in JPEG_Process()
3392 JPEG_StoreOutputData(hjpeg, 1); in JPEG_Process()
3401 …if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_EOCF | JPEG_FLAG_OFTF | JPEG_FLAG_OFNEF) == JPEG_FLAG_EOC… in JPEG_Process()
3404 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_Process()
3406 if ((hjpeg->Context & JPEG_CONTEXT_METHOD_MASK) == JPEG_CONTEXT_IT) in JPEG_Process()
3409 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_Process()
3413 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_ALL); in JPEG_Process()
3416 if (hjpeg->JpegOutCount > 0UL) in JPEG_Process()
3420 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_Process()
3422 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_Process()
3425 hjpeg->JpegOutCount = 0; in JPEG_Process()
3429 tmpContext = hjpeg->Context; in JPEG_Process()
3431 hjpeg->Context &= (JPEG_CONTEXT_CONF_ENCODING | JPEG_CONTEXT_CUSTOM_TABLES); in JPEG_Process()
3434 __HAL_UNLOCK(hjpeg); in JPEG_Process()
3437 hjpeg->State = HAL_JPEG_STATE_READY; in JPEG_Process()
3443 hjpeg->DecodeCpltCallback(hjpeg); in JPEG_Process()
3445 HAL_JPEG_DecodeCpltCallback(hjpeg); in JPEG_Process()
3451 hjpeg->EncodeCpltCallback(hjpeg); in JPEG_Process()
3453 HAL_JPEG_EncodeCpltCallback(hjpeg); in JPEG_Process()
3473 static void JPEG_StoreOutputData(JPEG_HandleTypeDef *hjpeg, uint32_t nbOutputWords) in JPEG_StoreOutputData() argument
3480 if (hjpeg->OutDataLength >= (hjpeg->JpegOutCount + (nbOutputWords * 4UL))) in JPEG_StoreOutputData()
3485 dataword = hjpeg->Instance->DOR; in JPEG_StoreOutputData()
3486 hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount] = (uint8_t)(dataword & 0x000000FFUL); in JPEG_StoreOutputData()
3487 hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 1UL] = (uint8_t)((dataword & 0x0000FF00UL) >> 8); in JPEG_StoreOutputData()
3488 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 2UL] = (uint8_t)((dataword & 0x00FF0000UL) >> 16); in JPEG_StoreOutputData()
3489 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 3UL] = (uint8_t)((dataword & 0xFF000000UL) >> 24); in JPEG_StoreOutputData()
3490 hjpeg->JpegOutCount += 4UL; in JPEG_StoreOutputData()
3492 if (hjpeg->OutDataLength == hjpeg->JpegOutCount) in JPEG_StoreOutputData()
3496 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3498 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3500 hjpeg->JpegOutCount = 0; in JPEG_StoreOutputData()
3503 else if (hjpeg->OutDataLength > hjpeg->JpegOutCount) in JPEG_StoreOutputData()
3505 nb_words = (hjpeg->OutDataLength - hjpeg->JpegOutCount) / 4UL; in JPEG_StoreOutputData()
3509 dataword = hjpeg->Instance->DOR; in JPEG_StoreOutputData()
3510 hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount] = (uint8_t)(dataword & 0x000000FFUL); in JPEG_StoreOutputData()
3511 hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 1UL] = (uint8_t)((dataword & 0x0000FF00UL) >> 8); in JPEG_StoreOutputData()
3512 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 2UL] = (uint8_t)((dataword & 0x00FF0000UL) >> 16); in JPEG_StoreOutputData()
3513 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 3UL] = (uint8_t)((dataword & 0xFF000000UL) >> 24); in JPEG_StoreOutputData()
3514 hjpeg->JpegOutCount += 4UL; in JPEG_StoreOutputData()
3516 if (hjpeg->OutDataLength == hjpeg->JpegOutCount) in JPEG_StoreOutputData()
3520 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3522 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3524 hjpeg->JpegOutCount = 0; in JPEG_StoreOutputData()
3528 nb_bytes = hjpeg->OutDataLength - hjpeg->JpegOutCount; in JPEG_StoreOutputData()
3529 dataword = hjpeg->Instance->DOR; in JPEG_StoreOutputData()
3532 …hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount] = (uint8_t)((dataword >> (8UL * (index & 0x3UL))) & 0x… in JPEG_StoreOutputData()
3533 hjpeg->JpegOutCount++; in JPEG_StoreOutputData()
3537 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3539 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_StoreOutputData()
3542 hjpeg->JpegOutCount = 0; in JPEG_StoreOutputData()
3547 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount] = (uint8_t)((dataword >> (8UL * index)) & 0xFFUL); in JPEG_StoreOutputData()
3548 hjpeg->JpegOutCount++; in JPEG_StoreOutputData()
3567 static void JPEG_ReadInputData(JPEG_HandleTypeDef *hjpeg, uint32_t nbRequestWords) in JPEG_ReadInputData() argument
3575 if ((hjpeg->InDataLength == 0UL) || (nbRequestWords == 0UL)) in JPEG_ReadInputData()
3578 (void) HAL_JPEG_Pause(hjpeg, JPEG_PAUSE_RESUME_INPUT); in JPEG_ReadInputData()
3580 else if (hjpeg->InDataLength > hjpeg->JpegInCount) in JPEG_ReadInputData()
3582 nb_bytes = hjpeg->InDataLength - hjpeg->JpegInCount; in JPEG_ReadInputData()
3584 else if (hjpeg->InDataLength == hjpeg->JpegInCount) in JPEG_ReadInputData()
3588 hjpeg->GetDataCallback(hjpeg, hjpeg->JpegInCount); in JPEG_ReadInputData()
3590 HAL_JPEG_GetDataCallback(hjpeg, hjpeg->JpegInCount); in JPEG_ReadInputData()
3593 if (hjpeg->InDataLength > 4UL) in JPEG_ReadInputData()
3595 hjpeg->InDataLength = hjpeg->InDataLength - (hjpeg->InDataLength % 4UL); in JPEG_ReadInputData()
3597 hjpeg->JpegInCount = 0; in JPEG_ReadInputData()
3598 nb_bytes = hjpeg->InDataLength; in JPEG_ReadInputData()
3604 if (((hjpeg->Context & JPEG_CONTEXT_PAUSE_INPUT) == 0UL) && (nb_bytes > 0UL)) in JPEG_ReadInputData()
3611 input_count = hjpeg->JpegInCount; in JPEG_ReadInputData()
3612 hjpeg->Instance->DIR = (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count])) | \ in JPEG_ReadInputData()
3613 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 1UL])) << 8) | \ in JPEG_ReadInputData()
3614 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 2UL])) << 16) | \ in JPEG_ReadInputData()
3615 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 3UL])) << 24)); in JPEG_ReadInputData()
3617 hjpeg->JpegInCount += 4UL; in JPEG_ReadInputData()
3626 input_count = hjpeg->JpegInCount; in JPEG_ReadInputData()
3627 hjpeg->Instance->DIR = (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count])) | \ in JPEG_ReadInputData()
3628 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 1UL])) << 8) | \ in JPEG_ReadInputData()
3629 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 2UL])) << 16) | \ in JPEG_ReadInputData()
3630 (((uint32_t)(hjpeg->pJpegInBuffPtr[input_count + 3UL])) << 24)); in JPEG_ReadInputData()
3632 hjpeg->JpegInCount += 4UL; in JPEG_ReadInputData()
3641 … dataword |= (uint32_t)hjpeg->pJpegInBuffPtr[hjpeg->JpegInCount] << (8UL * (index & 0x03UL)); in JPEG_ReadInputData()
3642 hjpeg->JpegInCount++; in JPEG_ReadInputData()
3644 hjpeg->Instance->DIR = dataword; in JPEG_ReadInputData()
3656 static HAL_StatusTypeDef JPEG_DMA_StartProcess(JPEG_HandleTypeDef *hjpeg) in JPEG_DMA_StartProcess() argument
3665 inXfrSize = hjpeg->hdmain->Init.BufferTransferLength; in JPEG_DMA_StartProcess()
3672 outXfrSize = hjpeg->hdmaout->Init.BufferTransferLength; in JPEG_DMA_StartProcess()
3674 if ((hjpeg->InDataLength < inXfrSize) || (hjpeg->OutDataLength < outXfrSize)) in JPEG_DMA_StartProcess()
3679 hjpeg->hdmain->XferCpltCallback = JPEG_MDMAInCpltCallback; in JPEG_DMA_StartProcess()
3681 hjpeg->hdmain->XferErrorCallback = JPEG_MDMAErrorCallback; in JPEG_DMA_StartProcess()
3684 hjpeg->hdmaout->XferCpltCallback = JPEG_MDMAOutCpltCallback; in JPEG_DMA_StartProcess()
3686 hjpeg->hdmaout->XferErrorCallback = JPEG_MDMAErrorCallback; in JPEG_DMA_StartProcess()
3688 hjpeg->hdmaout->XferAbortCallback = JPEG_MDMAOutAbortCallback; in JPEG_DMA_StartProcess()
3692 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_DMA_StartProcess()
3696 hjpeg->InDataLength = hjpeg->InDataLength - (hjpeg->InDataLength % inXfrSize); in JPEG_DMA_StartProcess()
3699 hjpeg->OutDataLength = hjpeg->OutDataLength - (hjpeg->OutDataLength % outXfrSize); in JPEG_DMA_StartProcess()
3703 …if (HAL_MDMA_Start_IT(hjpeg->hdmaout, (uint32_t)&hjpeg->Instance->DOR, (uint32_t)hjpeg->pJpegOutBu… in JPEG_DMA_StartProcess()
3704 hjpeg->OutDataLength, 1) != HAL_OK) in JPEG_DMA_StartProcess()
3706 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_DMA_StartProcess()
3710 …if (HAL_MDMA_Start_IT(hjpeg->hdmain, (uint32_t)hjpeg->pJpegInBuffPtr, (uint32_t)&hjpeg->Instance->… in JPEG_DMA_StartProcess()
3711 hjpeg->InDataLength, 1) != HAL_OK) in JPEG_DMA_StartProcess()
3713 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_DMA_StartProcess()
3726 static void JPEG_DMA_ContinueProcess(JPEG_HandleTypeDef *hjpeg) in JPEG_DMA_ContinueProcess() argument
3729 if ((hjpeg->Context & JPEG_CONTEXT_OPERATION_MASK) == JPEG_CONTEXT_DECODE) in JPEG_DMA_ContinueProcess()
3731 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_HPDF) != 0UL) in JPEG_DMA_ContinueProcess()
3734 (void) HAL_JPEG_GetInfo(hjpeg, &hjpeg->Conf); in JPEG_DMA_ContinueProcess()
3737 hjpeg->Conf.ImageQuality = 0; in JPEG_DMA_ContinueProcess()
3743 hjpeg->InfoReadyCallback(hjpeg, &hjpeg->Conf); in JPEG_DMA_ContinueProcess()
3745 HAL_JPEG_InfoReadyCallback(hjpeg, &hjpeg->Conf); in JPEG_DMA_ContinueProcess()
3748 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_IT_HPD); in JPEG_DMA_ContinueProcess()
3751 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_HPDF); in JPEG_DMA_ContinueProcess()
3756 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_EOCF) != 0UL) in JPEG_DMA_ContinueProcess()
3759 hjpeg->Context |= JPEG_CONTEXT_ENDING_DMA; in JPEG_DMA_ContinueProcess()
3762 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_DMA_ContinueProcess()
3764 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_DMA_ContinueProcess()
3767 __HAL_JPEG_CLEAR_FLAG(hjpeg, JPEG_FLAG_ALL); in JPEG_DMA_ContinueProcess()
3769 if (hjpeg->hdmain->State == HAL_MDMA_STATE_BUSY) in JPEG_DMA_ContinueProcess()
3772 (void) HAL_MDMA_Abort_IT(hjpeg->hdmain); in JPEG_DMA_ContinueProcess()
3775 if (hjpeg->hdmaout->State == HAL_MDMA_STATE_BUSY) in JPEG_DMA_ContinueProcess()
3778 (void) HAL_MDMA_Abort_IT(hjpeg->hdmaout); in JPEG_DMA_ContinueProcess()
3782 JPEG_DMA_EndProcess(hjpeg); in JPEG_DMA_ContinueProcess()
3795 static void JPEG_DMA_EndProcess(JPEG_HandleTypeDef *hjpeg) in JPEG_DMA_EndProcess() argument
3798 …hjpeg->JpegOutCount = hjpeg->OutDataLength - (hjpeg->hdmaout->Instance->CBNDTR & MDMA_CBNDTR_BNDT); in JPEG_DMA_EndProcess()
3801 if (hjpeg->JpegOutCount == hjpeg->OutDataLength) in JPEG_DMA_EndProcess()
3804 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_EndProcess()
3806 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_EndProcess()
3809 hjpeg->JpegOutCount = 0; in JPEG_DMA_EndProcess()
3813 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_OFNEF) == 0UL) in JPEG_DMA_EndProcess()
3815 if (hjpeg->JpegOutCount > 0UL) in JPEG_DMA_EndProcess()
3819 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_EndProcess()
3821 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_EndProcess()
3824 hjpeg->JpegOutCount = 0; in JPEG_DMA_EndProcess()
3828 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_DMA_EndProcess()
3830 tmpContext = hjpeg->Context; in JPEG_DMA_EndProcess()
3832 hjpeg->Context &= (JPEG_CONTEXT_CONF_ENCODING | JPEG_CONTEXT_CUSTOM_TABLES); in JPEG_DMA_EndProcess()
3835 __HAL_UNLOCK(hjpeg); in JPEG_DMA_EndProcess()
3838 hjpeg->State = HAL_JPEG_STATE_READY; in JPEG_DMA_EndProcess()
3844 hjpeg->DecodeCpltCallback(hjpeg); in JPEG_DMA_EndProcess()
3846 HAL_JPEG_DecodeCpltCallback(hjpeg); in JPEG_DMA_EndProcess()
3852 hjpeg->EncodeCpltCallback(hjpeg); in JPEG_DMA_EndProcess()
3854 HAL_JPEG_EncodeCpltCallback(hjpeg); in JPEG_DMA_EndProcess()
3858 else if ((hjpeg->Context & JPEG_CONTEXT_PAUSE_OUTPUT) == 0UL) in JPEG_DMA_EndProcess()
3860 JPEG_DMA_PollResidualData(hjpeg); in JPEG_DMA_EndProcess()
3875 static void JPEG_DMA_PollResidualData(JPEG_HandleTypeDef *hjpeg) in JPEG_DMA_PollResidualData() argument
3883 if ((hjpeg->Context & JPEG_CONTEXT_PAUSE_OUTPUT) == 0UL) in JPEG_DMA_PollResidualData()
3885 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_OFNEF) != 0UL) in JPEG_DMA_PollResidualData()
3887 dataOut = hjpeg->Instance->DOR; in JPEG_DMA_PollResidualData()
3888 hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount] = (uint8_t)(dataOut & 0x000000FFUL); in JPEG_DMA_PollResidualData()
3889 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 1UL] = (uint8_t)((dataOut & 0x0000FF00UL) >> 8); in JPEG_DMA_PollResidualData()
3890 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 2UL] = (uint8_t)((dataOut & 0x00FF0000UL) >> 16); in JPEG_DMA_PollResidualData()
3891 … hjpeg->pJpegOutBuffPtr[hjpeg->JpegOutCount + 3UL] = (uint8_t)((dataOut & 0xFF000000UL) >> 24); in JPEG_DMA_PollResidualData()
3892 hjpeg->JpegOutCount += 4UL; in JPEG_DMA_PollResidualData()
3894 if (hjpeg->JpegOutCount == hjpeg->OutDataLength) in JPEG_DMA_PollResidualData()
3898 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_PollResidualData()
3900 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_PollResidualData()
3903 hjpeg->JpegOutCount = 0; in JPEG_DMA_PollResidualData()
3910 tmpContext = hjpeg->Context; in JPEG_DMA_PollResidualData()
3912 …if ((__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_OFNEF) == 0UL) || ((tmpContext & JPEG_CONTEXT_PAUSE_OUTP… in JPEG_DMA_PollResidualData()
3915 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_DMA_PollResidualData()
3917 if (hjpeg->JpegOutCount > 0UL) in JPEG_DMA_PollResidualData()
3921 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_PollResidualData()
3923 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_DMA_PollResidualData()
3926 hjpeg->JpegOutCount = 0; in JPEG_DMA_PollResidualData()
3929 tmpContext = hjpeg->Context; in JPEG_DMA_PollResidualData()
3931 hjpeg->Context &= (JPEG_CONTEXT_CONF_ENCODING | JPEG_CONTEXT_CUSTOM_TABLES); in JPEG_DMA_PollResidualData()
3934 __HAL_UNLOCK(hjpeg); in JPEG_DMA_PollResidualData()
3937 hjpeg->State = HAL_JPEG_STATE_READY; in JPEG_DMA_PollResidualData()
3943 hjpeg->DecodeCpltCallback(hjpeg); in JPEG_DMA_PollResidualData()
3945 HAL_JPEG_DecodeCpltCallback(hjpeg); in JPEG_DMA_PollResidualData()
3951 hjpeg->EncodeCpltCallback(hjpeg); in JPEG_DMA_PollResidualData()
3953 HAL_JPEG_EncodeCpltCallback(hjpeg); in JPEG_DMA_PollResidualData()
3968 JPEG_HandleTypeDef *hjpeg = (JPEG_HandleTypeDef *)((MDMA_HandleTypeDef *)hmdma)->Parent; in JPEG_MDMAInCpltCallback() local
3971 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_MDMAInCpltCallback()
3974 if ((hjpeg->Context & (JPEG_CONTEXT_METHOD_MASK | JPEG_CONTEXT_ENDING_DMA)) == JPEG_CONTEXT_DMA) in JPEG_MDMAInCpltCallback()
3982 inXfrSize = hjpeg->hdmain->Init.BufferTransferLength; in JPEG_MDMAInCpltCallback()
3984 hjpeg->JpegInCount = hjpeg->InDataLength - (hmdma->Instance->CBNDTR & MDMA_CBNDTR_BNDT); in JPEG_MDMAInCpltCallback()
3988 hjpeg->GetDataCallback(hjpeg, hjpeg->JpegInCount); in JPEG_MDMAInCpltCallback()
3990 HAL_JPEG_GetDataCallback(hjpeg, hjpeg->JpegInCount); in JPEG_MDMAInCpltCallback()
3994 if (hjpeg->InDataLength >= inXfrSize) in JPEG_MDMAInCpltCallback()
3998 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_MDMAInCpltCallback()
3999 hjpeg->State = HAL_JPEG_STATE_ERROR; in JPEG_MDMAInCpltCallback()
4001 hjpeg->ErrorCallback(hjpeg); in JPEG_MDMAInCpltCallback()
4003 HAL_JPEG_ErrorCallback(hjpeg); in JPEG_MDMAInCpltCallback()
4009 hjpeg->InDataLength = hjpeg->InDataLength - (hjpeg->InDataLength % inXfrSize); in JPEG_MDMAInCpltCallback()
4012 else if (hjpeg->InDataLength > 0UL) in JPEG_MDMAInCpltCallback()
4015 if ((hjpeg->InDataLength % 4UL) != 0UL) in JPEG_MDMAInCpltCallback()
4017 hjpeg->InDataLength = ((hjpeg->InDataLength / 4UL) + 1UL) * 4UL; in JPEG_MDMAInCpltCallback()
4025 if (((hjpeg->Context & JPEG_CONTEXT_PAUSE_INPUT) == 0UL) && (hjpeg->InDataLength > 0UL)) in JPEG_MDMAInCpltCallback()
4028 …if (HAL_MDMA_Start_IT(hjpeg->hdmain, (uint32_t)hjpeg->pJpegInBuffPtr, (uint32_t)&hjpeg->Instance->… in JPEG_MDMAInCpltCallback()
4029 hjpeg->InDataLength, 1) != HAL_OK) in JPEG_MDMAInCpltCallback()
4031 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_MDMAInCpltCallback()
4032 hjpeg->State = HAL_JPEG_STATE_ERROR; in JPEG_MDMAInCpltCallback()
4034 hjpeg->ErrorCallback(hjpeg); in JPEG_MDMAInCpltCallback()
4036 HAL_JPEG_ErrorCallback(hjpeg); in JPEG_MDMAInCpltCallback()
4043 __HAL_JPEG_ENABLE_IT(hjpeg, JPEG_IT_EOC | JPEG_IT_HPD); in JPEG_MDMAInCpltCallback()
4054 JPEG_HandleTypeDef *hjpeg = (JPEG_HandleTypeDef *)((MDMA_HandleTypeDef *)hmdma)->Parent; in JPEG_MDMAOutCpltCallback() local
4058 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_MDMAOutCpltCallback()
4060 if ((hjpeg->Context & (JPEG_CONTEXT_METHOD_MASK | JPEG_CONTEXT_ENDING_DMA)) == in JPEG_MDMAOutCpltCallback()
4063 if (__HAL_JPEG_GET_FLAG(hjpeg, JPEG_FLAG_EOCF) == 0UL) in JPEG_MDMAOutCpltCallback()
4065 hjpeg->JpegOutCount = hjpeg->OutDataLength - (hmdma->Instance->CBNDTR & MDMA_CBNDTR_BNDT); in JPEG_MDMAOutCpltCallback()
4069 hjpeg->DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_MDMAOutCpltCallback()
4071 HAL_JPEG_DataReadyCallback(hjpeg, hjpeg->pJpegOutBuffPtr, hjpeg->JpegOutCount); in JPEG_MDMAOutCpltCallback()
4074 if ((hjpeg->Context & JPEG_CONTEXT_PAUSE_OUTPUT) == 0UL) in JPEG_MDMAOutCpltCallback()
4077 …if (HAL_MDMA_Start_IT(hjpeg->hdmaout, (uint32_t)&hjpeg->Instance->DOR, (uint32_t)hjpeg->pJpegOutBu… in JPEG_MDMAOutCpltCallback()
4078 hjpeg->OutDataLength, 1) != HAL_OK) in JPEG_MDMAOutCpltCallback()
4080 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_MDMAOutCpltCallback()
4081 hjpeg->State = HAL_JPEG_STATE_ERROR; in JPEG_MDMAOutCpltCallback()
4083 hjpeg->ErrorCallback(hjpeg); in JPEG_MDMAOutCpltCallback()
4085 HAL_JPEG_ErrorCallback(hjpeg); in JPEG_MDMAOutCpltCallback()
4093 __HAL_JPEG_ENABLE_IT(hjpeg, JPEG_IT_EOC | JPEG_IT_HPD); in JPEG_MDMAOutCpltCallback()
4105 JPEG_HandleTypeDef *hjpeg = (JPEG_HandleTypeDef *)((MDMA_HandleTypeDef *)hmdma)->Parent; in JPEG_MDMAErrorCallback() local
4108 hjpeg->Instance->CONFR0 &= ~JPEG_CONFR0_START; in JPEG_MDMAErrorCallback()
4111 __HAL_JPEG_DISABLE_IT(hjpeg, JPEG_INTERRUPT_MASK); in JPEG_MDMAErrorCallback()
4113 hjpeg->State = HAL_JPEG_STATE_READY; in JPEG_MDMAErrorCallback()
4114 hjpeg->ErrorCode |= HAL_JPEG_ERROR_DMA; in JPEG_MDMAErrorCallback()
4117 hjpeg->ErrorCallback(hjpeg); in JPEG_MDMAErrorCallback()
4119 HAL_JPEG_ErrorCallback(hjpeg); in JPEG_MDMAErrorCallback()
4130 JPEG_HandleTypeDef *hjpeg = (JPEG_HandleTypeDef *)((MDMA_HandleTypeDef *)hmdma)->Parent; in JPEG_MDMAOutAbortCallback() local
4132 if ((hjpeg->Context & JPEG_CONTEXT_ENDING_DMA) != 0UL) in JPEG_MDMAOutAbortCallback()
4134 JPEG_DMA_EndProcess(hjpeg); in JPEG_MDMAOutAbortCallback()
4145 static uint32_t JPEG_GetQuality(JPEG_HandleTypeDef *hjpeg) in JPEG_GetQuality() argument
4149 __IO uint32_t *tableAddress = hjpeg->Instance->QMEM0; in JPEG_GetQuality()
4166 scale = (quantVal * 100UL) / ((uint32_t) hjpeg->QuantTable0[JPEG_ZIGZAG_ORDER[i + j]]); in JPEG_GetQuality()