PVRScope example code seems doesn’t work.

This topic contains 1 reply, has 2 voices, and was last updated by  Joe Davis 5 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30904

    y1m1n9
    Member

    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;
    }

    then i compile it:
    gcc pvrtest.c
    A lot of errors were printed:
    In file included from pvrtest.c:1:
    PVRScope.h:42: error: expected specifier-qualifier-list before ‘bool’
    PVRScope.h:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeInitialise’
    PVRScope.h:75: error: expected ‘)’ before ‘*’ token
    PVRScope.h:84: error: expected ‘)’ before ‘*’ token
    PVRScope.h:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeGetCounters’
    PVRScope.h:106: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PVRScopeReadCountersThenSetGroup’
    PVRScope.h:141: error: expected specifier-qualifier-list before ‘ESPSCommsLibType’
    PVRScope.h:166: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
    PVRScope.h:169: error: expected ‘)’ before ‘*’ token
    PVRScope.h:173: error: expected ‘)’ before ‘&’ token
    PVRScope.h:181: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplSendMark’
    PVRScope.h:187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplLibraryCreate’
    PVRScope.h:196: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplLibraryDirtyGetFirst’
    PVRScope.h:203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplCountersCreate’
    PVRScope.h:212: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pplCountersUpdate’
    pvrtest.c: In function ‘main’:
    pvrtest.c:7: error: ‘SPVRScopeImplData’ undeclared (first use in this function)
    pvrtest.c:7: error: (Each undeclared identifier is reported only once
    pvrtest.c:7: error: for each function it appears in.)
    pvrtest.c:7: error: ‘scopeData’ undeclared (first use in this function)
    pvrtest.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘returnCode’
    pvrtest.c:9: error: ‘returnCode’ undeclared (first use in this function)
    pvrtest.c:17: error: ‘SPVRScopeCounterDef’ undeclared (first use in this function)
    pvrtest.c:17: error: ‘counterArray’ undeclared (first use in this function)
    pvrtest.c:19: error: ‘SPVRScopeCounterReading’ undeclared (first use in this function)
    pvrtest.c:19: error: expected ‘;’ before ‘counterReadings’
    pvrtest.c:23: error: ‘counterReadings’ undeclared (first use in this function)
    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. 
    #35938

    Joe Davis
    Member

    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

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.