Overriding Logical Configurations

To allow support for PnP cards that have invalid logical configs defined on the card, overriding logical configs are supported. These overriding logical configs are defined in the INF file for the device and transfered to the registry when the device is installed. When an overriding logical config is defined for a device, the config manager will replace the logical configs created by the enumerator with the overriding config defined in the registry. Refer to the Device Installation section for detailed information about the general case of overriding configurations.

The logical config created by the PCMCIA Bus Enumerator is an extended version of the normal logical config defined by the configuration manager. This logical config contains an additional DWORD flags value on the end of the I/O and IRQ resource descriptor, an additional DWORD flags value and DWORD card address value on the end of the memory resource desciptor, and an ignored resource descriptor which contains the REQUEST_CONFIG_PKT structure.

The extension to the I/O Range is a dword flags value. A single flag bit is defined (0x40), when set indicates the I/O ports are 16-bit I/O ports, otherwise they are 8-bit ports.

The extension to the IRQ List is a dword flags value. A single flag bit is defined IRQI_LEVEL (0x20), when set indicates the IRQ is level triggered. Currently, this bit must be set for the card to be configured.

The extension to the Memory Range is a dword flags value followed by a dword card offset. The flags value must be set to either WDWA_ATTRIB_MEM (0x02), or WDWA_16BIT (0x08). When it is set to WDWA_ATTRIB_MEM it indicates the memory window is in attribute memory. When it is set to WDWA_16BIT it indicates the memory window is in common memory. The card offset is the offset on the PC card for the memory window to be mapped.

PCMCIA PC Cards require an additional resource type. This resource is defined as type 0x897C. The data in the resource is the same as the PCMCIA Card Services RequestConfiguration argument structure (REQUEST_CONFIG_PKT). The Socket field in this structure does not need to be filled in.

The following is an example of the overriding logical config that may be defined for PCMCIA Cards in the INF file.


[SAMPLEOVERRIDE]
HKR,Override,0000,HEX, \ 
;
00,04,00,00, \            ; CONFIGMG_VERSION
00,00,00,00, \            ; PRIORITY
;
; I/O Resource Descriptor
;
24,00,00,00, \            ; Total length of I/O Resource Descriptor
02,00,00,00, \            ; ResType_IO = 0x00000002
01,00, \                 ; IOD_Count;
0C,00, \                 ; IOD_Type;    // IOType_Range = 0x000C
00,00, \                 ; IOD_Alloc_Base;
00,00, \                 ; IOD_Alloc_End;
00,00, \                 ; IOD_DesFlags;
00, \                     ; IOD_Alloc_Alias;
00, \                     ; IOD_Alloc_Decode;
F0,FF, \                 ; IOR_Align;    // Mask for base alignment
10,00, \                 ; IOR_nPorts;    // Number of ports
00,00, \                 ; IOR_Min;    // Min port address
FF,FF, \                 ; IOR_Max;    // Max port address
00,00, \                 ; IOR_RangeFlags;  // Flags
00, \                     ; IOR_Alias;    // Alias offset
00, \                     ; IOR_Decode;    // Address specified
40,00,00,00, \            ; PCCARD flags, 0x40 = 16-bit port
;
; Memory Resource Descriptor
;
34,00,00,00, \            ; Total length of Memory Descriptor
01,00,00,00, \            ; ResType_Mem = 0x00000001
01,00, \                 ; MD_Count;
14,00, \                 ; MD_Type;    // MType_Range = 0x0014
00,00,00,00, \            ; MD_Alloc_Base;
00,00,00,00, \            ; MD_Alloc_End;
00,00, \                 ; MD_Flags;
00,00, \                 ; MD_Reserved;
00,F0,FF,FF, \            ; MR_Align;    // Mask for base alignment
00,10,00,00, \            ; MR_nBytes;    // Count of bytes
00,00,00,00, \            ; MR_Min;    // Min Address
FF,FF,FF,FF, \            ; MR_Max;    // Max Address
00,00, \                 ; MR_Flags;    // Flags
00,00, \                 ; MR_Reserved;
02,00,00,00, \            ; PCCARD flags, 0x02 = attribute mem, or
                        ;    0x08 = 16-bit common mem
00,10,00,00, \            ; Memory card address
;
; IRQ Resource Descriptor
;
14,00,00,00, \            ; Total length of IRQ Resource Descriptor
04,00,00,00, \            ; ResType_IRQ = 0x00000004
00,00, \                 ; IRQD_Flags;
00,00, \                 ; IRQD_Alloc_Num;  // Allocated IRQ number
FF,FF, \                 ; IRQD_Req_Mask;  // Mask of possible IRQs
00,00, \                 ; IRQD_Reserved;
20,00,00,00, \            ; PCCARD flags, 0x20 = Level mode int's
;
; REQUEST_CONFIG_PKT Descriptor
;
19,00,00,00, \            ; Length of REQUEST_CONFIG_PKT Descriptor
7C,89,00,00, \        ; ResType_Ignored_Bit+PCCARD_DEVICE_ID= 0x897C
00,00, \                 ; Socket;
02,00, \                 ; Attributes;
32, \                     ; Vcc;
00, \                     ; Vpp1;
00, \                     ; Vpp2;
02, \                     ; IntType;
00,02,00,00, \            ; ConfigBase;
00, \                     ; Status;
00, \                     ; Pin;
00, \                     ; Copy;
01, \                     ; ConfigIndex;
0F, \                     ; Present;
;
00,00,00,00              ; TERMINATOR
<ex>

<h2>Display Tuple Utility (DTPL.EXE)

<p>DTPL.EXE is a tool designed for interpreting the tuples on a PC Card. This tool is intended to help you design or verify CIS for use with Microsoft's PCMCIA support in Windows. DTPL runs in realmode on MS-DOS using realmode Card Services and Socket Services implementations. It is intended to be run on PC Cards that have not been configured by a card services client, or enabler. Therefore card services clients and PC Card enablers should not be loaded or active when using this tool.

<p>This tool displays information derived from the tuples on the PC Card. This includes the PnP Device ID, the PnP Logical Configurations, and a display of each tuple on the card.

<p>The tool has the following syntax:

<ex>DTPL [-f <filename>] [-i] [-l] [-r] [-t] [<socket#>]

-f filename

Defines a filename to take the tuple input from instead of calling CS.

-i

Displays the PNP Device ID for the PC Card.

-l

Displays the PNP logical configurations for the PC Card.

-r

Displays raw tuple data bytes, formatted for input file.

-t

Displays all of the tuples on the PC Card.

socket#

An optional socket to display, otherwise all sockets will be displayed.


The -f option allows the tuple input to be taken from a file. This allows tuples to be interpreted with out the need for a realmode Card Services driver and also allows tuples to be tested before they are placed on a PC Card. The tuples in this file must be defined in an ASCII HEX format. Each hex value must have two digits, the parser for this is very simple. Comments may be placed in the tuple file using a semicolon (;).

For example the following tuple is a config entry tuple for a comm port.


; This is a COM1 port
1B 11  ; Config entry and link values.
E0 01 1D 48 D5 02 1D FC
14 A0 60 F8 03 07 30 3C 00

The optional socket# is ignored when the -f option is used and the socket for the tuples will be set to 0xFF.

The -i option displays the PnP Device ID for the PC Card.The PnP Device ID is the ID that will be generated by the PCMCIA Bus Enumerator for the device and used by the Plug and Play system. This ID should be used when generating the .INF file for a device. The device ID is created from the manufacturer name string, the product name string, and a 16-bit CRC of a set of tuples. The ID is created by concatinating the PCMCIA prefix, the manufacturer name string, the product name string, and a 16-bit CRC. The Device ID has the following format:

PCMCIA\manuf_name-prod_name-crc

The manuf_name and prod_name are obtained from the CISTPL_VERS_1 tuple. If the CISTPL_VERS_1 tuple is not available or the manufacturer name is NULL, the string "UNKNOWN_MANUFACTURER" will be included in its place.

The CRC will be created from the following tuple data: CISTPL_DEVICE, CISTPL_VERS_1, CISTPL_CONFIG, CISTPL_CFTABLE_ENTRY, CISTPL_MANFID.

Only the first two strings in the CISTPL_VERS_1 tuple, the manufacturer and product name strings, are included in the CRC. This is because serial numbers are occasionally placed in the additional strings of this tuple. These serial numbers would cause the CRC to be different for each card even though they are the same.

The total length of the device ID string is limited to 128 characters, including the null terminator. The manufacturer and product name will be truncated to maintain this length restriction in the ID string.

The characters in the manufacturer and product name strings that are greater than or equal to a space (0x20) or less than (0x7F) will be copied into the name string. Any other characters outside this range will be skipped. This makes it easier to include these characters in the .INF files for the device. Spaces and commas in the device ID will be converted to underscores (_).

The -l option displays the PnP Logical Configurations for the PC Card. The PnP Logical Configurations are generated by the PCMCIA Bus Enumerator from the Config and Config Entry tuples. The display of these configurations is intended to provide some feedback on the interpretation of the configuration tuples on the PC Card. The logical configuration will be used by the Plug and Play Configuration Manager to determine the configuration for the PC Card. The information displayed includes I/O, IRQ, and Memory resource data, along with the contents of a Card Services RequestConfiguration argument structure.

The -r option displays each tuple as its raw data bytes. This is in a format that can be easily edited and feed back to the DTPL tool as an input file using the -f option. Note that any strings that are not data bytes must be commented out with a semicolon (;) or removed from the input file.

The -t option displays each tuple in a more readable format. Many of the tuples are interpreted and displayed in an expanded form. For example this is done for the configuration entry tuples which are difficult to understand without such expansion. Following the expanded information for each tuple is a dump of the tuple data bytes in an ASCII HEX format followed by an ASCII dump of each byte in the tuple. Non-printable bytes are diplayed as a period (.) in the ASCII dump. Tuples that are not expanded are displayed in an ASCII HEX format only.