First public contribution.
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 // Test the video driver kernel extension that provides chunk handle to access video memory.
17 // This executable is a second process that is started by the main t_videomemory test process.
21 // - Check that we can get a chunk and that we can read/write the memory belonging to that chunk.
22 // - When this process exits, the main process will check that the value has changed in it's copy
24 // Platforms/Drives/Compatibility:
26 // Assumptions/Requirement/Pre-requisites:
27 // Failures and causes:
28 // Base Port information:
33 #include <videodriver.h>
36 #include <dispchannel.h>
37 #include "t_videomemory.h"
39 LOCAL_D RTest test(_L("T_VIDEOMEMPROCESS"));
42 #define DUMP(x) test.Printf(_L(#x"= %d =0x%08x\n"), x, x)
46 LOCAL_C TInt RunTestsForScreen(TInt aScreenID)
50 test.Next(_L("Checking Display Handle"));
51 // Second basic test. Use the HAL to fetch a handle
52 // to the display memory.
53 // Check that the handle is not zero.
54 // Get the base-address of the chunk.
55 // Write this base address with a new value.
56 // Read with the chunk base address to see that teh new value is there.
57 // Read the memory address from the above test and check that it changed
59 // Note that the memory address from above test MAY NOT BE SET - so
60 // check to see if it's non-zero first.
63 volatile TUint32 *pChunkBase = 0;
64 ret = HAL::Get(aScreenID, HALData::EDisplayMemoryHandle,handle);
65 test ((KErrNone == ret || KErrNotSupported == ret));
70 ret = chunk.SetReturnedHandle(handle);
71 test(KErrNone == ret);
77 pChunkBase = reinterpret_cast<TUint32 *>(chunk.Base());
78 test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TInt>(pChunkBase));
79 // Now check that we can read and write the memory that the chunk holds:
80 // First check that it contains what we expect.
81 test(KTestValue3 == *pChunkBase);
83 // Now check that we can CHANGE it.
84 *pChunkBase = KTestValue4;
85 test(KTestValue4 == *pChunkBase);
93 GLDEF_C TInt E32Main()
99 #if defined(__EPOC32__) && defined(__CPU_X86)
100 test.Printf(_L("Doesn't run on X86\n"));
105 User::GetTIntParameter(12, screen);
107 test.Start(_L("Testing Video Memory HAL interfaces (second process)"));
109 //Hack: Only use screen 0 for now - use passed argument(s) later on.
110 ret = RunTestsForScreen(screen);
111 test((ret == KErrNone));