sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// T_VIDEOMEMORY.CPP
|
sl@0
|
15 |
// Overview:
|
sl@0
|
16 |
// Test the video driver kernel extension that provides chunk handle to access video memory.
|
sl@0
|
17 |
// This executable is a second process that is started by the main t_videomemory test process.
|
sl@0
|
18 |
// API Information:
|
sl@0
|
19 |
// HAL, UserSvr
|
sl@0
|
20 |
// Details:
|
sl@0
|
21 |
// - Check that we can get a chunk and that we can read/write the memory belonging to that chunk.
|
sl@0
|
22 |
// - When this process exits, the main process will check that the value has changed in it's copy
|
sl@0
|
23 |
// - of the chunk.
|
sl@0
|
24 |
// Platforms/Drives/Compatibility:
|
sl@0
|
25 |
// All.
|
sl@0
|
26 |
// Assumptions/Requirement/Pre-requisites:
|
sl@0
|
27 |
// Failures and causes:
|
sl@0
|
28 |
// Base Port information:
|
sl@0
|
29 |
//
|
sl@0
|
30 |
//
|
sl@0
|
31 |
|
sl@0
|
32 |
#include <e32test.h>
|
sl@0
|
33 |
#include <videodriver.h>
|
sl@0
|
34 |
#include <hal.h>
|
sl@0
|
35 |
#include <e32svr.h>
|
sl@0
|
36 |
#include <dispchannel.h>
|
sl@0
|
37 |
#include "t_videomemory.h"
|
sl@0
|
38 |
|
sl@0
|
39 |
LOCAL_D RTest test(_L("T_VIDEOMEMPROCESS"));
|
sl@0
|
40 |
|
sl@0
|
41 |
#ifndef __WINS__
|
sl@0
|
42 |
#define DUMP(x) test.Printf(_L(#x"= %d =0x%08x\n"), x, x)
|
sl@0
|
43 |
#endif
|
sl@0
|
44 |
|
sl@0
|
45 |
|
sl@0
|
46 |
LOCAL_C TInt RunTestsForScreen(TInt aScreenID)
|
sl@0
|
47 |
{
|
sl@0
|
48 |
TInt ret = KErrNone;
|
sl@0
|
49 |
|
sl@0
|
50 |
test.Next(_L("Checking Display Handle"));
|
sl@0
|
51 |
// Second basic test. Use the HAL to fetch a handle
|
sl@0
|
52 |
// to the display memory.
|
sl@0
|
53 |
// Check that the handle is not zero.
|
sl@0
|
54 |
// Get the base-address of the chunk.
|
sl@0
|
55 |
// Write this base address with a new value.
|
sl@0
|
56 |
// Read with the chunk base address to see that teh new value is there.
|
sl@0
|
57 |
// Read the memory address from the above test and check that it changed
|
sl@0
|
58 |
// to the new value.
|
sl@0
|
59 |
// Note that the memory address from above test MAY NOT BE SET - so
|
sl@0
|
60 |
// check to see if it's non-zero first.
|
sl@0
|
61 |
|
sl@0
|
62 |
TInt handle = 0;
|
sl@0
|
63 |
volatile TUint32 *pChunkBase = 0;
|
sl@0
|
64 |
ret = HAL::Get(aScreenID, HALData::EDisplayMemoryHandle,handle);
|
sl@0
|
65 |
test ((KErrNone == ret || KErrNotSupported == ret));
|
sl@0
|
66 |
if (KErrNone == ret)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
test(0 != handle);
|
sl@0
|
69 |
RChunk chunk;
|
sl@0
|
70 |
ret = chunk.SetReturnedHandle(handle);
|
sl@0
|
71 |
test(KErrNone == ret);
|
sl@0
|
72 |
if (KErrNone != ret)
|
sl@0
|
73 |
{
|
sl@0
|
74 |
return ret;
|
sl@0
|
75 |
}
|
sl@0
|
76 |
|
sl@0
|
77 |
pChunkBase = reinterpret_cast<TUint32 *>(chunk.Base());
|
sl@0
|
78 |
test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TInt>(pChunkBase));
|
sl@0
|
79 |
// Now check that we can read and write the memory that the chunk holds:
|
sl@0
|
80 |
// First check that it contains what we expect.
|
sl@0
|
81 |
test(KTestValue3 == *pChunkBase);
|
sl@0
|
82 |
|
sl@0
|
83 |
// Now check that we can CHANGE it.
|
sl@0
|
84 |
*pChunkBase = KTestValue4;
|
sl@0
|
85 |
test(KTestValue4 == *pChunkBase);
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
return KErrNone;
|
sl@0
|
89 |
}
|
sl@0
|
90 |
|
sl@0
|
91 |
|
sl@0
|
92 |
|
sl@0
|
93 |
GLDEF_C TInt E32Main()
|
sl@0
|
94 |
//
|
sl@0
|
95 |
//
|
sl@0
|
96 |
{
|
sl@0
|
97 |
test.Title();
|
sl@0
|
98 |
|
sl@0
|
99 |
#if defined(__EPOC32__) && defined(__CPU_X86)
|
sl@0
|
100 |
test.Printf(_L("Doesn't run on X86\n"));
|
sl@0
|
101 |
#else
|
sl@0
|
102 |
TInt ret = KErrNone;
|
sl@0
|
103 |
|
sl@0
|
104 |
TInt screen;
|
sl@0
|
105 |
User::GetTIntParameter(12, screen);
|
sl@0
|
106 |
|
sl@0
|
107 |
test.Start(_L("Testing Video Memory HAL interfaces (second process)"));
|
sl@0
|
108 |
|
sl@0
|
109 |
//Hack: Only use screen 0 for now - use passed argument(s) later on.
|
sl@0
|
110 |
ret = RunTestsForScreen(screen);
|
sl@0
|
111 |
test((ret == KErrNone));
|
sl@0
|
112 |
#endif
|
sl@0
|
113 |
|
sl@0
|
114 |
return KErrNone;
|
sl@0
|
115 |
}
|