Hi,
we have a 66ak2e05 with default Linux image on it (MCSDK 3.01.04_04). Instead of unprecise std::chrono::steady_clock::now() to measure time between events in code, I want to switch to hardware timer to get high precision timer.
This is exactly what is stated in documentation:
"The timers can be used to time events, count events, generate pulses, interrupt the C66x CorePacs and ARM CorePac and send synchronization events to the EDMA3 channel controller."
Still according to documentation, I can use Timer16 for core A15-0 or Timer8 to Timer15 as general purpose timer:
"The 66AK2E0x device has up to twenty 64-bit timers in total, but only 13 timers are used in 66AK2E05 and 12 timers are used in 66AK2E02, of which Timer0 is dedicated to the C66x CorePacs Core 0 as watchdog timers and can also be used as general-purpose timers. Timer16 and Timer17 (66AK2E02) or Timer16 through Timer19 (66AK2E05) are dedicated to each of the Cortex-A15 processor cores as a watchdog timer and can also be used as general-purpose timers. The Timer8 through Timer15 can be configured as general-purpose timers only, with each timer programmed as a 64-bit timer or as two separate 32-bit timers."
I found code example with CSL library:
// Clear local data structures memset(&tmrObj_, 0, sizeof(CSL_TmrObj)); hTmr_ = CSL_tmrOpen(&tmrObj_, 0, NULL, &status_); if (hTmr_ == NULL){return false;} hwSetup_ = CSL_TMR_HWSETUP_DEFAULTS; timeCountMode_ = CSL_TMR_ENAMODE_CONT; /* Set the timer mode to 64bit GP Timer Mode and set the PRD registers */ hwSetup_.tmrTimerMode = CSL_TMR_TIMMODE_GPT; hwSetup_.tmrTimerPeriodLo = 0x0f; hwSetup_.tmrTimerPeriodHi = 0x00; CSL_tmrHwSetup(hTmr_, &hwSetup_); /* Reset the Timer */ CSL_tmrHwControl(hTmr_, CSL_TMR_CMD_RESET64, NULL); /* Start the timer in CONTINUOUS Mode. */ CSL_tmrHwControl(hTmr_, CSL_TMR_CMD_START64, (void *)&timeCountMode_);
It compiles but linker has issues since I did not link to the right library.
Is it the right way to do? If yes, which library do I need to link to? If no, where can I find a project code example for Timer 64 for Cortex-A15 of 66AK2E05 soc (either for MCSDK or Processor SDK)?