te
Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
CSX_ACCESSCONFIGURATIONREGISTER 9F "Jul 19, 1996"
NAME
csx_AccessConfigurationRegister - read or write a PC Card Configuration Register
SYNOPSIS
#include <sys/pccard.h>



int32_t csx_AccessConfigurationRegister(client_handle_t ch,
 access_config_reg_t *acr);
INTERFACE LEVEL
illumos DDI Specific (illumos DDI)
PARAMETERS
ch

Client handle returned from csx_RegisterClient(9F).

acr

Pointer to an access_config_reg_t structure.

DESCRIPTION
This function allows a client to read or write a PCCard Configuration Register.
STRUCTURE MEMBERS
The structure members of access_config_reg_t are:
uint32_t Socket; /* socket number*/
uint32_t Action; /* register access operation*/
uint32_t Offset; /* config register offset*/
uint32_t Value; /* value read or written*/

The fields are defined as follows: Socket

Not used in illumos, but for portability with other Card Services implementations, it should be set to the logical socket number.

Action

May be set to CONFIG_REG_READ or CONFIG_REG_WRITE. All other values in the Action field are reserved for future use. If the Action field is set to CONFIG_REG_WRITE, the Value field is written to the specified configuration register. Card Services does not read the configuration register after a write operation. For that reason, the Value field is only updated by a CONFIG_REG_READ request.

Offset

Specifies the byte offset for the desired configuration register from the PC Card configuration register base specified in csx_RequestConfiguration(9F).

Value

Contains the value read from the PC Card Configuration Register for a read operation. For a write operation, the Value field contains the value to write to the configuration register. As noted above, on return from a write request, the Value field is the value written to the PC Card and not any changed value that may have resulted from the write request (that is, no read after write is performed).

A client must be very careful when writing to the COR (Configuration Option Register) at offset 0. This has the potential to change the type of interrupt request generated by the PC Card or place the card in the reset state. Either request may have undefined results. The client should read the register to determine the appropriate setting for the interrupt mode (Bit 6) before writing to the register.

If a client wants to reset a PCCard, the csx_ResetFunction(9F) function should be used. Unlike csx_AccessConfigurationRegister(), the csx_ResetFunction(9F) function generates a series of event notifications to all clients using the PC Card, so they can re-establish the appropriate card state after the reset operation is complete.

RETURN VALUES
CS_SUCCESS

Successful operation.

CS_BAD_ARGS

Specified arguments are invalid. Client specifies an Offset that is out of range or neither CONFIG_REG_READ or CONFIG_REG_WRITE is set.

CS_UNSUPPORTED_MODE

Client has not called csx_RequestConfiguration(9F) before calling this function.

CS_BAD_HANDLE

Client handle is invalid.

CS_NO_CARD

No PC card in socket.

CS_UNSUPPORTED_FUNCTION

No PCMCIA hardware installed.

CONTEXT
This function may be called from user or kernel context.
SEE ALSO
csx_ParseTuple (9F), csx_RegisterClient (9F), csx_RequestConfiguration (9F), csx_ResetFunction (9F)

PCCard 95 Standard, PCMCIA/JEIDA