[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

CardServices Kernel Service

Purpose

Provides the programming interface for device drivers and other kernel routines to access PCMCIA Card Services functions.

Syntax

#include <sys/pcmciacs.h>
int CardServices (functionID, *objectID, pointer,
                  arglen, argbuf)
int functionID;
int *objectID;
void* pointer;
int arglen;
void* argbuf;

Parameters

funtionID The functions are the items listed under the description showing the syntax and parameters for each.
objectID Specifies the that each functionID may point to a different object, which is specified in the syntax for each function section.
arglen Specifies the length of the argument listed again in the syntax section for each function.

Description

The CardServices system call passes the Card Services function request, as specified by the functionID parameter, to the Card Services kernel services software. Each functionID has specific values to be used for objectID, pointer, arglen and argbuf parameters as specified in the syntax. Details on each function are provided in the PCMCIA Card Services Specification available through the Personal Computer Memory Card International Association. The argbuf pointer may point to a structure that is defined in the include file /usr/include/sys/pcmciacs.h. The following functionID's along with their syntax are supported:

CSAccessConfigurationRegister This function allows a client to read or write a PC Card Configuration Register.
int CardServices(CSAccessConfigurationRegister, null,
        null, sizeof(CSAccCfgRegPkt), (CSAccCfgRegPkt*)
        buf); 
CSDeregisterClient This function removes a client from the list of registered clients maintained by Card Services.

int CardServices(CSDeregisterClient, &clientID, null, 0,
        null); 
CSGetCardServicesInfo This function returns the number of logical sockets installed and information about Card Services presence, vendor revision number, and release compliance information.
int CardServices(CSGetCardServicesInfo, null, null,
        MaxLen, (CSGetCSInfoPkt *) buf);
CSGetClientInfo This function returns information describing a client. This information is expected to be used by browsing utilities.
int CardServices(CSGetClientInfo, &clientID, null,
        MaxLen, (CSGetCliInfoPkt *) buf); 
CSGetConfigurationInfo This function returns information about the specified socket and PC Card configuration.
int CardServices(CSGetConfigurationInfo, &clientID,
      null, sizeof(CSGetCfgInfoPkt), (CSGetCfgInfoPkt *) buf); 
CSGetEventMask This function returns the event mask for the client.
int CardServices(CSGetEventMask, &clientID, null,
       sizeof(CSGetEvMaskPkt), (CSGetEvMaskPkt *) buf); 
CSGetFirstClient This function returns the first ClientHandle of the clients that have registered with Card Services.
int CardServices(CSGetFirstClient, &clientID, null,
        sizeof(CSGetClientPkt), (CSGetClientPkt *) buf);
CSGetFirstTuple This function returns the first tuple of the specified type in the CIS for the specified socket. If there are no tuples, the Status argument is set to CSR_NO_MORE_ITEMS.
int CardServices(CSGetFirstTuple, null, null,
        sizeof(CSGetTuplePkt), (CSGetTuplePkt *) buf);
CSGetNextClient This function returns the ClientHandle for the next registered client. The ClientHandle previously returned by GetFirstClient or GetNextClient is passed as an argument.
int CardServices(CSGetNextClient, &clientID, null,
        sizeof(CSGetClientPkt), (CSGetClientPkt *) buf);
CSGetNextTuple This function returns the next tuple of the specified type in the CIS for the specified socket.
int CardServices(CSGetNextTuple, null, null,
        sizeof(CSGetTuplePkt), (CSGetTuplePkt *) buf);
CSGetStatus This function returns the current status of a PC Card and its socket.
int CardServices(CSGetStatus, null, null,
        sizeof(CSGetStatPkt), (CSGetStatPkt *) buf);
CSGetTupleData This function returns the content of the last tuple returned by GetFirstTuple or GetNextTuple.
int CardServices(CSGetTupleData, null, null, MaxPktSize,
        (CSGetTplDataPkt *) buf);
CSMapLogSocket This function maps a Card Services logical socket to its Socket Services physical adapter and socket values. The PhyAdapter should be the device number for the PCMCIA bus.
int CardServices(CSMapLogSocket, null, null,
        sizeof(CSMapSocketPkt), (CSMapSocketPkt *) buf);
CSMapLogWindow This function maps a Card Services WindowHandle passed in the Handle argument to its Socket Services physical adapter and window. The PhyAdapter should be the device number for the PCMCIA bus.
int CardServices(CSMapLogWindow, &windowID, null,
        sizeof(CSMapWindowPkt), (CSMapWindowPkt *) buf);
CSMapMemPage This function selects the memory area on a PC Card into a page of a window allocated with the RequestWindow function.
int CardServices(CSMapMemPage, &windowID, null,
      sizeof(CSMapMapMemPagePkt), (CSMapMapMemPagePkt *) buf);
CSMapPhySocket This function maps Socket Services physical adapter and socket values to a Card Services logical socket. The PhyAdapter should be the device number for the PCMCIA bus.
int CardServices(CSMapPhySocket, null, null,
        sizeof(CSMapSocketPkt), (CSMapSocketPkt *) buf);
CSMapPhyWindow This function maps Socket Services physical adapter and window values to a Card Services logical WindowHandle. The PhyAdapter should be the device number for the PCMCIA bus.
int CardServices(CSMapPhyWindow, &windowID, null,
        sizeof(CSMapWindowPkt), (CSMapWindowPkt *) buf);
CSModifyConfiguration This function allows a socket and PC Card configuration to be modified without a pair of ReleaseConfiguration and RequestConfiguration functions.
int CardServices(CSModifyConfiguration, &clientID, null,
            sizeof(CSModCfgPkt), (CSModCfgPkt *) buf);
CSModifyWindow This function modifies the attributes, or access speed of a window previously allocated with the RequestWindow function.
int CardServices(CSModifyWindow, &windowID, null,
         sizeof(CSModWinPkt), (CSModWinPkt *) buf);
CSRegisterClient This function registers a client with Card Services. ClientData will not be used by Card Services, but callback is always called with ClientData value. If client device driver can be multiplexed by multiple devices, the data area pointed to by ClientData should have data that can identify the device.
int CardServices(CSRegisterClient, &clientID,
       clientCallback, sizeof(CSRegCliPkt),
       (CSRegCliPkt *) buf); 
CSReleaseConfiguration This function returns a PC Card and socket to a simple memory only to interface the zero configurations. Card Services may remove power from the socket if clients have not indicated their usage of the socket by a RequestWindow function. Card Services will not reset the PC Card.
int CardServices(CSReleaseConfiguration, &clientID,
        null, sizeof(CSRelCfgPkt), (CSRelCfgPkt *) buf);
CSReleaseExclusive This function releases the exclusive use of a card in a socket for a client.
int CardServices(CSReleaseExclusive, &clientID, null,
        sizeof(CSRelExclPkt), (CSRelExclPkt *) buf);
CSReleaseIO This function releases previously requested I/O addresses.
int CardServices(CSReleaseIO, &clientID, null,
        sizeof(CSIOPkt), (CSIOPkt *) buf); 
CSReleaseIRQ This function releases a previously requested interrupt request line.
int CardServices(CSReleaseIRQ, &clientID, null,
        sizeof(CSRelIRQPkt), (CSRelIRQPkt *) buf);
CSReleaseSocketMask This function requests that the client no longer be notified of status changes for this socket.
int CardServices(CSReleaseSocketMask, &clientID, null,
        sizeof(CSRelSockMPkt), (CSRelSockMPkt *) buf);
CSReleaseWindow This function releases a block of system memory space which is obtained previously by a corresponding RequestWindow.
int CardServices(CSReleaseWindow, &windowID, null, 0,
        null);
CSRequestConfiguration This function configures the PC Card and socket.
int CardServices(CSRequestConfiguration, &clientID,
        null, sizeof(CSReqCfgPkt), (CSReqCfgPkt *) buf);
CSRequestExclusive This function requests the exclusive use of a PC Card in a socket for a client.
int CardServices(CSRequestExclusive, &clientID, null,
        sizeof(CSRelExclPkt), (CSRelExclPkt *) buf);
CSRequestIO This function requests I/O addresses for a socket.
int CardServices(CSRequestIO, &clientID, null,
        sizeof(CSIOPkt), (CSIOPkt *) buf);
CSRequestIRQ This function requests an interrupt request line.
int CardServices(CSRequestIRQ, &clientID, null,
        sizeof(CSReqIRQPkt), (CSReqIRQPkt *) buf)
CSRequestSocketMask This function requests that the client be notified of status changes for this socket.
int CardServices(CSRequestSocketMask, &clientID, null,
        sizeof(CSReqSockMPkt), (CSReqSockMPkt *) buf);
CSRequestWindow This function requests a block of system memory space be assigned to a memory region of a PC Card in a socket. The objectID means that the input value should be clientID and the output should be windowID.
int CardServices(CSRequestWindow, &objectID, null,
        sizeof(CSReqWinPkt), (CSReqWinPkt *) buf);
CSResetCard This function resets the PC Card in the specified socket.
int CardServices(CSResetCard, &clientID, null,
        sizeof(CSRstCardPkt), (CSRstCardPkt *) buf);
CSSetEventMask This function sets the event mask for the client.
int CardServices(CSSetEventMask, &clientID, null,
        sizeof(CSGetEvMaskPkt), (CSGetEvMaskPkt *) buf);
CSValidateCIS This function validates the Card Information Structure on the PC Card in the specified socket.
int CardServices(CSValidateCIS, &clientID, null,
        sizeof(CSValCISPkt), (CSValCISPkt *) buf);

Event Codes

CSE_PM_RESUME

CSE_PM_SUSPEND

CSE_BATTERY_DEAD

CSE_BATTERY_LOW

CSE_CARD_INSERTION

CSE_CARD_LOCK

CSE_CARD_READY

CSE_CARD_REMOVAL

CSE_CARD_RESET

CSE_CARD_UNLOCK

CSE_EJECTION_COMPLETE

CSE_EJECTION_REQUEST

CSE_ERASE_COMPLETE

CSE_EXCLUSIVE_COMPLETE

CSE_EXCLUSIVE_REQUEST

CSE_INSERTION_COMPLETE

CSE_INSERTION_REQUEST

CSE_REGISTRATION_COMPLETE

CSE_RESET_COMPLETE

CSE_RESET_PHYSICAL

CSE_RESET_REQUEST

CSE_MTD_REQUEST

CSE_CLIENT_INFO

CSE_TIMER_EXPIRED

CSE_SS_UPDATE

CSE_WRITE_PROTECT

Return Values

CSR_SUCCESS Specifies a successful completion.

Error Codes

If the CardServices does not complete successfully, one of the following error codes will be returned:

CSR_BAD_ADAPTER The specified adapter is invalid.
CSR_BAD_ATTRIBUTE Value specified for attributes field is invalid.
CSR_BAD_BASE Specified base system memory address is invalid.
CSR_BAD_EDC Specified EDC generator is invalid.
CSR_BAD_IRQ Specified IRQ level is invalid.
CSR_BAD_OFFSET Specified PC Card memory array offset is invalid.
CSR_BAD_PAGE Specified page is invalid.
CSR_READ_FAILURE Unable to complete the read request.
CSR_BAD_SIZE Specified size is invalid.
CSR_BAD_SOCKET Specified socket is invalid (logical or physical).
CSR_BAD_TYPE Window or interface type specified is invalid.
CSR_BAD_VCC Specified Vcc power level index is invalid
CSR_BAD_VPP Specified Vpp1 or Vpp2 power level index is invalid.
CSR_BAD_WINDOW Specified window is invalid.
CSR_WRITE_FAILURE Unable to complete write request.
CSR_NO_CARD No PC Card in socket.
CSR_UNSUPPORTED_FUNCTION Implementation does not support function.
CSR_UNSUPPORTED_MODE Processor mode is not supported.
CSR_BAD_SPEED Specified speed is unavailable.
CSR_BUSY Unable to process request at this time - retry later.
CSR_GENERAL_FAILURE An undefined error has occurred.
CSR_WRITE_PROTECTED Media is write-protected.
CSR_BAD_ARG_LENGTH arglen argument is invalid.
CSR_BAD_ARGS Values in Argument Packet are invalid.
CSR_CONFIGURATION_LOCKED A configuration is locked.
CSR_IN_USE Requested resource is being used by a client.
CSR_NO_MORE_ITEMS There are no more of the requested item.
CSR_OUT_OF_RESOURCE Card Services has exhausted resource.
CSR_BAD_HANDLE ClientHandle is invalid.

[ Previous | Next | Contents | Home | Search ]