system built-in routines cli() and sti()

本文详细介绍了IMASK和ILAT寄存器的功能与使用方法。IMASK用于控制哪些中断级别可以被处理器响应,而ILAT则记录了已被捕获但未处理的中断事件。文章还解释了如何通过cli()和sti()函数来管理和设置这些寄存器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

IMASK Values

unsigned cli(void) /* close interrupt */

void sti(unsigned mask) /* setup interrupt */

The cli() function retrieves the old value of IMASK, and disables interrupts by setting IMASK to all zeros. The sti() function installs a new value into IMASK, enabling the interrupt system according to the new mask stored.

Core Interrupt Mask Register (IMASK)

This register indicates which interrupt levels are allowed to be serviced. The IMASK register may be read and written in Supervisor mode. Bits15–5 have significance; bits4–0 are hard-coded to 1, and events of these levels are always enabled. If IMASK[N] == 1 and ILAT[N] == 1, then interrupt N will be taken if a higher priority is not already recognized. If IMASK[N] == 0, and ILAT[N] gets set by interrupt N, the interrupt will not be taken, and ILAT[N] will remain set.

Core Interrupt Latch Register (ILAT)

Each bit in ILAT indicates that the corresponding event is latched, but not yet accepted into the processor. The bit is reset before the first instruction in the corresponding ISR is executed. At the point the interrupt is accepted, ILAT[N] will be cleared and IPEND[N] will be set simultaneously. The ILAT register can be read in Supervisor mode. Writes to ILAT are used to clear bits only (in Supervisor mode). To clear bit N from ILAT, first make sure that IMASK[N] == 0, and then write ILAT[N] = 1. This write functionality to ILAT is provided for cases where latched interrupt requests need to be cleared (cancelled) instead of serviced.

The RAISE instruction can be used to set ILAT[15] through ILAT[5], and also ILAT[2] or ILAT[1].

Only the JTAG TRST pin can clear ILAT[0]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值