User manual

Appendix F DMA Programming Examples
© National Instruments Corporation F-7 VXI-MXI-2 User Manual
/* The following write is required to initialize the DMAICR. In
this example, the DMA interrupt is being routed to VMEbus IRQ5*.
You can route the DMA interrupt to any VMEbus interrupt level in
the DMAICR. You can put the DMA interrupt on the same level as
other interrupt conditions on the VXI-MXI-2 as well as interrupt
conditions on other devices. This write is also programming the
DMA interrupt condition to use a 16-bit Status ID when being
acknowledged. You can change this write if you prefer an 8-bit
Status ID. If you select an 8-bit Status ID you should also decide
if you want the contents of the DMAISIDR or the VXI-MXI-2 module's
logical address returned during the interrupt acknowledge cycle.
*/
write(A24, A24BASE + DMAICR, WORD, 0x2805);
/* The following write is required to initialize the DMAIER. This
is simply enabling the DMA interrupt condition to be routed to the
VMEbus. */
write(A24, A24BASE + DMAIER, BYTE, 0x09);
/* The following write sets up the DMAISIDR. This is just a Status
ID code that the VXI-MXI-2 will return during an interrupt
acknowledge cycle for the DMA interrupt condition. You should
program a code that you can use in your interrupt service routine
to uniquely identify the VXI-MXI-2 module's DMA interrupt
condition. Remember that you can change only the 5 most
significant bits of the Status ID using the DMAISIDR. For a 16-bit
Status ID, the VXI-MXI-2 always uses 011 binary for bits 10
through 8 and its logical address for bits 7 through 0. For an
8-bit Status ID, the VXI-MXI-2 can return either the contents of
the DMAISIDR (the value you write here with bits 2 through 0
forced to 011 binary) or the logical address of the VXI-MXI-2
module. */
write(A24, A24BASE + DMAISIDR, WORD, 0x0013);