您尚未登录。

楼主 # 2024-05-13 17:32:00

runner111
会员
注册时间: 2019-10-03
已发帖子: 4
积分: 9

F1C100S DMA

我现在使用LVGL,想把disp_flush效率提升。于是就使用了DMA,将color_p的数据搬运到LCD的buffer中,但是每次只能搬运几个字节。感觉像是cache同步问题,对cache进行了强制更新,也没用。请问有什么好办法?
DMA设置:
DMA_Init();
    g_dma.Type = NDMA;//类型
    g_dma.Ch = 0;//通道    
    g_dma.Continuous_Mode_Enable = 0;//连续模式
    g_dma.Read_Byte_Counter_Enable = 0;//读计数值使能       
    //---------   
    g_dma.Source_Address_Type = DMA_ADDRESS_TYEP_LINEER;//源地址类型
    g_dma.Source_DRQ_Type = NDMAS_DRQ_Type_SDRAM_Memory;//源类型
    g_dma.Source_Data_Width = DMA_DATA_WIDTH_32;//源数据宽度
    g_dma.Source_Burst_Length = DMA_BURST_LENGTH_4;//BURST
    //-----------   
    g_dma.Destination_Address_Type = DMA_ADDRESS_TYEP_LINEER;//目标地址类型
    g_dma.Destination_DRQ_Type = NDMAD_DRQ_Type_SDRAM_Memory;//目标类型
    g_dma.Destination_Data_Width = DMA_DATA_WIDTH_32;//目标数据宽度
    g_dma.Destination_Burst_Length = DMA_BURST_LENGTH_4;//BURST

更改后的disp_flush函数
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
    /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/

    int32_t x;
    int32_t y;

    g_dma.Source_Address = (unsigned int)color_p;   
   
    g_dma.Byte_Counter = (area->x2 + 1 - area->x1) * 2;//Byte计数   
    for(y = area->y1; y <= area->y2; y++) {
        MMU_CleanDCacheArray(g_dma.Source_Address, g_dma.Byte_Counter);
        g_dma.Destination_Address = (unsigned int)BT + y * LV_HOR_RES_MAX * 2 + area->x1 * 2;
        DMA_Config(&g_dma);
        DMA_Enable(&g_dma);
        while (DMA_Get_Full_TIP(&g_dma));
        DMA_Disable(&g_dma);
        MMU_InvalidateDCacheArray(g_dma.Destination_Address, g_dma.Byte_Counter);
        g_dma.Source_Address += (area->x2 + 1 - area->x1) * 2;
    }

    /* IMPORTANT!!!
     * Inform the graphics library that you are ready with the flushing*/
    lv_disp_flush_ready(disp_drv);
}

离线

#1 2024-05-16 13:41:09

视觉℡
会员
注册时间: 2019-01-29
已发帖子: 38
积分: 20
个人网站

Re: F1C100S DMA

你这不还是等待DMA搬完?  不还是浪费CPU,F1C100S不都是开一片lcd RAM自己CPU自己刷着玩,CPU更新RAM不挺快的





离线

#2 2024-05-16 14:00:21

Hangzhou2021
会员
注册时间: 2024-05-16
已发帖子: 1
积分: 1

Re: F1C100S DMA

使用DMA能不能快速的驱动小尺寸的SPI屏幕,因为很多小屏幕采用SPI接口,然后视频和图片的显示对于刷新率要求又很高

离线

#3 2024-05-16 17:18:04

armstrong
会员
注册时间: 2019-04-10
已发帖子: 268
积分: 182.5

Re: F1C100S DMA

完全可以,而且可以一次性把整屏像素都送出去

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn