applications/SymbianLogo_TextShell/SymbianLogo.cpp
changeset 19 2dd1d22cb0f3
equal deleted inserted replaced
18:0b7d3b28f025 19:2dd1d22cb0f3
       
     1 /*******************************************************************************
       
     2 * Copyright (c) 2009 Accenture
       
     3 * All rights reserved. This program and the accompanying materials
       
     4 * are made available under the terms of the Eclipse Public License v1.0
       
     5 * which accompanies this distribution, and is available at
       
     6 * http://www.eclipse.org/legal/epl-v10.html
       
     7 *
       
     8 * Contributors:
       
     9 * Accenture - Johnathan White
       
    10 
       
    11 *******************************************************************************/
       
    12 // SymbianLogo.cpp
       
    13 
       
    14 #include <e32std.h>
       
    15 #include <e32cons.h>
       
    16 #include <f32file.h>
       
    17 #include <hal.h>
       
    18 #include <S32FILE.H> 
       
    19 
       
    20 void SetupConsoleL();
       
    21 void DisplayLogoL(CConsoleBase* aConsole);
       
    22 
       
    23 CConsoleBase* console;
       
    24 
       
    25 GLDEF_C TInt E32Main()									
       
    26     {
       
    27 	CTrapCleanup* cleanup=CTrapCleanup::New();			
       
    28 	TRAPD(error,SetupConsoleL());	
       
    29 	if(error)
       
    30 		RDebug::Printf("SymbianLogo SetupError %d", error);
       
    31 	delete cleanup;										
       
    32 	return 0;									
       
    33     }
       
    34 
       
    35 void SetupConsoleL()									
       
    36     {
       
    37 	console=Console::NewL(_L("SymbianLogo"),
       
    38 	TSize(KConsFullScreen,KConsFullScreen));
       
    39 	
       
    40 	CleanupStack::PushL(console);
       
    41 	TRAPD(error,DisplayLogoL(console));					
       
    42 	if(error)
       
    43 		RDebug::Printf("SymbianLogo DisplayLogo Error %d", error);
       
    44 	CleanupStack::PopAndDestroy();						
       
    45     }
       
    46 
       
    47 
       
    48 GLDEF_C void DisplayLogoL(CConsoleBase* aConsole)
       
    49     {
       
    50 	TInt err =KErrNone;
       
    51 
       
    52 	//Connect to FileServer
       
    53     RFs fs;
       
    54     err = fs.Connect();
       
    55 
       
    56 	User::LeaveIfError(err);
       
    57     
       
    58 	//Open file 
       
    59 	
       
    60 	/*
       
    61 	File \sf\adaptation\qemu\baseport\syborg\syborg.dts contains board model description, the hostfs@0 block defines both the host path
       
    62 	and target drive. The hostpath is by default set to \svphostfs\ and default drive number is 19 (S:\). If you would like to change this 
       
    63 	edit the dts file and use arm-none-symbianelf-dtc.exe to create updated dtb file
       
    64 	*/
       
    65     RFile file; 
       
    66     err = file.Open(fs, _L("S:\\symbian_logo.bmp"), EFileRead);
       
    67     
       
    68 	User::LeaveIfError(err);
       
    69 
       
    70 	//Use to read stream from file on HostFs, first 54 bytes are header so skip
       
    71 	/*
       
    72 	symbian_logo.bmp is a 480*480 bmp file
       
    73 	*/
       
    74     RFileReadStream filestream(file, 54);
       
    75     
       
    76 	
       
    77 	//Obtain base address of framebuffer which will copy bitmap data into to display
       
    78     TInt iScreenAddress;
       
    79     HAL::Get(HAL::EDisplayMemoryAddress, iScreenAddress);
       
    80 	TUint8* pointer = (TUint8*)iScreenAddress;
       
    81     
       
    82 
       
    83 
       
    84 
       
    85     pointer+=640*479*4; //bitmap is 480*480 where as display is 640 *640, start by incrementing display pointer to last line required
       
    86 	for(TInt i=0;i<480;i++)
       
    87 		{
       
    88 		for(TInt j=0;j<1920;j++)
       
    89     		{
       
    90 			*pointer = filestream.ReadUint8L(); //reads byte from file into correct offset in framebuffer
       
    91 			pointer++;
       
    92     		}
       
    93 		
       
    94 		pointer-=1920; //decrement over offset between each line
       
    95 		pointer-=640*4; //decrement to start of next line    
       
    96 	}
       
    97     
       
    98     //Wait for User to press key then return
       
    99 	aConsole->Getch();
       
   100 	return;
       
   101 	}