// 电流类型:
// 1.电平型:handle_level_irq
/*
* Level type interrupts are active as long as the hardware line has
* the active level. This may require to mask the interrupt and unmask
* it after the associated handler has acknowledged the device, so the
* interrupt line is back to inactive.
*/
// 译:当中断线电平达到激活电平,中断一直会被激活。 所以需要刚进中断处理函数就要屏蔽掉中断,
// 等handler 处理完后再打开中断(unmask)。
// 问:为什么要先屏蔽中断中断,后确认呢(mask_and_ack)?
// 答:因为cpu周期性采样中断线,当发现电平有效时,触发中断,因此外部设备为了保证cpu可以检测到
// 有效电平,需要将电平保持一段时间。当cpu检测到有效电平后,cpu引脚被置位,如果不先屏蔽中断,
// 直接确认,当cpu引脚复位时,如果此时电平依然有效,那么同一个中断又被触发,此为不正确的。
// (注:cpu确认是用于复位cpu引脚,对外设的应答在注册的irq_action由特定的驱动程序进行)
// 问:这对于编写ISR有什么启示呢?
// 答:由于在handle_level_irq调用ISR过程中,中断被屏蔽,因此在此期间的新发生的中断可能会丢失(
// 因为电平型中断信号不被中断控制器锁存,电平恢复之前,如果cpu没有通过采样发现此有效电平,
// 则中断丢失),所以ISR应该尽快执行完毕。
//
// 2.边沿型:handle_edge_irq
/*
* Interrupt occures on the falling and/or rising edge of a hardware
* signal. The occurence is latched into the irq controller hardware
* and must be acked in order to be reenabled. After the ack another
* interrupt can happen on the same source even before the first one
* is handled by the assosiacted event handler. If this happens it
* might be necessary to disable (mask) the interrupt depending on the
* controller hardware. This requires to reenable the interrupt inside
* of the loop which handles the interrupts which have arrived while
* the handler was running. If all p
中断子系统5_电流层处理
最新推荐文章于 2022-02-28 15:58:52 发布