systems, inc. It is DOME’s exclusive property. It may not be reproduced
or transmitted, in whole or in part, without a written agreement from
DOME. No patent or other license is granted to this information.
The software, if any, described in this document is furnished under a
license agreement. The software may not be used or copied except as
provided in the license agreement.
DOME imaging systems, inc. provides this publication as is without
warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability or fitness for a particular purpose. DOME may revise this document from time to time without
notice. Some states or jurisdictions do not allow disclaimer of express or
implied warranties in certain transactions; therefore, this statement may
not apply to you.
Information in this document about products not manufactured by
DOME is provided without warranty or representation of any kind, and
DOME will not be liable for any damages resulting from the use of such
information.
DOME imaging systems, inc.
400 Fifth Avenue
Waltham, MA 02451-8738
(781) 895-1155 phone
(781) 895-1133 fax
Internet address for product information:
Internet address for sales information:
Internet address for technical support:
World Wide Web site:
www.dome.com
info@dome.com
sales@dome.com
support@dome.com
Part No. 41-DEVPCI-03
Product Nos. 55-MD2PCI2, 55-MD4PCI2, 55-MD5PCIB, 55-MD8PCI
October 2000
DOME is a registered trademark and DIMPL, DimplX, Calibration TQA,
Md2/PCI, Md4/PCI, Md5/PCI, and Md8/PCI are trademarks of DOME
imaging systems, inc. Microsoft, Windows, and Windows NT are trademarks of Microsoft Corporation. PS/2 is a trademark of International
Business Machines Corporation. Sun and Solaris are trademarks of
Sun Micro-systems, Inc. X Window System is a trademark of the
Massachusetts Institute of Technology.
Page 3
Contentsiii
Contents
About This Guide vi
Purpose vi
Audience vi
Conventions vii
What’s in this guide viii
Related documentation viii
Read this section for an overview of how to use this guide.
Purpose
This guide describes the architecture of the Md2/PCI,™
Md4/PCI,™ Md5/PCI,™ and Md8/PCI™ display controllers (boards). It explains how to develop applications with
these libraries:
• Dynamic Link Library (DLL) for Windows
systems
• DOME
Solaris™ operating systems
Audience
This guide serves developers who are writing software
applications for the Md2/PCI, Md4/PCI, Md5/PCI, or
Md8/PCI board. You should have programming experience with either Windows or Solaris operating systems.
Use this table to find the section for your operating system.
For this operating
system…See this section…
®
operating
®
MDlib Application Program Interface (API) for
Windows 2000 or
Windows NT
Solaris 2.xChapter 3, “DOME MDlib API
®
Chapter 2, “Dynamic Link Library” on
page 9
Function Reference” on page 67
Page 7
About This Guidevii
Conventions
This table explains the conventions used in the guide.
This
convention...Indicates...
Monospaced
type
Italic type
Bold type
File -> Open
<Key>
Computer code or directory; backslash (\)
indicates continuation of previous line of
UNIX code.
New or technical term; book title; or variable,
such as
Menu selection.
Select Open from the File menu.
Key name, such as
Information you should know regarding a
particular topic or procedure.
Information that can prevent potential
damage to hardware or software.
A helpful tip or an alternative method of
performing a procedure.
x.
<Enter>.
Page 8
viiiPCI Products Developer’s Guide
What’s in this guide
This table describes the organization of the guide.
This chapter…Provides…
Chapter 1
Board Architecture
Chapter 2
Dynamic Link Library
Chapter 3
DOME MDlib API
Function Reference
Architecture drawings for the
Md2/PCI, Md4/PCI, Md5/PCI, and
Md8/PCI boards, and an explanation
of gamma correction and 10-bit DACs.
Detailed descriptions of the data types
and functions of the DOME DLL for
Windows operating systems. It
explains the DOME data types and
gives detailed descriptions of each
DLL function. The functions are
organized logically. For example,
DSetGCT
Detailed descriptions of the types,
structures, and functions of the DOME
MDlib API. Use these functions with
Solaris operating systems only.
Functions are organized logically, in
the order in which they appear as
members of the
is followed by
DMdDev
DGetGCT
structure.
.
Related documentation
For more information about your board or related
DOME products, refer to these books:
• Md2/PCI Display Controller Installation Guide
• Md4/PCI Display Controller Installation Guide
• Md5/PCI Display Controller Installation Guide
• Md8/PCI Display Controller Installation Guide
• Calibration TQA User’s Guide
• DIMPL Library Reference
Page 9
Board Architecture1
Chapter 1
Board Architecture
In This Chapter
• Md2/PCI Board Architecture 2
• Md4/PCI Board Architecture 3
• Md5/PCI Board Architecture 4
• Md8/PCI Board Architecture 5
• Gamma Correction and the 10-Bit DAC 6
Page 10
2 Chapter 1
Md2/PCI Board Architecture
This figure shows the Md2/PCI™ board architecture.
Video Memory
4 MB VRAM
PCI
Local
Bus
32
Luminance
Calibr at o
in
Port
Md2/PCI board architecture
128
GUI & Copy
Accelerator
(I-128)
Masking
DRAM
64
VGA
Contr oller
10-bit DAC
Video
Video
10-bit DAC
VGA
DRAM
Page 11
Board Architecture3
Md4/PCI Board Architecture
This figure shows the Md4/PCI™ board architecture.
Video Memory
8 MB VRAM
128
128
128
10-bit DAC
Video
PCI
Local
Bus
GUI & Copy
32
Accelerator
(I-128)
Luminance
Calibr at o
in
Port*
* PS/2 or access bus supported
Md4/PCI board architecture
Masking
DRAM
10-bit DAC
VGA
Contr oller
VGA
DRAM
Video
Optional VGA Video
Page 12
4 Chapter 1
Md5/PCI Board Architecture
This figure shows the Md5/PCI™ board architecture.
PCI
Local
Bus
GUI & Copy
32
Accelerator
Luminance
Calibr at o
in
Port*
* PS/2 or access
bus supported
(I-128)
Md5/PCI board architecture
Video
128128
Memory
8 MB VRAM
VGA
DRAM
VGA
Contr oller
10-bit DAC
Video
Optional VGA Video
Page 13
Board Architecture5
Md8/PCI Board Architecture
This figure shows the Md8/PCI™ board architecture.
PCI
Local
Bus
GUI & Copy
32
Accelerator
Luminance
Calibration
Port*
* PS/2
(I-128)
Video
128128
Memory
8 MB VRAM
32
VGA
DRAM
Md8/PCI board architecture
VGA
Controller
10-bit DAC
Video
Optional VGA Video
Page 14
6 Chapter 1
Gamma Correction and the 10-Bit DAC
The Md2/PCI, Md4/PCI, Md5/PCI, and Md8/PCI display
controllers (boards) use a 10-bit digital-to-analog converter
(DAC) in their video output circuitry. Nearly all competitive display boards use 8-bit DACs.
The DAC converts the digital image data stored in the
board’s video memory to an analog signal that drives the
monitor. An 8-bit DAC can send no more than 256 different
analog values to the monitor, while a 10-bit DAC can
provide up to 1024 values. An 8-bit DAC can therefore
result in as much as a 30% reduction in gray shades available to display an image. With such a reduction, critical
image details can be lost.
Display monitors do not produce a linear response across
the full range of pixel values. If there are 256 possible analog values, the change in luminance from value 0 (zero) to
value 1 (one) is different than the change from value 127 to
128. Likewise, doubling the pixel value sent to the monitor
does not precisely double the displayed brightness.
Gamma correction
This nonlinearity can be corrected using a method known
as
gamma correction
table compensates for the nonlinearity by adjusting the
values sent to the monitor.
An 8-bit DAC can produce only 256 such values, and
a nonlinear translation must sacrifice some of these values.
. With this technique, the DAC’s lookup
For this reason, gamma correction performed with an 8-bit
DAC sends substantially fewer than 256 distinct values to
the monitor.
Page 15
Board Architecture7
The 10-bit DAC on the Md2/PCI, Md4/PCI, Md5/PCI, and
Md8/PCI boards can produce up to 1024 distinct analog
values. Thus, the boards can perform gamma correction
and send 256 distinct pixel values to the monitor, to produce a truer, more accurate grayscale image.
Accessing the gamma correction tables
You can access the
Windows
®
and Solaris™ operating systems.
gamma correction tables
(GCTs) in both
GCTs in Windows
If you are using a Windows operating system, apply the
Dynamic Link Library (DLL) provided with the DOME
®
Windows driver to set the GCT. For more information,
see “DSetGCT” on page 48.
The Windows operating system uses 8-bit color. Once
you set the GCT, the DOME Windows driver translates
all palette changes to the 10-bit value.
GCTs in Solaris
If you are using a Solaris operating system, initialize
the GCT to a linear ramp and load it into the hardware
with the
InitGCT
function (page 100) of the MDlib API.
Page 16
Page 17
Dynamic Link Library9
Chapter 2
Dynamic Link Library
In This Chapter
• DLL Data Types 10
• Windows NT DLL 11
• Windows 2000 DLL 12
• Using Functions in Multi-Monitor and
Windows NT 4.0-Compatible Modes 15
• New Functions in the Windows 2000 DLL 18
• DLL Functions 19
Page 18
10 Chapter 2
DLL Data Types
The
mdpcint
of functions that links Windows operating systems and
DOME software applications. This section describes the
data types specific to DOME as well as the Windows
types and structures used in the DLL.
DOME types
The standard C types of
different things to different compilers. The DOME types,
however, are strictly defined as signed or unsigned and
by byte size, as shown in this table.
SizeSignedUnsigned
1 byte
Dynamic Link Library (DLL) is a group
char, int
DOME Types
SBYTEUBYTE
, and
long
can mean
2 bytes
4 bytes
SWORDUWORD
SDWORDUDWORD
Windows types and structures
The DLL uses standard Windows types and structures, as
shown in this table.
Windows Types and Structures
Type or StructureDefinition
DWORD
HDC
SIZESIZE
POINTPOINT
Unsigned 4 bytes
Handle to display-device context
structure as defined on page 33
structure as defined on page 35
Page 19
Dynamic Link Library11
Windows NT DLL
All DOME Windows drivers include the
mdpcint.dll
library. This DLL provides an application interface to
the driver.
When working in Windows NT
®
4.0-compatible mode,
use only functions without the MM suffix.
Other functions listed in this chapter are not available
for the Windows NT operating system; these include
all functions with the MM suffix.
Page 20
12 Chapter 2
Windows 2000 DLL
All DOME Windows drivers include the
library. This DLL provides an application interface to
the driver.
The Windows
®
2000 DLL has some significant differences
from previous versions of the DLL. For example, the new
version of
mdpcint.dll
does not run on the Windows NT 4.0 operating system.
But, given a Windows NT 4.0-compatible screen configuration, programs written for Windows NT 4.0 will work
unchanged under Windows 2000 with the new DLL.
Windows 2000 DLL modes
Most functions in the Windows 2000 DLL have these
three modes:
• Full Windows NT 4.0-compatible mode
is
mdpcint.dll
not
backward-compatible. It
• Partial Windows NT 4.0-compatible mode
• Multi-monitor mode
The parameters to each function determine the mode.
Where possible, function names and parameters in the
Windows 2000 DLL use the same names and parameters
as they did in previous versions. The main difference
among the modes is in the way applications use the
parameters.
Page 21
Dynamic Link Library13
Full Windows NT 4.0-compatible mode
A system that is fully compatible with the Windows NT
4.0 operating system meets these criteria:
• All screens are driven by the same type of DOME
board, all at the same resolution.
• All screens combine to make a rectangle with no gaps.
• All screens are in nonnegative space.
Partial Windows NT 4.0-compatible mode
Partial Windows NT 4.0-compatible mode includes
these features:
• One system can include both DOME and other brands
of boards.
• One system can run different DOME board types
simultaneously.
• Screens do not have to combine to make a rectangle.
• All DOME screens are in nonnegative space.
When running in partial Windows NT 4.0-compatible
mode, these
Get
routines return an error, unless all
DOME displays have the same value:
DGetBoardType
•
•
DGetDriverVersion
DGetNumGCTBits
•
•
DGetRefreshRate
DGetNumScreens
returns the number of DOME screens
only (in all modes).
Page 22
14 Chapter 2
Multi-monitor mode
Multi-monitor mode works with any Windows 2000
desktop. Multi-monitor mode includes these features:
• One system can include both DOME and other brands
of boards.
• One system can run different DOME board types
simultaneously.
• One board can support different palette types on
each monitor.
• Screens do not have to combine to make a rectangle.
• Screens can be unattached from the Windows
desktop.
Changing displays in the Windows 2000
virtual desktop
If you change any of the display properties in the
Windows 2000 virtual desktop (for example, if you
change resolution, placement, or detachment), you
must unload and then reload the DLL as follows:
• To unload the DLL, exit all programs that are using
the DLL, including the DOME tab.
• To reload the DLL, start any program that accesses
the DLL.
Page 23
Dynamic Link Library15
Using Functions in Multi-Monitor and
Windows NT 4.0-Compatible Modes
Multi-monitor and the Windows NT 4.0-compatible
modes treat functions differently depending on the
function’s parameters. This section describes how
functions work in these modes.
Using functions that require HDC and
screen-number parameters
For functions that require both an HDC (handle to
display-device context) and screen number, the modes
differ as follows:
• In Windows NT 4.0-compatible modes (full and partial),
the
HDC
number is the
• Multi-monitor mode is signaled by combining the high
bit in the screen-number parameter with the Windows
2000 display number. The application can create the
hdc
parameter to the functions. If the application wants
the DLL to create the
parameter. Otherwise, the DLL creates a DC using
the display number. For an example of each method,
see “DGetDriverVersionMM” on page 23.
• Always use the
is from any screen display, and the screen
Windows NT 4.0 virtual screen number.
for the particular display and supply it as the first
hdc
hdc
, it uses
for unattached displays.
NULL
as the first
The Windows NT 4.0 virtual screen number is the screen
number assigned by the DLL and is independent of the
operating system. The DLL counts only DOME screens.
Page 24
16 Chapter 2
The Windows 2000 display number is the same as that
passed to the GDI (graphical device interface) function
EnumDisplayDevices
(the number shown via Identify
minus one).
The GDI call uses 32-bit numbers, while the DOME DLL
uses 16-bit numbers.
Example
WIN2K_DISPLAY_NUMBER
is defined in mdpcint.h as
0x8000. This code sample shows how to cast the display
number in the DLL:
nDisplay = (UWORD) Win2000DisplayNum |
WIN2K_DISPLAY_NUMBER;
Using functions that do not include HDC and
screen-number parameters
Functions that previously did not include a screennumber parameter are obsolete in multi-monitor mode.
Those that still provide useful information have been
rewritten with the MM suffix and
hdc and display-
number parameters.
ExampleFor example, Windows NT 4.0-compatible applications
use the
DGetBoardType (HDC hdc, UWORD FAR * lpRetType)
DGetBoardType function like this:
Multi-monitor applications use DGetBoardType
like this:
DGetBoardTypeMM (HDC hdc, UWORD nDisplay,
UWORD FAR * lpRetType)
DGetMaxScreens and DGetNumBoards are obsolete in
both modes.
Page 25
Dynamic Link Library17
DDirectBlt
is only available in Windows NT 4.0compatible mode. Currently this function is not fully
operational: although it splits the
blt between screens
correctly, GDI does not send the driver the correct clip,
and the driver overdraws overlapping windows.
Page 26
18 Chapter 2
New Functions in the Windows 2000 DLL
These functions exist only in multi-monitor mode and
are new in the Windows 2000 DLL:
DGetPaletteTypeMM
•
• DGetSisterDisplayRegPathMM
• DGetSisterDisplayNumberMM
A sister display is one of two displays being driven by
the same DOME board.
This table lists each updated function and the obsolete
function it replaces.
All functions with the MM suffix are available only in
Windows 2000 and work only in multi-monitor mode.
The previous versions (without the MM suffix) work in
Windows NT 4.0-compatible mode.
Page 27
Dynamic Link Library19
DLL Functions
Use the DLL functions described in this section to write
applications. The functions are listed logically; for example,
PurposeUse DGetDriverVersion to return the version number of
the DOME Windows driver.
Syntax
DWORD DGetDriverVersion (hdc, lpwDriverVersion)
DGetDriverVersion Parameters
Parameter
TypeNameDescription
HDChdcHandle to the display-
device context.
UWORD FAR * wDriverVersionPointer to UWORD.
It is filled in with a
hexadecimal value. The
high byte is the version
number , and the low b yte
is the revision number.
For example, 0x108 is
returned when you’re
using the version 1.8
driver.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
Page 30
22 DGetDriverVersion
ExampleThis example returns the driver version in
wDriverVersion.
#include <mdpcint.h>
{
HDChdc;
UWORDwDriverVersion;
DWORD dwRetCode;
dwRetCode + DGetDriverVersion (hdc,
&wDriverVersion);
return dwRetCode;
}
See alsoDGetLibraryVersion
Page 31
DGetDriverVersionMM23
DGetDriverVersionMM
(Windows 2000, multi-monitor mode only)
PurposeUse
DOME Windows driver for your board.
Syntax
DWORD DGetDriverVersionMM (hdc, nDisplay,
Parameter
TypeNameDescription
HDChdcHandle to the display-
UWORDnDisplayTarget display.
UWORD FAR * lpDriverVersionPointer to UWORD.
DGetDriverVersionMM to return the version of the
lpDriverVersion)
DGetDriverVersionMM Parameters
device context.
It is filled in with a
hexadecimal value. The
high byte is the version
number, and the low byte
is the revision number.
For example, 0x500 is
returned when you’re
using the version 5.0.0
driver.
Return valueDWORD – zero (0) if function completed successfully;
DEVMODE dmMode; HDC hdc;
/* Fill in relevant parts of dmMode. */
hdc = CreateDC ("DISPLAY", "\\\\.\\DISPLAY2",
NULL, &dmMode);
dwRetCode = DGetDriverVersionMM (hdc,
WIN2K_DISPLAY_NUMBER, &DriverVersion);
See alsoDGetLibraryVersion and GetFileVersionInfo
function of the Microsoft SDK
Page 33
DGetLibraryVersion25
DGetLibraryVersion
PurposeUse DGetLibraryVersion to return the version of the
DOME Windows DLL.
Syntax
DWORD DGetLibraryVersion (lpwLibraryVersion)
DGetLibraryVersion Parameters
Parameter
TypeNameDescription
UWORD FAR *wLibraryVersionPointer to UWORD.
It is filled in with a
hexadecimal value.
The high byte is the
version number, and
the low byte is the
revision number. For
example, 0x201 is
returned when you’re
using the version 2.1
library.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
ExampleThis example returns the library version in
wLibraryVersion
#include <mdpcint.h>
{
UWORDwLibraryVersion;
DWORDdwRetCode;
dwRetCode = DGetLibraryVersion
(&wLibraryVersion);
return dwRetCode;
}
See alsoDGetDriverVersion and GetFileVersionInfo function
of the Microsoft SDK
.
Page 34
26 DGetBoardType
DGetBoardType
(Obsolete in multi-monitor mode)
PurposeUse
(Md2/PCI, Md4/PCI, Md5/PCI, or Md8/PCI).
Syntax
DWORD DGetBoardType (hdc, lpwBoardType)
Parameter
TypeNameDescription
HDChdcHandle to the display-
UWORD FAR *wBoardTypePointer to UWORD; on
DGetBoardType to return the board type
DGetBoardType Parameters
device context.
successful return, it
contains one of these
values:
•MD2PCI
•MD4PCI
•MD5PCI
•MD8PCI
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code
This function is valid with version 1.08 and later of
the DLL.
PurposeUse DSetGCT to set the GCT for a particular screen.
Syntax
DWORD DSetGCT (hdc, wScreenNumber, lpgct)
DSetGCT Parameters
Parameter
TypeNameDescription
HDChdcHandle to the display-
device context.
UWORDwScreenNumberTarget screen number
(zero-based).
GAMMA_
CORRECTION_
TABLE FAR *
gctPointer to GCT.
ArraySize specifies
the number of entries in
each color array. For
current versions of the
DLL, ArraySize must
be 256. The table’s color
values are 16-bit values.
The DLL shifts these
values down if the DAC
doesn’t support the full
16 bits.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
Grayscale boards use green values only.
Page 57
DSetGCT49
StructureThis code fragment defines the only valid structure for the
GAMMA_CORRECTION_TABLE in this version of the library.
typedef struct
{
UWORD Reserved1;
UWORD Reserved2;
UWORD ArraySize;
UWORD Red[256];
UWORD Green[256];
UWORD Blue[256];
} GAMMA_CORRECTION_TABLE;
DSetGCT
overwrites the Reserved1 and Reserved2
fields in the GAMMA_CORRECTION_ TABLE. The ArraySize
field must be 256.
ExampleThis example sets the GCT for screen zero (0).
See alsoDSetGCT, DSetStartupGCT, DCancelStartupGCT
Page 60
52 DSetStartupGCT
DSetStartupGCT
PurposeUse DSetStartupGCT to set the initial GCT for a particular
screen. This table loads whenever you start the Windows
operating system. The GCT supplied to this function takes
Syntax
effect only when you restart Windows.
DSetStartupGCT
can also replace a previous startup table.
DWORD DSetStartupGCT (wScreenNumber, lpFileName)
DSetStartupGCT Parameters
Parameter
TypeNameDescription
UWORDwScreenNumberTarget screen number
(zero-based).
SBYTE FAR * FileNameFull path of the file
containing the GCT. The
colors in the file are full
16-bit values. IdGCT
must equal 0xD03E9A3A.
You must set Version
to 1 (one) for current
versions of the DLL.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
DSetStartupGCT
Delete the original GCT file to preserve disk space.
copies the GCT file to a system directory.
Page 61
DSetStartupGCT53
StructureThis code fragment defines the GCT_FILE_FORMAT
PurposeUse DCancelStartupGCT to cancel the startup GCT for a
particular screen. When you start the Windows operating
system after setting this function, the default (linear) GCT
loads for the indicated screen. This function takes effect
only when you restart the Windows operating system.
Syntax
DWORD DCancelStartupGCT (wScreenNumber)
DCancelStartupGCT Parameters
Parameter
TypeNameDescription
UWORDwScreenNumberTarget screen number
(zero-based)
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
ExampleThis example cancels the initial GCT for screen zero (0).
Calibration TQA™ and prepare it for taking
measurements.
Syntax
DWORD DCalibratorInit (hdc, wScreenNumber,
lpInitStruct)
DCalibratorInit Parameters
Parameter
TypeNameDescription
HDChdcHandle to the display-
device context
UWORDwScreenNumberTarget screen number
(zero-based)
INIT_
CALIBRATOR_
STRUCT FAR *
InitStructPointer to INIT_
CALIBRATOR_ STRUCT
structure
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
StructureThis code fragment defines the
structure.
typedef struct
{
UWORDVersion;
UWORDMeasurementTime;
DWORDReadTimeout;
UDWORDReserved;
} INIT_CALIBRATOR_STRUCT;
You must set Version to 2.
INIT_CALIBRATOR_STRUCT
Page 66
58 DCalibratorInit
MeasurementTime
which the sample is taken in
is the number of microseconds over
DCalibratorMeasure
(page 60). This parameter must be greater than 17 and
less than 1,179,630.
When measuring a periodic source such as a monitor,
sample at an integer number of periods. Setting the proper
integration time for a monitor at a specific frequency is
essential to obtaining accurate, repeatable measurements.
Each value set in
MeasurementTime is equal to one (1)
microsecond. Use this equation to find the integration time:
period of
one cycle
--------------------=
00010600
integration time for one cycle
Multiply the integration time by the number of cycles
you want to measure (31 cycles are recommended). For
example, with a 75 Hz monitor, use this calculation:
1
----- 75
6
10
×31×413333=
Thus, the integration time is:
413,333 microseconds = .413 seconds
ReadTimeout is the number of milliseconds to wait for
data when reading from the calibrator port.
You can still use Version 1 (one) of the structure, which
does not include
(one), the
ReadTimeout value defaults to 2000 (2 seconds),
and you must set
ReadTimeout. If you do use Version 1
Version to 1 (one).
Page 67
DCalibratorInit59
ExampleThis example initializes the DOME Calibration TQA and
prepares it for taking measurements on screen one (1).
InitStruct.Version = 2;
InitStruct.ReadTimeout = 2000;
/* Set InitStruct.MeasurementTime using the
calculation on page 58. */
.
.
.
dwRetCode = DCalibratorInit (hdc, 1,
&InitStruct);
return dwRetCode;
}
See alsoDCalibratorMeasure, DGetFtLamScale
Page 68
60 DCalibratorMeasure
DCalibratorMeasure
PurposeUse DCalibratorMeasure to take a measurement
from the DOME Calibration TQA and return the result.
Syntax
DWORD DCalibratorMeasure (hdc, wScreenNumber,
lpdwMeasure)
DCalibratorMeasure Parameters
Parameter
TypeNameDescription
HDChdcHandle to the display-de vice
context.
UWORDwScreenNumberTarget screen number
(zero-based).
DWORD FAR * dwMeasurePointer to DWORD. It is filled
in with the measurement
result, in the range from
0 (zero) to 65534. The
number 65535 indicates
a saturation error. Higher
numbers indicate greater
light striking the pod.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
Page 69
DCalibratorMeasure61
ExampleThis example returns the screen luminance on screen
PurposeUse DSerialCmd to write command bytes to the PS/2®
serial port and then read back the specified number of
response bytes from the port.
Syntax
DWORD DSerialCmd (hdc, wScreenNumber,
wnumCmdBytes, lpCmdBuffer, wnumResponseBytes,
lpResponseBuffer, dwTimeout)
DSerialCmd Parameters
Parameter
TypeNameDescription
HDChdcHandle to the display-
device context.
UWORDwScreenNumberTarget screen number
(zero-based).
mines which board’s
serial port to write to.
UWORDwnumCmdBytesNumber of bytes to write
to the command buffer.
If this is zero (0), the function reads the response
bytes without writing any
command bytes.
This deter-
UBYTE FAR *CmdBufferBuffer that contains the
command bytes that are
written to the port. This
parameter can be NULL
if wnumCmdBytes is
zero (0).
Page 73
DSerialCmd65
DSerialCmd Parameters (Cont.)
Parameter
TypeNameDescription
UWORDwnumResponse-
Bytes
UBYTE FAR *ResponseBuffer Buffer to receive the
DWORDdwTimeoutNumber of milliseconds
Number of bytes to be
read from the port after
the Cmd is sent. If this
value is zero (0), the
function returns zero (0)
without waiting for a
response.
response bytes. If
wnumResponseBytes
is zero (0), this can
be NULL.
\to wait for the response
data. If this value is
zero (0), the Read-
Timeout value from
InitCalibrator
is used.
Return valueDWORD – zero (0) if function completed successfully;
otherwise, operating system error code.
All structures are packed on 1-byte boundaries.
Page 74
66 DSerialCmd
ExampleThis example writes a command byte to the PS/2 serial
port and then reads back the specified number of response
bytes from the port.
The standard C types of char, int, and long can mean
different things to different compilers and machine types.
The MDlib API types, however, are strictly defined as
signed or unsigned and by byte size, as shown below.
PurposeThe DMdVersion structure provides the DOME MDlib
API version.
DMdVersion is a member of the DMdDev structure
returned by the
the program executes, it checks to see if the version of
the
domeMd.h header file it has used to compile matches
that of the MDlib API.
Full compatibility with the API exists only if both the
major and minor version numbers match. The sub
version number, however, does not need to match
for full compatibility.
If the major version number does not match, the program
DMdOpen or DMdFdOpen call. When
is unable to execute. When the major version number
changes, backward compatibility is not provided.
Page 78
70 DMdVersion Structure
If the major version number matches, but the minor version
number does not, the API retains backward compatibility;
a program compiled with an older version of
runs correctly with a newer MDlib API.
StructureThis table defines the
DMdVersion Structure
DMdVersionMemberDescription
struct {
DShortmajorMajor version number
DByteminorMinor version number
DBytesubSub version number
} DMdVersion
upper-left corner pixel of the source
rectangle. The upper-left corner
pixel of the screen has screen
coordinates (0,0). The x screen
coordinate increases to the right.
upper-left corner pixel of the source
rectangle. The upper-left corner
pixel of the screen has screen
coordinates (0,0). The y screen
coordinate increases downward.
DULongdstxThe x screen coordinate of the
DULongdstyThe y screen coordinate of the
DULongwidthWidth in pixels of the rectangle
DULongheightHeight in pixels of the rectangle
} DMdCopyRect
upper-left corner pixel of the
destination rectangle.
upper-left corner pixel of the
destination rectangle.
DError(*FillRects) ()See page 92
DError(*InitCmap) ()See page 94
DError(*WriteCmap) ()See page 95
DError(*UpdateCmap) ()See page 97
DError(*ReadCmap) ()See page 98
DError(*InitGCT) ()See page 100
DError(*WriteGCT) ()See page 101
DError(*UpdateGCT) ()See page 103
DError(*ReadGCT) ()See page 104
DVoid(*reserve1)For future use
DVoid(*reserve2)For future use
DVoid(*reserve3)For future use
DVoid(*reserve4)For future use
DVoid(*reserve5)For future use
DVoid(*reserve6)For future use
DVoid(*reserve7)For future use
DVoid(*reserve8)For future use
DVoid(*reserve9)For future use
} DMdDev
All structure members, except both version and fd,
are pointers to functions that provide the remaining
functionality of the DOME MDlib API. Those functions
are described in the next section, “MDlib API Functions.”
Page 83
MDlib API Functions 75
MDlib API Functions
Use this reference to the DOME MDlib API functions to
write applications. The two
Open functions appear first,
followed by the other functions in the order in which they
appear as members of the
PurposeUse DMdOpen to gain access to a DOME device.
Syntax
DMdDev DMdOpen (name)
DMdOpen Parameters
Parameter
TypeNameDescription
DChar*nameDevice file of the DOME device,
for example, "/dev/md4pci0.0"
Return valueDevice handle if successful; otherwise, NULL.
Description
DMdOpen() opens the DOME device specified by name
and returns the device handle, which provides access to
the device. To close the DOME device, use the
member function (page 78) of the returned device handle.
ErrorsIf
DMdOpen() returns NULL, an error message prints to
stderr
.
Close()
ExampleThis example opens the DOME device
#include "domeMd.h"
DMdDevdev;
dev = DMdOpen ("/dev/md4pci0.0");
.
.
.
(*dev->Close) (dev);
/dev/md4pci0.0.
See alsoDMdFdOpen, Close, DMdDev Structure
Page 85
DMdFdOpen77
DMdFdOpen
PurposeUse DMdFdOpen to access a DOME device if the device
file is already open.
Syntax
DMdDev DMdFdOpen (fd)
DMdFdOpen Parameters
Parameter
TypeNameDescription
DLongfdFile descriptor of the opened device file
Return valueDevice handle if successful; otherwise, NULL.
Description
DMdFdOpen() opens the DOME device specified by the
open file descriptor
fd and returns the device handle
that provides access to the device. To close the DOME
device, use the
Close() member function (page 78)
of the returned device handle.
ErrorsIf
DMdFdOpen() returns NULL, an error message prints to
stderr
.
ExampleThis example opens the DOME device
#include "domeMd.h"
DMdDevdev;
DLongfd;
fd = open ("/dev/md5pci0.0", O_RDWR);
if (fd == -1)
exit (-1);
dev = DMdFdOpen (fd);
.
.
.
(*dev->Close) (dev);
See alsoDMdOpen, Close, DMdDev Structure
/dev/md5pci0.0.
Page 86
78 Close
Close
PurposeUse Close to end access to a DOME device.
Syntax
DVoid (*Close) (dev)
Close Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueNone.
Description
Close() closes the DOME device previously opened
with either
Close(), you cannot access the DOME device using the
DMdOpen() or DMdFdOpen(). After you call
old device handle.
ErrorsNone.
ExampleThis example closes the device handle
#include "domeMd.h"
DMdDevdev;
dev.
dev = DMdOpen ("/dev/md2pci0.0");
.
.
.
(*dev->Close) (dev);
See alsoDMdOpen, DMdFdOpen, DMdDev Structure
Page 87
RefreshRate79
RefreshRate
PurposeUse RefreshRate to get the refresh rate for a monitor
mode setting.
Syntax
DLong (*RefreshRate) (dev)
RefreshRate Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle for the DOME device
Return valueAn integer equal to 100 times the refresh rate in Hz, if
successful. If the monitor mode is not set to a supported
Description
mode,
RefreshRate() returns a long integer equal to 100 times
RefreshRate() returns zero.
the refresh rate of the monitor mode setting.
ErrorsNone.
ExampleThis example returns the refresh rate of the monitor mode.
#include "domeMd.h"
DMdDevdev;
floatrefreshRate;
.
.
.
refreshRate = (*dev->RefreshRate) (dev) / 100.0;
See alsoDMdDev Structure
Page 88
80 FbVideo
FbVideo
PurposeUse FbVideo to turn video on or off.
Syntax
DBool (*FbVideo) (dev, on)
FbVideo Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
DBoolonSpecifies whether to turn video
on or off
Return valueTRUE if video was on before the call; FALSE if video
was off.
Description
FbVideo() turns the display video on if on is TRUE and
off if
on is FALSE. It also returns the status of the video
(on or off) before this call takes effect.
ErrorsNone.
ExampleThis example turns the display video off.
#include "domeMd.h"
DMdDevdev;
DBoolvideoOn;
.
.
.
videoOn = (*dev->FbVideo) (dev, FALSE);
See alsoDMdDev Structure
Page 89
MapFb81
MapFb
PurposeUse MapFb to map the framebuffer. This function allows
the program to access the framebuffer directly.
Syntax
DVoid *(*MapFb) (dev)
MapFb Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueA pointer to the beginning of the framebuffer if successful;
Description
otherwise,
MapFb() maps the framebuffer to the virtual address space
NULL.
of the caller and returns a pointer to the beginning of that
space. The caller can access the framebuffer directly
through the pointer.
Attempts to access locations before the beginning of the
framebuffer or beyond the size of the framebuffer will
result in an error.
To get the size of the framebuffer, use the FbSize()
member function of the device handle (page 84).
To unmap the framebuffer, use the
function of the device handle (page 83).
ErrorsIf
stderr
UnmapFb() member
MapFb() returns NULL, an error message prints to
.
Page 90
82 MapFb
ExampleThis example maps the framebuffer.
#include "domeMd.h"
DMdDevdev;
char*pFb;
.
.
.
pFb = (*dev->MapFb) (dev);
See alsoUnmapFb, FbSize, DMdDev Structure
Page 91
UnmapFb83
UnmapFb
PurposeUse UnmapFb to unmap the framebuffer.
Syntax
DVoid (*UnmapFb) (dev)
UnmapFb Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueNone.
Description
UnmapFb() unmaps the framebuffer from the virtual
address space of the caller, freeing up any system resources
that have been allocated. Attempts to access the framebuffer using the pointer formerly obtained from
will result in an error.
ErrorsIf
UnmapFb() fails, an error message prints to stderr.
ExampleThis example unmaps the framebuffer.
MapFb()
#include "domeMd.h"
DMdDevdev;
char*pFb;
.
.
.
pFb = (*dev->MapFb) (dev);
.
.
.
(*dev->UnmapFb) (dev);
See alsoMapFb, DMdDev Structure
Page 92
84 FbSize
FbSize
PurposeUse FbSize to get the size of the framebuffer.
Syntax
DLong (*FbSize) (dev)
FbSize Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueSize of framebuffer in bytes.
Description
FbSize() returns the size of the framebuffer in
bytes. Attempts to access locations beyond the
size of the framebuffer will result in an error.
ErrorsNone.
ExampleThis example returns the size of the framebuffer.
#include "domeMd.h"
DMdDevdev;
DLongfbSize;
.
.
.
fbSize = (*dev->FbSize) (dev);
See alsoFbWidth, FbHeight, FbPitch, DMdDev Structure
Page 93
FbWidth85
FbWidth
PurposeUse FbWidth to get the width of the framebuffer.
Syntax
DLong (*FbWidth) (dev)
FbWidth Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueWidth in pixels of the visible portion of the framebuffer.
Description
FbWidth() returns the width, in pixels, of the visible
portion of the framebuffer.
Access to locations beyond the visible portion of the frame-
buffer is reserved. To get the number of bits per pixel, use
the
BitsPerPixel() member function (page 89) of the
device handle.
ErrorsNone.
ExampleThis example returns the width of the framebuffer.
#include "domeMd.h"
DMdDevdev;
DLongfbWidth;
.
.
.
fbWidth = (*dev->FbWidth) (dev);
See alsoFbSize, FbHeight, FbPitch, BitsPerPixel,
DMdDev Structure
Page 94
86 FbHeight
FbHeight
PurposeUse FbHeight to get the height of the framebuffer.
Syntax
DLong (*FbHeight) (dev)
FbHeight Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valueHeight in pixels of the visible portion of the framebuffer.
Description
FbHeight() returns the height, in pixels, of the visible
portion of the framebuffer.
Access to locations beyond the visible portion of the
framebuffer is reserved.
ErrorsNone.
ExampleThis example returns the height of the framebuffer.
#include "domeMd.h"
DMdDevdev;
DLongfbHeight;
.
.
.
fbHeight = (*dev->FbHeight) (dev);
See alsoFbWidth, FbSize, FbPitch, DMdDev Structure
Page 95
FbPitch87
FbPitch
PurposeUse FbPitch to get the pitch of the framebuffer.
Syntax
DLong (*FbPitch) (dev)
FbPitch Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME device
Return valuePitch of framebuffer in pixels.
DescriptionThe pitch, sometimes called the stride, is the number of
pixels in one horizontal line of the framebuffer. It may be
equal to or greater than the width of the visible portion of
the framebuffer. To get from one pixel to another immediately below it on the screen, skip forward in the framebuffer by the number of pixels returned by
To get the number of bits per pixel, use the
FbPitch().
BitsPer-
Pixel()
member function (page 89) of the device handle.
ExampleThis example returns the pitch of the framebuffer in
PurposeUse CopyRects to make a screen-to-screen copy of
an array of rectangles.
Syntax
DError (*CopyRects) (dev, rop, planeMask, r,
nRects)
CopyRects Parameters
Parameter
TypeNameDescription
DMdDevdevDevice handle of the DOME
device
DLongropRaster operation to apply
(currently copy)
DLongplaneMaskPlane mask to apply (currently
all ones [1s])
DMdCopyRect*rArray of rectangles to copy
DLongnRectsNumber of rectangles to copy
Return valueD_OK if successful; otherwise, an error code.
Description
CopyRects() takes an array of nRects structures of
DMdCopyRect, containing pairs of source and destina-
tion rectangles, and copies each source rectangle to the
destination, applying the specified rasterop and plane
mask while doing so.
Even when the source and destination rectangles in each
pair overlap, the copying will work correctly. The order in
which pairs are copied matches the order of the rectangle
pairs in the array.
Page 99
CopyRects91
Currently the only rasterop supported is copy; rop is
ignored. Also,
written to the screen. For future compatibility, set
planeMask is ignored and all planes are
rop
to GXcopy (or 3), and planeMask to ~0 (all ones [1s]).
Errors
DMD_ERROR_BAD_DEVICE - Device failed to complete the
rectangle copy.
ExampleThis example copies two rectangles from one location on