ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference
|
IOPCCard16Enabler |
Inherits from: | |
Declared In: |
Class used to control the configuration of 16-bit PC Card devices.
When a 16-bit PC Card is inserted, the PC Card Family creates an IOPCCard16Device provider nub for drivers to match against. The provider nub allows the attached driver to control the card. For each instance of the IOPCCard16Device provider nub there is also an IOPCCard16Enabler object. Most calls to the provider nub are routed to the enabler object. All calls to the enabler come from the provider nub.
16-bit drivers need to take the additional step of configuring the card before they can request to have hardware registers mapped into virtual memory for them. This differs from the PCI or CardBus drivers where the card is presented to the driver in a state that is basically ready to go.
The class IOPCCard16Enabler implements the "default" card enabler for the configuration of cards. For most cards, this default enabler is sufficient for handling the needs of your attached driver. Some drivers may require additional support. The IOPCCard16Enabler class can be subclassed to provide additional support.
The attached 16-bit PC Card driver can replace the default enabler prior to requesting a configuration by calling its provider's installEnabler() method. If your driver supports multiple cards, it can implement more than one enabler and install the correct enabler depending on the card that it matches against.
The most common reason to create your own enabler is to override the default sorting of the configuration tuple entries (CISTPL_CFTABLE_ENTRY) in the card's Card Information Structure (CIS) or Metaformat. Drivers may want to look for different window configurations first. You may wish to filter out certain configurations or in the case of a mistake in the CIS on your card you may need to replace parts the CIS and/or override parts of the configuration process.
The configure method in the provider's nub calls the enabler's configure method to do three things: retrieve the configuration entries from the card's CIS, sort those entries, and then try each entry one by one until a configuration is found that works with that machine's overall configuration. Any or all of these steps can be overridden if necessary.
Selects a 16-bit card configuration and enables it for use.
Hook for Card Services events.
Returns information on the card's current configuration.
Adds configuration data from the card's CIS to the configTable array.
Returns the current state of the card.
Returns the attributes of this window.
Returns the number of windows that have been configured.
Returns the Card Services handle for this window.
Returns the offset that this window is currently at.
Returns the size of this window.
Returns the window type.
Hook for power management state changes.
Sets the offset for this window.
Sorts configurations in the selection order.
Tests if a configuration can be used.
Unconfigures a card.
Sets up a new enabler.
configure |
Selects a 16-bit card configuration and enables it for use.
public
virtual bool configure( UInt32 index=0);
index
Index of configuration to try. If no index is given then it is up to the enabler to decide.
Returns true if the card configuration was successful.
This method uses the indicated index from the 16-bit PC Card Configuration Table Entry Tuple, CISTPL_CFTABLE_ENTRY, to allocate resources and properly configure the card. If the index is not specified, the enabler will decide which configuration entries are to be tried.
eventHandler |
Hook for Card Services events.
public
virtual int eventHandler( cs_event_t event, int priority, event_callback_args_t *args);
A return value of non-zero prevents the event from being passed on to the socket drivers.
This method allows the enabler to catch Card Services events prior to routing them to the attached driver(s). This may be helpful if you need to do addition work or clean up for certain events. The default enabler does nothing.
getConfigurationInfo |
Returns information on the card's current configuration.
public
virtual bool getConfigurationInfo( config_info_t *config);
config
Pointer to config_info_t structure to be filled in.
Returns true on success.
This is a convenience method used to call the Card Services call GetConfigurationInfo.
getConfigurations |
Adds configuration data from the card's CIS to the configTable array.
public
virtual bool getConfigurations( void);
Returns true if any configurations were successfully found.
This method fetches configuration data from the card's CIS and expands them out into a form that is easier to use.
getState |
Returns the current state of the card.
public
virtual u_int getState( void);
Current state of card.
This method returns the current state of the card enabler.
getWindowAttributes |
Returns the attributes of this window.
public
virtual bool getWindowAttributes( UInt32 index, UInt32 *attributes);
index
Index of window.
attributes
Pointer to the attribute flags to be filled in.
Returns attributes for the window.
This method returns the attributes for the specified window. The meaning of the attributes flags varies depending on the type of window. The most useful attributes are the data access width flags for I/O windows. For definitions of these flags for both types of windows see "IOKit/pccard/cs.h".
getWindowCount |
Returns the number of windows that have been configured.
public
virtual UInt32 getWindowCount( void);
Returns the number of windows.
This method returns the number of windows that have been reserved in this configuration.
getWindowHandle |
Returns the Card Services handle for this window.
public
virtual bool getWindowHandle( UInt32 index, window_handle_t *handle);
index
Index to window.
handle
Pointer to the window_handle_t structure to be filled in.
Returns true if the window handle was found.
This method returns the Card Services handle for the window requested. This call is only valid for memory windows.
getWindowOffset |
Returns the offset that this window is currently at.
public
virtual bool getWindowOffset( UInt32 index, UInt32 *offset);
index
Index of window.
offset
The current offset for this window.
Returns true if the returned window offset is valid.
This method returns the current offset for this window into the card's memory space. This call is only valid for memory windows.
getWindowSize |
Returns the size of this window.
public
virtual UInt32 getWindowSize( UInt32 index);
index
Index of window.
Returns the size of the window in bytes.
This method returns the size of the window in bytes.
getWindowType |
Returns the window type.
public
virtual UInt32 getWindowType( UInt32 index);
index
Index of window.
Returns IOPCCARD16_MEMORY_WINDOW, IOPCCARD16_IO_WINDOW or IOPCCARD16_BAD_INDEX.
This method is used to find the type of window given its index. There are two types of windows, I/O and memory. If they are available in a specific configuration, memory windows will always come first in the list of windows.
setPowerState |
Hook for power management state changes.
public
virtual IOReturn setPowerState( unsigned long, IOService *);
The return value is currently ignored.
This method allows the enabler to catch power management events. This may be helpful if you need to do addition work or clean up for certain events. The default enabler uses this to track the state of power management.
setWindowOffset |
Sets the offset for this window.
public
virtual bool setWindowOffset( UInt32 index, UInt32 newOffset);
index
Index of window.
offset
The new offset for this window.
Returns true if the window offset was successfully updated.
This method updates the offset into the card's memory space for this window. This call is only valid for memory windows.
sortConfigurations |
Sorts configurations in the selection order.
public
virtual bool sortConfigurations( void);
Returns true if any configurations were successfully found.
This method sorts configurations into the order in which they should be tried. This method can also be used to eliminate configurations that might not be valid.
tryConfiguration |
Tests if a configuration can be used.
public
virtual bool tryConfiguration( UInt32 index);
Returns true if any configurations were successfully found.
This method is used to test if a configuration can be reserved from Card Services. If all resources are successfully reserved, the configuration is kept. The configure method enables the configuration later on. The built configuration is kept in the state variable, configuration.
unconfigure |
Unconfigures a card.
public
virtual bool unconfigure();
Returns true if the card was successfully unconfigured.
This method releases resources that were previously allocated back to Card Services.
withDevice |
Sets up a new enabler.
public
static IOPCCard16Enabler * withDevice( IOPCCard16Device *provider);
Returns the address of the new enabler.
This factory method creates and connects an enabler to a 16-bit PC Card provider nub.
configTable |
protected
cistpl_cftable_entry_t * configTable[ 32];
Stores the expanded information from the CIS configuration tuples
configuration |
protected
config_req_t configuration;
Stores the configuration reserved from Card Services
device |
protected
IOPCCard16Device * device;
Pointer to the provider nub
handle |
protected
client_handle_t handle;
Stores the Card Services handle for this socket
io |
protected
io_req_t io;
Tracks the current I/O reservations
ioWindowCount |
protected
UInt32 ioWindowCount;
Number of reserved I/O windows
irq |
protected
irq_req_t irq;
Tracks the current IRQ reservations
map |
protected
memreq_t map[CISTPL_MEM_MAX_WIN];
Tracks the current common memory mapping
memoryWindowCount |
protected
UInt32 memoryWindowCount;
Number of reserved memory windows
req |
protected
win_req_t req[CISTPL_MEM_MAX_WIN];
Tracks the current common memory reservations
state |
protected
u_int state;
Stores the current state of this socket
tableEntryCount |
protected
u_int tableEntryCount;
Number of entries stored in the configTable
win |
protected
window_handle_t win[CISTPL_MEM_MAX_WIN];
Stores the Card Services handle for a memory window
|
Last Updated: 2008-12-19