GxAoArbResumeStreamingInterrupt

Purpose

Resume processing interrupts after interrupt handler is called

Applies

GX1649-1

Syntax

GxAoArbResumeStreamingInterrupt (nHandle, pnStatus)

Parameters

Name
Type
Description
nHandle
SHORT
Handle to a GX1649 board.
pnStatus
PSHORT
Returned status: 0 on success, negative number on failure.

Comments

When the board generates an interrupt, the kernel will automatically block new interrupts from calling the interrupt handler until after this function is called. This function should be called at the end of the interrupt handler, so that the next interrupt can be processed when the FIFO is half empty.

Example

The following example shows interrupt handler for streaming, after data is written to the FIFO, GxAoArbSetupStreamingInterrupt is called at the end after handling is done.

 

LONG WINAPI InterruptCallback(SHORT nHandle, SHORT enEventType, PVOID pvUserData)

{

    static int s_iInterruptCount=0;

    short nStatus;

    WORD wStatus, wCount;

    INT iGroup;

    BOOL bEnable;

 

    // search all group for source of interrupt

    for (iGroup=GXAO_GROUPA ; iGroup<=GXAO_GROUPD ; iGroup++)

    {   // ignore group if streaming is not enabled

       GxAoArbIsGroupStreaming(nHandle, iGroup, &bEnable, &nStatus);

       CheckStatus(nStatus);

       if (!bEnable) continue;

        // retrieve streaming FIFO status

       GxAoArbGetGroupStreamingStatus(nHandle, iGroup, &wStatus, &wCount, &nStatus);

        CheckStatus(nStatus);

       // if FIFO is at least half empty

       if ((wStatus & GXAO_1649_ARB_STREAMING_STATUS_FULL)==0)

       {     printf("Group%c Interrupt received %d\r\n", 'A'+iGroup, ++s_iInterruptCount);

              // alternate output between sine and square wave

              if (s_iInterruptCount & 1)

               GxAoArbWriteStreaming(nHandle, iGroup, &g_adWaveformData[0],
                   POINTS_PER_WAVEFORM, GXAO_WAVEFORM_TYPE_DOUBLE, &nStatus);

              else

 

 

                GxAoArbWriteStreamin(nHandle, iGroup,
                      &g_adWaveformData[POINTS_PER_WAVEFORM],

                      POINTS_PER_WAVEFORM, GXAO_WAVEFORM_TYPE_DOUBLE, &nStatus);

              CheckStatus(nStatus);

            }

    }

 

    // resume streaming interrupt

    GxAoArbResumeStreamingInterrupt(nHandle, &nStatus);

    return 0;

}

 

See Also

GxAoArbEnableGroupStreaming, GxAoArbSetupStreamingInterrupt, GxAoArbWriteStreaming, GxAoGetErrorString