Microsoft Windows CE 3.0  

CardMapWindow

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function maps an area in PC Card memory or I/O space to system memory and returns a pointer used to access the mapped region.

PVOID CardMapWindow(
CARD_WINDOW_HANDLE
hCardWindow
UINT32
uCardAddress
UINT32
uSize
PUINT32
pGranularity
);

Parameters

hCardWindow
Handle to a memory window returned by a call to the CardRequestWindowfunction.
uCardAddress
Specifies a PC Card offset address.
uSize
Specifies the number of bytes to map.
pGranularity
Must be NULL.

Return Values

A PVOIDpointer mapped to the requested region. Callers must use GetLastError to determine of the call was successful, since CardMapWindowwill return 0x00 when mapping a PC Card offset address starting at emmory address 0. GetLastErrorreturns one of the following values:

CERR_SUCCESS
The mapping operation completed successfully.
CERR_BAD_WINDOW
Indicates that the hWinwindow handle is invalid.
CERR_BAD_HANDLE
Indicates that an hCardWindowdriver handle is invalid.
CERR_BAD_SIZE
Indicates that the value specified for uSizeis invalid.
CERR_OUT_OF_RESOURCE
Indicates that Card Services is unable to set up a memory window to read the CIS.
CERR_IN_USE
Indicates that another driver owns the memory window as well.

Remarks

If this function fails, a previous mapping of the window might be invalid.

The offset from the returned mapped virtual address must be multiplied by the value pointed to by pGranularity.

The pointer returned by this function can be used to access the PC Card directly. Drivers should access the memory in a try/exceptroutine to avoid faulting the system on card removal.

The pointer to the mapped PC Card memory that this function returns is to non-cached shared memory. This function calls the VirtualAllocfunction with flags to allocate non-cached memory. This guarantees that a PC Card device and its driver detect the same information when they access the same memory location.

To provide reliable access to the mapped PC Card memory, driver code should declare the pointer to the PC Card memory with the volatiletype qualifier.

Most Windows CE–based platforms use three fixed memory-mapped ranges to access the PC Card address spaces: attribute memory, I/O memory, and common memory. The address returned from this function is a virtual address mapped to the physical address corresponding to the caller's request. This function prevents multiple drivers from allocating overlapping ranges within each address space, though multiple allocations are permitted within each space. A single driver is enabled to map a range that overlaps its own previously allocated ranges.

Designers of Windows CE–based platforms that support programmable windows through a standard PC Card socket controller can define a combination of fixed memory-mapped ranges and programmable ranges in their PCMCIA PDD implementation. If the requested range cannot be mapped within one of the fixed regions, one of the programmable regions can be used. To avoid memory contention, Windows CE ensures that only one mapped range exists within a programmable range. The programmable ranges are not large, about 32 KB, but they can access any 32 KB range within the 64 MB PC Card address space.

In Windows CE versions 3.0 and later, CardGetParsedTuple will calculate and fill in all default fields in CISTPL_CFTABLE_ENTRY structures and set the ContainsDefaultsmember to TRUE for every entry returned. Earlier versions of Windows CE returned the tuples exactly as represented in the card information structure. Use CardGetFirstTuple and CardGetNextTuple if you need to retrieve tuple data as it is stored on the PC Card.

Driver name

PCMCIA

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later      
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CARD_WINDOW_HANDLE, CardRequestWindow



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.