udi_intr_event_ind(3udi)
Interrupt event indication
#include <udi.h>void udi_intr_event_ind ( udi_intr_event_cb_t *intr_event_cb, udi_ubit8_t flags ); /* Values for flags */#define UDI_INTR_MASKING_NOT_REQUIRED (1U<<0) #define UDI_INTR_OVERRUN_OCCURRED (1U<<1) #define UDI_INTR_PREPROCESSED (1U<<2)ARGUMENTS intr_event_cb is a pointer to an interrupt event control block.
flags specifies optional flags, described below.
TARGET CHANNEL The target channel for this operation is the interrupt event channel for this attachment, jointly spawned by the interrupt handler and interrupt dispatcher during interrupt attachment (see udi_intr_attach_req, udi_intr_attach_ack). The interrupt handler driver can use the channel context pointer for this channel to distinguish this event from events for other attached interrupts.
DESCRIPTION Upon receipt of an interrupt condition that may have been generated by a particular interrupt source, an interrupt dispatcher will prepare to deliver the interrupt to the appropriate handler. If the handler has requested interrupt preprocessing, it will execute the pre-registered PIO trans list (see udi_intr_attach_req) before delivering the interrupt to the handler driver.
The dispatcher must not allocate interrupt event control blocks to deliver the interrupt to the handler; the handler must have already provided a control block to be used for this purpose. If no control blocks are currently available, the dispatcher should execute the preprocessing trans list (if specified) starting at label 3 (as described by udi_intr_attach_req) and then exit without attempting to notify the handler of the interrupt.
If the preprocessing transaction list handles the interrupt in its entirety such that there is no need for the dispatcher to signal the interrupt event to the handler, the UDI_INTR_NO_EVENT flag should be set in the first byte of the control block's scratch space (see page 4-22) and the dispatcher will simply exit without performing the udi_intr_event_ind operation to the handler.
Since some interrupt handlers change between non-preprocessing and preprocessing modes, the presence of the UDI_INTR_PREPROCESSED bit in flags indicates whether or not this particular interrupt was pre-processed. The dispatcher must set UDI_INTR_PREPROCESSED in flags if this interrupt was preprocessed; otherwise this bit will never be set.
The following applies only to the preprocessing case:
The result value from the udi_pio_trans call used to preprocess the interrupt is used by the dispatcher to set intr_result in the interrupt event control block. If either the UDI_INTR_UNCLAIMED or the UDI_INTR_NO_EVENT flags were set in the first byte of scratch space, no udi_intr_event_ind operation will be sent to the handler driver; otherwise, the dispatcher must set event_buf to the buffer used with the udi_pio_trans call, set intr_result to the result value, and deliver the event to the dispatcher using udi_intr_event_ind with the UDI_INTR_PREPROCESSED flag.
The following applies only to the non-preprocessing case:
The dispatcher driver must fill in the event_buf buffer with the bus type-specific event info for the interrupt, if any, and deliver the event to the appropriate interrupt handler using the channel operation, udi_intr_event_ind.
When the interrupt handler receives and interrupt event indication it must process that indication and either respond back to the dispatcher using udi_intr_event_res (after deasserting the device interrupt condition) or it must act as an intermediary dispatcher for child interrupt handlers. An intermediary dispatcher must execute any child interrupt handler's registered preprocessing PIO trans lists and/or issue udi_intr_event_ind operations to the child's interrupt event channel, passing the subsequent response back to the parent dispatcher.
If the interrupt was not preprocessed, the udi_intr_event_ind operation must execute in an interrupt region, and the driver must process the interrupt as described in the previous paragraph before performing any other channel operations or asynchronous service calls, with the exception of udi_pio_trans, and must not depend on any additional callbacks or channel ops entry points, except the udi_pio_trans callback(s), in order to complete the sequence needed to invoke the required interrupt event operation.
If the interrupt was preprocessed, there are no restrictions on the service calls and channel operations that udi_intr_event_ind may invoke before invoking udi_intr_event_ind or udi_intr_event_rdy, since the interrupt condition was already dismissed in the first-level handler.
The flags values are interpreted as follows:
UDI_INTR_MASKING_NOT_REQUIRED - this flag indicates that an interrupt handler that is also an interrupt dispatcher does not need to mask off the interrupt before passing the event on to the next level (because a higher level interrupt dispatcher interprets interrupts as one-shot events-rather than continuous assertion-and will not pass continuous assertion through).
UDI_INTR_OVERRUN_OCCURRED - this flag indicates that the preprocessing_handle PIO trans list was executed one or more times at start label 3 and did not return UDI_INTR_UNCLAIMED. This is an indication to the handler that one or more interrupts from the device were dismissed and their associated data was discarded prior to the current event being indicated.
UDI_INTR_PREPROCESSED - this flag indicates that the preprocessing PIO trans list was called for the associated interrupt. If clear, no trans list was executed and the handler must operate in the non-preprocessing mode. This will only occur if the device driver previously attached the interrupt without preprocessing and then invoked udi_intr_attach_req again with preprocessing enabled.
REFERENCES udi_intr_event_cb_t, udi_intr_attach_req, udi_intr_event_rdy