Writing PCMCIA Device Drivers
  Buscar sólo este libro
Descargar este libro en PDF

PC Cards and Drivers

1

This chapter provides a brief overview of PC Card technology and the PCMCIA organization. It also presents introductory information on the Solaris UNIX implementation of the PC Card 95 Standard.

What Is PCMCIA?

PCMCIA is an acronym for Personal Computer Memory Card International Association. The PCMCIA develops standards for low-cost, credit card-sized, interchangeable computer peripheral devices called PC Cards. The published specification for these devices is called the PC Card Standard.
The PC Card Standard specifies the electrical and mechanical interface between the PC Card device and the socket it is plugged into. The standard also defines the software support needed to configure and control the device. The PCMCIA software architecture enables PC Cards to be configured dynamically at the time of insertion, thus providing hot-plugging capability. Hot plugging allows users to add (or remove) peripheral devices to their computer system without rebooting it.

Terminology: PCMCIA or PC Card

The terms PCMCIA and PC Cards are often used interchangeably, and PCMCIA can refer to any of the following:
  • A set of electrical, mechanical, and software specifications (defined in the PC Card Standard)
  • The organization that created the PC Card Standard
  • The class of low-cost, credit card-sized peripheral devices
In this manual, physical devices are referred to as PC Cards, and drivers are referred to as PC Card drivers. PCMCIA refers to the system framework that supports PC Cards and drivers as well as to the PCMCIA.

PCMCIA Background

As the size of chips decreased during the 1980s, the physical size of computer systems also decreased, and laptop computing became more prevalent. Hardware vendors became concerned about the proliferation of proprietary device designs for laptop computing, and recognized the need to standardize on a physical card size for peripheral devices. Vendors also acknowledged the need for common electrical specifications and standard software access mechanisms.
In 1985, the Japan Electronic Industry Development Association (JEIDA) was formed to promote memory cards, personal computers, and other portable "information products". In 1989, the PCMCIA was formed specifically to standardize memory cards. The membership of the PCMCIA includes peripheral vendors, software developers, and computer and semiconductor manufacturers.
In 1990, the PCMCIA completed the PCMCIA Standard Release 1.0, which supported only memory card devices. The specification included 68-pin and socket connectors originally defined by JEIDA as well as the Card Information Structure (CIS) format and the electrical and physical requirements for memory cards. PCMCIA Standard Release 2.0 added support for I/O cards.
The latest version of the PCMCIA Standard is called the PC Card Standard or PC Card 95 Standard, and is the result of the convergence of the PCMCIA and JEIDA standards organizations. The PC Card 95 Standard was released in February 1995.
For detailed information on the PC Card 95 Standard or the PCMCIA organization, contact the PCMCIA organization at http://www.pc-card.com/.

PCMCIA in the Solaris Environment

The Solaris system provides a UNIX implementation of the PC Card Standard, bundled with a number of drivers for common PC Cards. The Solaris PCMCIA implementation eliminates the x86 architectural dependencies in the original PCMCIA specification in favor of an open systems approach. In particular, the calling and argument passing conventions of the PCMCIA interface standard have been respecified in ANSI C language bindings in the Solaris environment to allow for both platform and operating system independence. Solaris PCMCIA enables drivers to be written that are independent of the particular platform and host architecture.

Card Services Interface

A major component of the PCMCIA architecture is Card Services. The Card Services interface forms a standardized software layer between PC Card devices and the operating system.
Card Services routines allow drivers to manage functions associated with card insertion and card removal for hot-pluggable devices. These routines ensure that users do not have to reboot their operating systems after plugging PC Cards into (or removing PC Cards from) PC Card sockets.
As implemented in the Solaris system, Card Services provides driver source code compatibility across Solaris platforms that support PCMCIA adapter hardware. Binary code compatibility is provided for PC Card drivers across different platform implementations that share the same instruction set architecture.

Card Services Binding

Because of its history, the PC Card Standard is bound both to PC operating systems (such as MS-DOS and Windows) and x86 instruction set architecture. The PC Card Standard contains functional notation that does not correspond exactly to ANSI C bindings but instead is mapped to Intel-specific assembly language. The contents of various x86 registers, for example, are passed as pointers and arguments to functions. The concepts behind IRQ routing and the number of bits required to express I/O addresses are unique to x86 platforms.
The PCMCIA standards body attempted to remedy the porting problems that arose from the bias toward x86 architecture by including a bindings section in the specification, where the specifics of Card Services functions under various operating system combinations can be addressed. The bindings section attempted to make up for the reliance on MS-DOS-based operating systems and x86 hardware by providing the capability to bind PCMCIA to operating systems not based on MS-DOS.
The Solaris system modifies and augments the basic PC Card Standard in the following ways:
  • Provides its own C language bindings
  • Adds common access functions (equivalent to the ddi_put8(9F) and ddi_get8(9F) family of functions) to Solaris Card Services to provide driver compatibility across different platforms
  • Adds Solaris-specific utility functions
There are other differences between the PC Card Standard and Solaris Card Services. Since in Solaris Card Services, there is only one instance of a PC Card driver attached to a function on a PC card, the PC Card driver does not need to keep track of the socket number in which the card is inserted. In addition, Solaris Card Services can dispatch I/O interrupts to the appropriate PC Card driver's interrupt handler.
The Solaris Card Services implementation is discussed in subsequent chapters. For more information on the PCMCIA architecture, see Chapter 2, "PCMCIA System Architecture."

PC Card Device Drivers

While PC Card device drivers are very similar to other Solaris device drivers, they differ from other drivers in their use of Card Services as an interface to the PCMCIA framework. PC Card drivers use Card Services to:
  • Register with the PCMCIA framework
  • Determine card characteristics
  • Configure cards
  • Activate cards
  • Modify card resources
  • Handle events
In other aspects, PC Card drivers are the same as other Solaris character or block drivers. PC Card drivers, for example, use the standard Device Driver Interface/Driver-Kernel Interface (DDI/DKI) entry points and interface with the same DDI/DKI functions and structures as other Solaris device drivers.
The remainder of this book discusses the specifics of implementing PC Card drivers. For background information on device drivers in the Solaris system and for specific information on non-PC Card character and block drivers, see the Writing Device Drivers manual.

Loading a PC Card Driver

A PC Card driver is loaded like any other Solaris driver. See Writing Device Drivers for information on loading device drivers.

Sample PC Card Drivers in Solaris

Complete source code for the following sample drivers is included in the Solaris DDK.
PC Memory Card Driver (pcsram) The pcsram driver is an SRAM/DRAM memory card client driver providing disk-like I/O access to SRAM/DRAM memory cards and nonvolatile SRAM/DRAM memory cards. pcsram can be used for system memory expansion or as a pseudo-floppy disk type of device containing an MS-DOS or UFS file system. This driver currently supports only a single partition.
PC Card I/O Driver (pcepp) The pcepp driver is a character device driver for parallel port printers. It supports all cards providing a standard PC-compatible parallel port. It is a unidirectional STREAMS driver that interfaces with Solaris printer administration. For more information on the pcepp driver, see Chapter 9, "PCMCIA Parallel Port Driver."