mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 00:31:36 +08:00
Fix an issue for architectures where interrupt numbers and vector numbers do not match 1-to-1
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4258 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/****************************************************************************
|
||||
* sched/irq_attach.c
|
||||
*
|
||||
* Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Copyright (C) 2007-2008, 2010, 2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -91,9 +91,23 @@ int irq_attach(int irq, xcpt_t isr)
|
||||
state = irqsave();
|
||||
if (isr == NULL)
|
||||
{
|
||||
#ifndef CONFIG_ARCH_NOINTC
|
||||
up_disable_irq(irq);
|
||||
/* Disable the interrupt if we can before detaching it. We might
|
||||
* not be able to do this if: (1) the device does not have a
|
||||
* centralized interrupt controller (so up_disable_irq() is not
|
||||
* supported. Or (2) if the device has different number for vector
|
||||
* numbers and IRQ numbers (in that case, we don't know the correct
|
||||
* IRQ number to use to disable the interrupt. In those cases, the
|
||||
* code will just need to be careful that it disables all interrupt
|
||||
* sources before detaching from the interrupt vector.
|
||||
*/
|
||||
|
||||
#if !defined(CONFIG_ARCH_NOINTC) && !defined(CONFIG_ARCH_VECNOTIRQ)
|
||||
up_disable_irq(irq);
|
||||
#endif
|
||||
/* Detaching the ISR really means re-attaching it to the
|
||||
* unexpected exception handler.
|
||||
*/
|
||||
|
||||
isr = irq_unexpected_isr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user