STM32F4xx_HAL_Driver  1.8.3
stm32f4xx_ll_dma2d.c
Go to the documentation of this file.
1 
18 #if defined(USE_FULL_LL_DRIVER)
19 
20 /* Includes ------------------------------------------------------------------*/
21 #include "stm32f4xx_ll_dma2d.h"
22 #include "stm32f4xx_ll_bus.h"
23 #ifdef USE_FULL_ASSERT
24 #include "stm32_assert.h"
25 #else
26 #define assert_param(expr) ((void)0U)
27 #endif /* USE_FULL_ASSERT */
28 
33 #if defined (DMA2D)
34 
39 /* Private types -------------------------------------------------------------*/
40 /* Private variables ---------------------------------------------------------*/
41 /* Private constants ---------------------------------------------------------*/
45 #define LL_DMA2D_COLOR 0xFFU
46 #define LL_DMA2D_NUMBEROFLINES DMA2D_NLR_NL
47 #define LL_DMA2D_NUMBEROFPIXELS (DMA2D_NLR_PL >> DMA2D_NLR_PL_Pos)
48 #define LL_DMA2D_OFFSET_MAX 0x3FFFU
49 #define LL_DMA2D_CLUTSIZE_MAX 0xFFU
53 /* Private macros ------------------------------------------------------------*/
57 #define IS_LL_DMA2D_MODE(MODE) (((MODE) == LL_DMA2D_MODE_M2M) || \
58  ((MODE) == LL_DMA2D_MODE_M2M_PFC) || \
59  ((MODE) == LL_DMA2D_MODE_M2M_BLEND) || \
60  ((MODE) == LL_DMA2D_MODE_R2M))
61 
62 #define IS_LL_DMA2D_OCMODE(MODE_ARGB) (((MODE_ARGB) == LL_DMA2D_OUTPUT_MODE_ARGB8888) || \
63  ((MODE_ARGB) == LL_DMA2D_OUTPUT_MODE_RGB888) || \
64  ((MODE_ARGB) == LL_DMA2D_OUTPUT_MODE_RGB565) || \
65  ((MODE_ARGB) == LL_DMA2D_OUTPUT_MODE_ARGB1555) || \
66  ((MODE_ARGB) == LL_DMA2D_OUTPUT_MODE_ARGB4444))
67 
68 #define IS_LL_DMA2D_GREEN(GREEN) ((GREEN) <= LL_DMA2D_COLOR)
69 #define IS_LL_DMA2D_RED(RED) ((RED) <= LL_DMA2D_COLOR)
70 #define IS_LL_DMA2D_BLUE(BLUE) ((BLUE) <= LL_DMA2D_COLOR)
71 #define IS_LL_DMA2D_ALPHA(ALPHA) ((ALPHA) <= LL_DMA2D_COLOR)
72 
73 
74 #define IS_LL_DMA2D_OFFSET(OFFSET) ((OFFSET) <= LL_DMA2D_OFFSET_MAX)
75 
76 #define IS_LL_DMA2D_LINE(LINES) ((LINES) <= LL_DMA2D_NUMBEROFLINES)
77 #define IS_LL_DMA2D_PIXEL(PIXELS) ((PIXELS) <= LL_DMA2D_NUMBEROFPIXELS)
78 
79 
80 
81 #define IS_LL_DMA2D_LCMODE(MODE_ARGB) (((MODE_ARGB) == LL_DMA2D_INPUT_MODE_ARGB8888) || \
82  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_RGB888) || \
83  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_RGB565) || \
84  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_ARGB1555) || \
85  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_ARGB4444) || \
86  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_L8) || \
87  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_AL44) || \
88  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_AL88) || \
89  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_L4) || \
90  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_A8) || \
91  ((MODE_ARGB) == LL_DMA2D_INPUT_MODE_A4))
92 
93 #define IS_LL_DMA2D_CLUTCMODE(CLUTCMODE) (((CLUTCMODE) == LL_DMA2D_CLUT_COLOR_MODE_ARGB8888) || \
94  ((CLUTCMODE) == LL_DMA2D_CLUT_COLOR_MODE_RGB888))
95 
96 #define IS_LL_DMA2D_CLUTSIZE(SIZE) ((SIZE) <= LL_DMA2D_CLUTSIZE_MAX)
97 
98 #define IS_LL_DMA2D_ALPHAMODE(MODE) (((MODE) == LL_DMA2D_ALPHA_MODE_NO_MODIF) || \
99  ((MODE) == LL_DMA2D_ALPHA_MODE_REPLACE) || \
100  ((MODE) == LL_DMA2D_ALPHA_MODE_COMBINE))
101 
102 
107 /* Private function prototypes -----------------------------------------------*/
108 
109 /* Exported functions --------------------------------------------------------*/
125 ErrorStatus LL_DMA2D_DeInit(DMA2D_TypeDef *DMA2Dx)
126 {
127  ErrorStatus status = SUCCESS;
128 
129  /* Check the parameters */
130  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
131 
132  if (DMA2Dx == DMA2D)
133  {
134  /* Force reset of DMA2D clock */
135  LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_DMA2D);
136 
137  /* Release reset of DMA2D clock */
138  LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_DMA2D);
139  }
140  else
141  {
142  status = ERROR;
143  }
144 
145  return (status);
146 }
147 
159 ErrorStatus LL_DMA2D_Init(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_InitTypeDef *DMA2D_InitStruct)
160 {
161  ErrorStatus status = ERROR;
162  LL_DMA2D_ColorTypeDef dma2d_colorstruct;
163  uint32_t tmp;
164  uint32_t tmp1;
165  uint32_t tmp2;
166  uint32_t regMask;
167  uint32_t regValue;
168 
169  /* Check the parameters */
170  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
171  assert_param(IS_LL_DMA2D_MODE(DMA2D_InitStruct->Mode));
172  assert_param(IS_LL_DMA2D_OCMODE(DMA2D_InitStruct->ColorMode));
173  assert_param(IS_LL_DMA2D_LINE(DMA2D_InitStruct->NbrOfLines));
174  assert_param(IS_LL_DMA2D_PIXEL(DMA2D_InitStruct->NbrOfPixelsPerLines));
175  assert_param(IS_LL_DMA2D_GREEN(DMA2D_InitStruct->OutputGreen));
176  assert_param(IS_LL_DMA2D_RED(DMA2D_InitStruct->OutputRed));
177  assert_param(IS_LL_DMA2D_BLUE(DMA2D_InitStruct->OutputBlue));
178  assert_param(IS_LL_DMA2D_ALPHA(DMA2D_InitStruct->OutputAlpha));
179  assert_param(IS_LL_DMA2D_OFFSET(DMA2D_InitStruct->LineOffset));
180 
181  /* DMA2D transfers must be disabled to configure bits in initialization registers */
182  tmp = LL_DMA2D_IsTransferOngoing(DMA2Dx);
183  tmp1 = LL_DMA2D_FGND_IsEnabledCLUTLoad(DMA2Dx);
184  tmp2 = LL_DMA2D_BGND_IsEnabledCLUTLoad(DMA2Dx);
185  if ((tmp == 0U) && (tmp1 == 0U) && (tmp2 == 0U))
186  {
187  /* DMA2D CR register configuration -------------------------------------------*/
188  LL_DMA2D_SetMode(DMA2Dx, DMA2D_InitStruct->Mode);
189 
190  /* DMA2D OPFCCR register configuration ---------------------------------------*/
191  regMask = DMA2D_OPFCCR_CM;
192  regValue = DMA2D_InitStruct->ColorMode;
193 
194 
195 
196 
197  MODIFY_REG(DMA2Dx->OPFCCR, regMask, regValue);
198 
199  /* DMA2D OOR register configuration ------------------------------------------*/
200  LL_DMA2D_SetLineOffset(DMA2Dx, DMA2D_InitStruct->LineOffset);
201 
202  /* DMA2D NLR register configuration ------------------------------------------*/
203  LL_DMA2D_ConfigSize(DMA2Dx, DMA2D_InitStruct->NbrOfLines, DMA2D_InitStruct->NbrOfPixelsPerLines);
204 
205  /* DMA2D OMAR register configuration ------------------------------------------*/
206  LL_DMA2D_SetOutputMemAddr(DMA2Dx, DMA2D_InitStruct->OutputMemoryAddress);
207 
208  /* DMA2D OCOLR register configuration ------------------------------------------*/
209  dma2d_colorstruct.ColorMode = DMA2D_InitStruct->ColorMode;
210  dma2d_colorstruct.OutputBlue = DMA2D_InitStruct->OutputBlue;
211  dma2d_colorstruct.OutputGreen = DMA2D_InitStruct->OutputGreen;
212  dma2d_colorstruct.OutputRed = DMA2D_InitStruct->OutputRed;
213  dma2d_colorstruct.OutputAlpha = DMA2D_InitStruct->OutputAlpha;
214  LL_DMA2D_ConfigOutputColor(DMA2Dx, &dma2d_colorstruct);
215 
216  status = SUCCESS;
217  }
218  /* If DMA2D transfers are not disabled, return ERROR */
219 
220  return (status);
221 }
222 
230 {
231  /* Set DMA2D_InitStruct fields to default values */
232  DMA2D_InitStruct->Mode = LL_DMA2D_MODE_M2M;
233  DMA2D_InitStruct->ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB8888;
234  DMA2D_InitStruct->NbrOfLines = 0x0U;
235  DMA2D_InitStruct->NbrOfPixelsPerLines = 0x0U;
236  DMA2D_InitStruct->LineOffset = 0x0U;
237  DMA2D_InitStruct->OutputBlue = 0x0U;
238  DMA2D_InitStruct->OutputGreen = 0x0U;
239  DMA2D_InitStruct->OutputRed = 0x0U;
240  DMA2D_InitStruct->OutputAlpha = 0x0U;
241  DMA2D_InitStruct->OutputMemoryAddress = 0x0U;
242 }
243 
255 void LL_DMA2D_ConfigLayer(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_LayerCfgTypeDef *DMA2D_LayerCfg, uint32_t LayerIdx)
256 {
257  /* Check the parameters */
258  assert_param(IS_LL_DMA2D_OFFSET(DMA2D_LayerCfg->LineOffset));
259  assert_param(IS_LL_DMA2D_LCMODE(DMA2D_LayerCfg->ColorMode));
260  assert_param(IS_LL_DMA2D_CLUTCMODE(DMA2D_LayerCfg->CLUTColorMode));
261  assert_param(IS_LL_DMA2D_CLUTSIZE(DMA2D_LayerCfg->CLUTSize));
262  assert_param(IS_LL_DMA2D_ALPHAMODE(DMA2D_LayerCfg->AlphaMode));
263  assert_param(IS_LL_DMA2D_GREEN(DMA2D_LayerCfg->Green));
264  assert_param(IS_LL_DMA2D_RED(DMA2D_LayerCfg->Red));
265  assert_param(IS_LL_DMA2D_BLUE(DMA2D_LayerCfg->Blue));
266  assert_param(IS_LL_DMA2D_ALPHA(DMA2D_LayerCfg->Alpha));
267 
268 
269  if (LayerIdx == 0U)
270  {
271  /* Configure the background memory address */
272  LL_DMA2D_BGND_SetMemAddr(DMA2Dx, DMA2D_LayerCfg->MemoryAddress);
273 
274  /* Configure the background line offset */
275  LL_DMA2D_BGND_SetLineOffset(DMA2Dx, DMA2D_LayerCfg->LineOffset);
276 
277  /* Configure the background Alpha value, Alpha mode, CLUT size, CLUT Color mode and Color mode */
278  MODIFY_REG(DMA2Dx->BGPFCCR, \
279  (DMA2D_BGPFCCR_ALPHA | DMA2D_BGPFCCR_AM | DMA2D_BGPFCCR_CS | DMA2D_BGPFCCR_CCM | DMA2D_BGPFCCR_CM), \
280  ((DMA2D_LayerCfg->Alpha << DMA2D_BGPFCCR_ALPHA_Pos) | DMA2D_LayerCfg->AlphaMode | \
281  (DMA2D_LayerCfg->CLUTSize << DMA2D_BGPFCCR_CS_Pos) | DMA2D_LayerCfg->CLUTColorMode | \
282  DMA2D_LayerCfg->ColorMode));
283 
284  /* Configure the background color */
285  LL_DMA2D_BGND_SetColor(DMA2Dx, DMA2D_LayerCfg->Red, DMA2D_LayerCfg->Green, DMA2D_LayerCfg->Blue);
286 
287  /* Configure the background CLUT memory address */
288  LL_DMA2D_BGND_SetCLUTMemAddr(DMA2Dx, DMA2D_LayerCfg->CLUTMemoryAddress);
289  }
290  else
291  {
292  /* Configure the foreground memory address */
293  LL_DMA2D_FGND_SetMemAddr(DMA2Dx, DMA2D_LayerCfg->MemoryAddress);
294 
295  /* Configure the foreground line offset */
296  LL_DMA2D_FGND_SetLineOffset(DMA2Dx, DMA2D_LayerCfg->LineOffset);
297 
298  /* Configure the foreground Alpha value, Alpha mode, CLUT size, CLUT Color mode and Color mode */
299  MODIFY_REG(DMA2Dx->FGPFCCR, \
300  (DMA2D_FGPFCCR_ALPHA | DMA2D_FGPFCCR_AM | DMA2D_FGPFCCR_CS | DMA2D_FGPFCCR_CCM | DMA2D_FGPFCCR_CM), \
301  ((DMA2D_LayerCfg->Alpha << DMA2D_FGPFCCR_ALPHA_Pos) | DMA2D_LayerCfg->AlphaMode | \
302  (DMA2D_LayerCfg->CLUTSize << DMA2D_FGPFCCR_CS_Pos) | DMA2D_LayerCfg->CLUTColorMode | \
303  DMA2D_LayerCfg->ColorMode));
304 
305  /* Configure the foreground color */
306  LL_DMA2D_FGND_SetColor(DMA2Dx, DMA2D_LayerCfg->Red, DMA2D_LayerCfg->Green, DMA2D_LayerCfg->Blue);
307 
308  /* Configure the foreground CLUT memory address */
309  LL_DMA2D_FGND_SetCLUTMemAddr(DMA2Dx, DMA2D_LayerCfg->CLUTMemoryAddress);
310  }
311 }
312 
320 {
321  /* Set DMA2D_LayerCfg fields to default values */
322  DMA2D_LayerCfg->MemoryAddress = 0x0U;
323  DMA2D_LayerCfg->ColorMode = LL_DMA2D_INPUT_MODE_ARGB8888;
324  DMA2D_LayerCfg->LineOffset = 0x0U;
325  DMA2D_LayerCfg->CLUTColorMode = LL_DMA2D_CLUT_COLOR_MODE_ARGB8888;
326  DMA2D_LayerCfg->CLUTSize = 0x0U;
327  DMA2D_LayerCfg->AlphaMode = LL_DMA2D_ALPHA_MODE_NO_MODIF;
328  DMA2D_LayerCfg->Alpha = 0x0U;
329  DMA2D_LayerCfg->Blue = 0x0U;
330  DMA2D_LayerCfg->Green = 0x0U;
331  DMA2D_LayerCfg->Red = 0x0U;
332  DMA2D_LayerCfg->CLUTMemoryAddress = 0x0U;
333 }
334 
343 void LL_DMA2D_ConfigOutputColor(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_ColorTypeDef *DMA2D_ColorStruct)
344 {
345  uint32_t outgreen;
346  uint32_t outred;
347  uint32_t outalpha;
348 
349  /* Check the parameters */
350  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
351  assert_param(IS_LL_DMA2D_OCMODE(DMA2D_ColorStruct->ColorMode));
352  assert_param(IS_LL_DMA2D_GREEN(DMA2D_ColorStruct->OutputGreen));
353  assert_param(IS_LL_DMA2D_RED(DMA2D_ColorStruct->OutputRed));
354  assert_param(IS_LL_DMA2D_BLUE(DMA2D_ColorStruct->OutputBlue));
355  assert_param(IS_LL_DMA2D_ALPHA(DMA2D_ColorStruct->OutputAlpha));
356 
357  /* DMA2D OCOLR register configuration ------------------------------------------*/
358  if (DMA2D_ColorStruct->ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB8888)
359  {
360  outgreen = DMA2D_ColorStruct->OutputGreen << 8U;
361  outred = DMA2D_ColorStruct->OutputRed << 16U;
362  outalpha = DMA2D_ColorStruct->OutputAlpha << 24U;
363  }
364  else if (DMA2D_ColorStruct->ColorMode == LL_DMA2D_OUTPUT_MODE_RGB888)
365  {
366  outgreen = DMA2D_ColorStruct->OutputGreen << 8U;
367  outred = DMA2D_ColorStruct->OutputRed << 16U;
368  outalpha = 0x00000000U;
369  }
370  else if (DMA2D_ColorStruct->ColorMode == LL_DMA2D_OUTPUT_MODE_RGB565)
371  {
372  outgreen = DMA2D_ColorStruct->OutputGreen << 5U;
373  outred = DMA2D_ColorStruct->OutputRed << 11U;
374  outalpha = 0x00000000U;
375  }
376  else if (DMA2D_ColorStruct->ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB1555)
377  {
378  outgreen = DMA2D_ColorStruct->OutputGreen << 5U;
379  outred = DMA2D_ColorStruct->OutputRed << 10U;
380  outalpha = DMA2D_ColorStruct->OutputAlpha << 15U;
381  }
382  else /* ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB4444 */
383  {
384  outgreen = DMA2D_ColorStruct->OutputGreen << 4U;
385  outred = DMA2D_ColorStruct->OutputRed << 8U;
386  outalpha = DMA2D_ColorStruct->OutputAlpha << 12U;
387  }
388  LL_DMA2D_SetOutputColor(DMA2Dx, (outgreen | outred | DMA2D_ColorStruct->OutputBlue | outalpha));
389 }
390 
402 uint32_t LL_DMA2D_GetOutputBlueColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
403 {
404  uint32_t color;
405 
406  /* Check the parameters */
407  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
408  assert_param(IS_LL_DMA2D_OCMODE(ColorMode));
409 
410  /* DMA2D OCOLR register reading ------------------------------------------*/
411  if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB8888)
412  {
413  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFFU));
414  }
415  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB888)
416  {
417  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFFU));
418  }
419  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB565)
420  {
421  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x1FU));
422  }
423  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB1555)
424  {
425  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x1FU));
426  }
427  else /* ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB4444 */
428  {
429  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFU));
430  }
431 
432  return color;
433 }
434 
446 uint32_t LL_DMA2D_GetOutputGreenColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
447 {
448  uint32_t color;
449 
450  /* Check the parameters */
451  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
452  assert_param(IS_LL_DMA2D_OCMODE(ColorMode));
453 
454  /* DMA2D OCOLR register reading ------------------------------------------*/
455  if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB8888)
456  {
457  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFF00U) >> 8U);
458  }
459  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB888)
460  {
461  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFF00U) >> 8U);
462  }
463  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB565)
464  {
465  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x7E0U) >> 5U);
466  }
467  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB1555)
468  {
469  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x3E0U) >> 5U);
470  }
471  else /* ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB4444 */
472  {
473  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xF0U) >> 4U);
474  }
475 
476  return color;
477 }
478 
490 uint32_t LL_DMA2D_GetOutputRedColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
491 {
492  uint32_t color;
493 
494  /* Check the parameters */
495  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
496  assert_param(IS_LL_DMA2D_OCMODE(ColorMode));
497 
498  /* DMA2D OCOLR register reading ------------------------------------------*/
499  if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB8888)
500  {
501  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFF0000U) >> 16U);
502  }
503  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB888)
504  {
505  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFF0000U) >> 16U);
506  }
507  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB565)
508  {
509  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xF800U) >> 11U);
510  }
511  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB1555)
512  {
513  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x7C00U) >> 10U);
514  }
515  else /* ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB4444 */
516  {
517  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xF00U) >> 8U);
518  }
519 
520  return color;
521 }
522 
534 uint32_t LL_DMA2D_GetOutputAlphaColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
535 {
536  uint32_t color;
537 
538  /* Check the parameters */
539  assert_param(IS_DMA2D_ALL_INSTANCE(DMA2Dx));
540  assert_param(IS_LL_DMA2D_OCMODE(ColorMode));
541 
542  /* DMA2D OCOLR register reading ------------------------------------------*/
543  if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB8888)
544  {
545  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xFF000000U) >> 24U);
546  }
547  else if ((ColorMode == LL_DMA2D_OUTPUT_MODE_RGB888) || (ColorMode == LL_DMA2D_OUTPUT_MODE_RGB565))
548  {
549  color = 0x0U;
550  }
551  else if (ColorMode == LL_DMA2D_OUTPUT_MODE_ARGB1555)
552  {
553  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0x8000U) >> 15U);
554  }
555  else /* ColorMode = LL_DMA2D_OUTPUT_MODE_ARGB4444 */
556  {
557  color = (uint32_t)(READ_BIT(DMA2Dx->OCOLR, 0xF000U) >> 12U);
558  }
559 
560  return color;
561 }
562 
570 void LL_DMA2D_ConfigSize(DMA2D_TypeDef *DMA2Dx, uint32_t NbrOfLines, uint32_t NbrOfPixelsPerLines)
571 {
572  MODIFY_REG(DMA2Dx->NLR, (DMA2D_NLR_PL | DMA2D_NLR_NL), \
573  ((NbrOfPixelsPerLines << DMA2D_NLR_PL_Pos) | NbrOfLines));
574 }
575 
588 #endif /* defined (DMA2D) */
589 
594 #endif /* USE_FULL_LL_DRIVER */
__STATIC_INLINE void LL_AHB1_GRP1_ReleaseReset(uint32_t Periphs)
Release AHB1 peripherals reset. @rmtoll AHB1RSTR GPIOARST LL_AHB1_GRP1_ReleaseReset AHB1RSTR GPIOBRS...
__STATIC_INLINE void LL_AHB1_GRP1_ForceReset(uint32_t Periphs)
Force AHB1 peripherals reset. @rmtoll AHB1RSTR GPIOARST LL_AHB1_GRP1_ForceReset AHB1RSTR GPIOBRST LL...
__STATIC_INLINE void LL_DMA2D_BGND_SetColor(DMA2D_TypeDef *DMA2Dx, uint32_t Red, uint32_t Green, uint32_t Blue)
Set DMA2D background color values, expressed on 24 bits ([23:0] bits). @rmtoll BGCOLR RED LL_DMA2D_BG...
__STATIC_INLINE void LL_DMA2D_BGND_SetLineOffset(DMA2D_TypeDef *DMA2Dx, uint32_t LineOffset)
Set DMA2D background line offset, expressed on 14 bits ([13:0] bits). @rmtoll BGOR LO LL_DMA2D_BGND_S...
__STATIC_INLINE void LL_DMA2D_BGND_SetMemAddr(DMA2D_TypeDef *DMA2Dx, uint32_t MemoryAddress)
Set DMA2D background memory address, expressed on 32 bits ([31:0] bits). @rmtoll BGMAR MA LL_DMA2D_BG...
__STATIC_INLINE uint32_t LL_DMA2D_BGND_IsEnabledCLUTLoad(DMA2D_TypeDef *DMA2Dx)
Indicate if DMA2D background CLUT loading is enabled. @rmtoll BGPFCCR START LL_DMA2D_BGND_IsEnabledCL...
__STATIC_INLINE void LL_DMA2D_BGND_SetCLUTMemAddr(DMA2D_TypeDef *DMA2Dx, uint32_t CLUTMemoryAddress)
Set DMA2D background CLUT memory address, expressed on 32 bits ([31:0] bits). @rmtoll BGCMAR MA LL_DM...
__STATIC_INLINE void LL_DMA2D_SetOutputColor(DMA2D_TypeDef *DMA2Dx, uint32_t OutputColor)
Set DMA2D output color, expressed on 32 bits ([31:0] bits).
__STATIC_INLINE void LL_DMA2D_SetLineOffset(DMA2D_TypeDef *DMA2Dx, uint32_t LineOffset)
Set DMA2D line offset, expressed on 14 bits ([13:0] bits). @rmtoll OOR LO LL_DMA2D_SetLineOffset.
__STATIC_INLINE uint32_t LL_DMA2D_IsTransferOngoing(DMA2D_TypeDef *DMA2Dx)
Indicate if a DMA2D transfer is ongoing. @rmtoll CR START LL_DMA2D_IsTransferOngoing.
__STATIC_INLINE void LL_DMA2D_SetOutputMemAddr(DMA2D_TypeDef *DMA2Dx, uint32_t OutputMemoryAddress)
Set DMA2D output memory address, expressed on 32 bits ([31:0] bits). @rmtoll OMAR MA LL_DMA2D_SetOutp...
__STATIC_INLINE void LL_DMA2D_SetMode(DMA2D_TypeDef *DMA2Dx, uint32_t Mode)
Set DMA2D mode. @rmtoll CR MODE LL_DMA2D_SetMode.
__STATIC_INLINE void LL_DMA2D_FGND_SetCLUTMemAddr(DMA2D_TypeDef *DMA2Dx, uint32_t CLUTMemoryAddress)
Set DMA2D foreground CLUT memory address, expressed on 32 bits ([31:0] bits). @rmtoll FGCMAR MA LL_DM...
__STATIC_INLINE void LL_DMA2D_FGND_SetColor(DMA2D_TypeDef *DMA2Dx, uint32_t Red, uint32_t Green, uint32_t Blue)
Set DMA2D foreground color values, expressed on 24 bits ([23:0] bits). @rmtoll FGCOLR RED LL_DMA2D_FG...
__STATIC_INLINE uint32_t LL_DMA2D_FGND_IsEnabledCLUTLoad(DMA2D_TypeDef *DMA2Dx)
Indicate if DMA2D foreground CLUT loading is enabled. @rmtoll FGPFCCR START LL_DMA2D_FGND_IsEnabledCL...
__STATIC_INLINE void LL_DMA2D_FGND_SetLineOffset(DMA2D_TypeDef *DMA2Dx, uint32_t LineOffset)
Set DMA2D foreground line offset, expressed on 14 bits ([13:0] bits). @rmtoll FGOR LO LL_DMA2D_FGND_S...
__STATIC_INLINE void LL_DMA2D_FGND_SetMemAddr(DMA2D_TypeDef *DMA2Dx, uint32_t MemoryAddress)
Set DMA2D foreground memory address, expressed on 32 bits ([31:0] bits). @rmtoll FGMAR MA LL_DMA2D_FG...
void LL_DMA2D_ConfigLayer(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_LayerCfgTypeDef *DMA2D_LayerCfg, uint32_t LayerIdx)
Configure the foreground or background according to the specified parameters in the LL_DMA2D_LayerCfg...
void LL_DMA2D_ConfigOutputColor(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_ColorTypeDef *DMA2D_ColorStruct)
Initialize DMA2D output color register according to the specified parameters in DMA2D_ColorStruct.
void LL_DMA2D_LayerCfgStructInit(LL_DMA2D_LayerCfgTypeDef *DMA2D_LayerCfg)
Set each LL_DMA2D_LayerCfgTypeDef field to default value.
uint32_t LL_DMA2D_GetOutputRedColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
Return DMA2D output Red color.
ErrorStatus LL_DMA2D_Init(DMA2D_TypeDef *DMA2Dx, LL_DMA2D_InitTypeDef *DMA2D_InitStruct)
Initialize DMA2D registers according to the specified parameters in DMA2D_InitStruct.
void LL_DMA2D_StructInit(LL_DMA2D_InitTypeDef *DMA2D_InitStruct)
Set each LL_DMA2D_InitTypeDef field to default value.
ErrorStatus LL_DMA2D_DeInit(DMA2D_TypeDef *DMA2Dx)
De-initialize DMA2D registers (registers restored to their default values).
uint32_t LL_DMA2D_GetOutputBlueColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
Return DMA2D output Blue color.
uint32_t LL_DMA2D_GetOutputAlphaColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
Return DMA2D output Alpha color.
void LL_DMA2D_ConfigSize(DMA2D_TypeDef *DMA2Dx, uint32_t NbrOfLines, uint32_t NbrOfPixelsPerLines)
Configure DMA2D transfer size.
uint32_t LL_DMA2D_GetOutputGreenColor(DMA2D_TypeDef *DMA2Dx, uint32_t ColorMode)
Return DMA2D output Green color.
LL DMA2D Output Color Structure Definition.
LL DMA2D Init Structure Definition.
LL DMA2D Layer Configuration Structure Definition.
Header file of BUS LL module.
Header file of DMA2D LL module.