Other Parts Discussed in Thread: SYSCONFIG
器件型号: AM2434
主题: SysConfig 中讨论的其他器件
大家好、我们使用的是工业通信 SDK 11.00.00.13。
我们还使用 GTC 来实现内核之间的时间测量。 我们刚刚注意到、当我们将 GTC 测量时间与通过两个 GPIO 测量的时间进行比较时、发现差异为 17%。
例如、我们在 GTC 开始和结束测量后、通过设置的两个 GPIO 测量了 109ms 的值。 GTC 的测量值为 93117us。
我们的一切工作方式:
/* the clock rate to calculate with */
static uint64_t clkRate = 0;
static bool initialized = false;
void implTimeMeasureInitialize()
{
uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
clkRate = HW_RD_REG32((baseAddr + CSL_GTC_CFG1_CNTFID0));
/* initialization moved to bootloader, since mutliple cores calling this function will cause problems */
initialized = true;
}
uint64_t implTimeMeasureMicros()
{
if(initialized)
{
return (GTC_getCount64()/(clkRate/1000000));
}
else
{
return 0;
}
}
在引导加载程序中:
uint64_t clkRate = 0;
/* initialize GTC */
uint32_t baseAddr = (uint32_t) AddrTranslateP_getLocalAddr(CSL_GTC0_GTC_CFG1_BASE);
clkRate = HW_RD_REG32((baseAddr + CSL_GTC_CFG1_CNTFID0));
uint32_t value = 0;
value = HW_RD_REG32(baseAddr);
if( (clkRate == 0) || ((value & CSL_GTC_CFG1_CNTCR_EN_MASK) != CSL_GTC_CFG1_CNTCR_EN_MASK))
{
GTC_init();
// just for debuging
SOC_moduleGetClockFrequency(TISCI_DEV_GTC0, TISCI_DEV_GTC0_GTC_CLK, &clkRate);
}
else
{
// nothing
}
测量:
uint64_t firstVal = 0; uint64_t secondVal = 0; uint64_t resultVal = 0; firstVal = implTimeMeasureMicros(); // set GPIO here // stuff happens secondVal = implTimeMeasureMicros(); // unset GPIO here resultVal = secondVal - firstVal; // <-- this value differs from the scope-measured time of gpio set and unset by 17%
我们在这里怎么做?
此致
Felix Heil







