[architecture]-Generic Timer

269 篇文章 400 订阅

快速链接:
.
👉👉👉 个人博客笔记导读目录(全部) 👈👈👈

在这里插入图片描述

前言:
什么是arch timer? 什么是apb timer? 什么generic timer?
自己悟去吧😁😁😁

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值相等


  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

代码改变世界ctw

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值