Imagination PowerVR SDK Blog

PVRScope example code seems doesn't work.

pvrscope

#1

Hi, I’ve tried to compile example code copy from PVRScope user manual, the code listed below:


```
#include "PVRScope.h"



int main(void)

{

// Create the PVRScope data storage area

SPVRScopeImplData* scopeData;

// Initialise PVRScope

const EPVRScopeInitCode returnCode = PVRScopeInitialise(scopeData);

// Check initialisation succeeded

if(returnCode != ePVRScopeInitCodeOk)

{

// Handle the error

}

// Create an array of counter definitions

unsigned int numCounters = 0;

SPVRScopeCounterDef *counterArray = 0;

// Create the data structure to contain the counter readings

SPVRScopeCounterReading counterReadings;

// Continue initialisation

if(scopeData)

{

PVRScopeGetCounters(scopeData, &numCounters, &counterArray, &counterReadings);

}



// Select the desired counter group (3 in this instance)

unsigned int desiredGroup = 3;

// Store which group is currently active

unsigned int activeGroup = 0;

// Do a quick check to save some processing

if(desiredGroup == activeGroup)

desiredGroup = 0xffffffff;

// Update the counters and store the active group

if(PVRScopeReadCountersThenSetGroup(scopeData, &counterReadings, desiredGroup))

activeGroup = counterReadings.nReadingActiveGroup;

// Read the counters from the above group, and process them accordingly.

// The counters will match (in order) the elements in ‘counterArray’ whose group

// matches ‘counterReadings.nReadingActiveGroup’



// De-initialise PVRScope

PVRScopeDeInitialise(&scopeData, &counterArray, &counterReadings);



return 0;

}
<font color="#0000ff"><br></font>
```<pre>then i compile it:</pre>```
<font color="#0000ff">gcc pvrtest.c</font>

A lot of errors were printed:

<font color="#0000ff">In file included from pvrtest.c:1:<br />
PVRScope.h:42: error: expected specifier-qualifier-list before ‘bool’<br />
PVRScope.h:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeInitialise’<br />
PVRScope.h:75: error: expected ‘)’ before ‘*’ token<br />
PVRScope.h:84: error: expected ‘)’ before ‘*’ token<br />
PVRScope.h:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeGetCounters’<br />
PVRScope.h:106: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeReadCountersThenSetGroup’<br />
PVRScope.h:141: error: expected specifier-qualifier-list before ‘ESPSCommsLibType’<br />
PVRScope.h:166: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token<br />
PVRScope.h:169: error: expected ‘)’ before ‘*’ token<br />
PVRScope.h:173: error: expected ‘)’ before ‘&’ token<br />
PVRScope.h:181: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplSendMark’<br />
PVRScope.h:187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplLibraryCreate’<br />
PVRScope.h:196: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplLibraryDirtyGetFirst’<br />
PVRScope.h:203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplCountersCreate’<br />
PVRScope.h:212: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplCountersUpdate’<br />
pvrtest.c: In function ‘main’:<br />
pvrtest.c:7: error: ‘SPVRScopeImplData’ undeclared (first use in this function)<br />
pvrtest.c:7: error: (Each undeclared identifier is reported only once<br />
pvrtest.c:7: error: for each function it appears in.)<br />
pvrtest.c:7: error: ‘scopeData’ undeclared (first use in this function)<br />
pvrtest.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘returnCode’<br />
pvrtest.c:9: error: ‘returnCode’ undeclared (first use in this function)<br />
pvrtest.c:17: error: ‘SPVRScopeCounterDef’ undeclared (first use in this function)<br />
pvrtest.c:17: error: ‘counterArray’ undeclared (first use in this function)<br />
pvrtest.c:19: error: ‘SPVRScopeCounterReading’ undeclared (first use in this function)<br />
pvrtest.c:19: error: expected ‘;’ before ‘counterReadings’<br />
pvrtest.c:23: error: ‘counterReadings’ undeclared (first use in this function)</font>
```<pre>My os is 64-bit Ubuntu 10.10. Since the code is exactly copied from offical user manual, i don't know what's wrong with it. Any help will be greatly appreciated. </pre></div>

#2

Hi,
It is a known bug that the code in this manual is broken. You should instead use the source from the PVRScope examples as a starting point for your implementation of this API.

Regards,
Joe