Ethos-U Integration for Cortex-M
Ethos-U Driver
Loading...
Searching...
No Matches
Performance Monitoring Unit API

Control the Ethos-U Performance Monitoring Unit (PMU). More...

Functions

void ETHOSU_PMU_Enable (struct ethosu_driver *drv)
 Enable the PMU.
void ETHOSU_PMU_Disable (struct ethosu_driver *drv)
 Disable the PMU.
void ETHOSU_PMU_Set_EVTYPER (struct ethosu_driver *drv, uint32_t num, enum ethosu_pmu_event_type type)
 Set event to count for PMU eventer counter.
uint32_t ETHOSU_PMU_Get_NumEventCounters (void)
 Get number of PMU event counters.
uint32_t ETHOSU_PMU_Get_NumEventCountersForDrv (struct ethosu_driver *drv)
 Get number of PMU event counters for driver.
enum ethosu_pmu_event_type ETHOSU_PMU_Get_EVTYPER (struct ethosu_driver *drv, uint32_t num)
 Get event to count for PMU eventer counter.
void ETHOSU_PMU_CYCCNT_Reset (struct ethosu_driver *drv)
 Reset cycle counter.
void ETHOSU_PMU_EVCNTR_ALL_Reset (struct ethosu_driver *drv)
 Reset all event counters.
void ETHOSU_PMU_CNTR_Enable (struct ethosu_driver *drv, uint32_t mask)
 Enable counters.
void ETHOSU_PMU_CNTR_Disable (struct ethosu_driver *drv, uint32_t mask)
 Disable counters.
uint32_t ETHOSU_PMU_CNTR_Status (struct ethosu_driver *drv)
 Determine counters activation.
uint64_t ETHOSU_PMU_Get_CCNTR (struct ethosu_driver *drv)
 Read cycle counter (64 bit).
void ETHOSU_PMU_Set_CCNTR (struct ethosu_driver *drv, uint64_t val)
 Set cycle counter (64 bit).
uint32_t ETHOSU_PMU_Get_EVCNTR (struct ethosu_driver *drv, uint32_t num)
 Read event counter.
void ETHOSU_PMU_Set_EVCNTR (struct ethosu_driver *drv, uint32_t num, uint32_t val)
 Set event counter value.
uint32_t ETHOSU_PMU_Get_CNTR_OVS (struct ethosu_driver *drv)
 Read counter overflow status.
void ETHOSU_PMU_Set_CNTR_OVS (struct ethosu_driver *drv, uint32_t mask)
 Clear counter overflow status.
void ETHOSU_PMU_Set_CNTR_IRQ_Enable (struct ethosu_driver *drv, uint32_t mask)
 Enable counter overflow interrupt request.
void ETHOSU_PMU_Set_CNTR_IRQ_Disable (struct ethosu_driver *drv, uint32_t mask)
 Disable counter overflow interrupt request.
uint32_t ETHOSU_PMU_Get_IRQ_Enable (struct ethosu_driver *drv)
 Get counters overflow interrupt request stiinings.
void ETHOSU_PMU_CNTR_Increment (struct ethosu_driver *drv, uint32_t mask)
 Software increment event counter.
void ETHOSU_PMU_PMCCNTR_CFG_Set_Start_Event (struct ethosu_driver *drv, enum ethosu_pmu_event_type start_event)
 Set start event number for the cycle counter.
void ETHOSU_PMU_PMCCNTR_CFG_Set_Stop_Event (struct ethosu_driver *drv, enum ethosu_pmu_event_type stop_event)
 Set stop event number for the cycle counter.
uint32_t ETHOSU_PMU_Get_QREAD (struct ethosu_driver *drv)
 Read qread register.
uint32_t ETHOSU_PMU_Get_STATUS (struct ethosu_driver *drv)
 Read status register.

Description

Control the Ethos-U Performance Monitoring Unit (PMU).

The PMU provides a 64-bit cycle counter and programmable event counters. Use the symbolic values from enum ethosu_pmu_event_type to select events. See PMU example for a complete measurement example.

Function Documentation

◆ ETHOSU_PMU_Enable()

void ETHOSU_PMU_Enable ( struct ethosu_driver * drv)

Enable the PMU.

Parameters
[in]drvDriver handle

Enables the PMU and requests NPU power.

◆ ETHOSU_PMU_Disable()

void ETHOSU_PMU_Disable ( struct ethosu_driver * drv)

Disable the PMU.

Parameters
[in]drvDriver handle

Disables the PMU and releases its NPU power request.

◆ ETHOSU_PMU_Set_EVTYPER()

void ETHOSU_PMU_Set_EVTYPER ( struct ethosu_driver * drv,
uint32_t num,
enum ethosu_pmu_event_type type )

Set event to count for PMU eventer counter.

Parameters
[in]drvDriver handle
[in]numEvent counter (0-ETHOSU_PMU_NCOUNTERS) to configure
[in]typeEvent to count

Selects the event counted by an event counter.

◆ ETHOSU_PMU_Get_NumEventCounters()

uint32_t ETHOSU_PMU_Get_NumEventCounters ( void )

Get number of PMU event counters.

Returns
Number of event counters
Note
Not available when multi variant support is enabled, use the ETHOSU_PMU_Get_NumEventCountersForDrv function.

Returns the number of event counters implemented by the compile-time selected NPU. This function is available only in a single-variant build.

◆ ETHOSU_PMU_Get_NumEventCountersForDrv()

uint32_t ETHOSU_PMU_Get_NumEventCountersForDrv ( struct ethosu_driver * drv)

Get number of PMU event counters for driver.

Returns
Number of event counters
Parameters
drvDriver handle.

Returns the number of event counters implemented by the NPU associated with the supplied driver. This function is available in both build modes.

◆ ETHOSU_PMU_Get_EVTYPER()

enum ethosu_pmu_event_type ETHOSU_PMU_Get_EVTYPER ( struct ethosu_driver * drv,
uint32_t num )

Get event to count for PMU eventer counter.

Parameters
[in]drvDriver handle
[in]numEvent counter (0-ETHOSU_PMU_NCOUNTERS) to configure
Returns
type Event to count

Returns the event selected for an event counter.

◆ ETHOSU_PMU_CYCCNT_Reset()

void ETHOSU_PMU_CYCCNT_Reset ( struct ethosu_driver * drv)

Reset cycle counter.

Parameters
[in]drvDriver handle

Resets the cycle counter to zero.

◆ ETHOSU_PMU_EVCNTR_ALL_Reset()

void ETHOSU_PMU_EVCNTR_ALL_Reset ( struct ethosu_driver * drv)

Reset all event counters.

Parameters
drvDriver handle.

Resets all programmable event counters to zero.

◆ ETHOSU_PMU_CNTR_Enable()

void ETHOSU_PMU_CNTR_Enable ( struct ethosu_driver * drv,
uint32_t mask )

Enable counters.

Parameters
[in]drvDriver handle
[in]maskCounters to enable
Note
Enables one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)

Enables the counters selected by mask.

◆ ETHOSU_PMU_CNTR_Disable()

void ETHOSU_PMU_CNTR_Disable ( struct ethosu_driver * drv,
uint32_t mask )

Disable counters.

Parameters
[in]drvDriver handle
[in]maskCounters to disable
Note
Disables one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)

Disables the counters selected by mask.

◆ ETHOSU_PMU_CNTR_Status()

uint32_t ETHOSU_PMU_CNTR_Status ( struct ethosu_driver * drv)

Determine counters activation.

Parameters
[in]drvDriver handle
Returns
a bitmask where bit-set means:
  • event counters activated (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter activate (bit 31)
Note
ETHOSU specific. Usage breaks CMSIS complience

Returns the enabled state of the cycle and event counters.

◆ ETHOSU_PMU_Get_CCNTR()

uint64_t ETHOSU_PMU_Get_CCNTR ( struct ethosu_driver * drv)

Read cycle counter (64 bit).

Parameters
[in]drvDriver handle
Returns
Cycle count
Note
Two HW 32-bit registers that can increment independently in-between reads. To work-around raciness yet still avoid turning off the event both are read as one value twice. If the latter read is not greater than the former, it means overflow of LSW without incrementing MSW has occurred, in which case the former value is used.

Returns a consistent 64-bit cycle-counter value.

◆ ETHOSU_PMU_Set_CCNTR()

void ETHOSU_PMU_Set_CCNTR ( struct ethosu_driver * drv,
uint64_t val )

Set cycle counter (64 bit).

Parameters
[in]drvDriver handle
[in]valConter value
Note
Two HW 32-bit registers that can increment independently in-between reads. To work-around raciness, counter is temporary disabled if enabled.
ETHOSU specific. Usage breaks CMSIS complience

Sets the 64-bit cycle-counter value.

◆ ETHOSU_PMU_Get_EVCNTR()

uint32_t ETHOSU_PMU_Get_EVCNTR ( struct ethosu_driver * drv,
uint32_t num )

Read event counter.

Parameters
[in]drvDriver handle
[in]numEvent counter (0-ETHOSU_PMU_NCOUNTERS)
Returns
Event count

Returns the value of an event counter.

◆ ETHOSU_PMU_Set_EVCNTR()

void ETHOSU_PMU_Set_EVCNTR ( struct ethosu_driver * drv,
uint32_t num,
uint32_t val )

Set event counter value.

Parameters
[in]drvDriver handle
[in]numEvent counter (0-ETHOSU_PMU_NCOUNTERS)
[in]valConter value
Note
ETHOSU specific. Usage breaks CMSIS complience

Sets the value of an event counter.

◆ ETHOSU_PMU_Get_CNTR_OVS()

uint32_t ETHOSU_PMU_Get_CNTR_OVS ( struct ethosu_driver * drv)

Read counter overflow status.

Parameters
[in]drvDriver handle
Returns
Counter overflow status bits for the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS))
  • cycle counter (bit 31)

Returns the counter-overflow status bits.

◆ ETHOSU_PMU_Set_CNTR_OVS()

void ETHOSU_PMU_Set_CNTR_OVS ( struct ethosu_driver * drv,
uint32_t mask )

Clear counter overflow status.

Parameters
[in]drvDriver handle
[in]maskCounter overflow status bits to clear
Note
Clears overflow status bits for one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)

Clears the counter-overflow status bits selected by mask.

◆ ETHOSU_PMU_Set_CNTR_IRQ_Enable()

void ETHOSU_PMU_Set_CNTR_IRQ_Enable ( struct ethosu_driver * drv,
uint32_t mask )

Enable counter overflow interrupt request.

Parameters
[in]drvDriver handle
[in]maskCounter overflow interrupt request bits to set
Note
Sets overflow interrupt request bits for one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)

Enables overflow interrupt requests for the counters selected by mask.

◆ ETHOSU_PMU_Set_CNTR_IRQ_Disable()

void ETHOSU_PMU_Set_CNTR_IRQ_Disable ( struct ethosu_driver * drv,
uint32_t mask )

Disable counter overflow interrupt request.

Parameters
[in]drvDriver handle
[in]maskCounter overflow interrupt request bits to clear
Note
Clears overflow interrupt request bits for one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)

Disables overflow interrupt requests for the counters selected by mask.

◆ ETHOSU_PMU_Get_IRQ_Enable()

uint32_t ETHOSU_PMU_Get_IRQ_Enable ( struct ethosu_driver * drv)

Get counters overflow interrupt request stiinings.

Parameters
[in]drvDriver handle
Returns
mask Counter overflow interrupt request bits
Note
Sets overflow interrupt request bits for one or more of the following:
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)
ETHOSU specific. Usage breaks CMSIS compliance

Returns the counter-overflow interrupt enable bits.

◆ ETHOSU_PMU_CNTR_Increment()

void ETHOSU_PMU_CNTR_Increment ( struct ethosu_driver * drv,
uint32_t mask )

Software increment event counter.

Parameters
[in]drvDriver handle
[in]maskCounters to increment
  • event counters (bit 0-ETHOSU_PMU_NCOUNTERS)
  • cycle counter (bit 31)
Note
Software increment bits for one or more event counters.

Increments the event counters selected by mask in software.

◆ ETHOSU_PMU_PMCCNTR_CFG_Set_Start_Event()

void ETHOSU_PMU_PMCCNTR_CFG_Set_Start_Event ( struct ethosu_driver * drv,
enum ethosu_pmu_event_type start_event )

Set start event number for the cycle counter.

Parameters
[in]drvDriver handle
[in]start_eventEvent to trigger start of the cycle counter
Note
Sets the event number that starts the cycle counter.

Selects the event that starts the cycle counter.

◆ ETHOSU_PMU_PMCCNTR_CFG_Set_Stop_Event()

void ETHOSU_PMU_PMCCNTR_CFG_Set_Stop_Event ( struct ethosu_driver * drv,
enum ethosu_pmu_event_type stop_event )

Set stop event number for the cycle counter.

Parameters
[in]drvDriver handle
[in]stop_eventEvent number
Note
Sets the event number that stops the cycle counter.

Selects the event that stops the cycle counter.

◆ ETHOSU_PMU_Get_QREAD()

uint32_t ETHOSU_PMU_Get_QREAD ( struct ethosu_driver * drv)

Read qread register.

Parameters
[in]drvDriver handle
Returns
QREAD register value

Returns the PMU QREAD register value.

◆ ETHOSU_PMU_Get_STATUS()

uint32_t ETHOSU_PMU_Get_STATUS ( struct ethosu_driver * drv)

Read status register.

Parameters
[in]drvDriver handle
Returns
STATUS register value

Returns the PMU status register value.