Read and write register values of your device before a

Read and write register values of your device before a
The Agilent Technologies
E2920 PCI/PCI-X Series
Application Note 4
Read and write register values of your device before a driver is
available
When designing a device, you
may need to read values from
(peek) and write values into
(poke) its registers or memory
before a driver is available.
The Agilent PCI/PCI-X Exerciser,
a combination of testcard and
software, simplifies this task.
The testcard makes it possible to
peek and poke the registers of
the device under test either via
an external host or via PCI
within the control PC. The |
testcard can be easily
programmed by entering specific
commands in the Command Line
Interface of the Agilent's
Exerciser GUI.
Aims of this Application Note
To show how to access registers
of a device before a driver is
available by using the Exerciser's
Command Line Interface (CLI).
Questions that can be
answered with the help of the
PCI/PCI-X Exerciser
How can I peek and poke:
·Register values of a PCI device
·Memory spaces of a PCI device
·Register values of a PCI-X
device before a driver is
available?
Benefits of the Agilent
PCI/PCI-X Exerciser
· Allows interactive work, which
allows you to immediately see
the effects of your changes.
Setting Up the Test
Plug the testcard into the system
under test, and start the Agilent
E2920 test software either on an
external host or on the control
PC.
The following figures show the
possible test setups.
Host System
SystemUnder Test
Host System
System Under Test
CLI
If the software is running on an
external host, connect the control
PC via parallel or serial port to
the testcard. (The parallel port is
used in combination with the
Fast Host Interface card plugged
into the host PC, see figure
below.)
If the software is running on the
system under test, the testcard
accesses the device under test via
the PCI bus (see figure below).
CLI
Fast Host
Fast
Host
Interface
Card
Interface Card
Control
Software
Testcard
PCI Bus
Control
Software
PCI Bus
Control Interface Cable
Data
Control PC
PCI Bus
Control PC
Control Interface Cable
Figure 1.
SystemUnder Test
System
Under Test
CLI
CLI
1. Open the Testcard
Configuration dialog box by
clicking this item in the Setup
menu of the main window.
Testcard
Data Testcard
Data
PCI Bus
PCI Bus
Device Under Test
Device Under Test
2. Select the port the testcard is
connected to.
2
PCI Bus
Device Under Test
Data
To establish the connection to the
testcard:
To communicate with the testcard, you need to send commands to it that you enter in the
CLI. To open the CLI, select
Command Line Interface in the
Windows menu of the Main
Window.
Testcard
Device Under Test
Figure 2.
All commands allow access to the
memory, I/O and configuration
space of the device under test.
Note
All available commands used to
access registers of PCI and PCI-X
devices are introduced in the
following examples. Note that not
all the available parameter
settings can be shown here. For
further information on these,
refer to the Summary of
Commands Used at the end of
this document.
Control
Software
Control
Software
Peeking and Poking
Register Values of a
PCI Device
This section shows how to peek
and poke register values of a PCI
device by means of the following
examples:
· Peeking register values from the
video frame buffer memory of a
VGA graphics adapter
· Poking register values into the
video frame buffer memory of a
VGA graphics adapter
Poking Register Values
Task
To poke a character into the top
left corner of the VGA text screen
(visible in DOS mode only).
You can also poke the I/O or
configuration space of a device
by setting space=io or
space=config.
Each successful completion of a
command is indicated by Ready
displayed in the CLI.
Results
Procedure
The character 'A' will be
displayed in the top left-hand
corner of the DOS screen.
1. Open the Command Line
Interface (CLI).
2. Write a single byte to the
physical memory address
0xb8000 by entering the
following command line:
Peeking Register Values
Task
To peek register values from the
video frame buffer memory of a
VGA graphics adapter.
Procedure
Command to
set a register
value
1. Open the Command Line
Interface.
Memory
address
space
Physical
address
Single
byte
transfer
Register
value
Figure 4.
2. Read a dword from the
physical memory address
0xb8000 by entering the
following command line:
BestHostPCIRegGet space=mem Bus_addr=b8000\h size=4
Command to get
a register value
dword
transfer
Figure 3.
3
Peeking and Poking
Memory Spaces of a
PCI Device
The PCI/PCI-X Exerciser operates
as follows when accessing
memory spaces:
Data Transfer to the Device
Under Test (Poking)
The Exerciser transfers data from
the control PC to the device
under test in two steps:
Peeking Memory Spaces
Task
To read 32 Kbytes from a VGA
graphics adapter (PCI address
0xB8000000) to the memory of the
control PC.
Procedure
1. Open the CLI.
2. Allocate the required buffer in
the testcard's data memory by
entering the following
command line:
BestHostSysMemAccessPrepare buscmd=B_CMD_MEM_READ bufsize=8192
1. It transfers the data into a
memory buffer in the testcard.
2. It writes the data from the
testcard into the device under
test
Data Transfer from the Device
Under Test (Peeking)
Command to
allocate the
required buffer
Read command
Required
buffer size
Figure 5.
3. Perform the data transfer by
entering the following command
line:
The Exerciser transfers data from
the device under test to the control PC in two steps:
1. It reads the data from the
device under test into a
memory buffer in the testcard.
2. It transfers the data from the
testcard to the control PC.
Because all data transfers require
the use of the testcard's data
memory, you need to allocate a
buffer in this memory before you
start the transfer.
The following examples show you
how to use Exerciser commands
to make data transfers:
· Peeking a data block from the
video frame buffer memory of a
VGA graphics adapter
· Poking a data block into the
video frame buffer memory of a
VGA graphics adapter
4
Command to read
data from the
system under test
PCI bus address
from where the
data is read
Figure 6.
Results
The CLI displays the value read
from the accessed memory space
Number of
bytes
transferred
Master
block
in bytes
Poking Memory Spaces
Task
To write the data (1\h, 2\h, 3\h,
4\h, 5\h, 6\h, 7\h, 8\h) to a VGA
graphic adapter (PCI address
0xB8000000).
Procedure
1. Open the CLI.
2. Allocate the required buffer in
the testcard's data memory by
entering the following
command line:
BestHostSysMemAccessPrepare buscmd=B_CMD_MEM_WRITE bufsize=8192
Command to
allocate the
required buffer
Write command
Required
buffer size
Figure 7b
3. Perform the data transfer by
entering the following command
line:
Transfer
data
Command to
write data to the
system under test
PCI bus address to
which the
data is written
Number of
bytes
transferred
Master block
size in bytes
Figure 7c
5
Peeking and Poking
Register Values of a
PCI-X Device
(valid only with Agilent
E2920 PCI-X Card)
Poking Register Values
Task
To transfer a dword from the
control PC to a register at the
physical memory address 0x8000
of a PCI-X device.
Procedure
The principles used to program
data transfers between the
Exerciser and a PCI-X device are
the same as for PCI devices. The
commands provided by the PCI-X
Exerciser software to access the
registers of a PCI-X device are
introduced in the following
examples.
1. Open the CLI.
2. Write the value to the register
by entering the following
command line
BestXHostPCIRegWrite addrspace=mem addr=08000\h size=4 val=1\h
Command to
write data to
the register
Peeking Register Values
Task
To transfer a dword from a register in a PCI-X device at the
physical memory address 0x8000
to the control PC.
Figure7
Procedure
Results
Memory
address
space
The value is written to the PCI-X
device register.
1. Open the Command Line
Interface.
2. Read the register dat by
entering the following
command line:
BestXHostPCIRegRead addrspace=mem addr=08000\h size=4
Command to read
data from the
register
Memory
address
space
Figure 8.
Results
The register value is displayed in
the Command Line Interface.
6
Physical
address
Dword
transfer
Physical
address
dword
transfer
Value to
be set
Summary of Commands
Used
Commands for PCI
BestHostPCIRegGet /
BestHostPCIRegSet
Description
Reads/writes the value from/to a specific PCI device register in a 32-bit address space—the type
address space determines the configuration, memory or I/O read.
Syntax
BestHostPCIRegGet space=<addrspace> bus_addr=<bus_addr> size=<size>
BestHostPCIRegSet space=<addrspace> bus_addr=<bus_addr> size=<size> val=<reg_value>
Parameters addrspace:
mem
io
config
(Memory Space)
(IO Space)
(Type 0 access to
Config Space)
(Type 1 access to
Config Space)
config_type
bus_addr:
size:
reg_val:
PCI bus address
1
2
4
Register Value
(byte)
(word)
(Dword)
BestHostSysMemAccessPrepare
Description
Prepares the internal address, the command in the master block properties, and a memor
buffer for a transfer through the data memory of the testcard. Data verification can be
activated.
Syntax
BestHostSysMemAccessPrepare buscmd=<buscmd> bufsize=<bufsize>
Parameters
buscmd:
bufsize:
B_CMD_MEM_WRITE
(memory write)
B_CMD_MEM_READ
(memory read)
internal memory buffer size in dwords (minimum: 2 dwords)
BestHostSysMemDump64/BestHostSysMemFill64
Description
Transfers data from a PCI device to the host system memory./
Transfers data from the host system memory to a PCI device.
Syntax
BestHostSysMemDump64
BestHostSysMemFill64
Parameters
bus_addr_low/
bus_addr_high:
num_of_bytes:
blocksize:
data_list:
data<"file path" (optional):
bus_addr_low=<bus_addr_low>
bus_addr_high=<bus_addr_high>
num_of_bytes=<num_of_bytes> blocksize=<blocksize>
[data>"file path"]
bus_addr_low=<bus_addr_low>
bus_addr_high=<bus_addr_high>
num_of_bytes=<num_of_bytes>
blocksize=<blocksize>
( data=<{data_list}> ) | ( data<"file path" )
PCI bus address
Number of bytes to be transferred (maximum of 128 Kbytes).
Size of the master block transfers in bytes.
List of data to be transferred.
File to which the data can be exported.
7
Commands for PCI-X
BestXHostPCIRegRead /
BestXHostPCIRegWrite
Description
Reads/writes the value from/to a specific PCI-X device register in a 32-bit address space—the type
of address space determines the Configuration, Memory or I/O Read.
Syntax
BestXHostPCIRegRead
BestXHostPCIRegWrite
space=<addrspace> bus_addr=<bus_addr> size=<size>
space=<addrspace> bus_addr=<bus_addr> size=<size>
val=<reg_value>
Parameters
addrspace:
mem
io
config
PCI bus address
(byte)
(word)
(Dword)
Register Value
bus_addr:
size:
reg_val:
8
(Memory Space)
(IO Space)
(Access to Config Space)
1
2
4
Register Value
Glossary
Control PC
This PC runs the software that controls the testcard.
Data Memory
The data memory holds received test data, and data to be transferred by the testcard. It is
shared between the master and the target and can be set up or read out with host
access functions. It also provides a data compare unit to compare incoming data with
previously stored reference data.
Exerciser (PCI)
The PCI Exerciser functions enable the testcard to emulate a PCI master
or target.
Exerciser (PCI-X)
The PCI-X Exerciser functions enable the testcard to emulate a PCI-X
requester-initiator, completer-target, completer-initiator or requester-target:
Host
Same as Control PC.
Peeking
Reading values from device registers or memory spaces.
Poking
Writing values into specific device registers or memory spaces.
System Under Test
The system under test is the PCI/PCI-X system into which the testcard is plugged.
9
Agilent Technologies' Test and Measurement Support, Services, and Assistance
Agilent Technologies aims to maximize the value you receive, while minimizing your risk and problems.
We strive to ensure that you get the test and measurement capabilities you paid for and obtain the
support you need. Our extensive support resources and services can help you choose the right Agilent
products for your applications and apply them successfully. Every instrument and system we sell has
a global warranty. Support is available for at least five years beyond the production life of the product.
Two concepts underlay Agilent's overall support policy: "Our Promise" and "Your Advantage."
Our Promise
Our Promise means your Agilent test and measurement equipment will meet its advertised performance
and functionality. When you are choosing new equipment, we will help you with product information,
including realistic performance specifications and practical recommendations from experienced test
engineers. When you use Agilent equipment, we can verify that it works properly, help with product
operation, and provide basic measurement assistance for the use of specified capabilities, at no
extra cost upon request. Many self-help tools are available.
Your Advantage
Your Advantage means that Agilent offers a wide range of additional expert test and measurement
services, which you can purchase according to your unique technical and business needs. Solve
problems efficiently and gain a competitive edge by contracting with us for calibration, extra-cost
upgrades, out-of-warranty repairs, and on-site education and training, as well as design, system
integration, project management, and other professional services. Experienced Agilent engineers
and technicians worldwide can help you maximize your productivity, optimize the return on investment
of your Agilent instruments and systems, and obtain dependable measurement accuracy for
the life of those products.
Related Agilent Literature
For more information,
please visit us at:
www.agilent.com/find/infiniband
By internet, phone, or fax, get assistance with all your test &
measurement needs
Online assistance:
www.agilent.com/find/assist
Phone or Fax
United States:
(tel) 1 800 452 4844
Canada:
(tel) 1 877 894 4414
(fax) (905) 206 4120
Europe:
(tel) (31 20) 547 2000
Japan:
(tel) (81) 426 56 7832
(fax) (81) 426 56 7840
· Agilent E2925B 32bit, 33 MHz, Agilent E2926B 32/64bit, 33 MHz PCI Exerciser & Analyzer, technical
specifications, p/n 5968-3501E
· Agilent E2928A 32/64bit, 66 MHz, PCI Exerciser & Analyzer, technical specifications, p/n 5968-3506E
· Agilent E2929A PCI Exerciser & Analyzer, technical specifications, P/n 5968-8984E
· Agilent E2922A PCI-X Master Target Card, technical overview, p/n 5968-9577E
· Agilent E2940A CompactPCI Exerciser & Analyzer, technical overview, P/n 5968-1915E
· Agilent E2976A System Validation Pack, Agilent E2977A System Test Library, technical overview,
p/n 5968-3500E
· Agilent E2920 Computer Verification Tools, PCI Series, brochure, p/n 5968-9694E
· Intel discusses basic concepts of PCI performance and efficient use of PCI with the Agilent E2920 series,
case study, p/n 5988-0448ENDE
· HP NSD stabilizes server designs quickly and completely with the Agilent E2920 PCI Series, case study,
p/n 5968-6948E
· HP HSTC speeds high-end server testing and reduces engineering costs with the Agilent E2920 PCI
Series, case study, p/n 5968-6949E
· Agilent E2920 Verification Tools, PCI Series gives Altera Corporation competitive Advantage, case study,
p/n 5968-4191E
Latin America:
(tel) (305) 267 4245
(fax) (305) 267 4286
You can find the current literature and software at:
www.agilent.com/find/pci_products
Copyright © 2001 Agilent Technologies
Printed in Germany July 30, 2001
5988-3310EN
For more information, please visit us at:
www.agilent.com/find/pci_overview
Australia:
(tel) 1 800 629 485
(fax) (61 3) 9272 0749
New Zealand:
(tel) 0 800 738 378
(fax) 64 4 495 8950
Asia Pacific:
(tel) (852) 3197 7777
(fax) (852) 2506 9284
Product specifications and descriptions in this
document subject to change without notice.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising