Chapter 4
Programming
©
National Instruments Corporation
4-3
Re-mapping the PCI E Series Board
The PCI E Series board uses two base address registers (BAR). BAR points
to the base address for the MITE registers, while BAR1 points to the base
address of the board registers such as the DAQ-STC.
The size of each BAR is 4 KB and both are mapped into memory space.
Therefore, you cannot use the C language I/O space read and write
functions inp() and outp() to communicate with the PCI E Series board.
Both BARs most likely map above 1 MB in the memory map. This means
you must know how to perform memory cycles to extended memory, which
is very difficult under operating systems such as Windows.
The Setup_Mite() function provides you with the capability to re-map the
board under 1 MB making the communication much simpler. If you know
how to perform memory calls under Windows or your operating system
re-mapping the board is both unnecessary and undesirable.
The pseudo code shown below demonstrates how to re-map the board
below 1 MB. If you do not want to re-map the board, you must still perform
steps 4 and 5 to enable the device window of the MITE. All values and bit
masks are 32 bits and all pseudo code functions are of the format
function_name (address, data). This example assumes the new BAR0
address is 0xd000 and BAR1 address is 0xd1000. If you are using other
addresses, you must make the appropriate changes.
1.
Write the address where you want to re-map the MITE (BAR0) to PCI
configuration space offset 0x10.
Using 0xd0000 for the new BAR0 address
PCI_Config_Write (0x10, 0xd0000)
2.
Write the value 0xaeae to offset 0x340 from the new MITE address.
Mem_Write (0xd0340, 0xaeae)
3.
Write the address where you want to re-map the board registers
(BAR1) to configuration space offset (0x14)
Using 0xd1000 for the new BAR1 address
PCI_Config_Write (0x14, 0xd1000)
4.
Create the window_data_value by masking the board address.
If you are not re-mapping the board,
window_data_value = ((0xffffff00 AND BAR1) OR (0x80))
If you are re-mapping the board,
window_data_value = ((0xffffff00 AND 0xd1000) OR (0x80))
window_data_value = 0xd1080 in this example.