Uboot中支持lcd和hdmi显示不同的logo图片

在lcd为竖屏,hdmi显示横屏的情况下,如果按照默认的uboot显示框架来看,只能保证lcd或者hdmi上面显示出来的图片一个是正的,另外一个是旋转了90度的样子。
为了能是lcd和hdmi同时支持显示图片都是正的,需要对uboot的框架做修改。如果硬件支持旋转功能的话,就可直接使用硬件旋转,不需要软件来调整。
由于项目原因,折腾了一把这个流程,具体实现记录下:
1:由于硬件不支持rotation功能,在软件上采用的方法是准备两份logo资源,解析后将两份数据送到不同的显示设备上面做显示。
在解析logo的时候需要解析两份资源:

static int splash_image_load(void)
{
    int ret;
    char *filename,*filename_hdmi;
    void *splash_image_addr,*splash_image_hdmi_addr;
    char splash_image_char[16], splash_image_hdmi_char[16];
    //分配给lcd资源的地址
    splash_image_addr = memalign(128, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
    if(splash_image_addr == NULL) {
        printk("Malloc size for splash image failed!\n");
        return -1;
    }
    //分配给hdmi资源logo的地址
    splash_image_hdmi_addr = memalign(128, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
    if(splash_image_hdmi_addr == NULL) {
        printk("Malloc size for splash image hdmi failed!\n");
        return -1;
    }

    filename = splash_image_select();
    filename_hdmi =  CONFIG_SYS_VIDEO_LOGO_HDMI_NAME;
    if (!filename) {
        printk("No splash image loaded\n");
        return -1;
    }
    //拿到lcd的logo
    ret = file_fat_read(filename, splash_image_addr, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);

    if(ret < 0) {
        printk("Fail to load splash image\n");
        free(splash_image_addr);
        return -1;
    }   
    //拿到hdmi的logo
    ret = file_fat_read(filename_hdmi, splash_image_hdmi_addr, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE);
    if(ret < 0) {
        printk("Fail to load splash  hdmi image\n");
        free(splash_image_hdmi_addr);
        return -1;
    }   
    sprintf(splash_image_char, "%x", (unsigned int) splash_image_addr);
    sprintf(splash_image_hdmi_char, "%x", (unsigned int) splash_image_hdmi_addr);
    //将解析到的地址保存到env中,后续需要再读取出来<
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值