Interrupt Functions

Describes the interrupt functions involved in implementing the GPIO interface class.

A common use for a pin is as a hardware interrupt source. The treatment of interrupts is platform dependent. Typically, the hardware multiplexes all interrupts from a module into a hardware controller: in this case it is part of the GPIO implementation to demultiplex the requests. A GPIO implementation with the capability to demultiplex will also have the capability to enable and disable interrupts and to bind and unbind their handlers.

Implement the interrupt functions

  • Implement BindInterrupt() with return value KErrNone.

    Associate the specified interrupt service routine with the specified pin ID.

  • Implement BindInterrupt() with return value KErrInUse.

    Return KErrInUse if an interrupt service routine is already bound to this interrupt.

  • Implement UnbindInterrupt() with return value KErrNone.

    Unbind the specified interrupt service routine with the specified pin ID.

  • Implement EnableInterrupt() with return value KErrNone.

    Verify that the pin is being used as an interrupt source and that there is an ISR bound to it. Enable the interrupt.

  • Implement DisableInterrupt() with return value KErrNone.

    Verify that the pin is being used as an interrupt source and that there is an ISR bound to it. Disable the interrupt.

  • Implement IsInterruptEnabled() with return value KErrNone.

    Verify that the pin is being used as an interrupt source and that there is an ISR bound to it. Determine the status of the interrupt. If it is enabled set aEnable to True and if it is disabled set aEnable to False.

  • Implement ClearInterrupt() with return value KErrNone.

    Clear the interrupt.

    Only implement this if the hardware does not automatically clear the interrupt after reading the interrupt status.

  • Implement GetMaskedInterruptState() with return value KErrNone.

    Read the interrupt state from the GPIO interrupt controller, probably by using a bit mask on a register. Set aActive to True if the interrupt state is active and to False if it is inactive.

  • Implement GetRawInterruptState() with return value KErrNone.

    Read the interrupt state directly from the pin. Set aActive to True if the interrupt state is active and to False if it is inactive.

    If the hardware does not allow the raw interrupt state to be read, implement the function to return KErrNotSupported or to return the same value as GetMaskedInterruptState().

  • Implement these functions with return value KErrNotSupported:

    • BindInterrupt()

    • UnbindInterrupt()

    • EnableInterrupt()

    • DisableInterrupt()

    • IsInterruptEnabled()

    Return KErrNotSupported for these functions if the pin does not support interrupts.

  • Implement these functions with return value KErrGeneral:

    • UnbindInterrupt()

    • EnableInterrupt()

    • DisableInterrupt()

    • IsInterruptEnabled()

    Return KErrGeneral for these functions if there is no Interrupt Service Routine bound to the pin.

  • Implement ClearInterrupt() with return value KErrNotSupported.

    Return KErrNotSupported if the pin does not support clearing the interrupt signal.

  • Implement GetMaskedInterruptState() with return value KErrNotSupported.

    Return KErrNotSupported if reading the interrupt state is not supported.

  • Implement GetRawInterruptState() with return value KErrNotSupported.

    Return KErrNotSupported if reading raw interrupt states is not supported.