STM32L4xx_HAL_Driver  1.14.0

IO operation functions. More...

Functions

HAL_StatusTypeDef HAL_DMA2D_Start (DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the DMA2D Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_BlendingStart (DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the multi-source DMA2D Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_Start_IT (DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the DMA2D Transfer with interrupt enabled. More...
 
HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT (DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height)
 Start the multi-source DMA2D Transfer with interrupt enabled. More...
 
HAL_StatusTypeDef HAL_DMA2D_Suspend (DMA2D_HandleTypeDef *hdma2d)
 Suspend the DMA2D Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_Resume (DMA2D_HandleTypeDef *hdma2d)
 Resume the DMA2D Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_Abort (DMA2D_HandleTypeDef *hdma2d)
 Abort the DMA2D Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_EnableCLUT (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Enable the DMA2D CLUT Transfer. More...
 
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad (DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
 Start DMA2D CLUT Loading. More...
 
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT (DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx)
 Start DMA2D CLUT Loading with interrupt enabled. More...
 
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Abort the DMA2D CLUT loading. More...
 
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Suspend the DMA2D CLUT loading. More...
 
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume (DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx)
 Resume the DMA2D CLUT loading. More...
 
HAL_StatusTypeDef HAL_DMA2D_PollForTransfer (DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout)
 Polling for transfer complete or CLUT loading. More...
 
void HAL_DMA2D_IRQHandler (DMA2D_HandleTypeDef *hdma2d)
 Handle DMA2D interrupt request. More...
 
void HAL_DMA2D_LineEventCallback (DMA2D_HandleTypeDef *hdma2d)
 Transfer watermark callback. More...
 
void HAL_DMA2D_CLUTLoadingCpltCallback (DMA2D_HandleTypeDef *hdma2d)
 CLUT Transfer Complete callback. More...
 

Detailed Description

IO operation functions.

 ===============================================================================
                      #####  IO operation functions  #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Configure the pdata, destination address and data size then
          start the DMA2D transfer.
      (+) Configure the source for foreground and background, destination address
          and data size then start a MultiBuffer DMA2D transfer.
      (+) Configure the pdata, destination address and data size then
          start the DMA2D transfer with interrupt.
      (+) Configure the source for foreground and background, destination address
          and data size then start a MultiBuffer DMA2D transfer with interrupt.
      (+) Abort DMA2D transfer.
      (+) Suspend DMA2D transfer.
      (+) Resume DMA2D transfer.
      (+) Enable CLUT transfer.
      (+) Configure CLUT loading then start transfer in polling mode.
      (+) Configure CLUT loading then start transfer in interrupt mode.
      (+) Abort DMA2D CLUT loading.
      (+) Suspend DMA2D CLUT loading.
      (+) Resume DMA2D CLUT loading.
      (+) Poll for transfer complete.
      (+) handle DMA2D interrupt request.
      (+) Transfer watermark callback.
      (+) CLUT Transfer Complete callback.

Function Documentation

◆ HAL_DMA2D_Abort()

HAL_StatusTypeDef HAL_DMA2D_Abort ( DMA2D_HandleTypeDef hdma2d)

Abort the DMA2D Transfer.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
HALstatus

Definition at line 820 of file stm32l4xx_hal_dma2d.c.

821 {
822  uint32_t tickstart;
823 
824  /* Abort the DMA2D transfer */
825  /* START bit is reset to make sure not to set it again, in the event the HW clears it
826  between the register read and the register write by the CPU (writing 0 has no
827  effect on START bitvalue) */
828  MODIFY_REG(hdma2d->Instance->CR, DMA2D_CR_ABORT|DMA2D_CR_START, DMA2D_CR_ABORT);
829 
830  /* Get tick */
831  tickstart = HAL_GetTick();
832 
833  /* Check if the DMA2D is effectively disabled */
834  while((hdma2d->Instance->CR & DMA2D_CR_START) != 0U)
835  {
836  if((HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_ABORT)
837  {
838  /* Update error code */
839  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
840 
841  /* Change the DMA2D state */
842  hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
843 
844  /* Process Unlocked */
845  __HAL_UNLOCK(hdma2d);
846 
847  return HAL_TIMEOUT;
848  }
849  }
850 
851  /* Disable the Transfer Complete, Transfer Error and Configuration Error interrupts */
852  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
853 
854  /* Change the DMA2D state*/
855  hdma2d->State = HAL_DMA2D_STATE_READY;
856 
857  /* Process Unlocked */
858  __HAL_UNLOCK(hdma2d);
859 
860  return HAL_OK;
861 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)

◆ HAL_DMA2D_BlendingStart()

HAL_StatusTypeDef HAL_DMA2D_BlendingStart ( DMA2D_HandleTypeDef hdma2d,
uint32_t  SrcAddress1,
uint32_t  SrcAddress2,
uint32_t  DstAddress,
uint32_t  Width,
uint32_t  Height 
)

Start the multi-source DMA2D Transfer.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
SrcAddress1The source memory Buffer address for the foreground layer.
SrcAddress2The source memory Buffer address for the background layer.
DstAddressThe destination memory Buffer address.
WidthThe width of data to be transferred from source to destination (expressed in number of pixels per line).
HeightThe height of data to be transferred from source to destination (expressed in number of lines).
Return values
HALstatus

Definition at line 752 of file stm32l4xx_hal_dma2d.c.

753 {
754  /* Check the parameters */
755  assert_param(IS_DMA2D_LINE(Height));
756  assert_param(IS_DMA2D_PIXEL(Width));
757 
758  /* Process locked */
759  __HAL_LOCK(hdma2d);
760 
761  /* Change DMA2D peripheral state */
762  hdma2d->State = HAL_DMA2D_STATE_BUSY;
763 
764  /* Configure DMA2D Stream source2 address */
765  WRITE_REG(hdma2d->Instance->BGMAR, SrcAddress2);
766 
767  /* Configure the source, destination address and the data size */
768  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
769 
770  /* Enable the Peripheral */
771  __HAL_DMA2D_ENABLE(hdma2d);
772 
773  return HAL_OK;
774 }
__HAL_LOCK(hrtc)
return HAL_OK
static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
Set the DMA2D transfer parameters.
__IO HAL_DMA2D_StateTypeDef State
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_BlendingStart_IT()

HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT ( DMA2D_HandleTypeDef hdma2d,
uint32_t  SrcAddress1,
uint32_t  SrcAddress2,
uint32_t  DstAddress,
uint32_t  Width,
uint32_t  Height 
)

Start the multi-source DMA2D Transfer with interrupt enabled.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
SrcAddress1The source memory Buffer address for the foreground layer.
SrcAddress2The source memory Buffer address for the background layer.
DstAddressThe destination memory Buffer address.
WidthThe width of data to be transferred from source to destination (expressed in number of pixels per line).
HeightThe height of data to be transferred from source to destination (expressed in number of lines).
Return values
HALstatus

Definition at line 787 of file stm32l4xx_hal_dma2d.c.

788 {
789  /* Check the parameters */
790  assert_param(IS_DMA2D_LINE(Height));
791  assert_param(IS_DMA2D_PIXEL(Width));
792 
793  /* Process locked */
794  __HAL_LOCK(hdma2d);
795 
796  /* Change DMA2D peripheral state */
797  hdma2d->State = HAL_DMA2D_STATE_BUSY;
798 
799  /* Configure DMA2D Stream source2 address */
800  WRITE_REG(hdma2d->Instance->BGMAR, SrcAddress2);
801 
802  /* Configure the source, destination address and the data size */
803  DMA2D_SetConfig(hdma2d, SrcAddress1, DstAddress, Width, Height);
804 
805  /* Enable the transfer complete, transfer error and configuration error interrupts */
806  __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
807 
808  /* Enable the Peripheral */
809  __HAL_DMA2D_ENABLE(hdma2d);
810 
811  return HAL_OK;
812 }
__HAL_LOCK(hrtc)
return HAL_OK
static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
Set the DMA2D transfer parameters.
__IO HAL_DMA2D_StateTypeDef State
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_CLUTLoad()

HAL_StatusTypeDef HAL_DMA2D_CLUTLoad ( DMA2D_HandleTypeDef hdma2d,
DMA2D_CLUTCfgTypeDef  CLUTCfg,
uint32_t  LayerIdx 
)

Start DMA2D CLUT Loading.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
CLUTCfgPointer to a DMA2D_CLUTCfgTypeDef structure that contains the configuration information for the color look up table.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Note
Invoking this API is similar to calling HAL_DMA2D_ConfigCLUT() then HAL_DMA2D_EnableCLUT().
Return values
HALstatus

Definition at line 984 of file stm32l4xx_hal_dma2d.c.

985 {
986  /* Check the parameters */
987  assert_param(IS_DMA2D_LAYER(LayerIdx));
988  assert_param(IS_DMA2D_CLUT_CM(CLUTCfg.CLUTColorMode));
989  assert_param(IS_DMA2D_CLUT_SIZE(CLUTCfg.Size));
990 
991  /* Process locked */
992  __HAL_LOCK(hdma2d);
993 
994  /* Change DMA2D peripheral state */
995  hdma2d->State = HAL_DMA2D_STATE_BUSY;
996 
997  /* Configure the CLUT of the background DMA2D layer */
998  if(LayerIdx == DMA2D_BACKGROUND_LAYER)
999  {
1000  /* Write background CLUT memory address */
1001  WRITE_REG(hdma2d->Instance->BGCMAR, (uint32_t)CLUTCfg.pCLUT);
1002 
1003  /* Write background CLUT size and CLUT color mode */
1004  MODIFY_REG(hdma2d->Instance->BGPFCCR, (DMA2D_BGPFCCR_CS | DMA2D_BGPFCCR_CCM),
1005  ((CLUTCfg.Size << DMA2D_BGPFCCR_CS_Pos) | (CLUTCfg.CLUTColorMode << DMA2D_BGPFCCR_CCM_Pos)));
1006 
1007  /* Enable the CLUT loading for the background */
1008  SET_BIT(hdma2d->Instance->BGPFCCR, DMA2D_BGPFCCR_START);
1009  }
1010  /* Configure the CLUT of the foreground DMA2D layer */
1011  else
1012  {
1013  /* Write foreground CLUT memory address */
1014  WRITE_REG(hdma2d->Instance->FGCMAR, (uint32_t)CLUTCfg.pCLUT);
1015 
1016  /* Write foreground CLUT size and CLUT color mode */
1017  MODIFY_REG(hdma2d->Instance->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM),
1018  ((CLUTCfg.Size << DMA2D_FGPFCCR_CS_Pos) | (CLUTCfg.CLUTColorMode << DMA2D_FGPFCCR_CCM_Pos)));
1019 
1020  /* Enable the CLUT loading for the foreground */
1021  SET_BIT(hdma2d->Instance->FGPFCCR, DMA2D_FGPFCCR_START);
1022  }
1023 
1024  return HAL_OK;
1025 }
__HAL_LOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_CLUTLoad_IT()

HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT ( DMA2D_HandleTypeDef hdma2d,
DMA2D_CLUTCfgTypeDef  CLUTCfg,
uint32_t  LayerIdx 
)

Start DMA2D CLUT Loading with interrupt enabled.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
CLUTCfgPointer to a DMA2D_CLUTCfgTypeDef structure that contains the configuration information for the color look up table.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Return values
HALstatus

Definition at line 1038 of file stm32l4xx_hal_dma2d.c.

1039 {
1040  /* Check the parameters */
1041  assert_param(IS_DMA2D_LAYER(LayerIdx));
1042  assert_param(IS_DMA2D_CLUT_CM(CLUTCfg.CLUTColorMode));
1043  assert_param(IS_DMA2D_CLUT_SIZE(CLUTCfg.Size));
1044 
1045  /* Process locked */
1046  __HAL_LOCK(hdma2d);
1047 
1048  /* Change DMA2D peripheral state */
1049  hdma2d->State = HAL_DMA2D_STATE_BUSY;
1050 
1051  /* Configure the CLUT of the background DMA2D layer */
1052  if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1053  {
1054  /* Write background CLUT memory address */
1055  WRITE_REG(hdma2d->Instance->BGCMAR, (uint32_t)CLUTCfg.pCLUT);
1056 
1057  /* Write background CLUT size and CLUT color mode */
1058  MODIFY_REG(hdma2d->Instance->BGPFCCR, (DMA2D_BGPFCCR_CS | DMA2D_BGPFCCR_CCM),
1059  ((CLUTCfg.Size << DMA2D_BGPFCCR_CS_Pos) | (CLUTCfg.CLUTColorMode << DMA2D_BGPFCCR_CCM_Pos)));
1060 
1061  /* Enable the CLUT Transfer Complete, transfer Error, configuration Error and CLUT Access Error interrupts */
1062  __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1063 
1064  /* Enable the CLUT loading for the background */
1065  SET_BIT(hdma2d->Instance->BGPFCCR, DMA2D_BGPFCCR_START);
1066  }
1067  /* Configure the CLUT of the foreground DMA2D layer */
1068  else
1069  {
1070  /* Write foreground CLUT memory address */
1071  WRITE_REG(hdma2d->Instance->FGCMAR, (uint32_t)CLUTCfg.pCLUT);
1072 
1073  /* Write foreground CLUT size and CLUT color mode */
1074  MODIFY_REG(hdma2d->Instance->FGPFCCR, (DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM),
1075  ((CLUTCfg.Size << DMA2D_FGPFCCR_CS_Pos) | (CLUTCfg.CLUTColorMode << DMA2D_FGPFCCR_CCM_Pos)));
1076 
1077  /* Enable the CLUT Transfer Complete, transfer Error, configuration Error and CLUT Access Error interrupts */
1078  __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1079 
1080  /* Enable the CLUT loading for the foreground */
1081  SET_BIT(hdma2d->Instance->FGPFCCR, DMA2D_FGPFCCR_START);
1082  }
1083 
1084  return HAL_OK;
1085 }
__HAL_LOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_CLUTLoading_Abort()

HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort ( DMA2D_HandleTypeDef hdma2d,
uint32_t  LayerIdx 
)

Abort the DMA2D CLUT loading.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Return values
HALstatus

Definition at line 1096 of file stm32l4xx_hal_dma2d.c.

1097 {
1098  uint32_t tickstart;
1099  const __IO uint32_t * reg = &(hdma2d->Instance->BGPFCCR); /* by default, point at background register */
1100 
1101  /* Abort the CLUT loading */
1102  SET_BIT(hdma2d->Instance->CR, DMA2D_CR_ABORT);
1103 
1104  /* If foreground CLUT loading is considered, update local variables */
1105  if(LayerIdx == DMA2D_FOREGROUND_LAYER)
1106  {
1107  reg = &(hdma2d->Instance->FGPFCCR);
1108  }
1109 
1110 
1111  /* Get tick */
1112  tickstart = HAL_GetTick();
1113 
1114  /* Check if the CLUT loading is aborted */
1115  while((*reg & DMA2D_BGPFCCR_START) != 0U)
1116  {
1117  if((HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_ABORT)
1118  {
1119  /* Update error code */
1120  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1121 
1122  /* Change the DMA2D state */
1123  hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1124 
1125  /* Process Unlocked */
1126  __HAL_UNLOCK(hdma2d);
1127 
1128  return HAL_TIMEOUT;
1129  }
1130  }
1131 
1132  /* Disable the CLUT Transfer Complete, Transfer Error, Configuration Error and CLUT Access Error interrupts */
1133  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CTC | DMA2D_IT_TE | DMA2D_IT_CE |DMA2D_IT_CAE);
1134 
1135  /* Change the DMA2D state*/
1136  hdma2d->State = HAL_DMA2D_STATE_READY;
1137 
1138  /* Process Unlocked */
1139  __HAL_UNLOCK(hdma2d);
1140 
1141  return HAL_OK;
1142 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State

◆ HAL_DMA2D_CLUTLoading_Resume()

HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume ( DMA2D_HandleTypeDef hdma2d,
uint32_t  LayerIdx 
)

Resume the DMA2D CLUT loading.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Return values
HALstatus

Definition at line 1214 of file stm32l4xx_hal_dma2d.c.

1215 {
1216  /* Check the SUSP and START bits for background or foreground CLUT loading */
1217  if(LayerIdx == DMA2D_BACKGROUND_LAYER)
1218  {
1219  /* Background CLUT loading suspension check */
1220  if ((hdma2d->Instance->CR & DMA2D_CR_SUSP) == DMA2D_CR_SUSP)
1221  {
1222  if((hdma2d->Instance->BGPFCCR & DMA2D_BGPFCCR_START) == DMA2D_BGPFCCR_START)
1223  {
1224  /* Ongoing CLUT loading is suspended: change the DMA2D state before resuming */
1225  hdma2d->State = HAL_DMA2D_STATE_BUSY;
1226  }
1227  }
1228  }
1229  else
1230  {
1231  /* Foreground CLUT loading suspension check */
1232  if ((hdma2d->Instance->CR & DMA2D_CR_SUSP) == DMA2D_CR_SUSP)
1233  {
1234  if ((hdma2d->Instance->FGPFCCR & DMA2D_FGPFCCR_START) == DMA2D_FGPFCCR_START)
1235  {
1236  /* Ongoing CLUT loading is suspended: change the DMA2D state before resuming */
1237  hdma2d->State = HAL_DMA2D_STATE_BUSY;
1238  }
1239  }
1240  }
1241 
1242  /* Resume the CLUT loading */
1243  CLEAR_BIT(hdma2d->Instance->CR, DMA2D_CR_SUSP);
1244 
1245  return HAL_OK;
1246 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State

◆ HAL_DMA2D_CLUTLoading_Suspend()

HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend ( DMA2D_HandleTypeDef hdma2d,
uint32_t  LayerIdx 
)

Suspend the DMA2D CLUT loading.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Return values
HALstatus

Definition at line 1153 of file stm32l4xx_hal_dma2d.c.

1154 {
1155  uint32_t tickstart;
1156  uint32_t loadsuspended;
1157  const __IO uint32_t * reg = &(hdma2d->Instance->BGPFCCR); /* by default, point at background register */
1158 
1159  /* Suspend the CLUT loading */
1160  SET_BIT(hdma2d->Instance->CR, DMA2D_CR_SUSP);
1161 
1162  /* If foreground CLUT loading is considered, update local variables */
1163  if(LayerIdx == DMA2D_FOREGROUND_LAYER)
1164  {
1165  reg = &(hdma2d->Instance->FGPFCCR);
1166  }
1167 
1168  /* Get tick */
1169  tickstart = HAL_GetTick();
1170 
1171  /* Check if the CLUT loading is suspended */
1172  loadsuspended = ((hdma2d->Instance->CR & DMA2D_CR_SUSP) == DMA2D_CR_SUSP)? 1UL: 0UL; /*1st condition: Suspend Check*/
1173  loadsuspended |= ((*reg & DMA2D_BGPFCCR_START) != DMA2D_BGPFCCR_START)? 1UL: 0UL; /*2nd condition: Not Start Check */
1174  while (loadsuspended == 0UL)
1175  {
1176  if((HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_SUSPEND)
1177  {
1178  /* Update error code */
1179  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1180 
1181  /* Change the DMA2D state */
1182  hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1183 
1184  return HAL_TIMEOUT;
1185  }
1186  loadsuspended = ((hdma2d->Instance->CR & DMA2D_CR_SUSP) == DMA2D_CR_SUSP)? 1UL: 0UL; /*1st condition: Suspend Check*/
1187  loadsuspended |= ((*reg & DMA2D_BGPFCCR_START) != DMA2D_BGPFCCR_START)? 1UL: 0UL; /*2nd condition: Not Start Check */
1188  }
1189 
1190  /* Check whether or not a transfer is actually suspended and change the DMA2D state accordingly */
1191  if ((*reg & DMA2D_BGPFCCR_START) != 0U)
1192  {
1193  hdma2d->State = HAL_DMA2D_STATE_SUSPEND;
1194  }
1195  else
1196  {
1197  /* Make sure SUSP bit is cleared since it is meaningless
1198  when no tranfer is on-going */
1199  CLEAR_BIT(hdma2d->Instance->CR, DMA2D_CR_SUSP);
1200  }
1201 
1202  return HAL_OK;
1203 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State

◆ HAL_DMA2D_CLUTLoadingCpltCallback()

__weak void HAL_DMA2D_CLUTLoadingCpltCallback ( DMA2D_HandleTypeDef hdma2d)

CLUT Transfer Complete callback.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
None

Definition at line 1571 of file stm32l4xx_hal_dma2d.c.

1572 {
1573  /* Prevent unused argument(s) compilation warning */
1574  UNUSED(hdma2d);
1575 
1576  /* NOTE : This function should not be modified; when the callback is needed,
1577  the HAL_DMA2D_CLUTLoadingCpltCallback can be implemented in the user file.
1578  */
1579 }

◆ HAL_DMA2D_EnableCLUT()

HAL_StatusTypeDef HAL_DMA2D_EnableCLUT ( DMA2D_HandleTypeDef hdma2d,
uint32_t  LayerIdx 
)

Enable the DMA2D CLUT Transfer.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
LayerIdxDMA2D Layer index. This parameter can be one of the following values: DMA2D_BACKGROUND_LAYER(0) / DMA2D_FOREGROUND_LAYER(1)
Return values
HALstatus

Definition at line 946 of file stm32l4xx_hal_dma2d.c.

947 {
948  /* Check the parameters */
949  assert_param(IS_DMA2D_LAYER(LayerIdx));
950 
951  /* Process locked */
952  __HAL_LOCK(hdma2d);
953 
954  /* Change DMA2D peripheral state */
955  hdma2d->State = HAL_DMA2D_STATE_BUSY;
956 
957  if(LayerIdx == DMA2D_BACKGROUND_LAYER)
958  {
959  /* Enable the background CLUT loading */
960  SET_BIT(hdma2d->Instance->BGPFCCR, DMA2D_BGPFCCR_START);
961  }
962  else
963  {
964  /* Enable the foreground CLUT loading */
965  SET_BIT(hdma2d->Instance->FGPFCCR, DMA2D_FGPFCCR_START);
966  }
967 
968  return HAL_OK;
969 }
__HAL_LOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_IRQHandler()

void HAL_DMA2D_IRQHandler ( DMA2D_HandleTypeDef hdma2d)

Handle DMA2D interrupt request.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
HALstatus

Definition at line 1385 of file stm32l4xx_hal_dma2d.c.

1386 {
1387  uint32_t isrflags = READ_REG(hdma2d->Instance->ISR);
1388  uint32_t crflags = READ_REG(hdma2d->Instance->CR);
1389 
1390  /* Transfer Error Interrupt management ***************************************/
1391  if ((isrflags & DMA2D_FLAG_TE) != 0U)
1392  {
1393  if ((crflags & DMA2D_IT_TE) != 0U)
1394  {
1395  /* Disable the transfer Error interrupt */
1396  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TE);
1397 
1398  /* Update error code */
1399  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1400 
1401  /* Clear the transfer error flag */
1402  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TE);
1403 
1404  /* Change DMA2D state */
1405  hdma2d->State = HAL_DMA2D_STATE_ERROR;
1406 
1407  /* Process Unlocked */
1408  __HAL_UNLOCK(hdma2d);
1409 
1410  if(hdma2d->XferErrorCallback != NULL)
1411  {
1412  /* Transfer error Callback */
1413  hdma2d->XferErrorCallback(hdma2d);
1414  }
1415  }
1416  }
1417  /* Configuration Error Interrupt management **********************************/
1418  if ((isrflags & DMA2D_FLAG_CE) != 0U)
1419  {
1420  if ((crflags & DMA2D_IT_CE) != 0U)
1421  {
1422  /* Disable the Configuration Error interrupt */
1423  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CE);
1424 
1425  /* Clear the Configuration error flag */
1426  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CE);
1427 
1428  /* Update error code */
1429  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1430 
1431  /* Change DMA2D state */
1432  hdma2d->State = HAL_DMA2D_STATE_ERROR;
1433 
1434  /* Process Unlocked */
1435  __HAL_UNLOCK(hdma2d);
1436 
1437  if(hdma2d->XferErrorCallback != NULL)
1438  {
1439  /* Transfer error Callback */
1440  hdma2d->XferErrorCallback(hdma2d);
1441  }
1442  }
1443  }
1444  /* CLUT access Error Interrupt management ***********************************/
1445  if ((isrflags & DMA2D_FLAG_CAE) != 0U)
1446  {
1447  if ((crflags & DMA2D_IT_CAE) != 0U)
1448  {
1449  /* Disable the CLUT access error interrupt */
1450  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CAE);
1451 
1452  /* Clear the CLUT access error flag */
1453  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CAE);
1454 
1455  /* Update error code */
1456  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CAE;
1457 
1458  /* Change DMA2D state */
1459  hdma2d->State = HAL_DMA2D_STATE_ERROR;
1460 
1461  /* Process Unlocked */
1462  __HAL_UNLOCK(hdma2d);
1463 
1464  if(hdma2d->XferErrorCallback != NULL)
1465  {
1466  /* Transfer error Callback */
1467  hdma2d->XferErrorCallback(hdma2d);
1468  }
1469  }
1470  }
1471  /* Transfer watermark Interrupt management **********************************/
1472  if ((isrflags & DMA2D_FLAG_TW) != 0U)
1473  {
1474  if ((crflags & DMA2D_IT_TW) != 0U)
1475  {
1476  /* Disable the transfer watermark interrupt */
1477  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TW);
1478 
1479  /* Clear the transfer watermark flag */
1480  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TW);
1481 
1482  /* Transfer watermark Callback */
1483 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
1484  hdma2d->LineEventCallback(hdma2d);
1485 #else
1487 #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */
1488 
1489  }
1490  }
1491  /* Transfer Complete Interrupt management ************************************/
1492  if ((isrflags & DMA2D_FLAG_TC) != 0U)
1493  {
1494  if ((crflags & DMA2D_IT_TC) != 0U)
1495  {
1496  /* Disable the transfer complete interrupt */
1497  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_TC);
1498 
1499  /* Clear the transfer complete flag */
1500  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TC);
1501 
1502  /* Update error code */
1503  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_NONE;
1504 
1505  /* Change DMA2D state */
1506  hdma2d->State = HAL_DMA2D_STATE_READY;
1507 
1508  /* Process Unlocked */
1509  __HAL_UNLOCK(hdma2d);
1510 
1511  if(hdma2d->XferCpltCallback != NULL)
1512  {
1513  /* Transfer complete Callback */
1514  hdma2d->XferCpltCallback(hdma2d);
1515  }
1516  }
1517  }
1518  /* CLUT Transfer Complete Interrupt management ******************************/
1519  if ((isrflags & DMA2D_FLAG_CTC) != 0U)
1520  {
1521  if ((crflags & DMA2D_IT_CTC) != 0U)
1522  {
1523  /* Disable the CLUT transfer complete interrupt */
1524  __HAL_DMA2D_DISABLE_IT(hdma2d, DMA2D_IT_CTC);
1525 
1526  /* Clear the CLUT transfer complete flag */
1527  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CTC);
1528 
1529  /* Update error code */
1530  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_NONE;
1531 
1532  /* Change DMA2D state */
1533  hdma2d->State = HAL_DMA2D_STATE_READY;
1534 
1535  /* Process Unlocked */
1536  __HAL_UNLOCK(hdma2d);
1537 
1538  /* CLUT Transfer complete Callback */
1539 #if (USE_HAL_DMA2D_REGISTER_CALLBACKS == 1)
1540  hdma2d->CLUTLoadingCpltCallback(hdma2d);
1541 #else
1543 #endif /* USE_HAL_DMA2D_REGISTER_CALLBACKS */
1544  }
1545  }
1546 
1547 }
__HAL_UNLOCK(hrtc)
void(* XferErrorCallback)(struct __DMA2D_HandleTypeDef *hdma2d)
void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d)
Transfer watermark callback.
__IO HAL_DMA2D_StateTypeDef State
void(* XferCpltCallback)(struct __DMA2D_HandleTypeDef *hdma2d)
void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d)
CLUT Transfer Complete callback.
void(* LineEventCallback)(struct __DMA2D_HandleTypeDef *hdma2d)
void(* CLUTLoadingCpltCallback)(struct __DMA2D_HandleTypeDef *hdma2d)

◆ HAL_DMA2D_LineEventCallback()

__weak void HAL_DMA2D_LineEventCallback ( DMA2D_HandleTypeDef hdma2d)

Transfer watermark callback.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
None

Definition at line 1555 of file stm32l4xx_hal_dma2d.c.

1556 {
1557  /* Prevent unused argument(s) compilation warning */
1558  UNUSED(hdma2d);
1559 
1560  /* NOTE : This function should not be modified; when the callback is needed,
1561  the HAL_DMA2D_LineEventCallback can be implemented in the user file.
1562  */
1563 }

◆ HAL_DMA2D_PollForTransfer()

HAL_StatusTypeDef HAL_DMA2D_PollForTransfer ( DMA2D_HandleTypeDef hdma2d,
uint32_t  Timeout 
)

Polling for transfer complete or CLUT loading.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
TimeoutTimeout duration
Return values
HALstatus

Definition at line 1257 of file stm32l4xx_hal_dma2d.c.

1258 {
1259  uint32_t tickstart;
1260  uint32_t layer_start;
1261  __IO uint32_t isrflags = 0x0U;
1262 
1263  /* Polling for DMA2D transfer */
1264  if((hdma2d->Instance->CR & DMA2D_CR_START) != 0U)
1265  {
1266  /* Get tick */
1267  tickstart = HAL_GetTick();
1268 
1269  while(__HAL_DMA2D_GET_FLAG(hdma2d, DMA2D_FLAG_TC) == 0U)
1270  {
1271  isrflags = READ_REG(hdma2d->Instance->ISR);
1272  if ((isrflags & (DMA2D_FLAG_CE|DMA2D_FLAG_TE)) != 0U)
1273  {
1274  if ((isrflags & DMA2D_FLAG_CE) != 0U)
1275  {
1276  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1277  }
1278  if ((isrflags & DMA2D_FLAG_TE) != 0U)
1279  {
1280  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1281  }
1282  /* Clear the transfer and configuration error flags */
1283  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CE | DMA2D_FLAG_TE);
1284 
1285  /* Change DMA2D state */
1286  hdma2d->State = HAL_DMA2D_STATE_ERROR;
1287 
1288  /* Process unlocked */
1289  __HAL_UNLOCK(hdma2d);
1290 
1291  return HAL_ERROR;
1292  }
1293  /* Check for the Timeout */
1294  if(Timeout != HAL_MAX_DELAY)
1295  {
1296  if(((HAL_GetTick() - tickstart ) > Timeout)||(Timeout == 0U))
1297  {
1298  /* Update error code */
1299  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1300 
1301  /* Change the DMA2D state */
1302  hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
1303 
1304  /* Process unlocked */
1305  __HAL_UNLOCK(hdma2d);
1306 
1307  return HAL_TIMEOUT;
1308  }
1309  }
1310  }
1311  }
1312  /* Polling for CLUT loading (foreground or background) */
1313  layer_start = hdma2d->Instance->FGPFCCR & DMA2D_FGPFCCR_START;
1314  layer_start |= hdma2d->Instance->BGPFCCR & DMA2D_BGPFCCR_START;
1315  if (layer_start != 0U)
1316  {
1317  /* Get tick */
1318  tickstart = HAL_GetTick();
1319 
1320  while(__HAL_DMA2D_GET_FLAG(hdma2d, DMA2D_FLAG_CTC) == 0U)
1321  {
1322  isrflags = READ_REG(hdma2d->Instance->ISR);
1323  if ((isrflags & (DMA2D_FLAG_CAE|DMA2D_FLAG_CE|DMA2D_FLAG_TE)) != 0U)
1324  {
1325  if ((isrflags & DMA2D_FLAG_CAE) != 0U)
1326  {
1327  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CAE;
1328  }
1329  if ((isrflags & DMA2D_FLAG_CE) != 0U)
1330  {
1331  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_CE;
1332  }
1333  if ((isrflags & DMA2D_FLAG_TE) != 0U)
1334  {
1335  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TE;
1336  }
1337  /* Clear the CLUT Access Error, Configuration Error and Transfer Error flags */
1338  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_CAE | DMA2D_FLAG_CE | DMA2D_FLAG_TE);
1339 
1340  /* Change DMA2D state */
1341  hdma2d->State= HAL_DMA2D_STATE_ERROR;
1342 
1343  /* Process unlocked */
1344  __HAL_UNLOCK(hdma2d);
1345 
1346  return HAL_ERROR;
1347  }
1348  /* Check for the Timeout */
1349  if(Timeout != HAL_MAX_DELAY)
1350  {
1351  if(((HAL_GetTick() - tickstart ) > Timeout)||(Timeout == 0U))
1352  {
1353  /* Update error code */
1354  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
1355 
1356  /* Change the DMA2D state */
1357  hdma2d->State= HAL_DMA2D_STATE_TIMEOUT;
1358 
1359  /* Process unlocked */
1360  __HAL_UNLOCK(hdma2d);
1361 
1362  return HAL_TIMEOUT;
1363  }
1364  }
1365  }
1366  }
1367 
1368  /* Clear the transfer complete and CLUT loading flags */
1369  __HAL_DMA2D_CLEAR_FLAG(hdma2d, DMA2D_FLAG_TC|DMA2D_FLAG_CTC);
1370 
1371  /* Change DMA2D state */
1372  hdma2d->State = HAL_DMA2D_STATE_READY;
1373 
1374  /* Process unlocked */
1375  __HAL_UNLOCK(hdma2d);
1376 
1377  return HAL_OK;
1378 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
__HAL_UNLOCK(hrtc)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State

◆ HAL_DMA2D_Resume()

HAL_StatusTypeDef HAL_DMA2D_Resume ( DMA2D_HandleTypeDef hdma2d)

Resume the DMA2D Transfer.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
HALstatus

Definition at line 918 of file stm32l4xx_hal_dma2d.c.

919 {
920  /* Check the SUSP and START bits */
921  if((hdma2d->Instance->CR & (DMA2D_CR_SUSP | DMA2D_CR_START)) == (DMA2D_CR_SUSP | DMA2D_CR_START))
922  {
923  /* Ongoing transfer is suspended: change the DMA2D state before resuming */
924  hdma2d->State = HAL_DMA2D_STATE_BUSY;
925  }
926 
927  /* Resume the DMA2D transfer */
928  /* START bit is reset to make sure not to set it again, in the event the HW clears it
929  between the register read and the register write by the CPU (writing 0 has no
930  effect on START bitvalue). */
931  CLEAR_BIT(hdma2d->Instance->CR, (DMA2D_CR_SUSP|DMA2D_CR_START));
932 
933  return HAL_OK;
934 }
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State

◆ HAL_DMA2D_Start()

HAL_StatusTypeDef HAL_DMA2D_Start ( DMA2D_HandleTypeDef hdma2d,
uint32_t  pdata,
uint32_t  DstAddress,
uint32_t  Width,
uint32_t  Height 
)

Start the DMA2D Transfer.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
pdataConfigure the source memory Buffer address if Memory-to-Memory or Memory-to-Memory with pixel format conversion mode is selected, or configure the color value if Register-to-Memory mode is selected.
DstAddressThe destination memory Buffer address.
WidthThe width of data to be transferred from source to destination (expressed in number of pixels per line).
HeightThe height of data to be transferred from source to destination (expressed in number of lines).
Return values
HALstatus

Definition at line 683 of file stm32l4xx_hal_dma2d.c.

684 {
685  /* Check the parameters */
686  assert_param(IS_DMA2D_LINE(Height));
687  assert_param(IS_DMA2D_PIXEL(Width));
688 
689  /* Process locked */
690  __HAL_LOCK(hdma2d);
691 
692  /* Change DMA2D peripheral state */
693  hdma2d->State = HAL_DMA2D_STATE_BUSY;
694 
695  /* Configure the source, destination address and the data size */
696  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
697 
698  /* Enable the Peripheral */
699  __HAL_DMA2D_ENABLE(hdma2d);
700 
701  return HAL_OK;
702 }
__HAL_LOCK(hrtc)
return HAL_OK
static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
Set the DMA2D transfer parameters.
__IO HAL_DMA2D_StateTypeDef State
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_Start_IT()

HAL_StatusTypeDef HAL_DMA2D_Start_IT ( DMA2D_HandleTypeDef hdma2d,
uint32_t  pdata,
uint32_t  DstAddress,
uint32_t  Width,
uint32_t  Height 
)

Start the DMA2D Transfer with interrupt enabled.

Parameters
hdma2dPointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
pdataConfigure the source memory Buffer address if the Memory-to-Memory or Memory-to-Memory with pixel format conversion mode is selected, or configure the color value if Register-to-Memory mode is selected.
DstAddressThe destination memory Buffer address.
WidthThe width of data to be transferred from source to destination (expressed in number of pixels per line).
HeightThe height of data to be transferred from source to destination (expressed in number of lines).
Return values
HALstatus

Definition at line 717 of file stm32l4xx_hal_dma2d.c.

718 {
719  /* Check the parameters */
720  assert_param(IS_DMA2D_LINE(Height));
721  assert_param(IS_DMA2D_PIXEL(Width));
722 
723  /* Process locked */
724  __HAL_LOCK(hdma2d);
725 
726  /* Change DMA2D peripheral state */
727  hdma2d->State = HAL_DMA2D_STATE_BUSY;
728 
729  /* Configure the source, destination address and the data size */
730  DMA2D_SetConfig(hdma2d, pdata, DstAddress, Width, Height);
731 
732  /* Enable the transfer complete, transfer error and configuration error interrupts */
733  __HAL_DMA2D_ENABLE_IT(hdma2d, DMA2D_IT_TC|DMA2D_IT_TE|DMA2D_IT_CE);
734 
735  /* Enable the Peripheral */
736  __HAL_DMA2D_ENABLE(hdma2d);
737 
738  return HAL_OK;
739 }
__HAL_LOCK(hrtc)
return HAL_OK
static void DMA2D_SetConfig(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height)
Set the DMA2D transfer parameters.
__IO HAL_DMA2D_StateTypeDef State
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_DMA2D_Suspend()

HAL_StatusTypeDef HAL_DMA2D_Suspend ( DMA2D_HandleTypeDef hdma2d)

Suspend the DMA2D Transfer.

Parameters
hdma2dpointer to a DMA2D_HandleTypeDef structure that contains the configuration information for the DMA2D.
Return values
HALstatus

Definition at line 869 of file stm32l4xx_hal_dma2d.c.

870 {
871  uint32_t tickstart;
872 
873  /* Suspend the DMA2D transfer */
874  /* START bit is reset to make sure not to set it again, in the event the HW clears it
875  between the register read and the register write by the CPU (writing 0 has no
876  effect on START bitvalue). */
877  MODIFY_REG(hdma2d->Instance->CR, DMA2D_CR_SUSP|DMA2D_CR_START, DMA2D_CR_SUSP);
878 
879  /* Get tick */
880  tickstart = HAL_GetTick();
881 
882  /* Check if the DMA2D is effectively suspended */
883  while ((hdma2d->Instance->CR & (DMA2D_CR_SUSP | DMA2D_CR_START)) == DMA2D_CR_START)
884  {
885  if((HAL_GetTick() - tickstart ) > DMA2D_TIMEOUT_SUSPEND)
886  {
887  /* Update error code */
888  hdma2d->ErrorCode |= HAL_DMA2D_ERROR_TIMEOUT;
889 
890  /* Change the DMA2D state */
891  hdma2d->State = HAL_DMA2D_STATE_TIMEOUT;
892 
893  return HAL_TIMEOUT;
894  }
895  }
896 
897  /* Check whether or not a transfer is actually suspended and change the DMA2D state accordingly */
898  if ((hdma2d->Instance->CR & DMA2D_CR_START) != 0U)
899  {
900  hdma2d->State = HAL_DMA2D_STATE_SUSPEND;
901  }
902  else
903  {
904  /* Make sure SUSP bit is cleared since it is meaningless
905  when no tranfer is on-going */
906  CLEAR_BIT(hdma2d->Instance->CR, DMA2D_CR_SUSP);
907  }
908 
909  return HAL_OK;
910 }
uint32_t HAL_GetTick(void)
Provide a tick value in millisecond.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
return HAL_OK
__IO HAL_DMA2D_StateTypeDef State
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)