![]() |
|
||||
Writing Device Drivers for LynxOS |
Writing PC Card Client Drivers
The LynxOS PC Card package architecture is based upon the PCMCIA/JEIDA PC Card Architecture specification. The following figure illustrates the card package architecture.
![]()
PC Card ArchitectureSocket Services provides a standardized interface to manipulate PC Cards, sockets and adapters. A host system may have more than one PC Card adapter present. Each adapter has its own Socket Services instance.
Each instance of Socket Services registers with Card Services and notifies it about status changes in PC Cards or sockets.
By making all accesses to adapters, sockets, and PC Cards through the Socket Services interface, higher-level software is unaffected by different implementations of the hardware. Only the hardware-specific Socket Services code needs to modified to accommodate a new hardware implementation.
Card Services coordinates access to PC Cards, sockets and system resources among multiple clients. There is only one instance of Card Services in the system. Card Services makes all access to the hardware level through the Socket Services interface. All Socket Services status change reporting is routed to Card Services. Card Services then notifies the appropriate clients. Card Services preserves for its clients an abstract, hardware-independent view of a card and its resources.
Client Device Drivers refers to all users of Card Services. In the LynxOS PC Card architecture, users of Card Services are device drivers. They use a standardized API to access Card Services.
Card Services Overview
Card Services Initialization
Card Services is implemented as a device driver. There is only one instance of Card Services present in the system. At installation time, Card Services initializes its resource databases and prepares to handle registration requests from both Socket Services and client device drivers. The Card Services driver must be installed prior to any other PC Card-related driver.
Logical Sockets
The Card Services interface uses logical socket numbers to identify the socket a service is intended to access. The first physical socket on the first physical adapter is logical socket 0. The last logical socket is the total number of sockets less one.
Card Services Groups
The services defined by the card services interface can be divided into six functional groups. These are:
- Client Services
- Client Utilities
- Resource Management Services
- Advanced Client Services
- Bulk Memory Services
- Special Services
Client Services
The following services are used for client initialization and registration.
Client Utilities
The following services are used to perform common tasks required by all clients.
Resource Management Services
The following services provide basic access to available system resources. These services combine knowledge of the current status of system resources with the underlying Socket Services adapter control services.
- GetConfigurationInfo
- GetFirstWindow (not supported)
- GetNextWindow (not supported)
- ReleaseConfiguration
- ReleaseIO
- ReleaseIRQ
- ReleaseWindow (not supported)
- RequestConfiguration
- RequestIO
- RequestIRQ
- RequestWindow (not supported)
Advanced Client Services
The following are advanced client services.
Bulk Memory Services
The following services provide various memory operations for memory clients that require isolation from the details of underlying memory technology hardware.
- CloseMemory (not supported)
- CopyMemory (not supported)
- OpenMemory (not supported)
- ReadMemory (not supported)
- WriteMemory (not supported)
Special Services
The following are services providing miscellaneous operations for client drivers.
Card Services Calling Conventions
The Card Services interface consists of the CardServices() function. CardServices() provides the API for all card services.
Header Files
All prototypes and constants needed to access card services from client device drivers are located in the following header files:
Card Services Header Files File Description Contains definitions common for all services. Contains definitions required by the tuple parsing services.
Synopsis
The prototype for CardServices() is:
The CardServices() parameters are defined as follows:
Specifies the service code. Services details are documented in "Card Services Reference". Is the client handle returned by the RegisterClient service. It is not used by any other service. The RegisterClient service places a new client handle in the location pointed to by this argument. Is a service-dependent value. Is the size of the structure pointed to by ArgPointer. Is a pointer to service-dependent data.After invocation, a service returns a completion code, unique for a particular service, as defined "Card Services Reference".
Client Structure
A client device driver is a device driver that uses the API defined by CardServices().
The following tasks are common for client device drivers:
- Detecting the presence of card services
- Registration with card services to receive event notifications
- Identification of a PC Card
- Requesting system resources for a PC Card
- Configuration of a PC Card
- Deregistration of the client
These steps are described below and are illustrated by a sample client device driver acting as a PC Card enabler.
Detecting the Presence of Card Services
The presence of card services is detected using the GetCardServicesInfo service. For example:
Client Registration
Following initialization, a client registers itself with card services to specify the event notification it is to receive. The RegisterClient service is used to register a new client. At registration time, the client specifies its type, thus defining its priority for event notification. I/O clients are notified of events first, memory technology drivers are notified next, and memory clients are notified last. Also, the client provides the event mask that defines the events to be notified of. For example:
Client Callback
Card services notifies clients of events through a single callback routine that is specified at client registration. A client receives notification of an event along with various event-specific data.
The prototype for callback() is:
Is the event code. Events are listed and described in the table, "Events." Is the logical socket with which the event is associated. socket is meaningful only for status change events. Is the client handle. These arguments are used by memory technology drivers (not supported). Is client-specific data provided at registration.
Events
The following events are supported:
PC Card Identification
When a client receives the PCMCIA_CS_EVENT_INSERTION event, it must first identify the just inserted PC Card. PC Card identification can be accomplished by using the card and manufacturer identification numbers present in the mandatory MANFID tuple. This tuple is parsed automatically by card services on card insertion and is provided to client in the data returned by the GetConfigurationInfo service. For example:
An alternate method to identify the PC card is to use the client utilities services to find some other tuples that contain card identification information, and parse them using the ParseTuple service. For example:
PC Card Configuration
To configure a PC Card, the client must first reserve appropriate system resources (I/O range and optional IRQ) using the RequestIO and RequestIRQ services. Reservation is necessary to prevent possible configuration conflicts with other client device drivers. For example:
Actual configuration of a PC Card is performed by the RequestConfiguration service. It applies the specified voltage to the card and reserves the I/O address ranges and IRQ for corresponding socket. For example:
Client Deregistration
To deregister a client, the DeregisterClient service is used. The client handle obtained using the RegisterClient service is passed to CardServices(). For example:
Sample Client Drivers
PC Card Enabler
An enabler is a client device driver that detects insertion of a certain PC Card and configures it. The enabler allows standard device drivers to work with the PC Card as a conventional ISA device. The simplest enabler is a character device driver that has only install and uninstall entry point functions. At installation, the enabler detects the presence of card services and registers with it, requesting to receive card insertion events. Upon receiving a card insertion event, the enabler identifies the PC Card. If a supported card is inserted, the enabler configures it.
As soon as the PC Card configuration is complete, an appropriate dynamic device driver can be installed. The PC Card is controlled as if it were an ISA device.
If both enabler and driver are linked statically into the kernel, the enabler is installed before the driver. The card must be inserted prior to system boot and the driver should work without any changes.
A sample driver layout is illustrated below:
Addition to Existing ISA Device Driver
It is possible to add the enabler code to an existing device driver of a conventional ISA card. This approach allows you to create a hot swap-capable device driver for the PC Card device. The driver can be statically or dynamically linked into the kernel.
A driver with an embedded enabler should return success at installation, whether it finds the card or not. However, it should be modified to reject any user accesses to the device until the enabler detects and configures the PC Card. As soon as the PC Card configuration is complete, the driver should perform the initialization procedure, which would have been otherwise performed at installation of the conventional device driver. Upon a request to remove the card, the driver should attempt to shut down the device.
A sample driver layout is illustrated below:
Card Services Reference
This section provides a description of the services supported by Card Services. Card Services uses the CardServices() API for access to all services. CardServices() is defined as follows:
AccessConfigReg
AccessConfigReg allows a client to read or write a PC Card Configuration Register. ArgPointer must be a pointer to a pcmcia_cs_access_reg_t structure.
The pcmcia_cs_access_reg_t structure is defined as follows:
RETURN CODES
Request succeeded. Specified socket is invalid. No PC Card in the socket. ArgLength is invalid. Specified arguments are invalid. Service is not supported.
DeregisterClient
The DeregisterClient service removes a client from the list of registered clients maintained by card services. The client handle is passed in the Handle parameter.
ErrorName
ErrorName service returns a character string corresponding to a specified error code returned previously by Card Services. ArgPointer must be a pointer to a pcmcia_cs_name_t structure.
The pcmcia_cs_name_t structure is defined as follows:
Is the error code. Is a pointer to the string that contains the error name.
GetCardServicesInfo
GetCardServicesInfo service returns the number of installed logical sockets and information about Card Services that includes the vendor revision number and release compliance code. ArgPointer must be a pointer to a pcmcia_cs_information_t structure.
The pcmcia_cs_information_t structure is defined as follows:
GetConfigurationInfo
GetConfigurationInfo service returns information about the specified socket and PC Card installed in the socket. ArgPointer must be a pointer to a pcmcia_cs_config_info_t structure.
The pcmcia_cs_config_info_t structure is defined as follows:
RETURN CODES
Request succeeded. Service is not supported. ArgLength is invalid. Specified socket is invalid.
GetFirstTuple
The GetFirstTuple service returns the first tuple of the specified type in the CIS for the specified socket. ArgPointer must be a pointer to a pcmcia_cs_tuple_t structure.
The pcmcia_cs_tuple_t structure is defined as follows:
Is the logical socket. Is the tuple code. See table below. Is the Card Services CIS state information. This field is used internally by Card Services.The following predefined constants can be used to specify a tuple code:
RETURN CODES
Request succeeded. Specified socket is invalid. Service is not supported. ArgLength is invalid. No PC Card in socket. No tuples with specified code.
GetNextTuple
The GetNextTuple service returns the next tuple of the specified type in the CIS for the specified socket. ArgPointer must be a pointer to the pcmcia_cs_tuple_t structure returned by a GetFirstTuple or a previous GetNextTuple request.
RETURN CODES
Request succeeded. Specified socket is invalid. Service is not supported. ArgLength is invalid. No PC Card in socket. No tuples with specified code.
ParseTuple
The ParseTuple service parses a tuple. Pointer must be a pointer to the pcmcia_cs_tuple_t structure returned by a GetFirstTuple or GetNextTuple request. The ParseTuple service fills a pcmcia_cs_tuple_data_t structure pointed to by the ArgPointer parameter. The pcmcia_cs_tuple_data_t structure is defined as follows:
Supported Tuple Codes
This section lists the supported tuple codes and field sets that support each. For detailed information about each field semantics, refer to the PCMIA\JEIDA Metaformat Specification.
Request succeeded. Specified socket is invalid. Service is not supported. ArgLength is invalid.
RegisterClient
The RegisterClient service registers a client with Card Services. ArgPointer must be a pointer to a pcmcia_cs_register_t structure. The client callback handler entry point is passed in Pointer. If the Handle argument is not NULL, the service places the new client handle into the location pointed by Handle.
The pcmcia_cs_register_t structure is defined as follows:
RETURN CODES
Request succeeded. Service is not supported. ArgLength is invalid. Incorrect client type.
ReleaseConfiguration
ReleaseConfiguration service returns a PC Card and its socket to a simple interface and configuration zero. ArgPointer must be a pointer to a pcmcia_cs_release_config_t structure.
The pcmcia_cs_release_config_t structure is defined as follows:
RETURN CODES
Request succeeded. Service is not supported. ArgLength is invalid. Specified socket is invalid.
ReleaseIO
The ReleaseIO service releases the I/O addresses requested with the RequestIO service. Only the Card Services resource database is modified by a call to this service. No changes are made in the socket adapter. ArgPointer must be a pointer to a pcmcia_cs_release_io_t structure.
The pcmcia_cs_release_io_t structure is defined as follows:
RETURN CODES
Request succeeded. Service is not supported. ArgLength is invalid. Specified socket is invalid.
ReleaseIRQ
The ReleaseIRQ service releases a previously allocated interrupt line. Only the Card Services resource database is modified by a call to this service. No changes are made in the socket adapter. The ArgPointer must be a pointer to a pcmcia_cs_release_irq_t structure.
The pcmcia_cs_release_irq_t structure is defined as follows:
RETURN CODES
Request succeeded. Service is not supported. ArgLength is invalid. Specified socket is invalid.
RequestConfiguration
RequestConfiguration service configures the PC Card and socket. ArgPointer must be a pointer to a pcmcia_cs_request_config_t structure.
The pcmcia_cs_request_config_t structure is defined as follows:
RETURN CODES
RequestIO
The RequestIO service reserves the specified I/O range for later assignment using the RequestConfiguration service. ArgPointer must be a pointer to a pcmcia_cs_request_io_t structure.
The pcmcia_cs_request_io_t structure is defined as follows:
RETURN CODES
RequestIRQ
The RequestIRQ service reserves the specified IRQ line for later assignment using the RequestConfiguration service. The ArgPointer must be a pointer to a pcmcia_cs_request_irq_t structure.
The pcmcia_cs_request_irq_t structure is defined as follows:
Is a logical socket. Is the IRQ line.RETURN CODES
ServiceName
ServiceName service returns a character string corresponding to a specified request code. ArgPointer must be a pointer to a pcmcia_cs_name_t structure.
The pcmcia_cs_name_t structure is defined as follows:
Is the request code. Is a pointer to a string containing the request name.
PC Card Support
PC Card Support is a facility that enables the use of PC Card (PCMCIA) devices in the LynxOS environment. Features supported by the PC Card subsystem include:
- Extendable support for several widely used PC Card devices. Supported cards are accessible as conventional ISA devices controlled by standard LynxOS device drivers.
- Simple and platform-independent means for developing new PC Card software (PC Card enablers and PC Card drivers).
- Support of preinstalled PC Card devices, thus allowing root file system to reside on a PC Card disk.
- Support of runtime insertion and extraction of PC Card devices.
Installing and Removing PC Card Support
.PC Card Support can be installed and removed after initial installation of LynxOS.
To install PC Card Support enter the following commands:
To remove PC Card Support enter the following commands:
PC Card Support Architecture
The LynxOS PC Card subsystem is based upon the PCMCIA/JEIDA PC Card architecture specification. It has three main layers (see figure below). At the lowest level is Socket Services. The next level is Card Services. Layered on the top of Card Services are client device drivers. All these components are kernel entities. User mode applications interact with PC Card devices and the PC Card subsystem using interfaces defined by client device drivers.
PC Card Support Architecture![]()
Socket Services
Socket Services provides a standardized interface to manipulate PC Cards, sockets and adapters.
Host systems may have more than one PC Card adapter present. Each adapter has its own Socket Services. All instances of Socket Services are intended to support a single instance of Card Services. A socket service registers with Card Services and notifies it of status changes on PC Cards or in sockets.
By making all accesses to adapters, sockets, and PC Cards through the socket services interface, higher-level software is unaffected by different implementations of the hardware. Only hardware-specific socket services implementations must be modified to accommodate any different hardware implementations.
LynxOS PC Card Support implements socket services as an ordinary device driver. Refer to "Writing PC Card Socket Services" for a detailed discussion of interfaces defined by Socket Services and for information on how to develop a new socket service.
Card Services
Above the Socket Services layer is the Card Services layer. Card Services coordinates accesses to PC Cards, sockets, and system resources among multiple clients. There is only one instance of Card Services in the system.
Card Services makes all accesses to the hardware level through the Socket Services interface. All Socket Services status change reporting is routed to Card Services. Card Services then notifies the appropriate clients. Card Services preserves for its clients an abstract, hardware-independent view of a card and associated system resources.
LynxOS PC Card Support implements the Card Services as an ordinary device driver. Refer to "Writing PC Card Socket Services"" for a detailed discussion of interfaces defined by Card Services.
Client Device Drivers
Client Device Drivers refers to all users of Card Services. In a LynxOS PC Card subsystem, users of Card Services are devices drivers that use the standardized API CardServices() to manipulate PC Cards, sockets, and adapters.
PC Card Enabler
LynxOS PC Card support includes a special client device driver called the PC Card Enabler. This driver responds to runtime insertion and removal events and provides the following services to the rest of the system:
- Card Configuration - Configured card acts as an ISA device.
- Automatic installation and deinstallation of static device drivers in response to card insertion and removal
- ioctl-based API to user mode applications - The API allows applications to monitor status of the PC Card subsystem.
Refer to pcmcia_enabler(4) man page for a detailed description of the PC Card Enabler.
PC Card Utilities
LynxOS PC Card support includes the following utilities:
- pcmcia_info - An information utility that displays information about all logical PCMCIA sockets and PC Card devices present in the system
- pcmcia_shu - A control utility used to prepare a socket for card removal
- pcmcia_d - A daemon that automatically handles dynamic driver installation and deinstallation in response to card insertion and removal.
For a complete discussion of each utility, refer to an appropriate man page.
Using a PC Card
When a supported PC Card is inserted before system boot, it is automatically configured by the PC Card Enabler. It can then be accessed as an ISA device using the existing device driver.
Supported Cards
The following PC Cards are supported by the PC Card Enabler and work with the specified standard LynxOS driver:
Supported PC Cards PC Card Driver for x86 Driver for MPC860 3Com 3C589x EtherLinkIII Ethernet adapter Adaptec SlimSCSI SCSI adapter EigerStar ATA Hard Disk
Hot Swapping
Hot swapping is used to refer to the ability of PC Cards to be inserted and removed when power is applied to the machine and OS is running, and the ability of the system to automatically detect and react to configuration changes.
When a card is being inserted on a running system, it is handled by the PC Card Enabler exactly the same way as a card inserted to a socket prior to boot. If the card is supported, it is configured as specified in the PC Card Enabler configuration tables.
There are two ways to automatically install an appropriate device driver in response to card insertion.
One way is to use the PC Card Enabler static driver installation feature. It allows for an automatic call to the device driver install entry point function of a static driver that failed to install a major device at the boot time due to the absence of a device. Because the PC Card Enabler calls the install entry point after the PC Card device has been inserted and configured on the I/O bus, the driver can successfully create an appropriate major device and return success, thus making the PC Card device available for the device driver operations.
Information about statically linked device drivers supported by the PC Card subsystem is located in the configuration file /sys/devices/pcmcia_enabler_info.c. Please refer to pcmcia_enabler(4) man page for a detailed description of the PC Card Enabler facility.
The second way is to use pcmcia_d daemon program. This daemon program responds to card insertion events, and acts according to the configuration data in the configuration files. The key responsibility of pcmcia_d is to dynamically install an appropriate device driver, create a device node, and invoke an optional script configuring the PC Card for operation in the system. For instance, the script can mount an inserted PC Card disk as a LynxOS file system. Please refer to pcmcia_d(1) man page for a detailed description of the pcmcia_d daemon.
It is possible to remove a PC Card from a running system. Prior to removal, call the pcmcia_shu utility to prepare the socket for card removal. pcmcia_shu is responsible for ensuring that no device driver is accessing the device being removed. pcmcia_shu interacts with the PC Card Enabler and pcmcia_d to handle the removal request. An attempt to deinstall the driver is made. In addition, if the driver has been deinstalled by the pcmcia_d daemon, the daemon calls an optional user script that removes the device special node.
Request to remove a PC Card device may fail, for example, if the PC Card disk being removed is mounted as a file system. Appropriate steps must be taken to ensure that the PC Card removed is not used by any application. Removing a card without a successful card shutdown may cause a system crash.
Adding Support for a New PC Card
You can add support for a new PC Card by adding support to the PC Card Enabler configuration tables or by developing of a new client device driver.
Adding Support to PC Card Enabler
To add support for a new card, add a new entry to the PC Card Enabler configuration table. The required information includes the manufacturer and product identification numbers from the card MANFID tuple, Configuration Table Entry index, and the configuration to which the entry corresponds.
You can use the pcmcia_info utility to find out various information about the PC Card. For instance, if the PC Card device is inserted into the first PCMCIA socket, pcmcia_info creates a display similar to one shown below:
The first line indicates that there is a PC Card device found in the PCMCIA socket, and its manufacturer and product identification numbers are 0x0106 and 0x0000 respectively.
The table shows correspondence between a Configuration Table Entry and I/O ranges used by the particular configuration. Choose an entry with the configuration most appropriate for the host system.
To add a new entry to the PC Card Enabler configuration table, use the information obtained using pcmcia_info to define an entry corresponding to the new PC Card device. A detailed description of the PC Card Enabler configuration table format is available in pcmcia_enabler(4) man page.
Next configure the existing LynxOS driver capable of controlling the ISA device. Configure the driver to ensure that it uses I/O ranges and IRQ line identical to those specified in the PC Card Enabler configuration table.
Create New Device Driver
A new device driver should be a regular device driver using the Card Services API to detect, identify, and configure the PC Card prior to any normal mode accesses to the device. Refer to "Writing PC Card Socket Services" for a detailed specification of the Card Services API.
Adding Support for a New PCMCIA Adapter
Adding support for a new PCMCIA adapter involves development of a new Socket Services device driver. No changes to other components of the PC Card Support software are necessary. Refer to "Writing PC Card Socket Services" for a detailed specification of the Socket Services API and information on how to develop a new Socket Services driver.
Supported PCMCIA Adapters
The following PCMCIA adapters are supported by the LynxOS PC Card subsystem:
Supported PCMCIA Adapters PCMCIA Adapter Architecture Embedded RPXL823 PCMCIA Interface RPXL823 i82365 compatible ISA/PCI PCMCIA Adapter x86 adapters
Troubleshooting
This section provides troubleshooting tips that support the EtherLinkIII PC Card on the x86 platform.
- Check that Socket Services information structure contains the correct information about the PCMCIA adapter(s) installed in your system:
Open the /sys/devices/pcmcia_ss_pci_info.c file. Find the description of your adapter(s) in the sspci_known_adapters array. The current revision of the driver has only two entries - one for the O2Micro OZ6860 adapter, another for all other i82365-compatible adapters. All adapters other than OZ6860 are configured in the ISA legacy mode. If you are having problems with your adapter, try to increase the verbosity level by setting the SSPCI_FLAG_VERBOSE flag in the attributes field of the adapter entry. Additional debug information may help to understand the problem. Note that the debug output is sent to COM2. Another field that you might want to change in the Socket Services information file is the interrupt delivery mode. Refer to the next troubleshooting tip for details. Note the possible ISA locations table. You can add ISA port address to the sspci_isa_locations array, if you know that your adapter uses an alternate ISA port.
- Check the IRQ numbers and I/O addresses in the Enabler table and in the EtherLinkIII device information file are the same and are not in use by some other device:
Open /sys/devices/pcmcia_enabler_info.c. Find the following entry in the pcmcia_enabler_card_table_cfg structure:
The first two fields identify the card. The third field is the base I/O address of the card. The last field is the IRQ number assigned to the card. Note that 32 is not added to the IRQ number.
The first field of the structure is the base I/O address of the device. The second field is the IRQ number. Note that here, 32 is added to the IRQ number. The assigned IRQ number must be the same in both files, and not in use by any other device. The I/O address must also be the same in both files. The I/O range used by the EtherLinkIII card must not overlap with I/O ranges used by other devices.
Unfortunately, there is no simple way to determine the IRQ numbers and I/O ranges are already in use. The device information files for all configured devices have to be examined. As a starting point, try the following configurations:
It is also possible that different values have to be used. Note that the I/O range must start at the 16 byte boundary. For example, 0x220 and 0x230 are valid, while 0x223 and 0x228 are not.
If no IRQ and base address combination works for the card, try to enable the PC Card I/O interrupts emulation mode in the Socket Services driver. To enable emulation, modify /sys/devices/pcmcia_ss_pci_info.c.
Find in the supported adapters table the entry containing information about the PCMCIA adapter, and add the SSPCI_FLAG_EMU flag to the attributes field.
To change the configuration edit the appropriate files, rebuild the device information files and the kernel. For example:
- Shut down the host computer. Remove all PC Cards from the PCMCIA sockets. Insert the EtherLinkIII PC Card into PCMCIA socket #0. Boot.
If the system hangs, go to troubleshooting tip 2 and change the values of IRQ number, I/O address, or both. Start with IRQ number the I/O address. IRQ 9,10,11,12,15 are good examples.
If any of the above nodes is not present, check CONFIG.TBL and make sure that all listed devices are installed. Rebuild the kernel if necessary. Rebuild the contents of /dev directory from /etc/nodetab using the following commands:
- Some of the devices are not present. Check CONFIG.TBL and make sure that all listed devices are installed. Rebuild the kernel if necessary.
- All devices are present, but "PCI CardBus SS" is not installed ((no dev) value in device start address column). Make sure that a PCMCIA adapter is present in the system and that it is i82365-compatible. This package does not support other types of PCMCIA adapters. If you are using an adapter other than OZ6860, make sure that the appropriate ISA port is listed in the possible ISA locations table in the Socket Services information file. Also ensure that the device configuration files are listed in CONFIG.TBL and are in proper order. Rebuild the kernel if necessary.
- All devices are present, but "pcmcia CS" or "PCMCIA Enabler" is not installed ((no dev) value in device start address column). Make sure that device configuration files are listed in CONFIG.TBL and are in proper order. Rebuild the kernel if necessary.
- Message "failed to open file /dev/pcmcia_enabler". Rebuild the contents of /dev from /etc/nodetab using the commands:
- The table shown by the pcmcia_info utility is empty. Make sure that a PCMCIA adapter is present in the system and that it is i82365-compatible. This package does not support other types of PCMCIA adapters. If you are using an adapter other than OZ6860, make sure that the appropriate ISA port is listed in the possible ISA locations table in the Socket Services information file.
- The card is not marked as configured. There is no description for this card in Card Enabler's information table. Check that Code and Card values provided by pcmcia_info match the values for the 3C589C card in the Card Enabler information file. These values should be equal to 0x0101 and 0x0589 respectively. If pcmcia_info gives different values, the wrong card is inserted. Also try different IRQ and I/O address settings (see Step 2).
This command gives more information about a PC Card in socket #0.
The sample output is given below:
Note the Current configuration section of the output. The values of I/O range 1 and IRQ should match the corresponding values in if_3c589x_pcmcia_info.c. If this is not so, correct if_3c589x_pcmcia_info.c or the card descriptions table in the Card Enabler information file as described in Step 2.
If there is no el_pc device listed, check that the line I:3c589x_pcmcia.cfg is present in CONFIG.TBL file.
If el_pc device is present but not installed ((no dev) value in the device start address column), check that IRQ value and I/O base address are the same in the output of pcmcia_info 0 command and in the if_3c589x_pcmcia_info.c file.
Also make sure that the line I:3c589x_pcmcia.cfg has been placed in CONFIG.TBL after the three lines describing the PCMCIA devices (I:pcmcia_cs.cfg, I:pcmcia_ss_pci.cfg, I:pcmcia_enabler.cfg).
Writing PC Card Socket Services
Socket Services is defined as a device driver that interfaces to the Card Services module and implements hardware-specific details of programming a specific PCMCIA adapter. The interface between Card Services and Socket Services is defined by a set of driver entry points and data structures, described in the following sections.
Socket Services Overview
Socket Services is the lower layer in the PC Card Support subsystem. Socket Services provides a unified software interface to the PCMCIA sockets hardware. It masks the hardware implementation details, providing an abstraction layer that allows for development of higher-level software without explicit knowledge of the underlying hardware interfaces.
Socket Services handles the hardware as a number of objects of different types. A PCMCIA adapter is the hardware that connects a host system bus to PC Card sockets. A host system may have more than one adapter. There is one instance of Socket Services for each adapter present in the system. Socket Services reports the number of sockets and windows implemented by the adapter it services. An adapter has one or more sockets. Sockets are receptacles for PC Cards and the source of status change events. A range in the PC Card memory or I/O address space can be mapped into the host system space through a window. Most adapters provide a limited number of windows and each window has different mapping capabilities. Socket Services reports the characteristics of each window to the higher-level PC Card Support layers.
Socket Services Groups
The Socket Services interface can be divided into three functional groups of services.
Adapter Services
Socket Services controls the adapter using the following SS_GetInfo service.
Socket Services
Socket Services controls sockets using the following services:
Window Services
Socket Services controls windows using the following services:
Socket Services Structure
LynxOS PC Card Support implements a Socket Services as an ordinary device driver. A Socket Services registers with Card Services at installation. As soon as the registration is complete, the Socket Services resources are available to Card Services and its clients. Socket Services drivers should be installed after Card Services, but before any client device drivers.
Header Files
All prototypes and constants needed to implement the Socket Services interface are defined in the following header files:
Registration
To register with Card Services, a Socket Services calls the pcmcia_cs_register_ss function, passing all necessary registration data as the parameters. The registration data consists of a callback entry point and user specific data to be passed to the callback:
pcmcia_cs_register_ss returns a Socket Services identification number. The Socket Services identification number is passed back to Card Services when Socket Services notifies it of a status change event. If registration fails, pcmcia_cs_register_ss returns -1.
Event Notification
Socket Services intercepts status changes and reports them to Card Services. Status change detection can be interrupt-driven or polled, depending on the hardware features of the PCMCIA adapter. If the adapter supports interrupt-driven delivery of status change events, Socket Services should install an interrupt handler and process status change interrupts within the handler. If the adapter does not implement an interrupt for the status change events, Socket Services should use a polling based technique to detect status changes in the PCMCIA sockets.
Socket Services reports a status change event to Card Services by calling the pcmcia_cs_event entry point. Socket status, socket number, and Socket Services identification number obtained at registration time must be passed as the parameters. For example:
Socket Services Callback
Card Services invokes a Socket Services through the callback interface. The callback entry point is provided by Socket Services at the registration time.
The callback routine has the following syntax:
Each service must return one of the following constants:
Request succeeded. Service or feature is not supported. Voltage specified for the SS_SetSocket request cannot be applied.
Socket Services Reference
SS_GetInfo
The SS_GetInfo service returns information about the PCMCIA adapter and the Socket Services. ArgPointer must be a pointer to a pcmcia_ss_information_t structure.
The pcmcia_ss_information_t structure is defined as follows:
Is the binary coded decimal (BCD) value of the SS version number. Specifies the number of sockets. Specifies the number of windows. Is the PCMCIA adapter name. Is the vendor-specific string.
SS_InquireSocket
The SS_InquireSocket service returns the read-only information about the specified socket. Number must be set to the socket number. ArgPointer must be a pointer to a pcmcia_ss_inquire_socket_t structure.
The pcmcia_ss_inquire_socket_t structure is defined as follows:
Is the bit mapped socket status. A bitwise combination of the following constants:
SS_SetSocket
The SS_SetSocket service configures the specified socket. Number must be set to the socket number. ArgPointer must be a pointer to a pcmcia_ss_socket_t structure.
The pcmcia_ss_socket_t structure is defined as follows:
SS_GetSocket
The SS_GetSocket service returns the configuration of the specified socket. Number must be set to the socket number. ArgPointer must be a pointer to a pcmcia_ss_socket_t structure.
SS_InquireWindow
The SS_InquireWindow service returns the read-only information about the specified window. Number must be set to the window number. ArgPointer must be a pointer to a pcmcia_ss_inquire_window_t structure.
The pcmcia_ss_inquire_window_t structure is defined as follows:
SS_SetWindow
The SS_SetWindow service configures the specified window. Number must be set to the window number. ArgPointer must be a pointer to a pcmcia_ss_window_t structure.
The pcmcia_ss_window_t structure is defined as follows:
SS_GetWindow
The SS_GetWindow service gets the configuration of the specified window. Number must be set to the window number. ArgPointer must be a pointer to a pcmcia_ss_window_t structure.
![]() LynuxWorks, Inc. 855 Branham Lane East San Jose, CA 95138 http://www.lynuxworks.com 1.800.255.5969 |
![]() |
![]() |
![]() |
![]() |