Bank 0b的AM3352X IRQ号97上断了IntruptAttach



我正在尝试将 irq处理程序附加到 gpio bank 0 i.e 0B irq no 97

目前,我的实现使用-1返回。我究竟做错了什么?实施将是一个非常简单的问题。

#include <stdio.h>                                                              
#include <unistd.h>                                                             
#include "gpio.h"
#include <sys/neutrino.h>                                                       
#include "interrupt.h"                                                          
volatile unsigned int gpio0_irq_count;                                          
static const struct sigevent * gpio0_irq_handler (void *gpio, int id){      
    gpio0_irq_count++;
    return NULL;
}
int main(){
    int ret;
    unsigned long count=0;
    ret = InterruptAttach(97, gpio0_irq_handler, NULL,0,_NTO_INTR_FLAGS_TRK_MSK);
    printf("%s: Registering handler for irq %d result = %dn",__func__ , 97, ret);
    if (ret)
        return -1;
    while(1){
        printf("%s:[%lu] : gpio0_irq_count = %dn", __func__, count++, gpio0_irq_count);
        sleep(2);
    }
}

错误的输出为:

main: Registering handler for irq 97 result = -1

在与qnx进行了多次来回之后,事实证明,请求InterruptAttach()或InterruptAttach_r()需要通过

获得的高架许可
ThreadCtl( _NTO_TCTL_IO, 0 );

执行API的工作后。但是,仍然必须配置GPIO寄存器以实际触发中断。

GPIO_OE
GPIO_STATUS
GPIO_STATUS_SET
GPIO_CTRL
GPIO_RISINGDETECT

最新更新