linux/drivers/pcmcia/vrc4173_cardu.c
_ement..6.6A ment. + idm> cmcia/ cm onT"){ r="up])=eclass="lf(dt[0 '
.6A 73_/spa).. 73_/form.. 73_a .6A 73 href="../linux+v3.6.10/drivers/pcmcia/vrc4173_cardu.c">.6A 73_img src="../.static/gfx/right.png" alt=">>">.6_/spa)...6_spa) class="lxr_search">.6A .6A 73_input typ |"hidden" nam |"navtarget" rea' |"">.6A 73_input typ |"text" nam |"search" id|"search">.6A 73_butt();typ |"submit">Search.6A 73Prefs. 73_/a>.6_/spa)..A 73 3_/div..A 73 3_form acom()="ajax+*" method="post" onsubmit="return false;">.6_input typ |"hidden" nam |"ajax_lookup" id|"ajax_lookup" rea' |"">.A 73 3_/form...A 73 3_div class="headingbott(m">. _div id|"file_contents".
3 31_/a>_spa) class="comment">/*_/spa)..3 32_/a>_spa) class="comment"> * FILE NAME_/spa)..3 33_/a>_spa) class="comment"> *      drivers/pcmcia/vrc4173_cardu.c_/spa)..3 34_/a>_spa) class="comment"> *_/spa)..3 35_/a>_spa) class="comment"> * BRIEF MODULE DESCRIPTION_/spa)..3 36_/a>_spa) class="comment"> *      NEC VRC4173 CARDU driver for Socket Services_/spa)..3 37_/a>_spa) class="comment"> *      (This device doesn't support CardBus. it is supporting only 16bit PC Card.)_/spa)..3 38_/a>_spa) class="comment"> *_/spa)..3 39_/a>_spa) class="comment"> * Copyright 2002,2003 Yoichi Yuasa <yuasa@linux-mips.org>_/spa)..3 10_spa) class="comment"> *_/spa)..3 11_/a>_spa) class="comment"> *  This program is free software; you ca) redistribute it and/or modify it_/spa)..3 12_/a>_spa) class="comment"> *  under the terms of the GNU General Public License as published by the_/spa)..3 13_/a>_spa) class="comment"> *  Free Software Foundaom(); either versm();2 of the License, or (at your_/spa)..3 14_/a>_spa) class="comment"> *3 opom()) any later versm()._/spa)..3 15_/a>_spa) class="comment"> *_/spa)..3 16_/a>_spa) class="comment"> *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED_/spa)..3 17_/a>_spa) class="comment"> *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF_/spa)..3 18_/a>_spa) class="comment"> *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED._/spa)..3 19_/a>_spa) class="comment"> *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,_/spa)..3 20_spa) class="comment"> *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,_/spa)..3 21_/a>_spa) class="comment"> *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS_/spa)..3 22_/a>_spa) class="comment"> *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND_/spa)..3 23_/a>_spa) class="comment"> *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR_/spa)..3 24_/a>_spa) class="comment"> *3 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE_/spa)..3 25_/a>_spa) class="comment"> *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE._/spa)..3 26_/a>_spa) class="comment"> *_/spa)..3 27_/a>_spa) class="comment"> *  You should have received a copy of the GNU General Public License along_/spa)..3 28_/a>_spa) class="comment"> *  with this program; if not, write to the Free Software Foundaom(), Inc.,_/spa)..3 29_/a>_spa) class="comment"> *  675 Mass Ave, Cambridge, MA 02139, USA._/spa)..3 30_spa) class="comment"> */_/spa)..3 31_/a>#include <linux/init.h_/a>>.3 32_/a>#include <linux/module.h_/a>>.3 33_/a>#include <linux/pci.h_/a>>.3 34_/a>#include <linux/spinlock.h_/a>>.3 35_/a>#include <linux/typ s.h_/a>>.3 36_/a>.3 37_/a>#include <asm/io.h_/a>>.3 38_/a>.3 39_/a>#include <pcmcia/ss.h_/a>>.3 40_/a>.3 41_/a>#include "vrc4173_cardu.h_/a>".3 42_/a>.3 43_/a>_a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION_/a>(_spa) class="string">"NEC VRC4173 CARDU driver for Socket Services"3 44_/a>_a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR_/a>(_spa) class="string">"Yoichi Yuasa <yuasa@linux-mips.org>"3 45_/a>_a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE_/a>(_spa) class="string">"GPL"3 46_/a>.3 47_/a>static int _a href="+code=vrc4173_cardu_slots" class="sref">vrc4173_cardu_slots_/a>;.3 48_/a>.3 49_/a>static _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> _a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=CARDU_MAX_SOCKETS" class="sref">CARDU_MAX_SOCKETS_/a>];.3 50_/a>.3 51_/a>extern struct _a href="+code=socket_info_t" class="sref">socket_info_t_/a> *_a href="+code=pcmcia_register_socket" class="sref">pcmcia_register_socket_/a> (int _a href="+code=slot" class="sref">slot_/a>,.3 52_/a>                                                     struct _a href="+code=pccard_operaom()s" class="sref">pccard_operaom()s_/a> *_a href="+code=vtable" class="sref">vtable_/a>,.3 53_/a>                                                     int _a href="+code=use_bus_pm" class="sref">use_bus_pm_/a>);.3 54_/a>extern void _a href="+code=pcmcia_unregister_socket" class="sref">pcmcia_unregister_socket_/a>(struct _a href="+code=socket_info_t" class="sref">socket_info_t_/a> *_a href="+code=s" class="sref">s_/a>);.3 55_/a>.3 56_/a>static _a href="+code=inline" class="sref">inline_/a> _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=offset" class="sref">offset_/a>).3 57_/a>{.3 58_/a>        return _a href="+code=readb" class="sref">readb_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 59_/a>}.3 60_/a>.3 61_/a>static _a href="+code=inline" class="sref">inline_/a> _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=offset" class="sref">offset_/a>).3 62_/a>{.3 63_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=val" class="sref">val_/a>;.3 64_/a>.3 65_/a>        _a href="+code=val" class="sref">val_/a> = _a href="+code=readb" class="sref">readb_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 66_/a>        _a href="+code=val" class="sref">val_/a> |= (_a href="+code=u16" class="sref">u16_/a>)_a href="+code=readb" class="sref">readb_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a> + 1) << 8;.3 67_/a>.3 68_/a>        return _a href="+code=val" class="sref">val_/a>;.3 69_/a>}.3 70_/a>.3 71_/a>static _a href="+code=inline" class="sref">inline_/a> void _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=offset" class="sref">offset_/a>, _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=val" class="sref">val_/a>).3 72_/a>{.3 73_/a>        _a href="+code=writeb" class="sref">writeb_/a>(_a href="+code=val" class="sref">val_/a>, _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 74_/a>}.3 75_/a>.3 76_/a>static _a href="+code=inline" class="sref">inline_/a> void _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=offset" class="sref">offset_/a>, _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=val" class="sref">val_/a>).3 77_/a>{.3 78_/a>        _a href="+code=writeb" class="sref">writeb_/a>((_a href="+code=u8" class="sref">u8_/a>)_a href="+code=val" class="sref">val_/a>, _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 79_/a>        _a href="+code=writeb" class="sref">writeb_/a>((_a href="+code=u8" class="sref">u8_/a>)(_a href="+code=val" class="sref">val_/a> >> 8), _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=EXCA_REGS_BASE" class="sref">EXCA_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a> + 1);.3 80_/a>}.3 81_/a>.3 82_/a>static _a href="+code=inline" class="sref">inline_/a> _a href="+code=uint32_t" class="sref">uint32_t_/a> _a href="+code=cardbus_socket_readl" class="sref">cardbus_socket_readl_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=u16" class="sref">u16_/a> _a href="+code=offset" class="sref">offset_/a>).3 83_/a>{.3 84_/a>        return _a href="+code=readl" class="sref">readl_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=CARDBUS_SOCKET_REGS_BASE" class="sref">CARDBUS_SOCKET_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 85_/a>}.3 86_/a>.3 87_/a>static _a href="+code=inline" class="sref">inline_/a> void _a href="+code=cardbus_socket_writel" class="sref">cardbus_socket_writel_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>, _a href="+code=u16" class="sref">u16_/a> _a href="+code=offset" class="sref">offset_/a>, _a href="+code=uint32_t" class="sref">uint32_t_/a> _a href="+code=val" class="sref">val_/a>).3 88_/a>{.3 89_/a>        _a href="+code=writel" class="sref">writel_/a>(_a href="+code=val" class="sref">val_/a>, _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> + _a href="+code=CARDBUS_SOCKET_REGS_BASE" class="sref">CARDBUS_SOCKET_REGS_BASE_/a> + _a href="+code=offset" class="sref">offset_/a>);.3 90_/a>}.3 91_/a>.3 92_/a>static void _a href="+code=cardu_pciregs_init" class="sref">cardu_pciregs_init_/a>(struct _a href="+code=pci_dev" class="sref">pci_dev_/a> *_a href="+code=dev" class="sref">dev_/a>).3 93_/a>{.3 94_/a>        _a href="+code=u32" class="sref">u32_/a> _a href="+code=syscnt" class="sref">syscnt_/a>;.3 95_/a>        _a href="+code=u16" class="sref">u16_/a> _a href="+code=brgcnt" class="sref">brgcnt_/a>;.3 96_/a>        _a href="+code=u8" class="sref">u8_/a> _a href="+code=devcnt" class="sref">devcnt_/a>;.3 97_/a>.3 98_/a>        _a href="+code=pci_write_config_dword" class="sref">pci_write_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, 0x1c, 0x10000000);.3 99_/a>        _a href="+code=pci_write_config_dword" class="sref">pci_write_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, 0x20, 0x17fff000);.3100_/a>        _a href="+code=pci_write_config_dword" class="sref">pci_write_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, 0x2c, 0);.3101_/a>        _a href="+code=pci_write_config_dword" class="sref">pci_write_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, 0x30, 0xfffc);.3102_/a>.3103_/a>        _a href="+code=pci_read_config_word" class="sref">pci_read_config_word_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=BRGCNT" class="sref">BRGCNT_/a>, &_a href="+code=brgcnt" class="sref">brgcnt_/a>);.3104_/a>        _a href="+code=brgcnt" class="sref">brgcnt_/a> &= ~_a href="+code=IREQ_INT" class="sref">IREQ_INT_/a>;.3105_/a>        _a href="+code=pci_write_config_word" class="sref">pci_write_config_word_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=BRGCNT" class="sref">BRGCNT_/a>, _a href="+code=brgcnt" class="sref">brgcnt_/a>);.3106_/a>.3107_/a>        _a href="+code=pci_read_config_dword" class="sref">pci_read_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=SYSCNT" class="sref">SYSCNT_/a>, &_a href="+code=syscnt" class="sref">syscnt_/a>);.3108_/a>        _a href="+code=syscnt" class="sref">syscnt_/a> &= ~(_a href="+code=BAD_VCC_REQ_DISB" class="sref">BAD_VCC_REQ_DISB_/a>|_a href="+code=PCPCI_EN" class="sref">PCPCI_EN_/a>|_a href="+code=CH_ASSIGN_MASK" class="sref">CH_ASSIGN_MASK_/a>|_a href="+code=SUB_ID_WR_EN" class="sref">SUB_ID_WR_EN_/a>|_a href="+code=PCI_CLK_RIN" class="sref">PCI_CLK_RIN_/a>);.3109_/a>        _a href="+code=syscnt" class="sref">syscnt_/a> |= (_a href="+code=CH_ASSIGN_NODMA" class="sref">CH_ASSIGN_NODMA_/a>|_a href="+code=ASYN_INT_MODE" class="sref">ASYN_INT_MODE_/a>);.3110_/a>        _a href="+code=pci_write_config_dword" class="sref">pci_write_config_dword_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=SYSCNT" class="sref">SYSCNT_/a>, _a href="+code=syscnt" class="sref">syscnt_/a>);.3111_/a>.3112_/a>        _a href="+code=pci_read_config_byte" class="sref">pci_read_config_byte_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=DEVCNT" class="sref">DEVCNT_/a>, &_a href="+code=devcnt" class="sref">devcnt_/a>);.3113_/a>        _a href="+code=devcnt" class="sref">devcnt_/a> &= ~(_a href="+code=ZOOM_VIDEO_EN" class="sref">ZOOM_VIDEO_EN_/a>|_a href="+code=SR_PCI_INT_SEL_MASK" class="sref">SR_PCI_INT_SEL_MASK_/a>|_a href="+code=PCI_INT_MODE" class="sref">PCI_INT_MODE_/a>|_a href="+code=IRQ_MODE" class="sref">IRQ_MODE_/a>);.3114_/a>        _a href="+code=devcnt" class="sref">devcnt_/a> |= (_a href="+code=SR_PCI_INT_SEL_NONE" class="sref">SR_PCI_INT_SEL_NONE_/a>|_a href="+code=IFG" class="sref">IFG_/a>);.3115_/a>        _a href="+code=pci_write_config_byte" class="sref">pci_write_config_byte_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=DEVCNT" class="sref">DEVCNT_/a>, _a href="+code=devcnt" class="sref">devcnt_/a>);.3116_/a>.3117_/a>        _a href="+code=pci_write_config_byte" class="sref">pci_write_config_byte_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=CHIPCNT" class="sref">CHIPCNT_/a>, _a href="+code=S_PREF_DISB" class="sref">S_PREF_DISB_/a>);.3118_/a>.3119_/a>        _a href="+code=pci_write_config_byte" class="sref">pci_write_config_byte_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=SERRDIS" class="sref">SERRDIS_/a>, 0);.3120_/a>}.3121_/a>.3122_/a>static int _a href="+code=cardu_init" class="sref">cardu_init_/a>(unsigned int _a href="+code=slot" class="sref">slot_/a>).3123_/a>{.3124_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=slot" class="sref">slot_/a>];.3125_/a>.3126_/a>        _a href="+code=cardu_pciregs_init" class="sref">cardu_pciregs_init_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=dev" class="sref">dev_/a>);.3127_/a>.3128_/a>        _spa) class="comment">/* CARD_SC bits are cleared by reading CARD_SC. */_/spa)..3129_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=GLO_CNT" class="sref">GLO_CNT_/a>, 0);.3130_/a>.3131_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=cap" class="sref">cap_/a>._a href="+code=features" class="sref">features_/a> |= _a href="+code=SS_CAP_PCCARD" class="sref">SS_CAP_PCCARD_/a> | _a href="+code=SS_CAP_PAGE_REGS" class="sref">SS_CAP_PAGE_REGS_/a>;.3132_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=cap" class="sref">cap_/a>._a href="+code=irq_mask" class="sref">irq_mask_/a> = 0;.3133_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=cap" class="sref">cap_/a>._a href="+code=map_size" class="sref">map_size_/a> = 0x1000;.3134_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=cap" class="sref">cap_/a>._a href="+code=pci_irq" class="sref">pci_irq_/a>  = _a href="+code=socket" class="sref">socket_/a>->_a href="+code=dev" class="sref">dev_/a>->_a href="+code=irq" class="sref">irq_/a>;.3135_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=events" class="sref">events_/a> = 0;.3136_/a>        _a href="+code=spin_lock_init" class="sref">spin_lock_init_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=event_lock" class="sref">event_lock_/a>);.3137_/a>.3138_/a>        _spa) class="comment">/* Enable PC Card status interrupts */_/spa)..3139_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=CARD_SCI" class="sref">CARD_SCI_/a>, _a href="+code=CARD_DT_EN" class="sref">CARD_DT_EN_/a>|_a href="+code=RDY_EN" class="sref">RDY_EN_/a>|_a href="+code=BAT_WAR_EN" class="sref">BAT_WAR_EN_/a>|_a href="+code=BAT_DEAD_EN" class="sref">BAT_DEAD_EN_/a>);.3140_/a>.3141_/a>        return 0;.3142_/a>}.3143_/a>.3144_/a>static int _a href="+code=cardu_register_callback" class="sref">cardu_register_callback_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>,.3145_/a>                                           void (*_a href="+code=handler" class="sref">handler_/a>)(void *, unsigned int),.3146_/a>                                           void * _a href="+code=info" class="sref">info_/a>).3147_/a>{.3148_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3149_/a>.3150_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=handler" class="sref">handler_/a> = _a href="+code=handler" class="sref">handler_/a>;.3151_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=info" class="sref">info_/a> = _a href="+code=info" class="sref">info_/a>;.3152_/a>.3153_/a>        return 0;.3154_/a>}.3155_/a>.3156_/a>static int _a href="+code=cardu_inquire_socket" class="sref">cardu_inquire_socket_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, _a href="+code=socket_cap_t" class="sref">socket_cap_t_/a> *_a href="+code=cap" class="sref">cap_/a>).3157_/a>{.3158_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3159_/a>.3160_/a>        *_a href="+code=cap" class="sref">cap_/a> = _a href="+code=socket" class="sref">socket_/a>->_a href="+code=cap" class="sref">cap_/a>;.3161_/a>.3162_/a>        return 0;.3163_/a>}.3164_/a>.3165_/a>static int _a href="+code=cardu_get_status" class="sref">cardu_get_status_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, _a href="+code=u_int" class="sref">u_int_/a> *_a href="+code=value" class="sref">value_/a>).3166_/a>{.3167_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3168_/a>        _a href="+code=uint32_t" class="sref">uint32_t_/a> _a href="+code=state" class="sref">state_/a>;.3169_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=status" class="sref">status_/a>;.3170_/a>        _a href="+code=u_int" class="sref">u_int_/a> _a href="+code=val" class="sref">val_/a> = 0;.3171_/a>.3172_/a>        _a href="+code=status" class="sref">status_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IF_STATUS" class="sref">IF_STATUS_/a>);.3173_/a>        if (_a href="+code=status" class="sref">status_/a> & _a href="+code=CARD_PWR" class="sref">CARD_PWR_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_POWERON" class="sref">SS_POWERON_/a>;.3174_/a>        if (_a href="+code=status" class="sref">status_/a> & _a href="+code=READY" class="sref">READY_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_READY" class="sref">SS_READY_/a>;.3175_/a>        if (_a href="+code=status" class="sref">status_/a> & _a href="+code=CARD_WP" class="sref">CARD_WP_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_WRPROT" class="sref">SS_WRPROT_/a>;.3176_/a>        if ((_a href="+code=status" class="sref">status_/a> & (_a href="+code=CARD_DETECT1" class="sref">CARD_DETECT1_/a>|_a href="+code=CARD_DETECT2" class="sref">CARD_DETECT2_/a>)) == (_a href="+code=CARD_DETECT1" class="sref">CARD_DETECT1_/a>|_a href="+code=CARD_DETECT2" class="sref">CARD_DETECT2_/a>)).3177_/a>                _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_DETECT" class="sref">SS_DETECT_/a>;.3178_/a>        if (_a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=INT_GEN_CNT" class="sref">INT_GEN_CNT_/a>) & _a href="+code=CARD_TYPE_IO" class="sref">CARD_TYPE_IO_/a>) {.3179_/a>                if (_a href="+code=status" class="sref">status_/a> & _a href="+code=STSCHG" class="sref">STSCHG_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_STSCHG" class="sref">SS_STSCHG_/a>;.3180_/a>        } else {.3181_/a>                _a href="+code=status" class="sref">status_/a> &= _a href="+code=BV_DETECT_MASK" class="sref">BV_DETECT_MASK_/a>;.3182_/a>                if (_a href="+code=status" class="sref">status_/a> != _a href="+code=BV_DETECT_GOOD" class="sref">BV_DETECT_GOOD_/a>) {.3183_/a>                        if (_a href="+code=status" class="sref">status_/a> == _a href="+code=BV_DETECT_WARN" class="sref">BV_DETECT_WARN_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_BATWARN" class="sref">SS_BATWARN_/a>;.3184_/a>                        else _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_BATDEAD" class="sref">SS_BATDEAD_/a>;.3185_/a>                }.3186_/a>        }.3187_/a>.3188_/a>        _a href="+code=state" class="sref">state_/a> = _a href="+code=cardbus_socket_readl" class="sref">cardbus_socket_readl_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=SKT_PRE_STATE" class="sref">SKT_PRE_STATE_/a>);.3189_/a>        if (_a href="+code=state" class="sref">state_/a> & _a href="+code=VOL_3V_CARD_DT" class="sref">VOL_3V_CARD_DT_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_3VCARD" class="sref">SS_3VCARD_/a>;.3190_/a>        if (_a href="+code=state" class="sref">state_/a> & _a href="+code=VOL_XV_CARD_DT" class="sref">VOL_XV_CARD_DT_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_XVCARD" class="sref">SS_XVCARD_/a>;.3191_/a>        if (_a href="+code=state" class="sref">state_/a> & _a href="+code=CB_CARD_DT" class="sref">CB_CARD_DT_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_CARDBUS" class="sref">SS_CARDBUS_/a>;.3192_/a>        if (!(_a href="+code=state" class="sref">state_/a> &.3193_/a>              (_a href="+code=VOL_YV_CARD_DT" class="sref">VOL_YV_CARD_DT_/a>|_a href="+code=VOL_XV_CARD_DT" class="sref">VOL_XV_CARD_DT_/a>|_a href="+code=VOL_3V_CARD_DT" class="sref">VOL_3V_CARD_DT_/a>|_a href="+code=VOL_5V_CARD_DT" class="sref">VOL_5V_CARD_DT_/a>|_a href="+code=CCD20" class="sref">CCD20_/a>|_a href="+code=CCD10" class="sref">CCD10_/a>))).3194_/a>                _a href="+code=val" class="sref">val_/a> |= _a href="+code=SS_PENDING" class="sref">SS_PENDING_/a>;.3195_/a>.3196_/a>        *_a href="+code=value" class="sref">value_/a> = _a href="+code=val" class="sref">val_/a>;.3197_/a>.3198_/a>        return 0;.3199_/a>}.3200_/a>.3201_/a>static _a href="+code=inline" class="sref">inline_/a> _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=set_Vcc_value" class="sref">set_Vcc_value_/a>(_a href="+code=u_char" class="sref">u_char_/a> _a href="+code=Vcc" class="sref">Vcc_/a>).3202_/a>{.3203_/a>        switch (_a href="+code=Vcc" class="sref">Vcc_/a>) {.3204_/a>        case 33:.3205_/a>                return _a href="+code=VCC_3V" class="sref">VCC_3V_/a>;.3206_/a>        case 50:.3207_/a>                return _a href="+code=VCC_5V" class="sref">VCC_5V_/a>;.3208_/a>        }.3209_/a>.3210_/a>        return _a href="+code=VCC_0V" class="sref">VCC_0V_/a>;.3211_/a>}.3212_/a>.3213_/a>static _a href="+code=inline" class="sref">inline_/a> _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=set_Vpp_value" class="sref">set_Vpp_value_/a>(_a href="+code=u_char" class="sref">u_char_/a> _a href="+code=Vpp" class="sref">Vpp_/a>).3214_/a>{.3215_/a>        switch (_a href="+code=Vpp" class="sref">Vpp_/a>) {.3216_/a>        case 33:.3217_/a>        case 50:.3218_/a>                return _a href="+code=VPP_VCC" class="sref">VPP_VCC_/a>;.3219_/a>        case 120:.3220_/a>                return _a href="+code=VPP_12V" class="sref">VPP_12V_/a>;.3221_/a>        }.3222_/a>.3223_/a>        return _a href="+code=VPP_0V" class="sref">VPP_0V_/a>;.3224_/a>}.3225_/a>.3226_/a>static int _a href="+code=cardu_set_socket" class="sref">cardu_set_socket_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, _a href="+code=socket_state_t" class="sref">socket_state_t_/a> *_a href="+code=state" class="sref">state_/a>).3227_/a>{.3228_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3229_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=val" class="sref">val_/a>;.3230_/a>.3231_/a>        if (((_a href="+code=state" class="sref">state_/a>->_a href="+code=Vpp" class="sref">Vpp_/a> == 33) || (_a href="+code=state" class="sref">state_/a>->_a href="+code=Vpp" class="sref">Vpp_/a> == 50)) && (_a href="+code=state" class="sref">state_/a>->_a href="+code=Vpp" class="sref">Vpp_/a> != _a href="+code=state" class="sref">state_/a>->_a href="+code=Vcc" class="sref">Vcc_/a>)).3232_/a>                        return -_a href="+code=EINVAL" class="sref">EINVAL_/a>;.3233_/a>.3234_/a>        _a href="+code=val" class="sref">val_/a> = _a href="+code=set_Vcc_value" class="sref">set_Vcc_value_/a>(_a href="+code=state" class="sref">state_/a>->_a href="+code=Vcc" class="sref">Vcc_/a>);.3235_/a>        _a href="+code=val" class="sref">val_/a> |= _a href="+code=set_Vpp_value" class="sref">set_Vpp_value_/a>(_a href="+code=state" class="sref">state_/a>->_a href="+code=Vpp" class="sref">Vpp_/a>);.3236_/a>        if (_a href="+code=state" class="sref">state_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=SS_OUTPUT_ENA" class="sref">SS_OUTPUT_ENA_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=CARD_OUT_EN" class="sref">CARD_OUT_EN_/a>;.3237_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=PWR_CNT" class="sref">PWR_CNT_/a>, _a href="+code=val" class="sref">val_/a>);.3238_/a>.3239_/a>        _a href="+code=val" class="sref">val_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=INT_GEN_CNT" class="sref">INT_GEN_CNT_/a>) & _a href="+code=CARD_REST0" class="sref">CARD_REST0_/a>;.3240_/a>        if (_a href="+code=state" class="sref">state_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=SS_RESET" class="sref">SS_RESET_/a>) _a href="+code=val" class="sref">val_/a> &= ~_a href="+code=CARD_REST0" class="sref">CARD_REST0_/a>;.3241_/a>        else _a href="+code=val" class="sref">val_/a> |= _a href="+code=CARD_REST0" class="sref">CARD_REST0_/a>;.3242_/a>        if (_a href="+code=state" class="sref">state_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=SS_IOCARD" class="sref">SS_IOCARD_/a>) _a href="+code=val" class="sref">val_/a> |= _a href="+code=CARD_TYPE_IO" class="sref">CARD_TYPE_IO_/a>;.3243_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=INT_GEN_CNT" class="sref">INT_GEN_CNT_/a>, _a href="+code=val" class="sref">val_/a>);.3244_/a>.3245_/a>        return 0;.3246_/a>}.3247_/a>.3248_/a>static int _a href="+code=cardu_get_io_map" class="sref">cardu_get_io_map_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, struct _a href="+code=pccard_io_map" class="sref">pccard_io_map_/a> *_a href="+code=io" class="sref">io_/a>).3249_/a>{.3250_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3251_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=ioctl" class="sref">ioctl_/a>, _a href="+code=window" class="sref">window_/a>;.3252_/a>        _a href="+code=u_char" class="sref">u_char_/a> _a href="+code=map" class="sref">map_/a>;.3253_/a>.3254_/a>        _a href="+code=map" class="sref">map_/a> = _a href="+code=io" class="sref">io_/a>->_a href="+code=map" class="sref">map_/a>;.3255_/a>        if (_a href="+code=map" class="sref">map_/a> > 1).3256_/a>                return -_a href="+code=EINVAL" class="sref">EINVAL_/a>;.3257_/a>.3258_/a>        _a href="+code=io" class="sref">io_/a>->_a href="+code=start" class="sref">start_/a> = _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_SA" class="sref">IO_WIN_SA_/a>(_a href="+code=map" class="sref">map_/a>));.3259_/a>        _a href="+code=io" class="sref">io_/a>->_a href="+code=stop" class="sref">stop_/a> = _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_EA" class="sref">IO_WIN_EA_/a>(_a href="+code=map" class="sref">map_/a>));.3260_/a>.3261_/a>        _a href="+code=ioctl" class="sref">ioctl_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_CNT" class="sref">IO_WIN_CNT_/a>);.3262_/a>        _a href="+code=window" class="sref">window_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>);.3263_/a>        _a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a>  = (_a href="+code=window" class="sref">window_/a> & _a href="+code=IO_WIN_EN" class="sref">IO_WIN_EN_/a>(_a href="+code=map" class="sref">map_/a>)) ? _a href="+code=MAP_ACTIVE" class="sref">MAP_ACTIVE_/a> : 0;.3264_/a>        if (_a href="+code=ioctl" class="sref">ioctl_/a> & _a href="+code=IO_WIN_DATA_AUTOSZ" class="sref">IO_WIN_DATA_AUTOSZ_/a>(_a href="+code=map" class="sref">map_/a>)).3265_/a>                _a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a> |= _a href="+code=MAP_AUTOSZ" class="sref">MAP_AUTOSZ_/a>;.3266_/a>        else if (_a href="+code=ioctl" class="sref">ioctl_/a> & _a href="+code=IO_WIN_DATA_16BIT" class="sref">IO_WIN_DATA_16BIT_/a>(_a href="+code=map" class="sref">map_/a>)).3267_/a>                _a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a> |= _a href="+code=MAP_16BIT" class="sref">MAP_16BIT_/a>;.3268_/a>.3269_/a>        return 0;.3270_/a>}.3271_/a>.3272_/a>static int _a href="+code=cardu_set_io_map" class="sref">cardu_set_io_map_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, struct _a href="+code=pccard_io_map" class="sref">pccard_io_map_/a> *_a href="+code=io" class="sref">io_/a>).3273_/a>{.3274_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3275_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=ioctl" class="sref">ioctl_/a>;.3276_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=window" class="sref">window_/a>, _a href="+code=enable" class="sref">enable_/a>;.3277_/a>        _a href="+code=u_char" class="sref">u_char_/a> _a href="+code=map" class="sref">map_/a>;.3278_/a>.3279_/a>        _a href="+code=map" class="sref">map_/a> = _a href="+code=io" class="sref">io_/a>->_a href="+code=map" class="sref">map_/a>;.3280_/a>        if (_a href="+code=map" class="sref">map_/a> > 1).3281_/a>                return -_a href="+code=EINVAL" class="sref">EINVAL_/a>;.3282_/a>.3283_/a>        _a href="+code=window" class="sref">window_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>);.3284_/a>        _a href="+code=enable" class="sref">enable_/a> = _a href="+code=IO_WIN_EN" class="sref">IO_WIN_EN_/a>(_a href="+code=map" class="sref">map_/a>);.3285_/a>.3286_/a>        if (_a href="+code=window" class="sref">window_/a> & _a href="+code=enable" class="sref">enable_/a>) {.3287_/a>                _a href="+code=window" class="sref">window_/a> &= ~_a href="+code=enable" class="sref">enable_/a>;.3288_/a>                _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>, _a href="+code=window" class="sref">window_/a>);.3289_/a>        }.3290_/a>.3291_/a>        _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_SA" class="sref">IO_WIN_SA_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=io" class="sref">io_/a>->_a href="+code=start" class="sref">start_/a>);.3292_/a>        _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_EA" class="sref">IO_WIN_EA_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=io" class="sref">io_/a>->_a href="+code=stop" class="sref">stop_/a>);.3293_/a>.3294_/a>        _a href="+code=ioctl" class="sref">ioctl_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_CNT" class="sref">IO_WIN_CNT_/a>) & ~_a href="+code=IO_WIN_CNT_MASK" class="sref">IO_WIN_CNT_MASK_/a>(_a href="+code=map" class="sref">map_/a>);.3295_/a>        if (_a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_AUTOSZ" class="sref">MAP_AUTOSZ_/a>) _a href="+code=ioctl" class="sref">ioctl_/a> |= _a href="+code=IO_WIN_DATA_AUTOSZ" class="sref">IO_WIN_DATA_AUTOSZ_/a>(_a href="+code=map" class="sref">map_/a>);.3296_/a>        else if (_a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_16BIT" class="sref">MAP_16BIT_/a>) _a href="+code=ioctl" class="sref">ioctl_/a> |= _a href="+code=IO_WIN_DATA_16BIT" class="sref">IO_WIN_DATA_16BIT_/a>(_a href="+code=map" class="sref">map_/a>);.3297_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IO_WIN_CNT" class="sref">IO_WIN_CNT_/a>, _a href="+code=ioctl" class="sref">ioctl_/a>);.3298_/a>.3299_/a>        if (_a href="+code=io" class="sref">io_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_ACTIVE" class="sref">MAP_ACTIVE_/a>).3300_/a>                _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>, _a href="+code=window" class="sref">window_/a> | _a href="+code=enable" class="sref">enable_/a>);.3301_/a>.3302_/a>        return 0;.3303_/a>}.3304_/a>.3305_/a>static int _a href="+code=cardu_get_mem_map" class="sref">cardu_get_mem_map_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, struct _a href="+code=pccard_mem_map" class="sref">pccard_mem_map_/a> *_a href="+code=mem" class="sref">mem_/a>).3306_/a>{.3307_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3308_/a>        _a href="+code=uint32_t" class="sref">uint32_t_/a> _a href="+code=start" class="sref">start_/a>, _a href="+code=stop" class="sref">stop_/a>, _a href="+code=offset" class="sref">offset_/a>, _a href="+code=page" class="sref">page_/a>;.3309_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=window" class="sref">window_/a>;.3310_/a>        _a href="+code=u_char" class="sref">u_char_/a> _a href="+code=map" class="sref">map_/a>;.3311_/a>.3312_/a>        _a href="+code=map" class="sref">map_/a> = _a href="+code=mem" class="sref">mem_/a>->_a href="+code=map" class="sref">map_/a>;.3313_/a>        if (_a href="+code=map" class="sref">map_/a> > 4).3314_/a>                return -_a href="+code=EINVAL" class="sref">EINVAL_/a>;.3315_/a>.3316_/a>        _a href="+code=window" class="sref">window_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>);.3317_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> = (_a href="+code=window" class="sref">window_/a> & _a href="+code=MEM_WIN_EN" class="sref">MEM_WIN_EN_/a>(_a href="+code=map" class="sref">map_/a>)) ? _a href="+code=MAP_ACTIVE" class="sref">MAP_ACTIVE_/a> : 0;.3318_/a>.3319_/a>        _a href="+code=start" class="sref">start_/a> = _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_SA" class="sref">MEM_WIN_SA_/a>(_a href="+code=map" class="sref">map_/a>));.3320_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> |= (_a href="+code=start" class="sref">start_/a> & _a href="+code=MEM_WIN_DSIZE" class="sref">MEM_WIN_DSIZE_/a>) ? _a href="+code=MAP_16BIT" class="sref">MAP_16BIT_/a> : 0;.3321_/a>        _a href="+code=start" class="sref">start_/a> = (_a href="+code=start" class="sref">start_/a> & 0x0fff) << 12;.3322_/a>.3323_/a>        _a href="+code=stop" class="sref">stop_/a> = _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_EA" class="sref">MEM_WIN_EA_/a>(_a href="+code=map" class="sref">map_/a>));.3324_/a>        _a href="+code=stop" class="sref">stop_/a> = ((_a href="+code=stop" class="sref">stop_/a> & 0x0fff) << 12) + 0x0fff;.3325_/a>.3326_/a>        _a href="+code=offset" class="sref">offset_/a> = _a href="+code=exca_readw" class="sref">exca_readw_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_OA" class="sref">MEM_WIN_OA_/a>(_a href="+code=map" class="sref">map_/a>));.3327_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> |= (_a href="+code=offset" class="sref">offset_/a> & _a href="+code=MEM_WIN_WP" class="sref">MEM_WIN_WP_/a>) ? _a href="+code=MAP_WRPROT" class="sref">MAP_WRPROT_/a> : 0;.3328_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> |= (_a href="+code=offset" class="sref">offset_/a> & _a href="+code=MEM_WIN_REGSET" class="sref">MEM_WIN_REGSET_/a>) ? _a href="+code=MAP_ATTRIB" class="sref">MAP_ATTRIB_/a> : 0;.3329_/a>        _a href="+code=offset" class="sref">offset_/a> = ((_a href="+code=offset" class="sref">offset_/a> & 0x3fff) << 12) + _a href="+code=start" class="sref">start_/a>;.3330_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=card_start" class="sref">card_start_/a> = _a href="+code=offset" class="sref">offset_/a> & 0x03ffffff;.3331_/a>.3332_/a>        _a href="+code=page" class="sref">page_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_SAU" class="sref">MEM_WIN_SAU_/a>(_a href="+code=map" class="sref">map_/a>)) << 24;.3333_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=sys_start" class="sref">sys_start_/a> = _a href="+code=start" class="sref">start_/a> + _a href="+code=page" class="sref">page_/a>;.3334_/a>        _a href="+code=mem" class="sref">mem_/a>->_a href="+code=sys_stop" class="sref">sys_stop_/a> = _a href="+code=start" class="sref">start_/a> + _a href="+code=page" class="sref">page_/a>;.3335_/a>.3336_/a>        return 0;.3337_/a>}.3338_/a>.3339_/a>static int _a href="+code=cardu_set_mem_map" class="sref">cardu_set_mem_map_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, struct _a href="+code=pccard_mem_map" class="sref">pccard_mem_map_/a> *_a href="+code=mem" class="sref">mem_/a>).3340_/a>{.3341_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=sock" class="sref">sock_/a>];.3342_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=value" class="sref">value_/a>;.3343_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=window" class="sref">window_/a>, _a href="+code=enable" class="sref">enable_/a>;.3344_/a>        _a href="+code=u_long" class="sref">u_long_/a> _a href="+code=sys_start" class="sref">sys_start_/a>, _a href="+code=sys_stop" class="sref">sys_stop_/a>, _a href="+code=card_start" class="sref">card_start_/a>;.3345_/a>        _a href="+code=u_char" class="sref">u_char_/a> _a href="+code=map" class="sref">map_/a>;.3346_/a>.3347_/a>        _a href="+code=map" class="sref">map_/a> = _a href="+code=mem" class="sref">mem_/a>->_a href="+code=map" class="sref">map_/a>;.3348_/a>        _a href="+code=sys_start" class="sref">sys_start_/a> = _a href="+code=mem" class="sref">mem_/a>->_a href="+code=sys_start" class="sref">sys_start_/a>;.3349_/a>        _a href="+code=sys_stop" class="sref">sys_stop_/a> = _a href="+code=mem" class="sref">mem_/a>->_a href="+code=sys_stop" class="sref">sys_stop_/a>;.3350_/a>        _a href="+code=card_start" class="sref">card_start_/a> = _a href="+code=mem" class="sref">mem_/a>->_a href="+code=card_start" class="sref">card_start_/a>;.3351_/a>.3352_/a>        if (_a href="+code=map" class="sref">map_/a> > 4 || _a href="+code=sys_start" class="sref">sys_start_/a> > _a href="+code=sys_stop" class="sref">sys_stop_/a> || ((_a href="+code=sys_start" class="sref">sys_start_/a> ^ _a href="+code=sys_stop" class="sref">sys_stop_/a>) >> 24) ||.3353_/a>            (_a href="+code=card_start" class="sref">card_start_/a> >> 26)).3354_/a>                return -_a href="+code=EINVAL" class="sref">EINVAL_/a>;.3355_/a>.3356_/a>        _a href="+code=window" class="sref">window_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>);.3357_/a>        _a href="+code=enable" class="sref">enable_/a> = _a href="+code=MEM_WIN_EN" class="sref">MEM_WIN_EN_/a>(_a href="+code=map" class="sref">map_/a>);.3358_/a>        if (_a href="+code=window" class="sref">window_/a> & _a href="+code=enable" class="sref">enable_/a>) {.3359_/a>                _a href="+code=window" class="sref">window_/a> &= ~_a href="+code=enable" class="sref">enable_/a>;.3360_/a>                _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>, _a href="+code=window" class="sref">window_/a>);.3361_/a>        }.3362_/a>.3363_/a>        _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_SAU" class="sref">MEM_WIN_SAU_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=sys_start" class="sref">sys_start_/a> >> 24);.3364_/a>.3365_/a>        _a href="+code=value" class="sref">value_/a> = (_a href="+code=sys_start" class="sref">sys_start_/a> >> 12) & 0x0fff;.3366_/a>        if (_a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_16BIT" class="sref">MAP_16BIT_/a>) _a href="+code=value" class="sref">value_/a> |= _a href="+code=MEM_WIN_DSIZE" class="sref">MEM_WIN_DSIZE_/a>;.3367_/a>        _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_SA" class="sref">MEM_WIN_SA_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=value" class="sref">value_/a>);.3368_/a>.3369_/a>        _a href="+code=value" class="sref">value_/a> = (_a href="+code=sys_stop" class="sref">sys_stop_/a> >> 12) & 0x0fff;.3370_/a>        _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_EA" class="sref">MEM_WIN_EA_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=value" class="sref">value_/a>);.3371_/a>.3372_/a>        _a href="+code=value" class="sref">value_/a> = ((_a href="+code=card_start" class="sref">card_start_/a> - _a href="+code=sys_start" class="sref">sys_start_/a>) >> 12) & 0x3fff;.3373_/a>        if (_a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_WRPROT" class="sref">MAP_WRPROT_/a>) _a href="+code=value" class="sref">value_/a> |= _a href="+code=MEM_WIN_WP" class="sref">MEM_WIN_WP_/a>;.3374_/a>        if (_a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_ATTRIB" class="sref">MAP_ATTRIB_/a>) _a href="+code=value" class="sref">value_/a> |= _a href="+code=MEM_WIN_REGSET" class="sref">MEM_WIN_REGSET_/a>;.3375_/a>        _a href="+code=exca_writew" class="sref">exca_writew_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=MEM_WIN_OA" class="sref">MEM_WIN_OA_/a>(_a href="+code=map" class="sref">map_/a>), _a href="+code=value" class="sref">value_/a>);.3376_/a>.3377_/a>        if (_a href="+code=mem" class="sref">mem_/a>->_a href="+code=flags" class="sref">flags_/a> & _a href="+code=MAP_ACTIVE" class="sref">MAP_ACTIVE_/a>).3378_/a>                _a href="+code=exca_writeb" class="sref">exca_writeb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=ADR_WIN_EN" class="sref">ADR_WIN_EN_/a>, _a href="+code=window" class="sref">window_/a> | _a href="+code=enable" class="sref">enable_/a>);.3379_/a>.3380_/a>        return 0;.3381_/a>}.3382_/a>.3383_/a>static void _a href="+code=cardu_proc_setup" class="sref">cardu_proc_setup_/a>(unsigned int _a href="+code=sock" class="sref">sock_/a>, struct _a href="+code=proc_dir_entry" class="sref">proc_dir_entry_/a> *_a href="+code=base" class="sref">base_/a>).3384_/a>{.3385_/a>}.3386_/a>.3387_/a>static struct _a href="+code=pccard_operations" class="sref">pccard_operations_/a> _a href="+code=cardu_operations" class="sref">cardu_operations_/a> = {.3388_/a>        ._a href="+code=init" class="sref">init_/a>                   = _a href="+code=cardu_init" class="sref">cardu_init_/a>,.3389_/a>        ._a href="+code=register_callback" class="sref">register_callback_/a>      = _a href="+code=cardu_register_callback" class="sref">cardu_register_callback_/a>,.3390_/a>        ._a href="+code=inquire_socket" class="sref">inquire_socket_/a>         = _a href="+code=cardu_inquire_socket" class="sref">cardu_inquire_socket_/a>,.3391_/a>        ._a href="+code=get_status" class="sref">get_status_/a>             = _a href="+code=cardu_get_status" class="sref">cardu_get_status_/a>,.3392_/a>        ._a href="+code=set_socket" class="sref">set_socket_/a>             = _a href="+code=cardu_set_socket" class="sref">cardu_set_socket_/a>,.3393_/a>        ._a href="+code=get_io_map" class="sref">get_io_map_/a>             = _a href="+code=cardu_get_io_map" class="sref">cardu_get_io_map_/a>,.3394_/a>        ._a href="+code=set_io_map" class="sref">set_io_map_/a>             = _a href="+code=cardu_set_io_map" class="sref">cardu_set_io_map_/a>,.3395_/a>        ._a href="+code=get_mem_map" class="sref">get_mem_map_/a>            = _a href="+code=cardu_get_mem_map" class="sref">cardu_get_mem_map_/a>,.3396_/a>        ._a href="+code=set_mem_map" class="sref">set_mem_map_/a>            = _a href="+code=cardu_set_mem_map" class="sref">cardu_set_mem_map_/a>,.3397_/a>        ._a href="+code=proc_setup" class="sref">proc_setup_/a>             = _a href="+code=cardu_proc_setup" class="sref">cardu_proc_setup_/a>,.3398_/a>};.3399_/a>.3400_/a>static void _a href="+code=cardu_bh" class="sref">cardu_bh_/a>(void *_a href="+code=data" class="sref">data_/a>).3401_/a>{.3402_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = (_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *)_a href="+code=data" class="sref">data_/a>;.3403_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=events" class="sref">events_/a>;.3404_/a>.3405_/a>        _a href="+code=spin_lock_irq" class="sref">spin_lock_irq_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=event_lock" class="sref">event_lock_/a>);.3406_/a>        _a href="+code=events" class="sref">events_/a> = _a href="+code=socket" class="sref">socket_/a>->_a href="+code=events" class="sref">events_/a>;.3407_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=events" class="sref">events_/a> = 0;.3408_/a>        _a href="+code=spin_unlock_irq" class="sref">spin_unlock_irq_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=event_lock" class="sref">event_lock_/a>);.3409_/a>.3410_/a>        if (_a href="+code=socket" class="sref">socket_/a>->_a href="+code=handler" class="sref">handler_/a>).3411_/a>                _a href="+code=socket" class="sref">socket_/a>->_a href="+code=handler" class="sref">handler_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=info" class="sref">info_/a>, _a href="+code=events" class="sref">events_/a>);.3412_/a>}.3413_/a>.3414_/a>static _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=get_events" class="sref">get_events_/a>(_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>).3415_/a>{.3416_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=events" class="sref">events_/a> = 0;.3417_/a>        _a href="+code=uint8_t" class="sref">uint8_t_/a> _a href="+code=csc" class="sref">csc_/a>, _a href="+code=status" class="sref">status_/a>;.3418_/a>.3419_/a>        _a href="+code=status" class="sref">status_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=IF_STATUS" class="sref">IF_STATUS_/a>);.3420_/a>        _a href="+code=csc" class="sref">csc_/a> = _a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=CARD_SC" class="sref">CARD_SC_/a>);.3421_/a>        if ((_a href="+code=csc" class="sref">csc_/a> & _a href="+code=CARD_DT_CHG" class="sref">CARD_DT_CHG_/a>) &&.3422_/a>            ((_a href="+code=status" class="sref">status_/a> & (_a href="+code=CARD_DETECT1" class="sref">CARD_DETECT1_/a>|_a href="+code=CARD_DETECT2" class="sref">CARD_DETECT2_/a>)) == (_a href="+code=CARD_DETECT1" class="sref">CARD_DETECT1_/a>|_a href="+code=CARD_DETECT2" class="sref">CARD_DETECT2_/a>))).3423_/a>                _a href="+code=events" class="sref">events_/a> |= _a href="+code=SS_DETECT" class="sref">SS_DETECT_/a>;.3424_/a>.3425_/a>        if ((_a href="+code=csc" class="sref">csc_/a> & _a href="+code=RDY_CHG" class="sref">RDY_CHG_/a>) && (_a href="+code=status" class="sref">status_/a> & _a href="+code=READY" class="sref">READY_/a>)).3426_/a>                _a href="+code=events" class="sref">events_/a> |= _a href="+code=SS_READY" class="sref">SS_READY_/a>;.3427_/a>.3428_/a>        if (_a href="+code=exca_readb" class="sref">exca_readb_/a>(_a href="+code=socket" class="sref">socket_/a>, _a href="+code=INT_GEN_CNT" class="sref">INT_GEN_CNT_/a>) & _a href="+code=CARD_TYPE_IO" class="sref">CARD_TYPE_IO_/a>) {.3429_/a>                if ((_a href="+code=csc" class="sref">csc_/a> & _a href="+code=BAT_DEAD_ST_CHG" class="sref">BAT_DEAD_ST_CHG_/a>) && (_a href="+code=status" class="sref">status_/a> & _a href="+code=STSCHG" class="sref">STSCHG_/a>)).3430_/a>                        _a href="+code=events" class="sref">events_/a> |= _a href="+code=SS_STSCHG" class="sref">SS_STSCHG_/a>;.3431_/a>        } else {.3432_/a>                if (_a href="+code=csc" class="sref">csc_/a> & (_a href="+code=BAT_WAR_CHG" class="sref">BAT_WAR_CHG_/a>|_a href="+code=BAT_DEAD_ST_CHG" class="sref">BAT_DEAD_ST_CHG_/a>)) {.3433_/a>                        if ((_a href="+code=status" class="sref">status_/a> & _a href="+code=BV_DETECT_MASK" class="sref">BV_DETECT_MASK_/a>) != _a href="+code=BV_DETECT_GOOD" class="sref">BV_DETECT_GOOD_/a>) {.3434_/a>                                if (_a href="+code=status" class="sref">status_/a> == _a href="+code=BV_DETECT_WARN" class="sref">BV_DETECT_WARN_/a>) _a href="+code=events" class="sref">events_/a> |= _a href="+code=SS_BATWARN" class="sref">SS_BATWARN_/a>;.3435_/a>                                else _a href="+code=events" class="sref">events_/a> |= _a href="+code=SS_BATDEAD" class="sref">SS_BATDEAD_/a>;.3436_/a>                        }.3437_/a>                }.3438_/a>        }.3439_/a>.3440_/a>        return _a href="+code=events" class="sref">events_/a>;.3441_/a>}.3442_/a>.3443_/a>static void _a href="+code=cardu_interrupt" class="sref">cardu_interrupt_/a>(int _a href="+code=irq" class="sref">irq_/a>, void *_a href="+code=dev_id" class="sref">dev_id_/a>).3444_/a>{.3445_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a> = (_a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *)_a href="+code=dev_id" class="sref">dev_id_/a>;.3446_/a>        _a href="+code=uint16_t" class="sref">uint16_t_/a> _a href="+code=events" class="sref">events_/a>;.3447_/a>.3448_/a>        _a href="+code=INIT_WORK" class="sref">INIT_WORK_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=tq_work" class="sref">tq_work_/a>, _a href="+code=cardu_bh" class="sref">cardu_bh_/a>, _a href="+code=socket" class="sref">socket_/a>);.3449_/a>.3450_/a>        _a href="+code=events" class="sref">events_/a> = _a href="+code=get_events" class="sref">get_events_/a>(_a href="+code=socket" class="sref">socket_/a>);.3451_/a>        if (_a href="+code=events" class="sref">events_/a>) {.3452_/a>                _a href="+code=spin_lock" class="sref">spin_lock_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=event_lock" class="sref">event_lock_/a>);.3453_/a>                _a href="+code=socket" class="sref">socket_/a>->_a href="+code=events" class="sref">events_/a> |= _a href="+code=events" class="sref">events_/a>;.3454_/a>                _a href="+code=spin_unlock" class="sref">spin_unlock_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=event_lock" class="sref">event_lock_/a>);.3455_/a>                _a href="+code=schedule_work" class="sref">schedule_work_/a>(&_a href="+code=socket" class="sref">socket_/a>->_a href="+code=tq_work" class="sref">tq_work_/a>);.3456_/a>        }.3457_/a>}.3458_/a>.3459_/a>static int _a href="+code=__devinit" class="sref">__devinit_/a> _a href="+code=vrc4173_cardu_probe" class="sref">vrc4173_cardu_probe_/a>(struct _a href="+code=pci_dev" class="sref">pci_dev_/a> *_a href="+code=dev" class="sref">dev_/a>,.3460_/a>                                         const struct _a href="+code=pci_device_id" class="sref">pci_device_id_/a> *_a href="+code=ent" class="sref">ent_/a>).3461_/a>{.3462_/a>        _a href="+code=vrc4173_socket_t" class="sref">vrc4173_socket_t_/a> *_a href="+code=socket" class="sref">socket_/a>;.3463_/a>        unsigned long _a href="+code=start" class="sref">start_/a>, _a href="+code=len" class="sref">len_/a>, _a href="+code=flags" class="sref">flags_/a>;.3464_/a>        int _a href="+code=slot" class="sref">slot_/a>, _a href="+code=err" class="sref">err_/a>, _a href="+code=ret" class="sref">ret_/a>;.3465_/a>.3466_/a>        _a href="+code=slot" class="sref">slot_/a> = _a href="+code=vrc4173_cardu_slots" class="sref">vrc4173_cardu_slots_/a>++;.3467_/a>        _a href="+code=socket" class="sref">socket_/a> = &_a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=slot" class="sref">slot_/a>];.3468_/a>        if (_a href="+code=socket" class="sref">socket_/a>->_a href="+code=noprobe" class="sref">noprobe_/a> != 0).3469_/a>                return -_a href="+code=EBUSY" class="sref">EBUSY_/a>;.3470_/a>.3471_/a>        _a href="+code=sprintf" class="sref">sprintf_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=nam " class="sref">nam _/a>, _span class="string">"NEC VRC4173 CARDU%1d", _a href="+code=slot" class="sref">slot_/a>+1);.3472_/a>.3473_/a>        if ((_a href="+code=err" class="sref">err_/a> = _a href="+code=pci_enable_device" class="sref">pci_enable_device_/a>(_a href="+code=dev" class="sref">dev_/a>)) < 0).3474_/a>                return _a href="+code=err" class="sref">err_/a>;.3475_/a>.3476_/a>        _a href="+code=start" class="sref">start_/a> = _a href="+code=pci_resource_start" class="sref">pci_resource_start_/a>(_a href="+code=dev" class="sref">dev_/a>, 0);.3477_/a>        if (_a href="+code=start" class="sref">start_/a> == 0) {.3478_/a>                _a href="+code=ret" class="sref">ret_/a> = -_a href="+code=ENODEV" class="sref">ENODEV_/a>;.3479_/a>                goto _a href="+code=disable" class="sref">disable_/a>;.3480_/a>        }.3481_/a>.3482_/a>        _a href="+code=len" class="sref">len_/a> = _a href="+code=pci_resource_len" class="sref">pci_resource_len_/a>(_a href="+code=dev" class="sref">dev_/a>, 0);.3483_/a>        if (_a href="+code=len" class="sref">len_/a> == 0) {.3484_/a>                _a href="+code=ret" class="sref">ret_/a> = -_a href="+code=ENODEV" class="sref">ENODEV_/a>;.3485_/a>                goto _a href="+code=disable" class="sref">disable_/a>;.3486_/a>        }.3487_/a>.3488_/a>        _a href="+code=flags" class="sref">flags_/a> = _a href="+code=pci_resource_flags" class="sref">pci_resource_flags_/a>(_a href="+code=dev" class="sref">dev_/a>, 0);.3489_/a>        if ((_a href="+code=flags" class="sref">flags_/a> & _a href="+code=IORESOURCE_MEM" class="sref">IORESOURCE_MEM_/a>) == 0) {.3490_/a>                _a href="+code=ret" class="sref">ret_/a> = -_a href="+code=EBUSY" class="sref">EBUSY_/a>;.3491_/a>                goto _a href="+code=disable" class="sref">disable_/a>;.3492_/a>        }.3493_/a>.3494_/a>        _a href="+code=err" class="sref">err_/a> = _a href="+code=pci_request_regions" class="sref">pci_request_regions_/a>(_a href="+code=dev" class="sref">dev_/a>, _a href="+code=socket" class="sref">socket_/a>->_a href="+code=nam " class="sref">nam _/a>);.3495_/a>        if (_a href="+code=err" class="sref">err_/a> < 0) {.3496_/a>                _a href="+code=ret" class="sref">ret_/a> = _a href="+code=err" class="sref">err_/a>;.3497_/a>                goto _a href="+code=disable" class="sref">disable_/a>;.3498_/a>        }.3499_/a>.3500_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> = _a href="+code=ioremap" class="sref">ioremap_/a>(_a href="+code=start" class="sref">start_/a>, _a href="+code=len" class="sref">len_/a>);.3501_/a>        if (_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> == _a href="+code=NULL" class="sref">NULL_/a>) {.3502_/a>                _a href="+code=ret" class="sref">ret_/a> = -_a href="+code=ENODEV" class="sref">ENODEV_/a>;.3503_/a>                goto _a href="+code=release" class="sref">release_/a>;.3504_/a>        }.3505_/a>.3506_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=dev" class="sref">dev_/a> = _a href="+code=dev" class="sref">dev_/a>;.3507_/a>.3508_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=pcmcia_socket" class="sref">pcmcia_socket_/a> = _a href="+code=pcmcia_register_socket" class="sref">pcmcia_register_socket_/a>(_a href="+code=slot" class="sref">slot_/a>, &_a href="+code=cardu_operations" class="sref">cardu_operations_/a>, 1);.3509_/a>        if (_a href="+code=socket" class="sref">socket_/a>->_a href="+code=pcmcia_socket" class="sref">pcmcia_socket_/a> == _a href="+code=NULL" class="sref">NULL_/a>) {.3510_/a>                _a href="+code=ret" class="sref">ret_/a> =  -_a href="+code=ENOMEM" class="sref">ENOMEM_/a>;.3511_/a>                goto _a href="+code=unmap" class="sref">unmap_/a>;.3512_/a>        }.3513_/a>.3514_/a>        if (_a href="+code=request_irq" class="sref">request_irq_/a>(_a href="+code=dev" class="sref">dev_/a>->_a href="+code=irq" class="sref">irq_/a>, _a href="+code=cardu_interrupt" class="sref">cardu_interrupt_/a>, _a href="+code=IRQF_SHARED" class="sref">IRQF_SHARED_/a>, _a href="+code=socket" class="sref">socket_/a>->_a href="+code=nam " class="sref">nam _/a>, _a href="+code=socket" class="sref">socket_/a>) < 0) {.3515_/a>                _a href="+code=ret" class="sref">ret_/a> = -_a href="+code=EBUSY" class="sref">EBUSY_/a>;.3516_/a>                goto _a href="+code=unregister" class="sref">unregister_/a>;.3517_/a>        }.3518_/a>.3519_/a>        _a href="+code=printk" class="sref">printk_/a>(_a href="+code=KERN_INFO" class="sref">KERN_INFO_/a> _span class="string">"%s at %#08lx, IRQ %d\n", _a href="+code=socket" class="sref">socket_/a>->_a href="+code=nam " class="sref">nam _/a>, _a href="+code=start" class="sref">start_/a>, _a href="+code=dev" class="sref">dev_/a>->_a href="+code=irq" class="sref">irq_/a>);.3520_/a>.3521_/a>        return 0;.3522_/a>.3523_/a>_a href="+code=unregister" class="sref">unregister_/a>:.3524_/a>        _a href="+code=pcmcia_unregister_socket" class="sref">pcmcia_unregister_socket_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=pcmcia_socket" class="sref">pcmcia_socket_/a>);.3525_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=pcmcia_socket" class="sref">pcmcia_socket_/a> = _a href="+code=NULL" class="sref">NULL_/a>;.3526_/a>_a href="+code=unmap" class="sref">unmap_/a>:.3527_/a>        _a href="+code=iounmap" class="sref">iounmap_/a>(_a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a>);.3528_/a>        _a href="+code=socket" class="sref">socket_/a>->_a href="+code=base" class="sref">base_/a> = _a href="+code=NULL" class="sref">NULL_/a>;.3529_/a>_a href="+code=release" class="sref">release_/a>:.3530_/a>        _a href="+code=pci_release_regions" class="sref">pci_release_regions_/a>(_a href="+code=dev" class="sref">dev_/a>);.3531_/a>_a href="+code=disable" class="sref">disable_/a>:.3532_/a>        _a href="+code=pci_disable_device" class="sref">pci_disable_device_/a>(_a href="+code=dev" class="sref">dev_/a>);.3533_/a>        return _a href="+code=ret" class="sref">ret_/a>;.3534_/a>}.3535_/a>.3536_/a>static int _a href="+code=__devinit" class="sref">__devinit_/a> _a href="+code=vrc4173_cardu_setup" class="sref">vrc4173_cardu_setup_/a>(char *_a href="+code=options" class="sref">options_/a>).3537_/a>{.3538_/a>        if (_a href="+code=options" class="sref">options_/a> == _a href="+code=NULL" class="sref">NULL_/a> || *_a href="+code=options" class="sref">options_/a> == _span class="string">'\0').3539_/a>                return 1;.3540_/a>.3541_/a>        if (_a href="+code=strncmp" class="sref">strncmp_/a>(_a href="+code=options" class="sref">options_/a>, _span class="string">"cardu1:", 7) == 0) {.3542_/a>                _a href="+code=options" class="sref">options_/a> += 7;.3543_/a>                if (*_a href="+code=options" class="sref">options_/a> != _span class="string">'\0') {.3544_/a>                        if (_a href="+code=strncmp" class="sref">strncmp_/a>(_a href="+code=options" class="sref">options_/a>, _span class="string">"noprobe", 7) == 0) {.3545_/a>                                _a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=CARDU1" class="sref">CARDU1_/a>]._a href="+code=noprobe" class="sref">noprobe_/a> = 1;.3546_/a>                                _a href="+code=options" class="sref">options_/a> += 7;.3547_/a>                        }.3548_/a>.3549_/a>                        if (*_a href="+code=options" class="sref">options_/a> != _span class="string">',').3550_/a>                                return 1;.3551_/a>                } else.3552_/a>                        return 1;.3553_/a>        }.3554_/a>.3555_/a>        if (_a href="+code=strncmp" class="sref">strncmp_/a>(_a href="+code=options" class="sref">options_/a>, _span class="string">"cardu2:", 7) == 0) {.3556_/a>                _a href="+code=options" class="sref">options_/a> += 7;.3557_/a>                if ((*_a href="+code=options" class="sref">options_/a> != _span class="string">'\0') && (_a href="+code=strncmp" class="sref">strncmp_/a>(_a href="+code=options" class="sref">options_/a>, _span class="string">"noprobe", 7) == 0)).3558_/a>                        _a href="+code=cardu_sockets" class="sref">cardu_sockets_/a>[_a href="+code=CARDU2" class="sref">CARDU2_/a>]._a href="+code=noprobe" class="sref">noprobe_/a> = 1;.3559_/a>        }.3560_/a>.3561_/a>        return 1;.3562_/a>}.3563_/a>.3564_/a>_a href="+code=__setup" class="sref">__setup_/a>(_span class="string">"vrc4173_cardu=", _a href="+code=vrc4173_cardu_setup" class="sref">vrc4173_cardu_setup_/a>);.3565_/a>.3566_/a>static _a href="+code=DEFINE_PCI_DEVICE_TABLE" class="sref">DEFINE_PCI_DEVICE_TABLE_/a>(_a href="+code=vrc4173_cardu_id_table" class="sref">vrc4173_cardu_id_table_/a>) = {.3567_/a>        { _a href="+code=PCI_DEVICE" class="sref">PCI_DEVICE_/a>(_a href="+code=PCI_VENDOR_ID_NEC" class="sref">PCI_VENDOR_ID_NEC_/a>, _a href="+code=PCI_DEVICE_ID_NEC_NAPCCARD" class="sref">PCI_DEVICE_ID_NEC_NAPCCARD_/a>) },.3568_/a>        {0, }.3569_/a>};.3570_/a>.3571_/a>static struct _a href="+code=pci_driver" class="sref">pci_driver_/a> _a href="+code=vrc4173_cardu_driver" class="sref">vrc4173_cardu_driver_/a> = {.3572_/a>        ._a href="+code=nam " class="sref">nam _/a>           = _span class="string">"NEC VRC4173 CARDU",.3573_/a>        ._a href="+code=probe" class="sref">probe_/a>          = _a href="+code=vrc4173_cardu_probe" class="sref">vrc4173_cardu_probe_/a>,.3574_/a>        ._a href="+code=id_table" class="sref">id_table_/a>       = _a href="+code=vrc4173_cardu_id_table" class="sref">vrc4173_cardu_id_table_/a>,.3575_/a>};.3576_/a>.3577_/a>static int _a href="+code=__devinit" class="sref">__devinit_/a> _a href="+code=vrc4173_cardu_init" class="sref">vrc4173_cardu_init_/a>(void).3578_/a>{.3579_/a>        _a href="+code=vrc4173_cardu_slots" class="sref">vrc4173_cardu_slots_/a> = 0;.3580_/a>.3581_/a>        return _a href="+code=pci_register_driver" class="sref">pci_register_driver_/a>(&_a href="+code=vrc4173_cardu_driver" class="sref">vrc4173_cardu_driver_/a>);.3582_/a>}.3583_/a>.3584_/a>static void _a href="+code=__devexit" class="sref">__devexit_/a> _a href="+code=vrc4173_cardu_exit" class="sref">vrc4173_cardu_exit_/a>(void).3585_/a>{.3586_/a>        _a href="+code=pci_unregister_driver" class="sref">pci_unregister_driver_/a>(&_a href="+code=vrc4173_cardu_driver" class="sref">vrc4173_cardu_driver_/a>);.3587_/a>}.3588_/a>.3589_/a>_a href="+code=module_init" class="sref">module_init_/a>(_a href="+code=vrc4173_cardu_init" class="sref">vrc4173_cardu_init_/a>);.3590_/a>_a href="+code=module_exit" class="sref">module_exit_/a>(_a href="+code=vrc4173_cardu_exit" class="sref">vrc4173_cardu_exit_/a>);.3591_/a>_a href="+code=MODULE_DEVICE_TABLE" class="sref">MODULE_DEVICE_TABLE_/a>(_a href="+code=pci" class="sref">pci_/a>, _a href="+code=vrc4173_cardu_id_table" class="sref">vrc4173_cardu_id_table_/a>);.3592_/a>
lxr.linux.no kindly hosted by _a href="http://www.redpill-linpro.no">Redpill Linpro AS_/a>, provider of Linux consulting and operations services since 1995.