您尚未登录。

楼主 #1 2020-12-29 22:23:33

xiaohui
会员
注册时间: 2019-01-15
已发帖子: 259
积分: 162.5

关于risc-v的mtime的简单描述

关于risc-v的mtime的简单描述
在risc-v里mtime是作为外设存在的,他的寄存器地址不在risc-v的规范范围内,是有soc设计厂商自己定义的。mtime包括了两个寄存器mtimemtimecmp。这两个寄存器的长度在官方的规范里规定是64bit(无论xlen是多少

mtime的中断使能在csrji寄存器mie(machine interrupt enable)里指定。

mtime中断发生时,ecode为7(特权文档版本:1.12-draft里描述到),flag为1.
下面引用原文。
The mtime register has a 64-bit precision on all RV32 and RV64
systems. Platforms provide a 64- bit memory-mapped machine-mode timer
compare register (mtimecmp). A timer interrupt becomes 34 Volume II:
RISC-V Privileged Architectures V1.12-draft pending whenever mtime
contains a value greater than or equal to mtimecmp, treating the
values as unsigned integers. The interrupt remains posted until
mtimecmp becomes greater than mtime (typically as a result of writing
mtimecmp). The interrupt will only be taken if interrupts are enabled
and the MTIE bit is set in the mie register.

mtime寄存器里的值 大于等于 mtimecmp寄存器的值时(比较时使用无符号的大小比较方式),需要触发mtime中断。

而且中断会一直触发直到mtimecmp寄存器的值 大于 mtime寄存器里的值 。

下一篇文章会描述freertos里对于risc-v的mtime相关的适配。

最近编辑记录 xiaohui (2020-12-29 22:24:10)

离线

#2 2020-12-29 23:35:53

微凉VeiLiang
会员
所在地: 深圳
注册时间: 2018-10-28
已发帖子: 595
积分: 525
个人网站

Re: 关于risc-v的mtime的简单描述

学习了,感谢分享经验

离线

楼主 #3 2021-03-06 18:38:09

xiaohui
会员
注册时间: 2019-01-15
已发帖子: 259
积分: 162.5

Re: 关于risc-v的mtime的简单描述

20210306更新:https://whycan.com/t_5844.html#p60439

最近编辑记录 xiaohui (2021-03-06 18:38:28)

离线

#4 2021-05-07 20:09:06

duanhnhy
会员
注册时间: 2020-05-16
已发帖子: 33
积分: 0

Re: 关于risc-v的mtime的简单描述

什么时候能普及risc-v呢?

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn