Share via


Window Classes (Windows Embedded CE 6.0)

1/6/2010

The window classes for the PC Card socket service shared code library can be found in %_WINCEROOT%\Public\Common\Oak\Drivers\PCCard\Common\Pcmciacardlib.h. These window classes can be used to set and retrieve memory and I/O window properties.

A window implementation must exist for each socket. The windows implementation for a socket must handle calls to the CardInquireWindow, CardGetWindow, and CardSetWindow socket functions.

The CPcmciaWindowImpl class template is the base class for all window classes. It provides a standard implementation for the CardInquireWindow and CardGetWindow functions. Many of the methods in this class template are virtual methods and must be implemented in a derived class.

The CPcmciaMemWindowImpl and CPcmciaIoWindowImpl class templates are derived from the CPcmciaWindowImpl class template. These classes contain additional functionality that a memory or I/O window object must provide. The CPcmciaMemWindowImpl template is used to implement the CardSetWindow function for a memory window. The PcmciaIoWindowImpl template is used to implement CardSetWindow for an I/O window. They are intended for use with dynamic windows, such as memory and I/O windows that may change size or location in memory. The CPcmciaMemWindowImpl and CPcmciaIoWindowImpl classes must be customized by overriding virtual member functions used for calculating the window base address, offset, size, hardware-specific window programming, initialization, and cleanup.

A sample implementation of these templates can be found in %_WINCEROOT%\Public\Common\Oak\Drivers\PCCard\i82365.

The following code example shows the methods provided by CPcmciaMemWindowImpl and CPcmciaIoWindowImpl.

STATUS CardInquireWindow(PSS_WINDOW_INFO pWinInfo);
STATUS CardGetWindow(PSS_WINDOW_STATE pWindowState);
STATUS CardSetWindow(PSS_WINDOW_STATE pWindowState);
void Initialize();
void Deinitialize();

The following code example shows the virtual member functions that must be provided in a derived window class.

virtual void FreeResources(); \\Frees window resources
virtual void DisableWindow(); \\Disables the window
virtual void ProgramWindow(); \\Programs the memory window
virtual DWORD GetNewOffset(PSS_WINDOW_STATE pWindowState, DWORD dwNewOffset); \\Calculates the new window offset
virtual DWORD GetNewLength(PSS_WINDOW_STATE pWindowState, DWORD dwNewOffset); \\Calculates the new window size
virtual BOOL GetBaseAddress(PSS_WINDOW_STATE pWindowState, DWORD dwNewOffset, DWORD dwNewLength, DWORD& dwNewBaseAddress); \\Calculates the base address and allocate any resources for the window

The virtual member functions are called by the base class as necessary to manipulate the window hardware. It may not be possible to perform initialization and cleanup operations from the base window class template constructor or destructor since the window initialization and cleanup code requires calls to hardware-specific code. This can be avoided by calling the Initialize and Deinitialize functions for the derived window class from the constructor or deconstructor.

See Also

Concepts

PC Card Socket Service Shared Code Library
Socket Class
Bridge Base Class
Static Window Classes
PC Card Socket Service Shared Code Library Registry Settings