// CPU Performance monitoring counters API /*---------------------------------------------------------------------------* Project: PMCPU Library File: pmcpu.h Copyright (C) Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __PMCPU_H #define __PMCPU_H #ifdef __cplusplus extern "C" { #endif #include #include typedef enum { PMC_ACTION_NONE, PMC_ACTION_STOP, PMC_ACTION_CLEAR_START, PMC_ACTION_RESUME, PMC_ACTION_CLEAR } PMCPUAction; //This is not used in current version - for later use typedef enum { PMC_MODE_ALL, PMC_MODE_USER, PMC_MODE_SUPERVISOR } PMCPUMode; //This is not used in current version - for later use // Basic structure of the Group to be used for typedef struct { u32 pmc_e1; // PMC Event for Counter 1 - Allowed events listed in ppc_asm_user.h u32 pmc_e2; u32 pmc_e3; u32 pmc_e4; u32 pm_mask; // Internal mask value for the group u32 pmc1; // Counter values after a read operation as set according to PMCSetGroup u32 pmc2; u32 pmc3; u32 pmc4; } PMCPUGroup; // Set Group pmc1 through pmc4 are the events desired, 0 for no use of the counter void PMCPUSetGroup(PMCPUGroup *group, u32 e1, u32 e2, u32 e3, u32 e4); //Start counting for *group -- this also acts as a resume void PMCPUStartGroup(PMCPUGroup *group); void PMCPUResetStartGroup(PMCPUGroup *pmc_g); //Stop counting for *group void PMCPUStopGroup(PMCPUGroup *group); //Read the counter values for the group. e.g. group->pmc1 gives the read out of counter 1, etc. void PMCPUReadGroup(PMCPUGroup *group); //Reset the group counters to zero void PMCPUResetGroup(PMCPUGroup *group); #ifdef __cplusplus } #endif #endif // __PMPU_H