pcmcia-prog
字号:
CS_BAD_ATTRIBUTE An unsupported attribute flag was specified. CS_UNSUPPORTED_FUNCTION For a CardBus client, this is returned if Card Services was not configured with CardBus support. 33..33..22.. RReelleeaasseeIIOO int CardServices(ReleaseIO, client_handle_t client, io_req_t *req); ReleaseIO un-reserves IO port windows allocated by a previous call to RequestIO. The req parameter should be the same one passed to RequestIO. If several card functions are sharing a larger IO port window, ports released by one function may not become available for other uses until all card functions have released their IO ports. For a CardBus client, this call releases all system resources allocated for this card. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_CONFIGURATION_LOCKED This socket's configuration has been locked by a call to RequestConfiguration. The configuration should be released before calling ReleaseIO. CS_BAD_ARGS The parameters in req do not match the parameters passed to RequestIO. 33..33..33.. RReeqquueessttIIRRQQ int CardServices(RequestIRQ, client_handle_t client, irq_req_t *req); The irq_req_t structure is given by: typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; u_int IRQInfo1, IRQInfo2; void *(Handler)(int, struct pt_regs *); void *Instance } irq_req_t; RequestIRQ reserves an interrupt line for use by a card. The IRQInfo1 and IRQInfo2 fields correspond to the interrupt description bytes in a CFTABLE_ENTRY tuple. If IRQ_INFO2_VALID is set in IRQInfo1, then IRQInfo2 is a bit-mapped mask of allowed interrupt values. Each bit corresponds to one interrupt line: bit 0 = irq 0, bit 1 = irq 1, etc. So, a mask of 0x1100 would mean that interrupts 12 and 8 could be used. If IRQ_INFO2_VALID is not set, IRQInfo1 is just the desired interrupt number. If the call is successful, the reserved interrupt is returned in AssignedIRQ. If the IRQ_HANDLER_PRESENT flag is set, then this call also specifies an interrupt handler to be installed when the interrupt is enabled. When RequestConfiguration is called, the handler given by Handler will be installed. For 2.0 and later kernels, the interrupt handler will be installed with the device ``instance'' given in Instance. For pre-2.1.60 kernels, the kernel irq2dev_map table will also be updated. With multifunction cards, the interrupt will be allocated in shared mode, and the handler(s) have responsibility for determining which card function(s) require attention when an interrupt is received. If a client instead bypasses Card Services to install its own interrupt service routine, it should allocate the interrupt in shared mode if this client could be bound to a multifunction card. The following flags can be specified in Attributes: IRQ_FORCED_PULSE Specifies that the interrupt should be configured for pulsed mode, rather than the default level mode. IRQ_TYPE_TIME Specifies that this interrupt can be time-shared with other Card Services drivers. Only one driver should enable the interrupt at any time. IRQ_FIRST_SHARED In conjunction with IRQ_TYPE_TIME, this should be set by the first driver requesting a shared interrupt. IRQ_HANDLER_PRESENT Indicates that the Handler field points to an interrupt service routine that should be installed. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_NO_CARD The socket assigned to this client is currently vacant. CS_IN_USE An interrupt has already been reserved for this socket, or the requested interrupt is unavailable. CS_CONFIGURATION_LOCKED This card function's configuration has been locked by a call to RequestConfiguration. CS_BAD_ATTRIBUTE An unsupported attribute flag was specified. 33..33..44.. RReelleeaasseeIIRRQQ int CardServices(ReleaseIRQ, client_handle_t client, irq_req_t *req); ReleaseIRQ un-reserves an interrupt assigned by an earlier call to RequestIRQ. The req structure should be the same structure that was passed to RequestIRQ. If a handler was specified in the RequestIRQ call, it will be unregistered at this time. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_CONFIGURATION_LOCKED This socket's configuration has been locked by a call to RequestConfiguration. The configuration should be released before calling ReleaseIRQ. CS_BAD_IRQ The parameters in req do not match the parameters passed to RequestIRQ. 33..33..55.. RReeqquueessttCCoonnffiigguurraattiioonn int CardServices(RequestConfiguration, client_handle_t client, config_req_t *req); The config_req_t structure is given by: typedef struct config_req_t { u_int Attributes; u_int Vcc, Vpp1, Vpp2; u_int IntType; u_int ConfigBase; u_char Status, Pin, Copy, ExtStatus; u_char ConfigIndex; u_int Present; } config_req_t; RequestConfiguration is responsible for actually configuring a socket. This includes setting voltages, setting CIS configuration registers, setting up IO port windows, and setting up interrupts. IntType specifies the type of interface to use for this card. It may be INT_MEMORY, INT_MEMORY_AND_IO, or INT_CARDBUS. Voltages are specified in units of 1/10 volt. Currently, Vpp1 must equal Vpp2. With multifunction cards, each card function is configured separately. Each function has its own set of CIS configuration registers. However, all functions must be configured with the same power and interface settings. When invoked by a CardBus client, most of the request structure is ignored, and all card functions will be configured based on data collected in a previous RequestIO call. This includes configuring the CardBus bridge, as well as initializing the Command, Base Address, and Interrupt Line registers in each card function's configuration space. IntType must be set to INT_CARDBUS in this case. The following flags can be specified in Attributes. DMA and speaker control are not supported on all systems. CONF_ENABLE_IRQ Enable the IO interrupt reserved by a previous call to RequestIRQ. CONF_ENABLE_DMA Enable DMA accesses for this socket. CONF_ENABLE_SPKR Enable speaker output from this socket. The Present parameter is a bit map specifying which CIS configuration registers are implemented by this card. ConfigBase gives the offset of the configuration registers in attribute memory. The following registers can be specified: PRESENT_OPTION Specifies that the Configuration Option Register is present. The COR register will be set using the ConfigIndex parameter. PRESENT_STATUS Specifies that the Card Configuration and Status Register is present. The CCSR will be initialized with the Status parameter. PRESENT_PIN_REPLACE Specifies that the Pin Replacement Register is present. The PRR will be initialized with the Pin parameter. PRESENT_COPY Specifies that the Socket and Copy Register is present. The SCR will be initialized with the Copy parameter. PRESENT_EXT_STATUS Specifies that the Extended Status Register is present. The ESR will be initialized with the ExtStatus parameter. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_NO_CARD The socket assigned to this client is currently vacant. CS_OUT_OF_RESOURCE Card Services was unable to allocate a memory window to access the card's configuration registers. CS_CONFIGURATION_LOCKED This card's configuration has already been locked by another call to RequestConfiguration. CS_BAD_VCC The requested Vcc voltage is not supported. CS_BAD_VPP The requested Vpp1/Vpp2 voltage is not supported. CS_UNSUPPORTED_MODE A non-CardBus client attempted to configure a CardBus card, or a CardBus client attempted to configure a non-CardBus card. 33..33..66.. MMooddiiffyyCCoonnffiigguurraattiioonn int CardServices(ModifyConfiguration, client_handle_t client, modconf_t *mod); The modconf_t structure is given by: typedef struct modconf_t { u_int Attributes; u_int Vcc, Vpp1, Vpp2; } modconf_t; ModifyConfiguration modifies some attributes of a socket that has been configured by a call to RequestConfiguration. The following flags can be specified in Attributes: CONF_IRQ_CHANGE_VALID Indicates that the CONF_ENABLE_IRQ setting should be updated. CONF_ENABLE_IRQ Specifies that IO interrupts should be enabled for this socket. CONF_VCC_CHANGE_VALID Indicates that Vcc should be updated. CONF_VPP1_CHANGE_VALID Indicates that Vpp1 should be updated. CONF_VPP2_CHANGE_VALID Indicates that Vpp2 should be updated. Currently, Vpp1 and Vpp2 must always have the same value. So, the two values must always be changed at the same time. Return codes: CS_BAD_HANDLE The client handle is invalid. CS_NO_CARD The socket assigned to this client is currently vacant. CS_CONFIGURATION_LOCKED This actually means that this socket has nnoott been locked. CS_BAD_VCC The requested Vcc voltage is not supported. CS_BAD_VPP The requested Vpp1/Vpp2 voltage is not supported. 33..33..77.. RReelleeaasseeCCoonnffiigguurraattiioonn int CardServices(ReleaseConfiguration, client_handle_t client, config_req_t *req); ReleaseConfiguration un-configures a socket previously set up by a call to RequestConfiguration. The req parameter should be the same one used to configure the socket. Return codes: CS_BAD_HANDLE The window handle is invalid, or the socket is not configured. 33..33..88.. GGeettCCoonnffiigguurraattiioonnIInnffoo int CardServices(GetConfigurationInfo, client_handle_t client, config_info_t *config); The config_info_t structure is given by: typedef struct config_info_t { u_char Function; u_int Attributes; u_int Vcc, Vpp1, Vpp2; u_int IntType; u_int ConfigBase; u_char Status, Pin, Copy, Option, ExtStatus; u_int Present; u_int AssignedIRQ; u_int IRQAttributes; ioaddr_t BasePort1; ioaddr_t NumPorts1; u_int Attributes1; ioaddr_t BasePort2; ioaddr_t NumPorts2; u_int Attributes2; u_int IOAddrLines; } config_info_t; GetConfigurationInfo returns the current socket configuration as it was set up by RequestIO, RequestIRQ, and RequestConfiguration. Most fields will only be filled in if the socket is fully configured; the CONF_VALID_CLIENT flag in Attributes indicates this fact. For normal clients bound to a single card function, the Function field is ignored, and data for that client's assigned function is returned. For clients bound to BIND_FN_ALL, this field specifies which function's configuration data should be returned. For CardBus cards, the ConfigBase field is set to the card's PCI vendor/device ID, and the Option field is set to the CardBus PCI bus number. Return codes: CS_BAD_HANDLE The window handle is invalid, or the socket is not configured. CS_NO_CARD The socket assigned to this client is currently vacant. CS_CONFIGURATION_LOCKED This actually means that the configuration has nnoott been locked. 33..44.. CCaarrdd IInnffoorrmmaattiioonn SSttrruuccttuurree ((CCIISS)) ccaallllss The definition of the Card Information Structure (CIS) is the darkest chapter of the PC Card standard. All version 2 compliant cards should have a CIS, which describes the card and how it should be configured. The CIS is a linked list of ``tuples'' in the card's attribute memory space. Each tuple consists of an identification code, a length byte, and a series of data bytes. The layout of the data bytes for some tuple types is absurdly complicated, in an apparent effort to use
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -