![National Instruments 6527 Скачать руководство пользователя страница 26](http://html2.mh-extra.com/html/national-instruments/6527/6527_programmers-manual_3433890026.webp)
Chapter 3
Programming
6527 Register-Level Programmer Manual
3-4
ni.com
The base address is now 0xD1000. Make sure the re-mapped PCI MITE and the 6527 memory
ranges are not used by another device or system resource. You can exclude this memory from
use with a memory manager.
Initializing the PCI for the Macintosh (PCI-6527 Only)
To program at the register level, you must know the base memory address and you must
develop your own configuration program. To do this, consult the following documents, which
you can find in your local bookstore:
•
Designing PCI Cards and Drivers for Power Macintosh Computers
•
Inside Macintosh: Devices
•
Inside Macintosh: Memory
•
Inside Macintosh: Operating System Utilities
•
Inside Macintosh: Processes
•
Inside Macintosh: Power PC System Software
Example
Use the following code sequence to activate the device. Using the documents listed above as
a reference, write a program to retrieve the
deviceNode
parameter from the Name Registry.
#include <pci.h>
void*configureCard(RegEntryIDPtr deviceNode);
void*configureCard
(RegEntryIDPtrdeviceNode)
{
unsigned shortpciCommandRegister;
unsigned longcardBaseAddress,
miteBaseAddress;
//configure the i/o space of the device such
//that it is memory mapped.
ExpMgrConfigReadWord(deviceNode,
((LogicalAddress) 0x00000004L),
&pciCommandRegister);
ExpMgrConfigWriteWord(deviceNode,
((LogicalAddress) 0x00000004L),
(pciCommandRegister | 0x0002));
//get the base addresses for the device.
ExpMgrConfigReadLong(deviceNode,
((LogicalAddress) 0x00000010L),
&miteBaseAddress);