This module manages the performance monitor unit's counters on ARM v7A
processors. This module does not manage the cycle counter. The cycle
counter is managed by the Timestamp module on most ARM cores.
The following is an example of how to configure one of the Pmu counters
to count L2 cache access events on a Cortex-A15 processor:
#include <ti/sysbios/family/arm/v7a/Pmu.h>
Int main(Int argc, char *argv[])
{
// Set L2 cache access as the event type for event counter 0.
// The event number corresponding to each event type can be determined
// using the Cortex-A15 reference manual.
Pmu_configureCounter(0, 0x16, FALSE);
// Reset the count
Pmu_resetCount(0);
// Start the counter
Pmu_startCounter(0);
// code
...
// Stop the counter
Pmu_stopCounter(0);
// Read and print the count
System_printf("L2 access count: %d\n", Pmu_getCount(0));
return 0;
}
var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
typedef Pmu_IntHandlerFuncPtr |
|
Pmu interrupt handler function type definition
typedef Void (*Pmu_IntHandlerFuncPtr)(UArg);
config Pmu_A_badIntNum // module-wide |
|
Assert raised when module cannot determine PMU interrupt number
for the given target/platform and the user is not providing the
interrupt number using intNum config param
config Pmu_A_invalidCounterId // module-wide |
|
Assert raised when invalid PMU counter Id passed
extern const Assert_Id Pmu_A_invalidCounterId;
config Pmu_intNum // module-wide |
|
A Hwi is created for the interrupt number 'pmuIntNum'
extern const UInt Pmu_intNum;
DETAILS
pmuIntNum specifies the interrupt number that is connected to the
nPMUIRQ signal from the PMU module.
Pmu_clearOverflowStatus() // module-wide |
|
Clear overflow status flag
Void Pmu_clearOverflowStatus(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Pmu_configureCounter() // module-wide |
|
Set the event type for an event counter and enable/disable
interrupt generation on a counter overflow
Void Pmu_configureCounter(UInt counterId, UInt eventNum, Bool interruptEnable);
ARGUMENTS
counterId
Event counter Id
eventNum
Event number
interruptEnable
Enable/Disable Interrupt generation
DETAILS
This function disables/stops the counter, sets the new event type,
enables/disables interrupt generation and then re-enables the
counter if it was enabled before.
Please refer the device's Technical Reference Manual for a list of
supported event types and their corresponding event numbers.
Pmu_disableInterrupt() // module-wide |
|
Disable interrupt generation on a counter overflow
Void Pmu_disableInterrupt(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Pmu_enableInterrupt() // module-wide |
|
Enable interrupt generation on a counter overflow
Void Pmu_enableInterrupt(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Pmu_getCount() // module-wide |
|
Read the event count
UInt32 Pmu_getCount(UInt counterId);
ARGUMENTS
counterId
Event counter Id
RETURNS
Event count
Pmu_getNumCounters() // module-wide |
|
Reads and returns the number of event counters
implemented in HW
UInt Pmu_getNumCounters();
Pmu_getOverflowStatus() // module-wide |
|
Returns a boolean indicating status of overflow flag
Bool Pmu_getOverflowStatus(UInt counterId);
ARGUMENTS
counterId
Event counter Id
RETURNS
Overflow status
Pmu_resetCount() // module-wide |
|
Reset the event counter's count to 0
Void Pmu_resetCount(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Pmu_setCount() // module-wide |
|
Set the event counter's count to counterVal
Void Pmu_setCount(UInt counterId, UInt32 counterVal);
ARGUMENTS
counterId
Event counter Id
counterVal
Counter value to set
Pmu_setInterruptFunc() // module-wide |
|
Set callback function
ARGUMENTS
interruptFunc
Callback function
DETAILS
When a counter overflow interrupt occurs, the registered
callback function is called with the contents of the Overflow
Flag Status Register passed as an argument. The overflow
status flag can be used to determine which counter generated
the interrupt when multiple counters are running with
overflow interrupt enabled.
Setting the callback function through this API overrides
the callback function set through
interruptFunc config param.
Pmu_startCounter() // module-wide |
|
Start an event counter
Void Pmu_startCounter(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Pmu_stopCounter() // module-wide |
|
Stop an event counter
Void Pmu_stopCounter(UInt counterId);
ARGUMENTS
counterId
Event counter Id
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool Pmu_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool Pmu_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 Pmu_Module_getMask();
// Returns the diagnostics mask for this module
Void Pmu_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module