User manual

Appendix F DMA Programming Examples
© National Instruments Corporation F-11 VXI-MXI-2 User Manual
write(A24, A24BASE + DMAIER, BYTE, 0x08);
write(A24, A24BASE + CHCR1, LONGWORD, 0x40004000);
write(A24, A24BASE + DMAIER, BYTE, 0x09);
return_from_interrupt();
}
/* DMA controller 2 section */
read(A24, A24BASE + CHSR2, LONGWORD, value);
/* The following if statement checks if DMA controller 2 is
currently interrupting. */
if (value & 0x80000000) {
/* At this point it is known that DMA controller 2 is
the interrupter. The DONE and ERROR bits of CHSR2 should
be checked for a successful operation. This could be
handled either here or in the main program after the
interrupt service routine has exited. If handled here,
the value variable already contains a copy of CHSR2. The
following three writes re-arm the DMA interrupt
condition. This must be done because it is possible that
the other DMA controller is also interrupting. Notice
that the overall DMA interrupt in CHCR2 (for DMA
controller 2) is left disabled when the interrupt
service routine exits. It will be re-enabled the next
time DMA controller 2 is started (as shown in the last
write of the operation setup section earlier in this
example). */
write(A24, A24BASE + DMAIER, BYTE, 0x08);
write(A24, A24BASE + CHCR2, LONGWORD, 0x40004000);
write(A24, A24BASE + DMAIER, BYTE, 0x09);
return_from_interrupt();
}
/* The interrupt service routine should never reach this point. If
it did, it would indicate that the Status ID of the VXI-MXI-2
module's DMA interrupt condition was returned during the interrupt
acknowledge cycle yet neither DMA controller indicated it was
interrupting. */
print("Error message.");
return_from_interrupt();
}