Protected mode C binding for PCMCIA card services interface

Information

  • Patent Grant
  • 5689710
  • Patent Number
    5,689,710
  • Date Filed
    Tuesday, July 11, 1995
    29 years ago
  • Date Issued
    Tuesday, November 18, 1997
    27 years ago
Abstract
A library of C functions to perform PCMCIA Card Services. A PCMCIA Card Services specification defines a set of functions which allow applications and device drivers to access PCMCIA Cards. The PCMCIA Card Services specification provides a register based software interrupt binding to access the Card Services functions. A library of C functions is defined which can be called to perform the Card Services functions. The library of C functions can reformat the function parameters and then call a Card Services provider with a standard register based software interrupt binding. Alternatively, the library of C functions can be a fully protected mode implemenation of Card Services.
Description

BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to device driver interfaces. More specifically to a C language function library for accessing PCMCIA Card Services on a personal computer running the Microsoft.RTM. Windows operating system.
2. Art Background
Laptop and notebook sized personal computers have become very common. A problem with many existing laptop and notebook sized personal computers is that is difficult to add peripherals to such systems since there are no internal expansion slots. Peripherals can be connected to external ports on laptop and notebook sized personal computers, however, the external peripherals hang off the side of the portable computer system thereby making the system no longer portable.
To provide a convenient interface for small peripheral devices, a computer industry consortium drafted a specification defining a standard interface for credit-card sized peripherals. The computer industry consortium is known as the Personal Computer Memory Card Industry Association (PCMCIA) and the standard credit-card sized peripherals are known as PCMCIA Cards. The first version of the PCMCIA specification (PCMCIA 1.0) created an interface that could handle memory card expansion as well as some simple peripherals such as card-sized modems. The second version of the PCMCIA specification (PCMCIA 2.0) is a full bus specification capable of handling most common types of computer peripherals such as hard disk drives and LAN interfaces.
The PCMCIA standard is defined such that it is possible to plug in and remove cards while the base system is running, without damage to the cards or to the base system. This hot insertion/removal feature is unique to PCMCIA computer hardware. Furthermore, configuration information is kept in memory on a PCMCIA card itself, to allow the system to adapt to the card when it is plugged into a computer system. The PCMCIA standard defines the physical size and shape of PCMCIA cards. The PCMCIA standard also defines power and voltage levels, and connector pinouts. Cards which comply with the PCMCIA standard may be plugged into compatible systems without fear that the connectors won't match or that voltage differences will damage the hardware. The standard also defines the range of configuration information which may be kept on the cards, and indicates how software can read this information.
The PCMCIA hardware includes the socket into which the card is plugged, a connector for conveying power and information between the cards and the computer, and a socket adapter integrated circuit which couples the computer microprocessor to the sockets. The adapter contains hardware to generate microprocessor interrupts when a card hardware change event occurs, such as a cards being inserted or removed, or a card battery running low. Mapping hardware allows the card's memory, I/O, and interrupt to be directed to the proper places within the overall computer system. For example, if a card which contains memory, the memory may be made to appear at any point in the computer's address space below 16 megabytes. Similarly, if a card can generate an interrupt request, the interrupt request can be routed to one of a number of system IRQ lines.
The current PCMCIA standard defines two layers of software that a computer system uses to access and manage PCMCIA cards. The two layers of software are called the Socket Services layer and the Card Services layer. The Socket Services and Card Services layers are designed such that a single system may have several instances of Socket Services (each instance of Socket Services serving a corresponding PCMCIA adapter), but only a single instance of Card Services. Clients of the Card Services layer see only a number of PCMCIA sockets available but not a number of PCMCIA adapters each of which has one or more sockets. This abstraction, and the configuration management support, are the primary reasons for the Card Services software layer.
In operation, applications which wish use PCMCIA cards access the PCMCIA cards by using a library of functions provided by the Card Services software layer. Applications which use the Card Services functions are known as Card Services `clients.` A Card Services client registers with Card Services initially, giving Card Services the address of a client callback routine. Card Services executes the callback routine when a PCMCIA card related event occurs. For example, when a hardware interrupt from a PCMCIA card socket occurs the client's callback routine performs processing associated with the event. Events include hardware events such as card insertion/removal or low battery and software events such as a client requesting exclusive use of a card. Upon card insertion, a registered client might use the callback routine to query the card to determine the card's type. If card was the correct type it would then proceed to configure the card. The card's onboard memory, I/O, and interrupt must be set up to fit the system into which the card has been plugged. Card Services functions enable clients to configure cards by programming the card hardware registers and the PCMCIA adapter.
In the real mode DOS environment of an IBM.RTM. compatible personal computer, the Socket Services software layer of the PCMCIA standard is implemented using a ROM, a device driver, or a Terminate and Stay Resident (TSR) program. Most implementations of the Socket Services layer only require about 3K of memory, a relatively small amount of memory.
The Card Services software layer is implemented in a real mode DOS environment using a device driver or a TSR program which is loaded after DOS has loaded. The Card Services functions are accessed by Card Services clients using the software interrupt mechanism of the Intel processor as defined in the PCMCIA Card Services specification. (See PC Card Services Interface Specification, Release 2.00, September 1992, Personal Computer Memory Card International Association). Specifically, to call a Card Services function an application must load the function parameters into certain registers and then execute a INT 1A instruction with the AH register set to the hexadecimal value AF. Card Services analyzes the contents of the registers to obtain the function parameters and then performs the Card Services function requested. After completing the function, Cards Services returns to the application using a return from interrupt instruction.
The Microsoft.RTM. Windows operating environment is largely replacing the older DOS only environment in personal computers. The Microsoft.RTM. Windows environment provides an attractive graphical user interface (GUI) which makes Windows application programs easier to use. The Microsoft.RTM. Windows environment runs Windows applications located in the extended area of memory above the 1 megabyte boundary using the protected mode of the Intel processor.
Currently, Windows application programs which require access to Card Services must use the existing real mode implementation of Card Services as device drivers or Terminate and Stay Resident (TSR) programs for DOS. To access the real mode implementation of Card Services, a Windows application must switch from protected mode to real mode and calls Card Services TSR to carry out the Card Services function. This method of accessing Card Services is not very attractive for a number of reasons.
One problem is that it is inefficient to switch from protected mode which used to run Windows applications into real mode every time a call to the Card Services TSR is made.
Another problem with real mode DOS drivers is that the parameters supplied to the device driver must be translated when the real mode device driver is called from a protected mode Windows application. When a Windows application calls a real mode device driver, it passes pointers to data in selector:offset format. The interface to a real mode device driver requires that pointers to data be presented in a segment:offset format. Furthermore, it is likely that the protected mode Windows application points to data at an address above 1 Megabyte boundary. Since real mode device driver use segment:offset pointers, real mode device drivers cannot see data at addresses above 1 Megabyte. Therefore to use a real mode device driver the parameter data must be moved below the 1 Megabyte boundary.
Finally, most Windows application programs are written in the high level languages C and C++. Therefore most programmers that write Windows applications are not familiar with using the register based real mode binding defined in Appendix D of the PCMCIA Card Services specification. In fact to use the 8086 real mode binding a programmer must write assembly language code. Therefore the creation of a library of C Card Services functions would greatly facilitate the programming of Windows applications that use Card Services functions.
SUMMARY OF THE INVENTION
It is therefore an object of the present invention to provide a simple interface to Card Services functions for Windows applications.
Another object of the present invention is to provide a library of C functions for Windows applications which perform the Card Services functions.
Another object of the present invention is to provide a library of C functions for Windows applications which perform the Card Services functions without switching from protected mode into real mode.
These and other objectives are accomplished by the Card Services dynamic link library of the present invention. The Card Services dynamic link library provides a set of C functions which handle every Card Services function defined in the PCMCIA Card Services specification.





BRIEF DESCRIPTION OF THE DRAWINGS
The objects, features and advantages of the present invention will be apparent to one skilled in the art, in view of the following detailed description in which:
FIG. 1 is a block diagram of the Card Services and Socket Services software layers defined by the PCMCIA specification as used in a computer system.
FIG. 2 is a typical memory map of a DOS machine after DOS, device drivers, and Terminate and Stay Resident (TSR) programs have been loaded.
FIG. 3 is a conceptual diagram of the enhanced mode of Microsoft.RTM. Windows.
FIG. 4 is a block diagram of a protected mode Card Services translation dynamic link library which calls a read mode implementation of Card Services within a conceptual diagram of Microsoft.RTM. Windows in enhanced mode.
FIG. 5 is a block diagram of a fully protected mode implementation of Card Services within a conceptual diagram of Microsoft.RTM. Windows in enhanced mode.





NOTATION AND NOMENCLATURE
The detailed descriptions which follow are presented largely in terms of display images, algorithms, and symbolic representations of operations of data bits within a computer memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art.
An algorithm is here, and generally, conceived to be a self consistent sequence of steps leading to a desired result. These steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, selected, chosen, modified, and otherwise manipulated. It proves convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, images, terms, numbers, or the like. It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantifies and are merely convenient labels applied to these quantifies.
In the present case, the operations are machine operations performed in conjunction with a human operator. Useful machines for performing the operations of the present invention include general purpose digital computers or other similar devices. In all cases, there should be borne in mind the distinction between the method operations of operating a computer and the method of computation itself. The present invention relates to method steps for operating a computer and processing electrical or other physical signals to generate other desired physical signals.
The present invention also relates to apparatus for performing these operations. This apparatus may be specially constructed for the required purposes or it may comprise a general purpose computer selectively activated or reconfigured by a computer program stored in the computer. The algorithms presented herein are not inherently related to any particular computer or other apparatus. In particular, various general purpose machines may be used with programs in accordance with the teachings herein, or it may prove more convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these machines will appear from the description given below. Machines which may perform the functions of the present invention include those manufactured by the Assignee, Intel Corporation, as well as other manufacturers of computer systems.
DETAILED DESCRIPTION OF THE INVENTION
A C language function library for accessing PCMCIA Card Services on a personal computer is disclosed. In the following description, for purposes of explanation, specific nomenclature is set forth to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that these specific details are not required in order to practice the present invention. In other instances, well known circuits and devices are shown in block diagram form in order not to obscure the present invention unnecessarily.
Card Services in Real Mode
The current PCMCIA standard defines two layers of software that a computer system uses to access and manage PCMCIA cards. The two layers of software are called the Socket Services layer and the Card Services layer. FIG. 1 illustrates how the Socket Services and Card Services software layers are related and access the PCMCIA cards.
An instance of the Socket Services layer is implemented for each particular PCMCIA socket adapter in the system. Each Socket Services instance provides a set of routines used configure and control the corresponding PCMCIA Socket. Referring to FIG. 1, there is a different implementation of Socket Services (21 and 23) for each particular PCMCIA socket adapter (25 and 27, respectively) in the system. The Socket Services layer is designed such that it can be implemented in ROM and can be part of the system BIOS. However, the Socket Services layer is independent of the operating system running on the computer system. The functions in the Socket Services software layers (21 and 23) are called by the Card Services layer 31. The PCMCIA Socket Services Interface Specification specifies that Socket Services functions are called using the software interrupt mechanism INIT 1A. (See PCMCIA Socket Services Interface Specification, Release 2.00, September 1992, Personal Computer Memory Card International Association)
The Card Services software layer is designed to run on top of one or more instances of Socket Services. Card Services provides a set of functions which Card Services clients use to access and configure PCMCIA cards. Referring to FIG. 1, the Card Services software layer 31 is located above each implementation of Socket Services and calls the routines from each Socket Services implementation to perform hardware specific functions. The Card Services software layer 31 is operating system dependent and usually is loaded during the startup of the operating system. In an 8086 microprocessor operating in real mode, the Card Services functions are called by Card Services clients (33 and 35) using the software interrupt mechanism of the 8086 microprocessor. (INT 1A with the AH register set to the hexadecimal value AF). The Card Services layer 31 is designed to hide the different PCMCIA socket adapters from Card Services clients (33 and 35), such that the Card Services clients (33 and 35) always have a consistent interface to PCMCIA Cards. (See PC Card Services Interface Specification, Release 2.00, September 1992, Personal Computer Memory Card International Association)
FIG. 2 illustrates the memory map of a DOS computer system with a real mode implementation of the Card Services and Socket Services software layers. In the DOS machine illustrated in FIG. 2, the Socket Services and Card Services software layers are implemented as Terminate and Stay Resident (TSR) programs. The Socket Services TSR 25 and Card Services TSR 31 use valuable memory below the 640K barrier. The Socket Services TSR 25 only uses about 3K of memory, and therefore, it does not significantly reduce the amount of memory available to DOS applications in the application area 41. However, the 40K implementation of the Card Services TSR 31 significantly decreases the amount of real mode memory available to DOS application programs in the application area 41.
The Windows Environment
The Microsoft.RTM. Windows 3.1 system can operate in one of two modes: "standard" mode and "enhanced" mode. The standard mode exists so that personal computers equipped with older 80286 processors can use the Windows environment. The enhanced mode of Microsoft.RTM. Windows is used when Microsoft.RTM. Windows is run on a computer system which uses an 80386 or better microprocessor. Support for an older "real mode" of Windows has been dropped.
The present invention provides an C function library for performing PCMCIA Card Services functions for Windows applications running in the Microsoft.RTM. Windows environment. The two Card Services implementations disclosed are designed to operate only in the enhanced mode of Microsoft.RTM. Windows. In order to sufficiently disclose the C function library for Card Services of the present invention, the enhanced mode of the Microsoft.RTM. Windows operating system must first be explained.
The enhanced mode of Microsoft.RTM. Windows operates in the protected mode of the Intel 386 and 486 processors. In this manner, the enhanced mode of Microsoft.RTM. Windows takes advantage of features in the Intel 386 and 486 processors to offer virtual memory and multitasking operation. The processor hardware supports execution of several Windows applications in protected mode.
The enhanced mode of Microsoft.RTM. Windows supports DOS applications using "DOS virtual machines." In a DOS Virtual Machine, the 386 or 486 microprocessor operates in Virtual 8086 mode and uses the virtual memory feature to provide DOS, device drivers, and TSR programs originally loaded into the computer to a DOS virtual machine in extended memory. Windows uses the virtual memory system to make the application area and the DOS, device drivers, and TSR programs appear to be a single contiguous block of real mode memory. When the microprocessor is operating in Virtual 8086 mode within the address area of DOS virtual machine, the Virtual 8086 mode microprocessor cannot see any memory outside of the DOS virtual machine.
FIG. 3 provides a conceptual diagram of the Windows system in enhanced mode. At the bottom of the diagram is the computer system hardware. Just above the computer system hardware is the Ring 0 level with the Kernel and virtual device drivers (VxDs). At the top level is the system virtual machine and the various DOS virtual machines. Windows creates DOS virtual machines by mapping DOS, device drivers, and TSR programs in the system VM into the DOS VMs. Therefore, all the virtual machines share a region of memory called the shared real mode memory.
The Virtual device drivers (VxDs) at ring 0 are a special feature of Microsoft.RTM. Windows enhanced mode. A virtual device driver is actually a routine which manages a system resource such that more than one application can use the system resource at a time. Virtual device drivers therefore support Windows' ability to act as a multitasking operating system. Since virtual device drivers run at ring 0, virtual device drivers have access to a wide range of kernel services, including those for hardware management, memory management, task scheduling, and communicating with other virtual devices.
As illustrated in FIG. 3, all the Windows applications run within the system virtual machine which operates in protected mode. The Windows Dynamic Link Libraries (DLLs) which support Windows applications also run within the system virtual machine.
Each DOS application in FIG. 3 runs within its own DOS virtual machine. Since the DOS virtual machines usually operate in the Virtual 8086 mode of the microprocessor, the DOS applications generally can only address the 1 Megabyte of memory in the DOS virtual machine.
Card Services C Library Translation DLL
When the prior art real mode Card Services implementation of FIG. 2 is added to the Windows environment illustrated in FIG. 3, the Card Services Terminate and Stay Resident (TSR) program 31 is placed in the shared real mode memory area. In the enhanced mode of the Windows operating system, any program from any virtual machine would be able to directly access the Card Services TSR 31 located in the shared real mode memory area. However, if every program in every virtual machine directly accessed the single Card Services TSR 31, the Card Services TSR 31 would not operate properly and would eventually crash. The reason the Card Services TSR 31 would not operate properly is that the Card Services TSR 31 was originally designed and written only to operate in a simple DOS based computer.
To properly manage the Card Services TSR 31, a Card Services virtual device driver is required. Card Services virtual device driver "virtualizes" the INT 1A software interrupt such that each time a Card Services client attempts to access the Card Services TSR 31, the Card Services virtual device driver gets control. The Card Services virtual device driver uses this control to carefully manage every access to the Card Services TSR 31 such that the Card Services TSR 31 will operate properly. FIG. 4 illustrates the enhanced mode Windows environment with a Card Services virtual device driver 95 to control access to the Card Services TSR 31 located in the shared real mode memory.
In order to provide a library of Card Services C functions for Windows applications, a software layer has been placed in the system virtual machine between the Windows applications and the Card Services virtual device driver 95. This software layer comprises a dynamic link library of C functions entitled the Card Services Translation Dynamic Link Library (DLL) 81. The Card Services Translation DLL 81 provides a full library of C functions such that any of the Windows applications which are Card Services clients 61 can access any Card Services function by calling the appropriate C function in the Card Services Translation DLL 81. The complete library of C functions is fully described in the later section entitled "Card Services C Function Library". The Card Services Translation DLL 81 operates by loading the microprocessor registers and the performing an INT 1A software interrupt as defined in the PCMCIA Card Services Specification. The INT 1A software interrupt invokes the Card Services virtual device driver 95 to handle the access to Card Services.
The Card Services virtual device driver 95 obtains control after an INT 1A software interrupt is generated by any program in any virtual machine. The Card Services virtual device driver 95 first examines the parameters supplied by the calling Card Services client. If the parameters are real mode parameters supplied by a Card Services client located in a DOS virtual machine, then the Card Services virtual device driver 95 calls the Card Services TSR 31 with the supplied parameters.
However, if the parameters supplied by the calling Card Services client are protected mode parameters supplied by the Card Services Translation DLL 81 on behalf of a Windows client 61 operating in the system virtual machine then translation must be performed before the Card Services TSR 31 is called. The Card Services virtual device driver 95 translates the protected mode parameters by first copying the parameter data into a buffer below the 1 megabyte boundary and then supplying a real mode segment:offset pointer to the parameter data in the new buffer. The translated Card Services function parameters are loaded into the appropriate registers as defined by the Card Services specification. The Card Services virtual device driver 95 then access the Card Services TSR 31.
The Card Services virtual device driver 95 also handles callbacks from the Card Services TSR 31 back into the Card Services clients. However, in order to perform the callbacks properly, the Card Services virtual device driver 95 must slightly alter the client registration system. To fully disclose the callback procedure performed by the Card Services virtual device driver 95, the altered Card Services client registration system must first be explained.
Before a program can use Card Services functions, the program must first register with Card Services to become a Card Services client. The client registration is performed by generating an INT 1A software interrupt after loading specified registers with the address of a callback routine within the client and a pointer to a buffer supplying some client information. Within the buffer supplying some client information is a field called ClientData. The ClientData field contains an 8 byte value that the client needs to receive whenever a callback into the client is performed.
When the Card Services virtual device driver 95 obtains control after a program has attempted a Card Services client registration, the Card Services virtual device driver 95 stores copies of the ClientData field and the address of the callback routine provided by the registering program. The Card Services virtual device driver 95 then replaces the ClientData field with a value which will uniquely identify the new Card Services client. The Card Services virtual device driver 95 also replaces the callback address provided by the registering program with the address of a callback handling routine within the Card Services virtual device driver 95. The Card Services virtual device driver 95 then calls the Card Services TSR 31 with the altered ClientData field and callback address to perform the client registration. By altering the registration data, the Card Services virtual device driver 95 causes the Card Services TSR 31 to call the callback handling routine within the Card Services virtual device driver 95 whenever the Card Services TSR 31 performs a callback. The ClientData field provided by the Card Services TSR 31 will provide a value which uniquely identifies the Card Services client to be called back. The callback handling routine within the Card Services virtual device driver 95 will then perform the callback into the proper Card Services client.
For example, when the Card Services TSR 31 performs a callback (such as a callback to indicate that a client registration has successfully completed), the Card Services TSR 31 will always call the callback handling routine within the Card Services virtual device driver 95. The callback handling routine within the Card Services virtual device driver 95 examines the ClientData field supplied by the Card Services TSR 31 in order to identify which Card Services client must be called back. After identifying the proper Card Services client, the callback handling routine replaces the ClientData field supplied by the Card Services TSR 31 with the original ClientData field which was supplied by the Card Services client during client registration. The callback handling routine within the Card Services virtual device driver 95 next requests the kernel to schedule the virtual machine of the Card Services client to be called back. When the virtual machine of the Card Services client to be called back is scheduled, the callback handling routine finally calls the callback routine of the client using the original callback address supplied by the client during client registration. The callback into the Card Services client is performed using nested execution.
Although the system illustrated in FIG. 4 provides a C function library interface into Card Services for Windows applications, the system does not address the problem of requiring a switch from protected mode into real mode. The system illustrated in FIG. 4 also uses valuable memory below the 640K memory barrier in every DOS VM regardless of whether the DOS application requires Card Services.
Full Protected Mode Card Services DLL
A better method of providing a clean C function library interface into Card Services for Windows applications would be to create a fully protected mode version of Card Services. Referring to FIG. 5, a block diagram of a fully protected mode implementation of Card Services is presented. The protected mode Card Services implementation of the present invention uses the combination of a Windows Dynamic Linked Library (DLL) 51, a Windows application 53, and a Virtual Device Driver (VxD) 55.
The Dynamic Linked Library (DLL) 51 and the Windows application 53 form the core of the protected mode Card Services implementation of the present invention. The DLL 51 contains code that performs the Card Services functions. The Card Services functions are implemented with a DLL in order to allow several Windows applications to share the Card Services code. The Card Services DLL 51 maintains a database 57 of Card Services resources such that it can share the Card Services resources among clients of Card Services. Certain Card Services functions and hardware events require background processing. The Card Services implementation of the present invention uses the Windows application 53 to perform the required background processing.
A variety of Card Services requirements are provided by the Card Services Virtual Device Driver (VxD) 55 of the present invention. The Card Services Virtual Device Driver 55 provides a method of accessing the Card Services functions in the Card Services DLL 51 from DOS applications running in DOS virtual machines. The Virtual Device Driver (VxD) 55 also traps interrupts caused by PCMCIA socket adapters and calls the appropriate handling routine in the Card Services DLL 51. Finally the Virtual Device Driver (VxD) 55 also performs any functions that require system services, such as memory mapping, which are only available at ring 0. A complete description of the protected mode implementation of Card Services is provided in the copending application "An Architecture for Implementing PCMCIA Card Services under the Windows Operating System in Enhanced Mode", Ser. No. 08/631,950, filed concurrently herewith.
Referring to FIG. 5, the Card Services DLL 51 is illustrated within the system VM. Unlike the Card Services Translation DLL 81 of FIG. 4, the Card Services DLL 51 in FIG. 5 is a full implementation of Card Services such that no Card Services TSR is required. Since the Card Services DLL 51 is a full protected mode implementation of Card Services, there is no need to switch from protected mode into real mode to perform a Card Services function.
Since the Card Services DLL 51 is a centralized provider of Card Services functions to many different Card Services clients, the Card Services DLL 51 must allocate the available Card Services resources among the several the Card Services clients. To keep track of the available Card Services resources, the Card Services DLL 51 maintains a database 57 of the Card Services resources. When a Card Services client requests a resource, the Card Services DLL 51 checks the Card Services database 57 to see if the resource is available. If the resource is available, the Card Services DLL 51 gives the resource to the requesting client and marks the resource as unavailable in the Card Services database 57. When a Card Services client no longer needs a resource that was allocated to it, the Card Services client informs the Card Services DLL 51 that it no longer needs the resource. The Card Services DLL 51 then marks the resource as available in the Card Services database 57.
To configure and control the Socket adapter hardware the Card Services DLL 51 uses any Socket Services layers, such as the Socket Services TSR 21 in FIG. 5, that were loaded before Windows started. Note that any other type of Socket Services implementation such as a BIOS ROM extension or a device driver would also be acceptable.
The Card Services DLL 51 access the Socket Services TSR 21 in shared real mode memory using the DOS Protected Mode Interface (DPMI) provided by Windows as illustrated in FIG. 5. The actual address used to make the DOS Protected Mode Interface call is the address of the Socket Services real mode INT 1A chain. This address is provided to the Card Services DLL 51 during the initialization of the Card Services implementation.
When the Card Services DLL 51 calls the Socket Services layer using the DOS Protected Mode Interface, Card Services DLL 51 must make sure that all buffers passed to Socket Services are below the 1 megabyte real mode boundary. This must be done since the Socket Services TSR 21 runs in real mode and therefore cannot access any memory above the 1 megabyte real mode boundary.
Card Services C Function Library
For either the real mode Card Services system of FIG. 4 or the protected mode Card Services system of FIG. 5, the present invention provides a library of C functions. One C function is provide for each Card Services function such that a Windows Card Services client can request any Card Services function to be performed by calling the corresponding C function in the DLL. This section describes the Card Services C functional bindings of the present invention in detail.
The Card Services functions are listed here alphabetically. Each function is listed with the function parameters for ease of reference. Structure data types and enumerated types which are used as function parameters are defined. A complete description of each of these Card Services functions is available in section 5 of the PCMCIA Card Services Interface Specification, Release 2.00, September 1992, Personal Computer Memory Card International Association. ##SPC1##
The foregoing has described a C language function library for accessing PCMCIA Card Services on a personal computer. It is contemplated that changes and modifications may be made by one of ordinary skill in the art, to the materials and arrangements of elements of the present invention without departing from the scope of the invention.
Claims
  • 1. A method for implementing PCMCIA Card Services for at least one application program running on a computer system executing a Windows operating system, said method comprising the steps of:
  • loading a Card Services driver into said computer system, said Card Services driver being software interrupt based;
  • providing a translation Card Services dynamic link library, said translation Card Services dynamic link library comprising a library of translation C functions corresponding to a library of defined Card Services functions;
  • calling a translation C function in said translation Card Services dynamic link library from said application program to perform a corresponding Card Services function, said application program passing at least one function parameter to said translation C function;
  • placing said function parameter passed to said translation C function into a register for a Card Services software interrupt call into said Card Services driver; and
  • calling said Card Services driver from said translation C function in said translation Card Services dynamic link library using a software interrupt call, said Card Services driver performing said Card Services functionality.
  • 2. The method as claimed in claim 1, wherein said method further comprises the step of:
  • translating said function parameters from a protected mode into a real mode such that said Card Services provider receives real mode parameters.
  • 3. The method as claimed in claim 2, wherein said method further comprises the step of:
  • moving said real mode function parameters from a first memory region in said computer system above a one megabyte address boundary to a second memory region in said computer system below said one megabyte address boundary.
  • 4. The method as claimed in claim 3, wherein said method further comprises the steps of:
  • creating a Card Services virtual device driver;
  • hooking a Card Services software interrupt such that said Card Services virtual device driver executes when a Card Services client generates said Card Services software interrupt; and
  • calling said Card Services provider from said Card Services virtual device driver to perform Card Services functions.
  • 5. The method as claimed in claim 4, wherein said method further comprises the steps of:
  • calling a callback routine in said Card Services client from said Card Services virtual device driver if a corresponding defined Card Services function requires a callback to be performed into said Card Services client.
  • 6. The method as claimed in claim 5, further comprising the steps of:
  • registering a Card Services client with said Card Services provider, said Card Services client providing a ClientData field and an original client callback address to said Card Services provider during said step of registering;
  • storing said ClientData field in said Card Services virtual device driver;
  • replacing said ClientData field in said Card Services provider with a value that uniquely identifies said Card Services client;
  • storing said original client callback address in said Card Services virtual device driver;
  • replacing said original client callback address in said Card Services provider with a VxD callback address located within said Card Services virtual device driver;
  • receiving a callback to said VxD callback address in said Card Services virtual device driver from said Card Services provider, said Card Services virtual device driver identifying a Card Services client using said value that uniquely identifies said Card Services client; and
  • calling said callback routine in said Card Services client from said Card Services virtual device driver using said original client callback address provided by said Card Services client and providing said original ClientData field as a ClientData field.
  • 7. The method as claimed in claim 6, wherein said Card Services virtual device driver also handles Card Services requests from at least one Card Services client in a DOS virtual machine running under said Windows operating system.
  • 8. The method as claimed in claim 7, wherein said Card Services virtual device driver also handles callbacks into said Card Services client in said DOS virtual machine running under said Windows operating system.
  • 9. The method as claimed in claim 8, wherein said Card Services provider comprises a Terminate and Stay Resident (TSR) DOS program.
  • 10. A method for implementing PCMCIA Card Services for at least one application program running on a computer system executing a Windows operating system, said method comprising the steps of:
  • creating a Card Services dynamic link library, said Card Services dynamic link library comprising a library of C functions corresponding a library of defined Card Services functions;
  • executing a Card Services Windows application program on said computer system, said Card Services Windows application for performing background processing;
  • calling a C function in said Card Services dynamic link library from said application program, said application program providing at least one function parameter when calling said C function, said C function performing said corresponding defined Card Services function; and
  • posting a message to said Card Services Windows application from said Card Services dynamic link library if said C function requires background processing.
  • 11. The method as claimed in claim 10, wherein said Card Services Windows application performs background processing by calling a C function located within the Card Services dynamic link library.
  • 12. The method as claimed in claim 11, wherein said method further comprises the step of:
  • storing a Card Services database within said Card Services dynamic link library, said Card Services database containing a list of available Card Services resources, said Card Services data base is updated by said C functions.
  • 13. The method as claimed in claim 12, wherein said method further comprises the step of:
  • executing a callback routine in a Windows application from said Card Services dynamic link library if a corresponding defined Card Services function requires a callback into said Windows application to be performed.
  • 14. The method as claimed in claim 13, wherein said method further comprises the step of:
  • implementing a Card Services virtual device driver;
  • executing operating system functions from said Card Services virtual device driver on behalf of said Card Services dynamic link library.
  • 15. The method as claimed in claim 14, wherein said method further comprises the steps of:
  • hooking a Card Services software interrupt such that said Card Services virtual device driver executes when a Card Services client generates said Card Services software interrupt; and
  • calling a C function in said Card Services dynamic link library from said Card Services virtual device driver to perform Card Services functions when said Card Services virtual device driver receives a software interrupt.
  • 16. The method as claimed in claim 15, wherein said method further comprises the steps of:
  • implementing a VxD Card Services interface into said Card Services virtual device driver such that at least one other virtual device driver can access said Card Services virtual device driver;
  • calling said VxD Card Services interface from said other virtual device driver; and
  • calling a C function in said Card Services dynamic link library from said Card Services virtual device driver to perform Card Services functions when said Card Services virtual device driver receives a call from said other virtual device driver.
  • 17. The method as claimed in claim 15, wherein said Card Services virtual device driver executes a callback routine in said other virtual device driver if a corresponding defined Card Services function requires a callback to be performed.
  • 18. In a computer system running the Windows operating system, an apparatus for providing a C library for PCMCIA Card Services for at least one Windows application running on said Windows operating system, said apparatus comprising the elements of:
  • translation Card Services library means, said translation Card Services library means comprising a library of translation C functions corresponding a library of defined Card Services functions; and
  • Card Services means, said Card Services means performing the Card Services functions, said translation Card Services library means calling said Card Services means to perform Card Services functions.
Parent Case Info

This is a continuation of application Ser. No. 08/040,214, filed Apr. 1, 1993 now abandoned.

US Referenced Citations (3)
Number Name Date Kind
5204947 Bernstein et al. Apr 1993
5274819 Bloomfield-Brown Dec 1993
5302947 Fuller et al. Apr 1994
Non-Patent Literature Citations (7)
Entry
Daniel A. Norton, Windows device drivers, Journal: C Users Journal Dec. 1992, Copyright R&D Pulbications Inc. (1992).
Mark Nelson, Bimodal interrupt handling under 80286 DOS extenders, (includes a related article describing DOS extenders), Journal: C Users Journal Dec. 1992, Copyright R&D Publications (1992).
Andrew Schulman, Call VxD functions and VMW services easily using our generic VxD., Journal Microsoft Systems Journal Feb. 1993, Copyright M&t Publishing Inc. (1993).
Thomas W. Olsen, Making Windows and DOS programs talk (Tutorial), Journal: Windows-DOS Developrer's Journal May 1992, Copyright R&D Pulbications Inc. (1992).
Publication of the Personal Computer Memory Card International Association (PCMCIA) entitled: Card Services -Release 1.11; Sunnyvale, California, Aug. 16, 1992.
Publication of the Personal Computer Memory Card International Association (PCMCIA) entitled: PC-Compatible Socket Services Binding, Draft 2.00c; Sunnyvale, California, Sep. 12, 1992.
Publication of the Personal Computer Memory Card International Association (PCMCIA) entitled: PCMCIA Socket Services Interface Specification. Draft 2.00c; Sunnyvale, California, Sep. 12, 1992.
Continuations (1)
Number Date Country
Parent 40214 Apr 1993