module ti.sysbios.family.arm.v7a.Pmu

ARM Performance Monitoring Unit module

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. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/arm/v7a/Pmu.xdc
#include <ti/sysbios/family/arm/v7a/Pmu.h>
Functions
Void 
Void 
Void 
Void 
UInt32 
UInt 
Bool 
Void 
Void 
Void 
Void 
Void 
Functions common to all target modules
Typedefs
typedef Void 
Constants
extern const Assert_Id 
extern const Assert_Id 
extern const UInt 
 
DETAILS
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:
C source file:
  #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;
  }
*.cfg file:
  var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');

Calling Context

Function Hwi Swi Task Main Startup
configureCounter Y Y Y Y N
clearOverflowStatus Y Y Y Y N
disableInterrupt Y Y Y Y N
enableInterrupt Y Y Y Y N
getCount Y Y Y Y N
getOverflowStatus Y Y Y Y N
resetCount Y Y Y Y N
setCount Y Y Y Y N
setInterruptFunc Y Y Y Y N
startCounter Y Y Y Y N
stopCounter Y Y Y Y N
Definitions:
  • Hwi: API is callable from a Hwi thread.
  • Swi: API is callable from a Swi thread.
  • Task: API is callable from a Task thread.
  • Main: API is callable during any of these phases:
    • In your module startup after this module is started (e.g. PerfMonitor_Module_startupDone() returns TRUE).
    • During xdc.runtime.Startup.lastFxns.
    • During main().
    • During BIOS.startupFxns.
  • Startup: API is callable during any of these phases:
    • During xdc.runtime.Startup.firstFxns.
    • In your module startup before this module is started (e.g. Cache_Module_startupDone() returns FALSE).
 
typedef Pmu_IntHandlerFuncPtr

Pmu interrupt handler function type definition

C synopsis target-domain
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

C synopsis target-domain
extern const Assert_Id Pmu_A_badIntNum;
 
 
config Pmu_A_invalidCounterId  // module-wide

Assert raised when invalid PMU counter Id passed

C synopsis target-domain
extern const Assert_Id Pmu_A_invalidCounterId;
 
 
config Pmu_intNum  // module-wide

A Hwi is created for the interrupt number 'pmuIntNum'

C synopsis target-domain
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

C synopsis target-domain
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

C synopsis target-domain
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

C synopsis target-domain
Void Pmu_disableInterrupt(UInt counterId);
 
ARGUMENTS
counterId — Event counter Id
 
Pmu_enableInterrupt()  // module-wide

Enable interrupt generation on a counter overflow

C synopsis target-domain
Void Pmu_enableInterrupt(UInt counterId);
 
ARGUMENTS
counterId — Event counter Id
 
Pmu_getCount()  // module-wide

Read the event count

C synopsis target-domain
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

C synopsis target-domain
UInt Pmu_getNumCounters();
 
 
Pmu_getOverflowStatus()  // module-wide

Returns a boolean indicating status of overflow flag

C synopsis target-domain
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

C synopsis target-domain
Void Pmu_resetCount(UInt counterId);
 
ARGUMENTS
counterId — Event counter Id
 
Pmu_setCount()  // module-wide

Set the event counter's count to counterVal

C synopsis target-domain
Void Pmu_setCount(UInt counterId, UInt32 counterVal);
 
ARGUMENTS
counterId — Event counter Id
counterVal — Counter value to set
 
Pmu_setInterruptFunc()  // module-wide

Set callback function

C synopsis target-domain
Void Pmu_setInterruptFunc(Pmu_IntHandlerFuncPtr interruptFunc);
 
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

C synopsis target-domain
Void Pmu_startCounter(UInt counterId);
 
ARGUMENTS
counterId — Event counter Id
 
Pmu_stopCounter()  // module-wide

Stop an event counter

C synopsis target-domain
Void Pmu_stopCounter(UInt counterId);
 
ARGUMENTS
counterId — Event counter Id
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Pmu_Module_id();
// Get this module's unique id
 
Bool Pmu_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Pmu_Module_heap();
// 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
 
Configuration settings sourced in ti/sysbios/family/arm/v7a/Pmu.xdc
var Pmu = xdc.useModule('ti.sysbios.family.arm.v7a.Pmu');
module-wide config parameters
        msg: "A_badIntNum: Set PMU interrupt number using Pmu.intNum config param."
    };
        msg: "A_invalidCounterId: Invalid PMU counter Id passed."
    };
 
 
 
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

Configuration settings
Pmu.A_badIntNum = Assert.Desc {
    msg: "A_badIntNum: Set PMU interrupt number using Pmu.intNum config param."
};
 
C SYNOPSIS
 
config Pmu.A_invalidCounterId  // module-wide

Assert raised when invalid PMU counter Id passed

Configuration settings
Pmu.A_invalidCounterId = Assert.Desc {
    msg: "A_invalidCounterId: Invalid PMU counter Id passed."
};
 
C SYNOPSIS
 
config Pmu.intNum  // module-wide

A Hwi is created for the interrupt number 'pmuIntNum'

Configuration settings
Pmu.intNum = UInt (~0);
 
DETAILS
pmuIntNum specifies the interrupt number that is connected to the nPMUIRQ signal from the PMU module.
C SYNOPSIS
 
metaonly config Pmu.common$  // module-wide

Common module configuration parameters

Configuration settings
Pmu.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
 
metaonly config Pmu.interruptFunc  // module-wide

PMU overflow interrupt callback function pointer

Configuration settings
Pmu.interruptFunc = Void(*)(UArg) null;
 
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.
generated on Thu, 25 May 2017 22:10:01 GMT