sp5v210 Boot logo

Source: Internet
Author: User

1, assign a block to the logo in Loader.h
NAND Boot (loads into steppingstone) @ Block 0
#define NBOOT_BLOCK 0
#define NBOOT_BLOCK_SIZE 1
#define Nboot_sector Block_to_sector (Nboot_block)

Eboot @ Block 1
#define EBOOT_BLOCK 1
#define Eboot_sector_size file_to_sector_size (eboot_ram_image_size)
#define Eboot_block_size Sector_to_block (eboot_sector_size)
#define Eboot_sector Block_to_sector (Eboot_block)


LOGO @ Block 8
#define LOGO_BLOCK (6)
#define Logo_sector_size file_to_sector_size (logo_ram_image_size)
#define LOGO_BLOCK_SIZE 20
#define Logo_sector Block_to_sector (Logo_block)

TOC @ Block 5
#define Toc_block (logo_block+eboot_block+eboot_block_size+1)
#define TOC_BLOCK_SIZE 1
#define Toc_sector Block_to_sector (Toc_block)

#define Reserved_boot_blocks (nboot_block_size + toc_block_size + eboot_block_size+logo_block_size)

Images start after OEM Reserved Blocks
#define Image_start_block Reserved_boot_blocks
#define Image_start_sector Block_to_sector (Image_start_block)

2, in Nand.cpp

BOOL Writelogotobootmedia (DWORD Dwimagestart, DWORD Dwimagelength, DWORD dwlaunchaddr)
{
DWORD dwblock,dwnumblocks;
Lpbyte pbbuffer;
Sectorinfo si;

Oalmsg (TRUE, (TEXT ("+writelogotobootmedia\r\n")));

Dwblock = Logo_block;
Pbbuffer = (LPBYTE) Dwimagestart;

  Oalmsg (TRUE, ("^^ ^^ ^^ ^^ 0x%x ^^ ^^ ^^ \ r \ n"), (unsigned short *) pbbuffer));
 //oalmsg (TRUE (TEXT ("^^ ^^ ^^ ^^ 0x%x ^^ ^^ ^^ \ r \ n"), G_flashinfo.wdatabytespersector));
  Oalmsg (TRUE, (TEXT ("g_flashinfo.wdatabytespersector = 0x%x \ r \ n"), G_flashinfo.wdatabytespersector));
  Oalmsg (TRUE, (TEXT ("G_flashinfo.wsectorsperblock = 0x%x \ r \ n"), G_flashinfo.wsectorsperblock));
  Dwnumblocks = (dwimagelength/(g_flashinfo.wdatabytespersector*g_flashinfo.wsectorsperblock)) +   
                                                   (dwimagelength% (g_ Flashinfo.wdatabytespersector*g_flashinfo.wsectorsperblock)? 1:0);

Oalmsg (TRUE, (TEXT ("dwimagelength = 0x%x \ r \ n"), dwimagelength));
Oalmsg (TRUE, (TEXT ("dwnumblocks = 0x%x \ r \ n"), dwnumblocks));

while (dwnumblocks--)
{
Oalmsg (TRUE, (TEXT ("Dwblock (0x%x) x"), Dwblock));
Oalmsg (TRUE, (TEXT ("G_flashinfo.wsectorsperblock (0x%x)"), G_flashinfo.wsectorsperblock));
Oalmsg (TRUE, (TEXT ("= 0x%x \ r \ n"), Dwblock*g_flashinfo.wsectorsperblock));

Fmd_readsector (Dwblock*g_flashinfo.wsectorsperblock, NULL, &si, 1);

Stepldr & eboot image in NAND flash
Block Mark as Block_status_reserved & Block_status_readonly & Block_status_bad
if ((Si.bbadblock = = 0x0) && (si.boemreserved!=3))
{
++dwblock;
++dwnumblocks; Compensate for fact, we didn ' t write any blocks.
Continue
}

if (! Readblock (Dwblock, NULL, G_psectorinfobuf))
{
Oalmsg (Oal_error, (TEXT ("writedata:failed to read block (0x%x). \ r \ n"), Dwblock));
return (FALSE);
}

if (! Fmd_eraseblock (Dwblock))
{
Oalmsg (Oal_error, (TEXT ("Writedata:failed to erase Block (0x%x). \ r \ n"), Dwblock));
return FALSE;
}

if (! WriteBlock (Dwblock, Pbbuffer, G_psectorinfobuf))
{
Oalmsg (Oal_error, (TEXT ("Writedata:failed to write Block (0x%x). \ r \ n"), Dwblock));
return (FALSE);
}

++dwblock;
Pbbuffer + = G_flashinfo.dwbytesperblock;
Oalmsg (TRUE, (TEXT ("Dwbytesperblock:%d\r\n"), G_flashinfo.dwbytesperblock));
}

Oalmsg (TRUE, (TEXT ("_writelogotobootmedia\r\n")));
Displaylogofrombootmedia (Dwimagestart, Dwimagelength, dwlaunchaddr);
svs=0;
return TRUE;
}

/*
Read the Logo data from Nand Flash
Add by Jazka 2014.06.04
*/
BOOL Displaylogofrombootmedia (DWORD Dwimagestart, DWORD Dwimagelength, DWORD dwlaunchaddr)
{
unsigned int * pFB32 = (unsigned int *) Eboot_framebuffer_ua_start;
unsigned int * dst = pFB32;
unsigned int * p = NULL;
Sectorinfo si;

DWORD dwblock,dwnumblocks;

Oalmsg (TRUE, (TEXT ("+readlogofrombootmedia\r\n")));

Dwblock = Logo_block;

Oalmsg (TRUE, (TEXT ("dwimagelength = 0x%x \ r \ n"), dwimagelength));
Oalmsg (TRUE, (TEXT ("dwimagelength = 0x%x \ r \ n"), G_flashinfo.wdatabytespersector));
Oalmsg (TRUE, (TEXT ("dwimagelength = 0x%x \ r \ n"), G_flashinfo.wsectorsperblock));

if (0 = = G_flashinfo.wdatabytespersector | | 0 = = g_flashinfo.wsectorsperblock)
{
return FALSE; This is where you return the
}

Dwnumblocks = (Dwimagelength/(G_flashinfo.wdatabytespersector*g_flashinfo.wsectorsperblock)) +
(dwimagelength% (g_flashinfo.wdatabytespersector*g_flashinfo.wsectorsperblock)? 1:0);
Oalmsg (TRUE, (TEXT ("dwnumblocks = 0x%x \ r \ n"), dwnumblocks));
dwnumblocks=0x60;

while (dwnumblocks--)
{
Oalmsg (TRUE, (TEXT ("Dwblock (0x%x) x"), Dwblock));
Oalmsg (TRUE, (TEXT ("G_flashinfo.wsectorsperblock (0x%x)"), G_flashinfo.wsectorsperblock));
Oalmsg (TRUE, (TEXT ("= 0x%x \ r \ n"), Dwblock*g_flashinfo.wsectorsperblock));

BOOL Readblock (DWORD dwblock, Lpbyte pbblock, Psectorinfo psectorinfotable)
if (! Readblock (Dwblock, (LPBYTE) DST, G_psectorinfobuf))
{
Oalmsg (Oal_error, (TEXT ("writedata:failed to read block (0x%x). \ r \ n"), Dwblock));
return (FALSE);
}
DST + = G_FLASHINFO.DWBYTESPERBLOCK/4;
DST + = 1024*128/4;
++dwblock;
}
Oalmsg (TRUE, (TEXT ("_readlogofrombootmedia\r\n")));

return TRUE;
}

3, in MAIN.C

if (! Displaylogofrombootmedia (Dwreadaddr, (DWORD) lcd_width*lcd_height*2, dwreadaddr))
{
Oalmsg (TRUE, (TEXT ("+displaylogofrombootmedia error\r\n"));
Edbgoutputdebugstring ("Displaylogofrombootmedia error\r\n");
int i;
unsigned short *pfb;
PFB = (unsigned short *) Eboot_framebuffer_ua_start;

for (i=0; i<lcd_width*lcd_height; i++)
*pfb++ = 0xae30;//0x001f; Blue
for (i=0; i<800*480; i++)
*pfb++ =0xae30;//logo[i];//0xae30;//0x001f;

Oalmsg (TRUE, (TEXT ("+displaylogofrombootmedia error\r\n"));
}
4, add in MENU.C

while (1)
{
Selection = Oemreaddebugbyte ();
for (i = 0; i < Nmenuitem; i++)
{
if (selection== ' x ' | | | selection== ' x ')
{
Edbgoutputdebugstring ("%c\r\n\r\n", selection);
return 0;
}

if (selection== ' P ' | | | selection== ' P ')
{//oemplatforminit ();
Checkusbdownload ();
Oempredownload ();
Oalmsg (TRUE, (TEXT ("Please send the Logo through usb.\r\n"));
G_busbdownload = TRUE;

{
DWORD dwstartaddr = 0;
Lpbyte lpdes = NULL;
Lpdes = (LPBYTE) (File_cache_start);

if (! Oemreaddata (lcd_width*lcd_height*2, Lpdes))
{
Oalmsg (TRUE, (TEXT ("Error when sending the Logo through usb.\r\n"));
Spinforever ();
}

Dwstartaddr = (DWORD) lpdes;

if (! Writelogotobootmedia (Dwstartaddr, (DWORD) (lcd_width*lcd_height*2), dwstartaddr))
{
Oalmsg (TRUE, (TEXT ("Error when writelogotobootmedia.\r\n")));
Spinforever ();
}
}

return 0;
}



sp5v210 Boot logo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.