166 #ifdef HAL_DMA2D_MODULE_ENABLED
187 #define DMA2D_TIMEOUT_ABORT (1000U)
188 #define DMA2D_TIMEOUT_SUSPEND (1000U)
204 static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
249 assert_param(IS_DMA2D_OFFSET(hdma2d->Init.OutputOffset));
250 #if defined (DMA2D_ALPHA_INV_RB_SWAP_SUPPORT)
251 assert_param(IS_DMA2D_ALPHA_INVERTED(hdma2d->Init.AlphaInverted));
252 assert_param(IS_DMA2D_RB_SWAP(hdma2d->Init.RedBlueSwap));
255 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
256 if (hdma2d->State == HAL_DMA2D_STATE_RESET)
259 hdma2d->LineEventCallback = HAL_DMA2D_LineEventCallback;
260 hdma2d->CLUTLoadingCpltCallback = HAL_DMA2D_CLUTLoadingCpltCallback;
261 if(hdma2d->MspInitCallback ==
NULL)
263 hdma2d->MspInitCallback = HAL_DMA2D_MspInit;
267 hdma2d->MspInitCallback(hdma2d);
270 if(hdma2d->State == HAL_DMA2D_STATE_RESET)
275 HAL_DMA2D_MspInit(hdma2d);
280 hdma2d->State = HAL_DMA2D_STATE_BUSY;
290 #if defined (DMA2D_ALPHA_INV_RB_SWAP_SUPPORT)
297 hdma2d->ErrorCode = HAL_DMA2D_ERROR_NONE;
300 hdma2d->State = HAL_DMA2D_STATE_READY;
329 if (HAL_DMA2D_Abort(hdma2d) !=
HAL_OK)
340 if (HAL_DMA2D_CLUTLoading_Abort(hdma2d, 0U) !=
HAL_OK)
351 if (HAL_DMA2D_CLUTLoading_Abort(hdma2d, 1U) !=
HAL_OK)
362 hdma2d->Instance->CR = 0U;
363 hdma2d->Instance->IFCR = 0x3FU;
364 hdma2d->Instance->FGOR = 0U;
365 hdma2d->Instance->BGOR = 0U;
366 hdma2d->Instance->FGPFCCR = 0U;
367 hdma2d->Instance->BGPFCCR = 0U;
368 hdma2d->Instance->OPFCCR = 0U;
370 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
372 if(hdma2d->MspDeInitCallback ==
NULL)
374 hdma2d->MspDeInitCallback = HAL_DMA2D_MspDeInit;
378 hdma2d->MspDeInitCallback(hdma2d);
382 HAL_DMA2D_MspDeInit(hdma2d);
386 hdma2d->ErrorCode = HAL_DMA2D_ERROR_NONE;
389 hdma2d->State = HAL_DMA2D_STATE_RESET;
403 __weak
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d)
419 __weak
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d)
429 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
446 HAL_StatusTypeDef HAL_DMA2D_RegisterCallback(DMA2D_HandleTypeDef *hdma2d, HAL_DMA2D_CallbackIDTypeDef CallbackID, pDMA2D_CallbackTypeDef pCallback)
450 if(pCallback ==
NULL)
453 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
459 if(HAL_DMA2D_STATE_READY == hdma2d->State)
463 case HAL_DMA2D_TRANSFERCOMPLETE_CB_ID :
464 hdma2d->XferCpltCallback = pCallback;
467 case HAL_DMA2D_TRANSFERERROR_CB_ID :
468 hdma2d->XferErrorCallback = pCallback;
471 case HAL_DMA2D_LINEEVENT_CB_ID :
472 hdma2d->LineEventCallback = pCallback;
475 case HAL_DMA2D_CLUTLOADINGCPLT_CB_ID :
476 hdma2d->CLUTLoadingCpltCallback = pCallback;
479 case HAL_DMA2D_MSPINIT_CB_ID :
480 hdma2d->MspInitCallback = pCallback;
483 case HAL_DMA2D_MSPDEINIT_CB_ID :
484 hdma2d->MspDeInitCallback = pCallback;
489 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
495 else if(HAL_DMA2D_STATE_RESET == hdma2d->State)
499 case HAL_DMA2D_MSPINIT_CB_ID :
500 hdma2d->MspInitCallback = pCallback;
503 case HAL_DMA2D_MSPDEINIT_CB_ID :
504 hdma2d->MspDeInitCallback = pCallback;
509 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
518 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
543 HAL_StatusTypeDef HAL_DMA2D_UnRegisterCallback(DMA2D_HandleTypeDef *hdma2d, HAL_DMA2D_CallbackIDTypeDef CallbackID)
550 if(HAL_DMA2D_STATE_READY == hdma2d->State)
554 case HAL_DMA2D_TRANSFERCOMPLETE_CB_ID :
555 hdma2d->XferCpltCallback =
NULL;
558 case HAL_DMA2D_TRANSFERERROR_CB_ID :
559 hdma2d->XferErrorCallback =
NULL;
562 case HAL_DMA2D_LINEEVENT_CB_ID :
563 hdma2d->LineEventCallback = HAL_DMA2D_LineEventCallback;
566 case HAL_DMA2D_CLUTLOADINGCPLT_CB_ID :
567 hdma2d->CLUTLoadingCpltCallback = HAL_DMA2D_CLUTLoadingCpltCallback;
570 case HAL_DMA2D_MSPINIT_CB_ID :
571 hdma2d->MspInitCallback = HAL_DMA2D_MspInit;
574 case HAL_DMA2D_MSPDEINIT_CB_ID :
575 hdma2d->MspDeInitCallback = HAL_DMA2D_MspDeInit;
580 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
586 else if(HAL_DMA2D_STATE_RESET == hdma2d->State)
590 case HAL_DMA2D_MSPINIT_CB_ID :
591 hdma2d->MspInitCallback = HAL_DMA2D_MspInit;
594 case HAL_DMA2D_MSPDEINIT_CB_ID :
595 hdma2d->MspDeInitCallback = HAL_DMA2D_MspDeInit;
600 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
609 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_INVALID_CALLBACK;
673 HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
683 hdma2d->State = HAL_DMA2D_STATE_BUSY;
686 DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
689 __HAL_DMA2D_ENABLE(hdma2d);
707 HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
717 hdma2d->State = HAL_DMA2D_STATE_BUSY;
720 DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
723 __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
726 __HAL_DMA2D_ENABLE(hdma2d);
742 HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
752 hdma2d->State = HAL_DMA2D_STATE_BUSY;
755 WRITE_REG(hdma2d->Instance->BGMAR, SrcAddress2);
758 DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
761 __HAL_DMA2D_ENABLE(hdma2d);
777 HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
787 hdma2d->State = HAL_DMA2D_STATE_BUSY;
790 WRITE_REG(hdma2d->Instance->BGMAR, SrcAddress2);
793 DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
796 __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
799 __HAL_DMA2D_ENABLE(hdma2d);
826 if((
HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_ABORT)
829 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
832 hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
842 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
845 hdma2d->State = HAL_DMA2D_STATE_READY;
875 if((
HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_SUSPEND)
878 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
881 hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
890 hdma2d->State = HAL_DMA2D_STATE_SUSPEND;
914 hdma2d->State = HAL_DMA2D_STATE_BUSY;
936 HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
945 hdma2d->State = HAL_DMA2D_STATE_BUSY;
947 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
974 HAL_StatusTypeDef HAL_DMA2D_CLUTLoad(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
985 hdma2d->State = HAL_DMA2D_STATE_BUSY;
988 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
991 WRITE_REG(hdma2d->Instance->BGCMAR, (uint32_t)CLUTCfg.pCLUT);
1004 WRITE_REG(hdma2d->Instance->FGCMAR, (uint32_t)CLUTCfg.pCLUT);
1028 HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
1039 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1042 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1045 WRITE_REG(hdma2d->Instance->BGCMAR, (uint32_t)CLUTCfg.pCLUT);
1052 __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1061 WRITE_REG(hdma2d->Instance->FGCMAR, (uint32_t)CLUTCfg.pCLUT);
1068 __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1086 HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
1089 const __IO uint32_t * reg = &(hdma2d->Instance->BGPFCCR);
1095 if(LayerIdx == DMA2D_FOREGROUND_LAYER)
1097 reg = &(hdma2d->Instance->FGPFCCR);
1107 if((
HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_ABORT)
1110 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1113 hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1123 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1126 hdma2d->State = HAL_DMA2D_STATE_READY;
1143 HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
1146 uint32_t loadsuspended;
1147 const __IO uint32_t * reg = &(hdma2d->Instance->BGPFCCR);
1153 if(LayerIdx == DMA2D_FOREGROUND_LAYER)
1155 reg = &(hdma2d->Instance->FGPFCCR);
1164 while (loadsuspended == 0UL)
1166 if((
HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_SUSPEND)
1169 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1172 hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1183 hdma2d->State = HAL_DMA2D_STATE_SUSPEND;
1204 HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
1207 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1215 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1227 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1247 HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout)
1250 uint32_t layer_start;
1251 __IO uint32_t isrflags = 0x0U;
1259 while(__HAL_DMA2D_GET_FLAG(hdma2d, DMA2D_FLAG_TC) == 0U)
1261 isrflags =
READ_REG(hdma2d->Instance->ISR);
1262 if ((isrflags & (DMA2D_FLAG_CE|DMA2D_FLAG_TE)) != 0U)
1264 if ((isrflags & DMA2D_FLAG_CE) != 0U)
1266 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1268 if ((isrflags & DMA2D_FLAG_TE) != 0U)
1270 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1273 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CE | DMA2D_FLAG_TE);
1276 hdma2d->State = HAL_DMA2D_STATE_ERROR;
1286 if(((
HAL_GetTick() - tickstart ) > Timeout)||(Timeout == 0U))
1289 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1292 hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1305 if (layer_start != 0U)
1310 while(__HAL_DMA2D_GET_FLAG(hdma2d, DMA2D_FLAG_CTC) == 0U)
1312 isrflags =
READ_REG(hdma2d->Instance->ISR);
1313 if ((isrflags & (DMA2D_FLAG_CAE|DMA2D_FLAG_CE|DMA2D_FLAG_TE)) != 0U)
1315 if ((isrflags & DMA2D_FLAG_CAE) != 0U)
1317 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CAE;
1319 if ((isrflags & DMA2D_FLAG_CE) != 0U)
1321 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1323 if ((isrflags & DMA2D_FLAG_TE) != 0U)
1325 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1328 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CAE | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
1331 hdma2d->State= HAL_DMA2D_STATE_ERROR;
1341 if(((
HAL_GetTick() - tickstart ) > Timeout)||(Timeout == 0U))
1344 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1347 hdma2d->State= HAL_DMA2D_STATE_TIMEOUT;
1359 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TC|DMA2D_FLAG_CTC);
1362 hdma2d->State = HAL_DMA2D_STATE_READY;
1375 void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d)
1377 uint32_t isrflags =
READ_REG(hdma2d->Instance->ISR);
1378 uint32_t crflags =
READ_REG(hdma2d->Instance->CR);
1381 if ((isrflags & DMA2D_FLAG_TE) != 0U)
1383 if ((crflags & DMA2D_IT_TE) != 0U)
1386 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TE);
1389 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1392 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TE);
1395 hdma2d->State = HAL_DMA2D_STATE_ERROR;
1400 if(hdma2d->XferErrorCallback !=
NULL)
1403 hdma2d->XferErrorCallback(hdma2d);
1408 if ((isrflags & DMA2D_FLAG_CE) != 0U)
1410 if ((crflags & DMA2D_IT_CE) != 0U)
1413 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CE);
1416 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CE);
1419 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1422 hdma2d->State = HAL_DMA2D_STATE_ERROR;
1427 if(hdma2d->XferErrorCallback !=
NULL)
1430 hdma2d->XferErrorCallback(hdma2d);
1435 if ((isrflags & DMA2D_FLAG_CAE) != 0U)
1437 if ((crflags & DMA2D_IT_CAE) != 0U)
1440 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CAE);
1443 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CAE);
1446 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CAE;
1449 hdma2d->State = HAL_DMA2D_STATE_ERROR;
1454 if(hdma2d->XferErrorCallback !=
NULL)
1457 hdma2d->XferErrorCallback(hdma2d);
1462 if ((isrflags & DMA2D_FLAG_TW) != 0U)
1464 if ((crflags & DMA2D_IT_TW) != 0U)
1467 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TW);
1470 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TW);
1473 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
1474 hdma2d->LineEventCallback(hdma2d);
1476 HAL_DMA2D_LineEventCallback(hdma2d);
1482 if ((isrflags & DMA2D_FLAG_TC) != 0U)
1484 if ((crflags & DMA2D_IT_TC) != 0U)
1487 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TC);
1490 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TC);
1493 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_NONE;
1496 hdma2d->State = HAL_DMA2D_STATE_READY;
1501 if(hdma2d->XferCpltCallback !=
NULL)
1504 hdma2d->XferCpltCallback(hdma2d);
1509 if ((isrflags & DMA2D_FLAG_CTC) != 0U)
1511 if ((crflags & DMA2D_IT_CTC) != 0U)
1514 __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CTC);
1517 __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CTC);
1520 hdma2d->ErrorCode |= HAL_DMA2D_ERROR_NONE;
1523 hdma2d->State = HAL_DMA2D_STATE_READY;
1529 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
1530 hdma2d->CLUTLoadingCpltCallback(hdma2d);
1532 HAL_DMA2D_CLUTLoadingCpltCallback(hdma2d);
1545 __weak
void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d)
1561 __weak
void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d)
1604 HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
1606 DMA2D_LayerCfgTypeDef *pLayerCfg;
1607 uint32_t regMask, regValue;
1611 assert_param(IS_DMA2D_OFFSET(hdma2d->LayerCfg[LayerIdx].InputOffset));
1612 if(hdma2d->Init.Mode != DMA2D_R2M)
1614 assert_param(IS_DMA2D_INPUT_COLOR_MODE(hdma2d->LayerCfg[LayerIdx].InputColorMode));
1615 if(hdma2d->Init.Mode != DMA2D_M2M)
1617 assert_param(IS_DMA2D_ALPHA_MODE(hdma2d->LayerCfg[LayerIdx].AlphaMode));
1620 #if defined (DMA2D_ALPHA_INV_RB_SWAP_SUPPORT)
1621 assert_param(IS_DMA2D_ALPHA_INVERTED(hdma2d->LayerCfg[LayerIdx].AlphaInverted));
1622 assert_param(IS_DMA2D_RB_SWAP(hdma2d->LayerCfg[LayerIdx].RedBlueSwap));
1629 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1631 pLayerCfg = &hdma2d->LayerCfg[LayerIdx];
1634 #if defined (DMA2D_ALPHA_INV_RB_SWAP_SUPPORT)
1644 if ((pLayerCfg->InputColorMode == DMA2D_INPUT_A4) || (pLayerCfg->InputColorMode == DMA2D_INPUT_A8))
1654 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1657 MODIFY_REG(hdma2d->Instance->BGPFCCR, regMask, regValue);
1660 WRITE_REG(hdma2d->Instance->BGOR, pLayerCfg->InputOffset);
1663 if ((pLayerCfg->InputColorMode == DMA2D_INPUT_A4) || (pLayerCfg->InputColorMode == DMA2D_INPUT_A8))
1674 MODIFY_REG(hdma2d->Instance->FGPFCCR, regMask, regValue);
1677 WRITE_REG(hdma2d->Instance->FGOR, pLayerCfg->InputOffset);
1680 if ((pLayerCfg->InputColorMode == DMA2D_INPUT_A4) || (pLayerCfg->InputColorMode == DMA2D_INPUT_A8))
1686 hdma2d->State = HAL_DMA2D_STATE_READY;
1705 HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
1716 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1719 if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1722 WRITE_REG(hdma2d->Instance->BGCMAR, (uint32_t)CLUTCfg.pCLUT);
1732 WRITE_REG(hdma2d->Instance->FGCMAR, (uint32_t)CLUTCfg.pCLUT);
1740 hdma2d->State = HAL_DMA2D_STATE_READY;
1759 HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line)
1774 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1780 __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TW);
1783 hdma2d->State = HAL_DMA2D_STATE_READY;
1802 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1807 hdma2d->State = HAL_DMA2D_STATE_READY;
1825 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1830 hdma2d->State = HAL_DMA2D_STATE_READY;
1846 HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime(DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime)
1851 hdma2d->State = HAL_DMA2D_STATE_BUSY;
1856 hdma2d->State = HAL_DMA2D_STATE_READY;
1891 HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d)
1893 return hdma2d->State;
1902 uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d)
1904 return hdma2d->ErrorCode;
1930 static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
1942 WRITE_REG(hdma2d->Instance->OMAR, DstAddress);
1945 if (hdma2d->Init.Mode == DMA2D_R2M)
1953 if (hdma2d->Init.ColorMode == DMA2D_OUTPUT_ARGB8888)
1955 tmp = (tmp3 | tmp2 | tmp1| tmp4);
1957 else if (hdma2d->Init.ColorMode == DMA2D_OUTPUT_RGB888)
1959 tmp = (tmp3 | tmp2 | tmp4);
1961 else if (hdma2d->Init.ColorMode == DMA2D_OUTPUT_RGB565)
1963 tmp2 = (tmp2 >> 19U);
1964 tmp3 = (tmp3 >> 10U);
1965 tmp4 = (tmp4 >> 3U );
1966 tmp = ((tmp3 << 5U) | (tmp2 << 11U) | tmp4);
1968 else if (hdma2d->Init.ColorMode == DMA2D_OUTPUT_ARGB1555)
1970 tmp1 = (tmp1 >> 31U);
1971 tmp2 = (tmp2 >> 19U);
1972 tmp3 = (tmp3 >> 11U);
1973 tmp4 = (tmp4 >> 3U );
1974 tmp = ((tmp3 << 5U) | (tmp2 << 10U) | (tmp1 << 15U) | tmp4);
1978 tmp1 = (tmp1 >> 28U);
1979 tmp2 = (tmp2 >> 20U);
1980 tmp3 = (tmp3 >> 12U);
1981 tmp4 = (tmp4 >> 4U );
1982 tmp = ((tmp3 << 4U) | (tmp2 << 8U) | (tmp1 << 12U) | tmp4);
1985 WRITE_REG(hdma2d->Instance->OCOLR, tmp);
1990 WRITE_REG(hdma2d->Instance->FGMAR, pdata);