Partager via


Access PCMCIA Attribute Memory by Using a Plug and Play I/O Request

This section describes how a PC Card or Cardbus card driver can use Plug and Play I/O requests to access attribute memory.

A driver typically uses this method to initialize a device, to configure a device, or to obtain information from a device. A driver should use this method if the I/O overhead is acceptable, and the access can be done at IRQL < DISPATCH_LEVEL.

A driver can only use this method while running at IRQL < DISPATCH_LEVEL.

A driver performs the following sequence of operations:

  • Creates and initializes a new IRP_MJ_PNP request.

    The driver specifies either an IRP_MN_READ_CONFIG or an IRP_MN_WRITE_CONFIG minor function.

  • Gets the next stack location.

  • Sets the following members of the Parameters.ReadWriteConfig structure in the new stack location:

    WhichSpace
    Specifies the value PCCARD_ATTRIBUTE_MEMORY.

    Buffer
    Pointer to a paged-memory buffer that the driver allocates for the access. For a write operation, the buffer contains the data to write to the configuration space. For a read operation, the buffer is a zero-filled buffer. After the request completes, this buffer holds a copy of the attribute memory read from the device.

    Offset
    Specifies the WORD offset from the base of the attribute memory where the read or write operation begins.

    Length
    Specifies the size in bytes of the buffer that the driver allocates for the request.

  • Sets a completion routine.

  • Sends the request down the device stack.