Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\apb_timer.c Create Date:2022-07-28 08:43:30
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:alled before apb_timer_enable, use early map

Proto:unsigned long apbt_quick_calibrate(void)

Type:unsigned long

Parameter:Nothing

355  khz = 0
358  apbt_set_mapping()
359  dw_apb_clocksource_start(clocksource_apbt)
362  old = dw_apb_clocksource_read(clocksource_apbt)
363  i = 10000
364  When --i cycle
365  If old != dw_apb_clocksource_read(clocksource_apbt) Then Break
368  If Not i Then Go to failed
372  loop = Common DW APB timer info / 1000 << 4
375  dw_apb_clocksource_start(clocksource_apbt)
377  old = dw_apb_clocksource_read(clocksource_apbt)
378  old += loop
380  t1 = dtsc() - returns the current TSC without ordering constraints* rdtsc() returns the result of RDTSC as a 64-bit integer
382  Do
383  new = dw_apb_clocksource_read(clocksource_apbt)
384  When new < old cycle
386  t2 = dtsc() - returns the current TSC without ordering constraints* rdtsc() returns the result of RDTSC as a 64-bit integer
388  shift = 5
389  If Value for the false possibility is greater at compile time(loop >> shift == 0) Then
390  printk(formational "APBT TSC calibration failed, not enough resolution\n")
392  Return 0
394  scale = div_u64 - unsigned 64bit divide with 32bit divisor*@dividend: unsigned 64bit dividend*@divisor: unsigned 32bit divisor* This is the most common 64bit divide and should be used if possible,* as many 32bit archs can optimize this variant better than a full
395  khz = scale * Common DW APB timer info / 1000 >> shift
396  printk(formational "TSC freq calculated by APB timer is %lu khz\n", khz)
397  Return khz
398  failed :
399  Return 0