AM261x MCU+ SDK: APIs for Counting CPU Cycles

| AM261x MCU+ SDK 26.00.00 |

Functions
APIs for Counting CPU Cycles
APIs for Driver Porting Layer

## Introduction

For more details and example usage, see Cycle Counter

## Functions
void | CycleCounterP_init (const uint64_t cpuFreqHz)
| initialize PMU Cycle Counter More...
uint32_t | CycleCounterP_getCount32 (void)
| Get 32b CPU cycle counter value. More...
void | CycleCounterP_reset (void)
| Enable, reset, clear overflow for CPU cycle counter. More...
uint64_t | CycleCounterP_getCount64 (void)
| Get 64b CPU cycle counter value. More...
uint64_t | CycleCounterP_nsToTicks (const uint64_t nanosecs)
| API function to convert nanosecs to PMU counter ticks. More...
void | CycleCounterP_enableUserAccess (void)
| Enable User mode access to performance monitor and validation registers. More...

## Function Documentation

## ◆ CycleCounterP_init()

void CycleCounterP_init | ( | const uint64_t | cpuFreqHz | ) |

initialize PMU Cycle Counter

## ◆ CycleCounterP_getCount32()

uint32_t CycleCounterP_getCount32 | ( | void |  | ) |

Get 32b CPU cycle counter value.

Make sure to handle overflow condition in your application.

Returns
  32b cycle counter value

## ◆ CycleCounterP_reset()

void CycleCounterP_reset | ( | void |  | ) |

Enable, reset, clear overflow for CPU cycle counter.

- Call this API atleast once before using CycleCounterP_getCount32() to reset and enable the counter
- Call this API to reset counter to zero.

## ◆ CycleCounterP_getCount64()

uint64_t CycleCounterP_getCount64 | ( | void |  | ) |

Get 64b CPU cycle counter value.

Only support with below CPUs,

- A53

Returns
  64b cycle counter value

## ◆ CycleCounterP_nsToTicks()

uint64_t CycleCounterP_nsToTicks | ( | const uint64_t | nanosecs | ) |

API function to convert nanosecs to PMU counter ticks.

Parameters

  nanosecs | time unit in nano sec

Returns
  PMU counter ticks

## ◆ CycleCounterP_enableUserAccess()

void CycleCounterP_enableUserAccess | ( | void |  | ) |

Enable User mode access to performance monitor and validation registers.

This API should be called from Privileged mode before calling any other CycleCounterP APIs from user mode.