Chinaunix首页 | 论坛 | 博客
  • 博客访问: 106851
  • 博文数量: 26
  • 博客积分: 1060
  • 博客等级: 少尉
  • 技术积分: 300
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-04 10:32
文章分类

全部博文(26)

文章存档

2013年(1)

2011年(21)

2010年(4)

分类: WINDOWS

2011-03-26 16:20:57

存储开机logo

改动过程:

1.       分区nandflash

Nandflash中要分出一块用于存放图片。我们的屏幕是800X480 16位的, 所以需要800*480* 16>>3 = 76800 (750KB)

我们的flash 512 kb为一个block,为了以后的扩展,我开辟了4block,存储logo。开辟方法:

SMDK6410\SRC\BOOTLOADER\EBOOT\loader.h

添加logo分区

分区放置于eboot之后。内核之前

#define LOGO_BLOCK                   EBOOT_BLOCK + EBOOT_BLOCK_SIZE

#define LOGO_BLOCK_SIZE              4 //2//512 * 4 = 2M

#define LOGO_SECTOR_SIZE             BLOCK_TO_SECTOR(PIC_BLOCK_SIZE)

#define LOGO_SECTOR                  BLOCK_TO_SECTOR(PIC_BLOCK)

修改:

 

#define RESERVED_BOOT_BLOCKS        (NBOOT_BLOCK_SIZE + TOC_BLOCK_SIZE + EBOOT_BLOCK_SIZE + LOGO_BLOCK_SIZE)

 

 

 

至此, bootloader 分区完成。。。。

 

2.       eboot中添加选项用于下载图片

SMDK6410\SRC\BOOTLOADER\EBOOT\main.c

static BOOL MainMenu(PBOOT_CFG pBootCfg)

添加:

//ztl++ add menu to download logo img

EdbgOutputDebugString ( "Z) DOWNLOAD logo img(USB)\r\n");

    //ztl++

添加选项‘z’对应操作:

        case 'Z':

        case 'z':

            OALMSG(OAL_INFO, (TEXT("Select the logo bmp (800 X 480 * 16)\r\n")));

            DowloadLogo();

            break;

 

添加函数

//add by ZhangTianlu(ztlchina@foxmail.com) 2011-3-25 17:53:02

//add for dowload logo.bin form usb

#define LOGO_BIN_HEAD_FLAG_SIZE     8

 

//logo.bin creat by Img2Lcd.exe, First 8 bytes is as :

#define LOGO_BIN_HEAD_FLAG_1        0x00

#define LOGO_BIN_HEAD_FLAG_2        0x10

#define LOGO_BIN_HEAD_FLAG_3        0x20

#define LOGO_BIN_HEAD_FLAG_4        0x03

#define LOGO_BIN_HEAD_FLAG_5        0xe0

#define LOGO_BIN_HEAD_FLAG_6        0x01

#define LOGO_BIN_HEAD_FLAG_7        0x01

#define LOGO_BIN_HEAD_FLAG_8        0x1b

 

static BOOL DowloadLogo()

{

    int i = 0;

   

    unsigned char imgFlagbuff[LOGO_BIN_HEAD_FLAG_SIZE] ={0};

 

    OALMSG(TRUE, (TEXT("[DowloadLogo]\r\n")));;

 

    do

    {

        if (!UbootReadData(LOGO_BIN_HEAD_FLAG_SIZE, imgFlagbuff))

        {

            OALMSG(TRUE, (TEXT("[Dowloadlogo]Read error\r\n")));

            //HALT (BLERR_MAGIC);

            return (FALSE);

        }

 

        if (imgFlagbuff[0] == LOGO_BIN_HEAD_FLAG_1 &&

            imgFlagbuff[1] == LOGO_BIN_HEAD_FLAG_2 &&

            imgFlagbuff[2] == LOGO_BIN_HEAD_FLAG_3 &&

            imgFlagbuff[3] == LOGO_BIN_HEAD_FLAG_4 &&

            imgFlagbuff[4] == LOGO_BIN_HEAD_FLAG_5 &&

            imgFlagbuff[5] == LOGO_BIN_HEAD_FLAG_6 &&

            imgFlagbuff[6] == LOGO_BIN_HEAD_FLAG_7 &&

            imgFlagbuff[7] == LOGO_BIN_HEAD_FLAG_8

            ) //check if one bmp.bin has been dowload from usb.

        {

            OALMSG(TRUE, (TEXT("[Dowloadlogo]img ok \r\n")));

            //read the img.bin to IMAGE_NK_UA_START

            UbootReadData(g_FramebufferSize, IMAGE_NK_UA_START);

            /*for (i = 0; i < 10; i++)

            {

                 OALMSG(TRUE, (TEXT("%x "), *((unsigned char *)IMAGE_NK_UA_START + i)));

 

            }

            */

 

            //write img to flash

            WriteLogoToBootMedia(IMAGE_NK_UA_START, g_FramebufferSize, 0);

            break;

        }

        else

        {

            OALMSG(TRUE, (TEXT("[Dowloadlogo]it is not one bin file of logo: ")));

            for (i = 0; i < LOGO_BIN_HEAD_FLAG_SIZE; i++)

            {

                OALMSG(TRUE, (TEXT("%x "), imgFlagbuff[i]));

            }

            OALMSG(TRUE, (TEXT("\r\n")));

            SpinForever();

            return FALSE;

        }

    }while(1);

    return TRUE;

}

 

 

 



阅读(1372) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~