Отключить аппаратное прерывание


#include <sys/neutrino.h>
int InterruptMask( int intr,
int id );


The interrupt you want to mask.
The value returned by InterruptAttach() or InterruptAttachEvent(), or -1 if you don't want the kernel to track interrupt maskings and unmaskings for each handler.

Note: The id is ignored unless you use the _NTO_INTR_FLAGS_TRK_MSK flag when you attach the handler.




The InterruptMask() kernel call disables the hardware interrupt specified by intr for the handler specified by id. You can call this function from a thread or from an interrupt handler. Before calling this function, the thread must request I/O privileges by calling:

ThreadCtl( _NTO_TCTL_IO, 0 );

If the thread doesn't do this, it might SIGSEGV when it calls InterruptMask().

Reenable the interrupt by calling InterruptUnmask().

The kernel automatically enables an interrupt when the first handler attaches to it using InterruptAttach() and disables it when the last handler detaches.

This call is often used when a device presents a level-sensitive interrupt to the system that can't be easily cleared in the interrupt handler. Since the interrupt is level-sensitive, you can't exit the handler with the interrupt line active and unmasked. InterruptMask() lets you mask the interrupt in the handler and schedule a thread to do the real work of communicating with the device to clear the source. Once cleared, the thread should call InterruptUnmask() to reenable this interrupt.

To disable all hardware interrupts, use the InterruptLock() function.

Note: To ensure hardware portability, use InterruptMask() instead of writing code that talks directly to the interrupt controller.

Calls to InterruptMask() are nested; the interrupt isn't unmasked until InterruptUnmask() has been called once for every call to InterruptMask().

Возвращаемое значение:

The current mask level count for success.

Если возникла ошибка функция возвращает -1, код ошибки записывается в errno.

Коды ошибок:

The value of intr isn't a supported hardware interrupt.
The id parameter isn't something returned by InterruptAttach() or InterruptAttachEvent(), or -1.


ЗОСРВ «Нейтрино»

Точка остановки потока
Обработчик прерываний
Обработчик сигналов
В потоке

Тематические ссылки:

InterruptAttach(), InterruptAttachEvent(), InterruptDisable(), InterruptEnable(), InterruptLock(), InterruptUnlock(), InterruptUnmask(), ThreadCtl()

Предыдущий раздел: Описание API системной библиотеки