[ Previous |
Next |
Contents |
Home |
Search ]
AIX Version 4.3 Understanding the Diagnostic Subsystem for AIX
Example C source file for TU Interrupt Handler
/*
* COMPONENT_NAME: tu_device
*
* FUNCTIONS: device_interrupt
*/
/*** header files ***/
#include <sys/adspace.h>
#include <sys/ioacc.h>
#include <sys/types.h>
#include <sys/sleep.h>
#include <sys/watchdog.h>
#include <sys/trcmacros.h>
#include <sys/pdiagex_dds.h>
/******************************************************************************
*
* NAME: device_interrupt
*
* FUNCTION: Interrupt handler for the ....... adapter.
*
* INPUT PARAMETERS: handle = handle returned from pdiagex_open
* data = data passed to handler during
* initialization.
*
* EXECUTION ENVIRONMENT: Interrupt
*
* RETURN VALUE DESCRIPTION: none.
*
* EXTERNAL PROCEDURES CALLED: pdiag_dd_read, pdiag_dd_write
*
******************************************************************************/
int device_interrupt(pdiag_info_handle_t handle, char *data_area,
int *interrupt_flag, int sleep_flag, int *sleep_word)
{
ushort readdata, rc;
int interrupt_mask;
int offset;
ulong writedata;
pdiagex_opflags_t flags={ PDIAG_MEM_OP,
1,
PDIAG_SING_LOC_ACC,
INTRKMEM,
NULL };
/******************************************
* Get value of interrupt status register
******************************************/
rc = pdiag_dd_read(handle, IOSHORT16, offset,
(void *)&readdata, &flags);
*interrupt_flag = 0;
/***********************************************************
* An Interrupt for this resource has occurred, process it.
***********************************************************/
rc = pdiag_dd_write(handle, IOSHORT16, offset, (void *)&writedata,
&flags);
/************************************************************
* Set a value to the watchdog function that indicates that
* this is the interrupt expected
************************************************************/
*interrupt_flag |= interrupt_mask;
/*********************************************
* Wake up sleeping application IF necessary
**********************************************/
if (sleep_flag) {
pdiag_dd_interrupt_notify( sleep_word );
}
return (0);
} /* end device_intr */
[ Previous |
Next |
Contents |
Home |
Search ]