#include <IOKit/IOInterruptEventSource.h>
IOKit/IOInterruptEventSource.h
classIOInterruptEventSource
@class IOInterruptEventSource : public IOEventSource
@abstract Event source for interrupt delivery to work-loop based drivers.
@discussion The IOInterruptEventSource is a generic object that delivers calls interrupt routines in it's client in a guaranteed single-threaded manner. IOInterruptEventSource is part of the IOKit $link IOWorkLoop infrastructure where the semantic that one and only one action method is executing within a work-loops event chain.
<br><br>
When the action method is called in the client member function will receive 2 arguments, (IOEventSource *) sender and (int) count, See $link IOInterruptEventSource::Action. Where sender will be reference to the interrupt that occurred and the count will be computed by the difference between the $link producerCount and $link consumerCount. This number may not be reliable as no attempt is made to adjust for around the world type problems but is provided for general information and statistic gathering.
<br><br>
In general a client will use the factory member function to create and initialise the event source and then add it to their work-loop. It is the work loop's responsiblity to maintain the new event source in it's event chain. See $link IOWorkLoop.
<br><br>
An interrupt event source attaches itself to the given provider's interrupt source at initialisation time. At this time it determines if it is connected to a level or edge triggered interrupt. If the interrupt is an level triggered interrupt the event source automatically disables the interrupt source at primary interrupt time and after it call's the client it automatically reenables the interrupt. This action is fairly expensive but it is 100% safe and defaults sensibly so that the driver writer does not have to implement type dependant interrupt routines. So to repeat, the driver writer does not have to be concerned by the actual underlying interrupt mechanism as the event source hides the complexity.
<br><br>
Saying this if the hardware is a multi-device card, for instance a 4 port NIC, where all of the devices are sharing one level triggered interrupt AND it is possible to determine each port's interrupt state non-destructively then the $link IOFilterInterruptEventSource would be a better choice.
<br><br>
Warning: All IOInterruptEventSources are created in the disabled state. If you want to actually schedule interrupt delivery do not forget to enable the source.
: public IOEventSource
| IOService * | provider | |
| int | intIndex | |
| volatile unsigned int | producerCount | |
| unsigned int | consumerCount | |
| bool | autoDisable | |
| bool | explicitDisable | |
| ExpansionData * | reserved |
APPLE_KEXT_OVERRIDE
virtual void free()virtual protected@function free
@abstract Sub-class implementation of free method, disconnects from the interrupt source.
APPLE_KEXT_OVERRIDE
virtual bool checkForWork()virtual protected@function checkForWork
@abstract Pure Virtual member function used by IOWorkLoop for issueing a client calls.
@discussion This function called when the work-loop is ready to check for any work to do and then to call out the owner/action.
@result Return true if this function needs to be called again before all its outstanding events have been processed.
APPLE_KEXT_OVERRIDE virtual void setWorkLoop(IOWorkLoop *inWorkLoop)virtual protected
@function setWorkLoop
@abstract Sub-class implementation of setWorkLoop method.
static OSPtr<IOInterruptEventSource> interruptEventSource( OSObject *owner, Action action, IOService *provider = NULL, int intIndex = 0 )static
@function interruptEventSource
@abstract Factory function for IOInterruptEventSources creation and initialisation.
@param owner Owning client of the new event source.
@param action 'C' Function to call when something happens.
@param provider IOService that represents the interrupt source. Defaults to 0. When no provider is defined the event source assumes that the client will in some manner call the interruptOccured method explicitly. This will start the ball rolling for safe delivery of asynchronous event's into the driver.
@param intIndex The index of the interrupt within the provider's interrupt sources. Defaults to 0, i.e. the first interrupt in the provider.
@result A new interrupt event source if successfully created and initialised, 0 otherwise.
static OSPtr<IOInterruptEventSource> interruptEventSource( OSObject *owner, IOService *provider, int intIndex, ActionBlock action )static
@function interruptEventSource
@abstract Factory function for IOInterruptEventSources creation and initialisation.
@param owner Owning client of the new event source.
@param provider IOService that represents the interrupt source. When no provider is defined the event source assumes that the client will in some manner call the interruptOccured method explicitly. This will start the ball rolling for safe delivery of asynchronous event's into the driver.
@param intIndex The index of the interrupt within the provider's interrupt sources.
@param action Block for the callout routine of this event source..
@result A new interrupt event source if successfully created and initialised, 0 otherwise.
virtual bool init( OSObject *owner, Action action, IOService *provider = NULL, int intIndex = 0 )virtual
@function init
@abstract Primary initialiser for the IOInterruptEventSource class.
@param owner Owning client of the new event source.
@param action 'C' Function to call when something happens.
@param provider IOService that represents the interrupt source. Defaults to 0. When no provider is defined the event source assumes that the client will in some manner call the interruptOccured method explicitly. This will start the ball rolling for safe delivery of asynchronous event's into the driver.
@param intIndex The index of the interrupt within the provider's interrupt sources. Defaults to 0, i.e. the first interrupt in the provider.
@result true if the inherited classes and this instance initialise
successfully.
APPLE_KEXT_OVERRIDE
virtual void enable()virtual@function enable
@abstract Enable event source.
@discussion A subclass implementation is expected to respect the enabled
state when checkForWork is called. Calling this function will cause the
work-loop to be signalled so that a checkForWork is performed.
APPLE_KEXT_OVERRIDE
virtual void disable()virtual@function disable
@abstract Disable event source.
@discussion A subclass implementation is expected to respect the enabled
state when checkForWork is called.
virtual const IOService *getProvider() constvirtual
@function getProvider
@abstract Get'ter for $link provider variable.
@result value of provider.
virtual int getIntIndex() constvirtual
@function getIntIndex
@abstract Get'ter for $link intIndex interrupt index variable.
@result value of intIndex.
virtual bool getAutoDisable() constvirtual
@function getAutoDisable
@abstract Get'ter for $link autoDisable variable.
@result value of autoDisable.
virtual void interruptOccurred(void *, IOService *nub, int ind)virtual
@function interruptOccurred
@abstract Functions that get called by the interrupt controller. See $link IOService::registerInterrupt
@param nub Where did the interrupt originate from
@param ind What is this interrupts index within 'nub'.
virtual void normalInterruptOccurred(void *, IOService *nub, int ind)virtual
@function normalInterruptOccurred
@abstract Functions that get called by the interrupt controller.See $link IOService::registerInterrupt
@param nub Where did the interrupt originate from
@param ind What is this interrupts index within 'nub'.
virtual void disableInterruptOccurred(void *, IOService *nub, int ind)virtual
@function disableInterruptOccurred
@abstract Functions that get called by the interrupt controller.See $link IOService::registerInterrupt
@param nub Where did the interrupt originate from
@param ind What is this interrupts index within 'nub'.
IOReturn warmCPU(uint64_t abstime)
@function warmCPU
@abstract Tries to reduce latency for an interrupt which will be received near a specified time.
@discussion Warms up a CPU in advance of an interrupt so that the interrupt may be serviced with predictable latency.
The warm-up is not periodic; callers should call warmCPU once in advance of each interrupt. It is recommended that
requests be issues in serial (i.e. each after the target for the previous call has elapsed), as there is a systemwide
cap on the number of outstanding requests. This routine may be disruptive to the system if used with very small intervals
between requests; it should be used only in cases where interrupt latency is absolutely critical, and tens or hundreds of
milliseconds between targets is the expected time scale. NOTE: it is not safe to call this method with interrupts disabled.
@param abstime Time at which interrupt is expected.
void enablePrimaryInterruptTimestamp(bool enable)
uint64_t getPrimaryInterruptTimestamp()
macroIOInterruptEventAction
@defined IOInterruptEventAction
@discussion Backward compatibilty define for the old non-class scoped type definition. See $link IOInterruptEventSource::Action
#define IOInterruptEventAction IOInterruptEventSource::Action