==============================================================================
##### 如何使用此驱动 #####
==============================================================================
1、函数 HAL_DMA2D_Init()做基本参数配置,比如传输模式,输出颜色模式,输出偏移等。
2、函数HAL_DMA2D_ConfigLayer配置前景色和背景色的输入颜色模式,输入颜色,输入Alpha值,Alpha模式,R/B颜色通道切换,Alpha值反转和输入偏移。
3、查询方式操作:
调用函数HAL_DMA2D_Start启动传输,然后调用函数HAL_DMA2D_PollForTransfer等待传输完成
4、中断方式操作
(1)调用函数HAL_DMA2D_Start_IT启动DMA2D传输
(2)DMA2D的中断服务程序DMA2D_IRQHandler里面调用HAL_DMA2D_IRQHandler
(3)DMA2D传输结束后,会执行DMA2D中断服务程序里面的函数HAL_DMA2D_IRQHandler,如果用户设置了函数指针XferCpltCallback,也会被执行
(4)如果传输出现错误,会调用函数HAL_DMA2D_IRQHandler()的回调函数XferErrorCallback
5、配置和使能CLUT使用函数HAL_DMA2D_CLUTLoad和HAL_DMA2D_CLUTLoad_IT
6、配置line watermark使用HAL_DMA2D_ProgramLineEvent
7、使用函数HAL_DMA2D_ConfigDeadTime配置死区时间,函数HAL_DMA2D_EnableDeadTime使能死区时间,函数HAL_DMA2D_DisableDeadTime禁止死区时间。
死区时间是指的DMA2D连续访问AHB主控端口设备时插入的AHB时钟周期个数。
8、函数HAL_DMA2D_Suspend(), HAL_DMA2D_Resume(), HAL_DMA2D_Abort()分别挂起,恢复和终止传输。
9、CLUT加载的挂起函数HAL_DMA2D_CLUTLoading_Suspend(), 恢复函数HAL_DMA2D_CLUTLoading_Resume()和终止HAL_DMA2D_CLUTLoading_Abort()
10、函数HAL_DMA2D_GetState用于获取DMA2D的状态
11、函数HAL_DMA2D_GetError用于获取DAM2D的错误信息。
12、
(+) __HAL_DMA2D_ENABLE: Enable the DMA2D peripheral.
(+) __HAL_DMA2D_GET_FLAG: Get the DMA2D pending flags.
(+) __HAL_DMA2D_CLEAR_FLAG: Clear the DMA2D pending flags.
(+) __HAL_DMA2D_ENABLE_IT: Enable the specified DMA2D interrupts.
(+) __HAL_DMA2D_DISABLE_IT: Disable the specified DMA2D interrupts.
(+) __HAL_DMA2D_GET_IT_SOURCE: Check whether the specified DMA2D interrupt is enabled or not.
初始化和复位初始化函数
HAL_StatusTypeDef HAL_DMA2D_Init(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_DeInit (DMA2D_HandleTypeDef *hdma2d);
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef* hdma2d);
void HAL_DMA2D_MspDeInit(DMA2D_HandleTypeDef* hdma2d);
DMA2D操作函数
HAL_StatusTypeDef HAL_DMA2D_Start(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
HAL_StatusTypeDef HAL_DMA2D_BlendingStart(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
HAL_StatusTypeDef HAL_DMA2D_Start_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t pdata, uint32_t DstAddress, uint32_t Width, uint32_t Height);
HAL_StatusTypeDef HAL_DMA2D_BlendingStart_IT(DMA2D_HandleTypeDef *hdma2d, uint32_t SrcAddress1, uint32_t SrcAddress2, uint32_t DstAddress, uint32_t Width, uint32_t Height);
HAL_StatusTypeDef HAL_DMA2D_Suspend(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_Resume(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_Abort(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_EnableCLUT(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_CLUTLoad_IT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Abort(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Suspend(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_CLUTLoading_Resume(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_PollForTransfer(DMA2D_HandleTypeDef *hdma2d, uint32_t Timeout);
void HAL_DMA2D_IRQHandler(DMA2D_HandleTypeDef *hdma2d);
void HAL_DMA2D_LineEventCallback(DMA2D_HandleTypeDef *hdma2d);
void HAL_DMA2D_CLUTLoadingCpltCallback(DMA2D_HandleTypeDef *hdma2d);
外设控制函数
HAL_StatusTypeDef HAL_DMA2D_ConfigLayer(DMA2D_HandleTypeDef *hdma2d, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_ConfigCLUT(DMA2D_HandleTypeDef *hdma2d, DMA2D_CLUTCfgTypeDef CLUTCfg, uint32_t LayerIdx);
HAL_StatusTypeDef HAL_DMA2D_ProgramLineEvent(DMA2D_HandleTypeDef *hdma2d, uint32_t Line);
HAL_StatusTypeDef HAL_DMA2D_EnableDeadTime(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_DisableDeadTime(DMA2D_HandleTypeDef *hdma2d);
HAL_StatusTypeDef HAL_DMA2D_ConfigDeadTime(DMA2D_HandleTypeDef *hdma2d, uint8_t DeadTime);
外设状态
HAL_DMA2D_StateTypeDef HAL_DMA2D_GetState(DMA2D_HandleTypeDef *hdma2d);
uint32_t HAL_DMA2D_GetError(DMA2D_HandleTypeDef *hdma2d); |