Appendix B
Register-Level Programming — Programming
PCI-DIO-96/PXI-6508/PCI-6503 User Manual
B-16
ni.com
Base Address Register 0 (BAR0) corresponds to the base address of the PCI MITE, while
Base Address Register 1 (BAR1) is the base address of the board registers. The size of each
of these windows is 4 KB. Both addresses will most likely be mapped above 1 MB in the
memory map. This means that you must know how to perform memory cycles to extended
memory to communicate with the board. The memory map provides information to re-map
the board under 1 MB, which simplifies communication with the board. To accomplish this,
use PCI BIOS read and write calls. Use the pseudocode in this section to re-map the board
below 1 MB. If you choose not to re-map the board, you must still perform steps 4 and 5. All
values in this example are 32 bits.
1.
Write the address to which you want to re-map the PCI MITE to
PCI configuration space
offset 0x10 (BAR0)
.
2.
Write the value
0x0000aeae
to offset
0x340
from the new PCI MITE address.
3.
Write the address to which you want to re-map the board (other than the PCI MITE) to
PCI configuration space offset 0x14 (BAR1)
.
4.
Create the window data value by masking the new board address:
window data value = ((0xffffff00
and
new board address)
or
(0x00000080))
If you are not remapping the board, then the new board address is the value in
BAR1
.
5.
Write the window data value to offset 0xc0 from the new PCI MITE address.
If you are not remapping the board, then the new PCI MITE address is the value in
BAR0
.
The following pseudocode re-maps the PCI MITE to memory address
0xd0000
and the board
to memory address
0xd1000
.
CWrite(0x10,0x000d0000)
Write(0xd0340,0x0000aeae)
CWrite(0x14,0x000d1000)
Write(0xd00c0,0x000d1080)
In this example, the new base address for the PCI-DIO-96 or PXI-6508 is now
0xd1000
. It is
important that the memory range to which you re-map the board is not being used by another
device or system resource. You can exclude this memory from use with a memory manager.