我尝试为基于 TI am335x SoC 的电路板创建裸机应用程序。我需要做的一件事是callback1在上升沿和callback2下降沿调用。从我发现的数据表中,可以通过写入1 << pinRISINGDETECT 和 FALLINGDETECT GPIO 寄存器来启用对上升沿和下降沿的同时检测。但是,我不明白(在数据表中没有看到它的迹象),我如何确定当前出现的中断是由 GPIO 的上升沿还是下降沿引起的?
我最近在我的应用程序中添加了一个部分,旨在允许它使用属于辅助 PIC 的 IRQ 进行操作。特别是,中断处理程序需要向两个 PIC 发出中断结束条件信号,而不是仅向主 PIC 发出信号。这是我的代码:
push cs
pop ds
mov al, 20h ; acknowledge interrupt
cmp byte [serial_use_irqmask + 1], 0
je @F
out 0A0h, al ; to secondary PIC
@@:
out 20h, al ; to primary PIC
Run Code Online (Sandbox Code Playgroud)
现在,在添加这部分时,我考虑是先向次要 PIC 发送 EOI 信号,还是向主要 PIC 发送信号。以任何方式搜索都没有产生任何陈述。但是,我发现一些示例似乎选择了我最终实施的顺序;即首先是次要 PIC,然后是主要 PIC。
我的问题是,这有关系吗?是否有实际的理由更喜欢这两种顺序?
bootlib中断处理程序:
movb $0x20, %al # end of interrupt command
outb %al, $0xA0 # PIC2 command port
outb %al, $0x20 # PIC1 command port
Run Code Online (Sandbox Code Playgroud)
osdev.org …
我需要重新启动处理内核中的IRQ.
我想调用/sbin/reboot二进制文件,但由于IRQ范围,我有限制.
代码如下:
#define MY_IRQ_ID 42
void __init rebootmodule_init(void) {
request_any_context_irq(MY_IRQ_ID, rebootmodule_irq_handler, IRQF_TRIGGER_FALLING, "irq-name", NULL);
}
irqreturn_t rebootmodule_irq_handler(int irq, void *dev_id) {
my_reboot();
return IRQ_HANDLED;
}
void my_reboot(void) {
int ret;
char *argv[2], *envp[4];
argv[0] = "/sbin/reboot";
argv[1] = NULL;
envp[0] = "HOME=/";
envp[1] = "PWD=/";
envp[2] = "PATH=/sbin";
envp[3] = NULL;
ret = call_usermodehelper(argv[0], argv, envp, 0);
printk(KERN_INFO "trying to reboot (ret = %d)", ret);
}
Run Code Online (Sandbox Code Playgroud)
我可以看到printk(...)IRQ被触发的时间,但是我有一些错误,即使我替换/sbin/reboot了/bin/rm /tmp/its-not-working.
我测试了其他办法可以做到像重启mvBoardReset(), …
为什么java.nio.FileChannel transferTo()和transferFrom()比一些JVM/OS组合上的逐字节传输(基于流或使用ByteBuffer)更快?
这些方法是否使用直接内存访问(DMA)而不是为每个字节传输发出中断请求(IRQ)?
当我们使用irq_set_chained_handler时,当我们为关联的处理程序提供服务时,irq行不会被禁用,就像request_irq一样.
irq linux-device-driver linux-kernel interrupt-handling embedded-linux
我正在寻找 RISC-V 处理器如何处理中断请求。
我查看了互联网上的指令集手册和信息。重点是准确解释标题设置的内容:指令集。在我看来,如何处理中断是所谓的处理器“程序员模型”的问题。它不适合关于指令集的文档,因为部分中断处理没有在指令中表达。显然,跳转到 ISR并不是出现在程序代码中任何地方的指令。指令集手册提供了 saymret和 的描述mstatus,但未能提供整体视图。
对于一个假设的架构,中断处理可能是这样描述的:
If the IRQ line is high and the I-bit in the status register is set,
the processor executes the following steps atomically:
- Push the PC of the next instruction onto the stack.
- Push the status register onto the stack.
- Clear the I-bit in the status register.
- The PC is set to the location specified in the INTHNDLR register.
Run Code Online (Sandbox Code Playgroud)
这是我正在寻找的 RISC-V 架构的信息。
在下面的 2 种情况下,“current->pid”打印什么
1) 硬IRQ上下文
2) 软IRQ上下文
我知道 IRQ 上下文和进程上下文是不同的,并且 PID 在 IRQ 上下文的情况下必须无效。但是当尝试在 IRQ 上下文中打印“current->pid”时,它正在打印一些有效的 PID,因此产生了疑问。请澄清。
谢谢你,
戈皮纳斯。