[architecture]-Generic Timer
快速鏈接:
.
👉👉👉 個人博客筆記導讀目錄(全部) 👈👈👈
前言:
什么是arch timer? 什么是apb timer? 什么generic timer?
自己悟去吧😁😁😁
文章目錄
- 1、architecture
- 2、processor中有哪些timer?
- 3、寄存器介紹
- (1)、Count and frequency
- (2)、Timer registers
- (3)、Accessing the timers
- 4、Configuring a timer
- 4、中斷
- 5、Timer virtualization
1、architecture
generic Timer由System Counter和per-core timer組成.
System Counter提供固定頻率的counter,56-64bits寬度,1MHZ-50MHZ
2、processor中有哪些timer?
3、寄存器介紹
(1)、Count and frequency
CNTPCT_EL0:reports the current system count value
CNTFRQ_EL0:reports the frequency of the system count
(2)、Timer registers
主要有三個寄存器:
前綴是:
(3)、Accessing the timers
? EL1 Physical and Virtual Timers
EL0 access to these timers is controlled by CNTKCTL_EL1.
? EL2 Physical and Virtual Timers
When HCR_EL2.{TGE,E2H}=={1,1}, EL0 access to these timers is controlled by CNTKCTL_EL2:. These timers were added as part of the support for the Armv8.1-A Virtualization Host Extension, which is beyond the scope of this
guide
? EL3 physical timer
S.EL1 and S.EL2 access to this timer is controlled by SCR_EL3.ST.
4、Configuring a timer
使用timer有兩種方式:
- 使用CVAL, CVAL是64位的寄存器;
Timer Condition Met: CVAL <= System Count - 使用TVAL, TVAL是32位的寄存器, TVAL隨著system conter值的增加而減小.
CVAL = TVAL + System Counter
Timer Condition Met: CVAL <= System Count
4、中斷
timer產生的中斷,只可以routing到當前core
timer中斷的控制,在CTL寄存器中
? ENABLE – Enables the timer.
? IMASK – Interrupt mask. Enables or disables interrupt generation.
? ISTATUS – When ENABLE==1, reports whether the timer is firing (CVAL <= System Count).
Must set ENABLE to 1 and clear IMASK to 0
The interrupt ID (INTID)由SBSA文檔定義推薦的值, 注:Server Base System Architecture (SBSA)
中斷產生之后,會持續輸出中斷,直到如下條件發生:
? IMASK is set to one, which masks the interrupt.
? ENABLE is cleared to 0, which disables the timer.
? TVAL or CVAL is written, so that firing condition is no longer met.
所以在產生一個timer中斷后,軟件需要在該中斷變為deactivating之前,清除該中斷。
5、Timer virtualization
Virtual Count = Physical Count -
CNTVOFF_EL2配置offset,CNTVOFF_EL2只可以在EL3或EL2中訪問
如果EL2沒有使用,那么offset為0,此時虛擬counter和物理conter值相等
總結
以上是生活随笔為你收集整理的[architecture]-Generic Timer的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: optee的Offline Signin
- 下一篇: github:已经提交并push后再次追