Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Agere Systems Inc. |
| 3 | * Wireless device driver for Linux (wlags49). |
| 4 | * |
| 5 | * Copyright (c) 1998-2003 Agere Systems Inc. |
| 6 | * All rights reserved. |
| 7 | * http://www.agere.com |
| 8 | * |
| 9 | * Initially developed by TriplePoint, Inc. |
| 10 | * http://www.triplepoint.com |
| 11 | * |
| 12 | *------------------------------------------------------------------------------ |
| 13 | * |
| 14 | * This file contains processing and initialization specific to Card Services |
| 15 | * devices (PCMCIA, CF). |
| 16 | * |
| 17 | *------------------------------------------------------------------------------ |
| 18 | * |
| 19 | * SOFTWARE LICENSE |
| 20 | * |
| 21 | * This software is provided subject to the following terms and conditions, |
| 22 | * which you should read carefully before using the software. Using this |
| 23 | * software indicates your acceptance of these terms and conditions. If you do |
| 24 | * not agree with these terms and conditions, do not use the software. |
| 25 | * |
Prashant P. Shah | 8cd5778 | 2010-06-23 12:16:41 +0530 | [diff] [blame] | 26 | * Copyright (c) 2003 Agere Systems Inc. |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 27 | * All rights reserved. |
| 28 | * |
| 29 | * Redistribution and use in source or binary forms, with or without |
| 30 | * modifications, are permitted provided that the following conditions are met: |
| 31 | * |
| 32 | * . Redistributions of source code must retain the above copyright notice, this |
| 33 | * list of conditions and the following Disclaimer as comments in the code as |
| 34 | * well as in the documentation and/or other materials provided with the |
| 35 | * distribution. |
| 36 | * |
| 37 | * . Redistributions in binary form must reproduce the above copyright notice, |
| 38 | * this list of conditions and the following Disclaimer in the documentation |
| 39 | * and/or other materials provided with the distribution. |
| 40 | * |
| 41 | * . Neither the name of Agere Systems Inc. nor the names of the contributors |
| 42 | * may be used to endorse or promote products derived from this software |
| 43 | * without specific prior written permission. |
| 44 | * |
| 45 | * Disclaimer |
| 46 | * |
Prashant P. Shah | 8cd5778 | 2010-06-23 12:16:41 +0530 | [diff] [blame] | 47 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 48 | * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF |
| 49 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY |
| 50 | * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN |
| 51 | * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY |
| 52 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 53 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 54 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 55 | * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT |
| 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 57 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 58 | * DAMAGE. |
| 59 | * |
| 60 | ******************************************************************************/ |
| 61 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 62 | /******************************************************************************* |
| 63 | * include files |
| 64 | ******************************************************************************/ |
| 65 | #include <wl_version.h> |
| 66 | |
| 67 | #include <linux/kernel.h> |
| 68 | #include <linux/sched.h> |
| 69 | #include <linux/ptrace.h> |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 70 | #include <linux/ctype.h> |
| 71 | #include <linux/string.h> |
| 72 | #include <linux/timer.h> |
| 73 | #include <linux/interrupt.h> |
| 74 | #include <linux/in.h> |
| 75 | #include <linux/delay.h> |
| 76 | #include <asm/io.h> |
| 77 | #include <asm/system.h> |
| 78 | #include <asm/bitops.h> |
| 79 | |
| 80 | #include <linux/netdevice.h> |
| 81 | #include <linux/etherdevice.h> |
| 82 | #include <linux/skbuff.h> |
| 83 | #include <linux/if_arp.h> |
| 84 | #include <linux/ioport.h> |
| 85 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 86 | #include <pcmcia/cistpl.h> |
| 87 | #include <pcmcia/cisreg.h> |
| 88 | #include <pcmcia/ciscode.h> |
| 89 | #include <pcmcia/ds.h> |
| 90 | #include <debug.h> |
| 91 | |
| 92 | #include <hcf.h> |
| 93 | #include <dhf.h> |
| 94 | #include <hcfdef.h> |
| 95 | |
| 96 | #include <wl_if.h> |
| 97 | #include <wl_internal.h> |
| 98 | #include <wl_util.h> |
| 99 | #include <wl_main.h> |
| 100 | #include <wl_netdev.h> |
| 101 | #include <wl_cs.h> |
| 102 | #include <wl_sysfs.h> |
| 103 | |
| 104 | |
| 105 | /******************************************************************************* |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 106 | * global definitions |
| 107 | ******************************************************************************/ |
| 108 | #if DBG |
| 109 | extern dbg_info_t *DbgInfo; |
| 110 | #endif /* DBG */ |
| 111 | |
| 112 | |
| 113 | /******************************************************************************* |
| 114 | * wl_adapter_attach() |
| 115 | ******************************************************************************* |
| 116 | * |
| 117 | * DESCRIPTION: |
| 118 | * |
| 119 | * Creates an instance of the driver, allocating local data structures for |
| 120 | * one device. The device is registered with Card Services. |
| 121 | * |
| 122 | * PARAMETERS: |
| 123 | * |
| 124 | * none |
| 125 | * |
| 126 | * RETURNS: |
| 127 | * |
| 128 | * pointer to an allocated dev_link_t structure |
| 129 | * NULL on failure |
| 130 | * |
| 131 | ******************************************************************************/ |
| 132 | static int wl_adapter_attach(struct pcmcia_device *link) |
| 133 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 134 | struct net_device *dev; |
| 135 | struct wl_private *lp; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 136 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 137 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 138 | DBG_FUNC("wl_adapter_attach"); |
| 139 | DBG_ENTER(DbgInfo); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 140 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 141 | dev = wl_device_alloc(); |
| 142 | if (dev == NULL) { |
| 143 | DBG_ERROR(DbgInfo, "wl_device_alloc returned NULL\n"); |
| 144 | return -ENOMEM; |
| 145 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 146 | |
Linus Torvalds | 1685e63 | 2010-08-06 12:25:06 -0700 | [diff] [blame] | 147 | link->resource[0]->end = HCF_NUM_IO_PORTS; |
| 148 | link->resource[0]->flags= IO_DATA_PATH_WIDTH_16; |
Dominik Brodowski | 1ac71e5 | 2010-07-29 19:27:09 +0200 | [diff] [blame] | 149 | link->config_flags |= CONF_ENABLE_IRQ; |
Dominik Brodowski | 7feabb6 | 2010-07-29 18:35:47 +0200 | [diff] [blame] | 150 | link->config_index = 5; |
| 151 | link->config_regs = PRESENT_OPTION; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 152 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 153 | link->priv = dev; |
| 154 | lp = wl_priv(dev); |
| 155 | lp->link = link; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 156 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 157 | wl_adapter_insert(link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 158 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 159 | DBG_LEAVE(DbgInfo); |
| 160 | return 0; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 161 | } /* wl_adapter_attach */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 162 | /*============================================================================*/ |
| 163 | |
| 164 | |
| 165 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 166 | static void wl_adapter_detach(struct pcmcia_device *link) |
| 167 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 168 | struct net_device *dev = link->priv; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 169 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 170 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 171 | DBG_FUNC("wl_adapter_detach"); |
| 172 | DBG_ENTER(DbgInfo); |
| 173 | DBG_PARAM(DbgInfo, "link", "0x%p", link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 174 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 175 | wl_adapter_release(link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 176 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 177 | if (dev) { |
| 178 | unregister_wlags_sysfs(dev); |
| 179 | unregister_netdev(dev); |
| 180 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 181 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 182 | wl_device_dealloc(dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 183 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 184 | DBG_LEAVE(DbgInfo); |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 185 | } /* wl_adapter_detach */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 186 | /*============================================================================*/ |
| 187 | |
| 188 | |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 189 | void wl_adapter_release(struct pcmcia_device *link) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 190 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 191 | DBG_FUNC("wl_adapter_release"); |
| 192 | DBG_ENTER(DbgInfo); |
| 193 | DBG_PARAM(DbgInfo, "link", "0x%p", link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 194 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 195 | /* Stop hardware */ |
| 196 | wl_remove(link->priv); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 197 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 198 | pcmcia_disable_device(link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 199 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 200 | DBG_LEAVE(DbgInfo); |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 201 | } /* wl_adapter_release */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 202 | /*============================================================================*/ |
| 203 | |
| 204 | static int wl_adapter_suspend(struct pcmcia_device *link) |
| 205 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 206 | struct net_device *dev = link->priv; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 207 | |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 208 | /* if (link->open) { */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 209 | netif_device_detach(dev); |
| 210 | wl_suspend(dev); |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 211 | /* CHECK! pcmcia_release_configuration(link->handle); */ |
| 212 | /* } */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 213 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 214 | return 0; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 215 | } /* wl_adapter_suspend */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 216 | |
| 217 | static int wl_adapter_resume(struct pcmcia_device *link) |
| 218 | { |
| 219 | struct net_device *dev = link->priv; |
| 220 | |
| 221 | wl_resume(dev); |
| 222 | |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 223 | netif_device_attach(dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 224 | |
| 225 | return 0; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 226 | } /* wl_adapter_resume */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 227 | |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 228 | void wl_adapter_insert(struct pcmcia_device *link) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 229 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 230 | struct net_device *dev; |
| 231 | int i; |
| 232 | int ret; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 233 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 234 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 235 | DBG_FUNC("wl_adapter_insert"); |
| 236 | DBG_ENTER(DbgInfo); |
| 237 | DBG_PARAM(DbgInfo, "link", "0x%p", link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 238 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 239 | dev = link->priv; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 240 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 241 | /* Do we need to allocate an interrupt? */ |
Dominik Brodowski | 1ac71e5 | 2010-07-29 19:27:09 +0200 | [diff] [blame] | 242 | link->config_flags |= CONF_ENABLE_IRQ; |
Linus Torvalds | 1685e63 | 2010-08-06 12:25:06 -0700 | [diff] [blame] | 243 | link->io_lines = 6; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 244 | |
Linus Torvalds | 1685e63 | 2010-08-06 12:25:06 -0700 | [diff] [blame] | 245 | ret = pcmcia_request_io(link); |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 246 | if (ret != 0) |
| 247 | goto failed; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 248 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 249 | ret = pcmcia_request_irq(link, (void *) wl_isr); |
| 250 | if (ret != 0) |
| 251 | goto failed; |
Henk de Groot | 93822ad | 2010-05-13 16:27:33 +0200 | [diff] [blame] | 252 | |
Dominik Brodowski | 1ac71e5 | 2010-07-29 19:27:09 +0200 | [diff] [blame] | 253 | ret = pcmcia_enable_device(link); |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 254 | if (ret != 0) |
| 255 | goto failed; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 256 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 257 | dev->irq = link->irq; |
Linus Torvalds | 1685e63 | 2010-08-06 12:25:06 -0700 | [diff] [blame] | 258 | dev->base_addr = link->resource[0]->start; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 259 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 260 | SET_NETDEV_DEV(dev, &link->dev); |
| 261 | if (register_netdev(dev) != 0) { |
| 262 | printk("%s: register_netdev() failed\n", MODULE_NAME); |
| 263 | goto failed; |
| 264 | } |
Henk de Groot | 93822ad | 2010-05-13 16:27:33 +0200 | [diff] [blame] | 265 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 266 | register_wlags_sysfs(dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 267 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 268 | printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ", |
| 269 | dev->name, dev->base_addr, dev->irq); |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 270 | for (i = 0; i < ETH_ALEN; i++) |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 271 | printk("%02X%c", dev->dev_addr[i], ((i < (ETH_ALEN-1)) ? ':' : '\n')); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 272 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 273 | DBG_LEAVE(DbgInfo); |
| 274 | return; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 275 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 276 | failed: |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 277 | wl_adapter_release(link); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 278 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 279 | DBG_LEAVE(DbgInfo); |
| 280 | return; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 281 | } /* wl_adapter_insert */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 282 | /*============================================================================*/ |
| 283 | |
| 284 | |
| 285 | /******************************************************************************* |
| 286 | * wl_adapter_open() |
| 287 | ******************************************************************************* |
| 288 | * |
| 289 | * DESCRIPTION: |
| 290 | * |
| 291 | * Open the device. |
| 292 | * |
| 293 | * PARAMETERS: |
| 294 | * |
| 295 | * dev - a pointer to a net_device structure representing the network |
| 296 | * device to open. |
| 297 | * |
| 298 | * RETURNS: |
| 299 | * |
| 300 | * 0 on success |
| 301 | * errno value otherwise |
| 302 | * |
| 303 | ******************************************************************************/ |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 304 | int wl_adapter_open(struct net_device *dev) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 305 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 306 | struct wl_private *lp = wl_priv(dev); |
| 307 | struct pcmcia_device *link = lp->link; |
| 308 | int result = 0; |
| 309 | int hcf_status = HCF_SUCCESS; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 310 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 311 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 312 | DBG_FUNC("wl_adapter_open"); |
| 313 | DBG_ENTER(DbgInfo); |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 314 | DBG_PRINT("%s\n", VERSION_INFO); |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 315 | DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 316 | |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 317 | if (!pcmcia_dev_present(link)) { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 318 | DBG_LEAVE(DbgInfo); |
| 319 | return -ENODEV; |
| 320 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 321 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 322 | link->open++; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 323 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 324 | hcf_status = wl_open(dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 325 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 326 | if (hcf_status != HCF_SUCCESS) { |
| 327 | link->open--; |
| 328 | result = -ENODEV; |
| 329 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 330 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 331 | DBG_LEAVE(DbgInfo); |
| 332 | return result; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 333 | } /* wl_adapter_open */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 334 | /*============================================================================*/ |
| 335 | |
| 336 | |
| 337 | /******************************************************************************* |
| 338 | * wl_adapter_close() |
| 339 | ******************************************************************************* |
| 340 | * |
| 341 | * DESCRIPTION: |
| 342 | * |
| 343 | * Close the device. |
| 344 | * |
| 345 | * PARAMETERS: |
| 346 | * |
| 347 | * dev - a pointer to a net_device structure representing the network |
| 348 | * device to close. |
| 349 | * |
| 350 | * RETURNS: |
| 351 | * |
| 352 | * 0 on success |
| 353 | * errno value otherwise |
| 354 | * |
| 355 | ******************************************************************************/ |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 356 | int wl_adapter_close(struct net_device *dev) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 357 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 358 | struct wl_private *lp = wl_priv(dev); |
| 359 | struct pcmcia_device *link = lp->link; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 360 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 361 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 362 | DBG_FUNC("wl_adapter_close"); |
| 363 | DBG_ENTER(DbgInfo); |
| 364 | DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 365 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 366 | if (link == NULL) { |
| 367 | DBG_LEAVE(DbgInfo); |
| 368 | return -ENODEV; |
| 369 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 370 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 371 | DBG_TRACE(DbgInfo, "%s: Shutting down adapter.\n", dev->name); |
| 372 | wl_close(dev); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 373 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 374 | link->open--; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 375 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 376 | DBG_LEAVE(DbgInfo); |
| 377 | return 0; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 378 | } /* wl_adapter_close */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 379 | /*============================================================================*/ |
| 380 | |
Joe Perches | 2202a5a | 2011-05-03 19:29:02 -0700 | [diff] [blame^] | 381 | static const struct pcmcia_device_id wl_adapter_ids[] = { |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 382 | #if !((HCF_TYPE) & HCF_TYPE_HII5) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 383 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0003), |
| 384 | PCMCIA_DEVICE_PROD_ID12("Agere Systems", "Wireless PC Card Model 0110", |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 385 | 0x33103a9b, 0xe175b0dd), |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 386 | #else |
| 387 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0004), |
| 388 | PCMCIA_DEVICE_PROD_ID12("Linksys", "WCF54G_Wireless-G_CompactFlash_Card", |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 389 | 0x0733cc81, 0x98a599e1), |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 390 | #endif /* (HCF_TYPE) & HCF_TYPE_HII5 */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 391 | PCMCIA_DEVICE_NULL, |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 392 | }; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 393 | MODULE_DEVICE_TABLE(pcmcia, wl_adapter_ids); |
| 394 | |
| 395 | static struct pcmcia_driver wlags49_driver = { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 396 | .owner = THIS_MODULE, |
Dominik Brodowski | 2e9b981 | 2010-08-08 11:36:26 +0200 | [diff] [blame] | 397 | .name = DRIVER_NAME, |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 398 | .probe = wl_adapter_attach, |
| 399 | .remove = wl_adapter_detach, |
| 400 | .id_table = wl_adapter_ids, |
| 401 | .suspend = wl_adapter_suspend, |
| 402 | .resume = wl_adapter_resume, |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 403 | }; |
| 404 | |
| 405 | |
| 406 | |
| 407 | /******************************************************************************* |
| 408 | * wl_adapter_init_module() |
| 409 | ******************************************************************************* |
| 410 | * |
| 411 | * DESCRIPTION: |
| 412 | * |
| 413 | * Called by init_module() to perform PCMCIA driver initialization. |
| 414 | * |
| 415 | * PARAMETERS: |
| 416 | * |
| 417 | * N/A |
| 418 | * |
| 419 | * RETURNS: |
| 420 | * |
| 421 | * 0 on success |
| 422 | * -1 on error |
| 423 | * |
| 424 | ******************************************************************************/ |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 425 | int wl_adapter_init_module(void) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 426 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 427 | int ret; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 428 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 429 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 430 | DBG_FUNC("wl_adapter_init_module"); |
| 431 | DBG_ENTER(DbgInfo); |
| 432 | DBG_TRACE(DbgInfo, "wl_adapter_init_module() -- PCMCIA\n"); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 433 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 434 | ret = pcmcia_register_driver(&wlags49_driver); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 435 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 436 | DBG_LEAVE(DbgInfo); |
| 437 | return ret; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 438 | } /* wl_adapter_init_module */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 439 | /*============================================================================*/ |
| 440 | |
| 441 | |
| 442 | /******************************************************************************* |
| 443 | * wl_adapter_cleanup_module() |
| 444 | ******************************************************************************* |
| 445 | * |
| 446 | * DESCRIPTION: |
| 447 | * |
| 448 | * Called by cleanup_module() to perform driver uninitialization. |
| 449 | * |
| 450 | * PARAMETERS: |
| 451 | * |
| 452 | * N/A |
| 453 | * |
| 454 | * RETURNS: |
| 455 | * |
| 456 | * N/A |
| 457 | * |
| 458 | ******************************************************************************/ |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 459 | void wl_adapter_cleanup_module(void) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 460 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 461 | DBG_FUNC("wl_adapter_cleanup_module"); |
| 462 | DBG_ENTER(DbgInfo); |
| 463 | DBG_TRACE(DbgInfo, "wl_adapter_cleanup_module() -- PCMCIA\n"); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 464 | |
| 465 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 466 | pcmcia_unregister_driver(&wlags49_driver); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 467 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 468 | DBG_LEAVE(DbgInfo); |
| 469 | return; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 470 | } /* wl_adapter_cleanup_module */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 471 | /*============================================================================*/ |
| 472 | |
| 473 | |
| 474 | /******************************************************************************* |
| 475 | * wl_adapter_is_open() |
| 476 | ******************************************************************************* |
| 477 | * |
| 478 | * DESCRIPTION: |
| 479 | * |
| 480 | * Check with Card Services to determine if this device is open. |
| 481 | * |
| 482 | * PARAMETERS: |
| 483 | * |
| 484 | * dev - a pointer to the net_device structure whose open status will be |
| 485 | * checked |
| 486 | * |
| 487 | * RETURNS: |
| 488 | * |
| 489 | * nonzero if device is open |
| 490 | * 0 otherwise |
| 491 | * |
| 492 | ******************************************************************************/ |
Prashant P. Shah | aa605fa | 2010-06-10 22:07:04 +0530 | [diff] [blame] | 493 | int wl_adapter_is_open(struct net_device *dev) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 494 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 495 | struct wl_private *lp = wl_priv(dev); |
| 496 | struct pcmcia_device *link = lp->link; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 497 | |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 498 | if (!pcmcia_dev_present(link)) |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 499 | return 0; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 500 | |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 501 | return link->open; |
| 502 | } /* wl_adapter_is_open */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 503 | /*============================================================================*/ |
| 504 | |
| 505 | |
| 506 | #if DBG |
| 507 | |
| 508 | /******************************************************************************* |
| 509 | * DbgEvent() |
| 510 | ******************************************************************************* |
| 511 | * |
| 512 | * DESCRIPTION: |
| 513 | * |
| 514 | * Converts the card serivces events to text for debugging. |
| 515 | * |
| 516 | * PARAMETERS: |
| 517 | * |
| 518 | * mask - a integer representing the error(s) being reported by Card |
| 519 | * Services. |
| 520 | * |
| 521 | * RETURNS: |
| 522 | * |
| 523 | * a pointer to a string describing the error(s) |
| 524 | * |
| 525 | ******************************************************************************/ |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 526 | const char *DbgEvent(int mask) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 527 | { |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 528 | static char DbgBuffer[256]; |
| 529 | char *pBuf; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 530 | /*--------------------------------------------------------------------*/ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 531 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 532 | pBuf = DbgBuffer; |
| 533 | *pBuf = '\0'; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 534 | |
| 535 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 536 | if (mask & CS_EVENT_WRITE_PROTECT) |
| 537 | strcat(pBuf, "WRITE_PROTECT "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 538 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 539 | if (mask & CS_EVENT_CARD_LOCK) |
| 540 | strcat(pBuf, "CARD_LOCK "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 541 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 542 | if (mask & CS_EVENT_CARD_INSERTION) |
| 543 | strcat(pBuf, "CARD_INSERTION "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 544 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 545 | if (mask & CS_EVENT_CARD_REMOVAL) |
| 546 | strcat(pBuf, "CARD_REMOVAL "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 547 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 548 | if (mask & CS_EVENT_BATTERY_DEAD) |
| 549 | strcat(pBuf, "BATTERY_DEAD "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 550 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 551 | if (mask & CS_EVENT_BATTERY_LOW) |
| 552 | strcat(pBuf, "BATTERY_LOW "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 553 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 554 | if (mask & CS_EVENT_READY_CHANGE) |
| 555 | strcat(pBuf, "READY_CHANGE "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 556 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 557 | if (mask & CS_EVENT_CARD_DETECT) |
| 558 | strcat(pBuf, "CARD_DETECT "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 559 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 560 | if (mask & CS_EVENT_RESET_REQUEST) |
| 561 | strcat(pBuf, "RESET_REQUEST "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 562 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 563 | if (mask & CS_EVENT_RESET_PHYSICAL) |
| 564 | strcat(pBuf, "RESET_PHYSICAL "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 565 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 566 | if (mask & CS_EVENT_CARD_RESET) |
| 567 | strcat(pBuf, "CARD_RESET "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 568 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 569 | if (mask & CS_EVENT_REGISTRATION_COMPLETE) |
| 570 | strcat(pBuf, "REGISTRATION_COMPLETE "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 571 | |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 572 | /* if (mask & CS_EVENT_RESET_COMPLETE) |
| 573 | strcat(pBuf, "RESET_COMPLETE "); */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 574 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 575 | if (mask & CS_EVENT_PM_SUSPEND) |
| 576 | strcat(pBuf, "PM_SUSPEND "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 577 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 578 | if (mask & CS_EVENT_PM_RESUME) |
| 579 | strcat(pBuf, "PM_RESUME "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 580 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 581 | if (mask & CS_EVENT_INSERTION_REQUEST) |
| 582 | strcat(pBuf, "INSERTION_REQUEST "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 583 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 584 | if (mask & CS_EVENT_EJECTION_REQUEST) |
| 585 | strcat(pBuf, "EJECTION_REQUEST "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 586 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 587 | if (mask & CS_EVENT_MTD_REQUEST) |
| 588 | strcat(pBuf, "MTD_REQUEST "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 589 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 590 | if (mask & CS_EVENT_ERASE_COMPLETE) |
| 591 | strcat(pBuf, "ERASE_COMPLETE "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 592 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 593 | if (mask & CS_EVENT_REQUEST_ATTENTION) |
| 594 | strcat(pBuf, "REQUEST_ATTENTION "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 595 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 596 | if (mask & CS_EVENT_CB_DETECT) |
| 597 | strcat(pBuf, "CB_DETECT "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 598 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 599 | if (mask & CS_EVENT_3VCARD) |
| 600 | strcat(pBuf, "3VCARD "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 601 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 602 | if (mask & CS_EVENT_XVCARD) |
| 603 | strcat(pBuf, "XVCARD "); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 604 | |
| 605 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 606 | if (*pBuf) { |
| 607 | pBuf[strlen(pBuf) - 1] = '\0'; |
| 608 | } else { |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 609 | if (mask != 0x0) |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 610 | sprintf(pBuf, "<<0x%08x>>", mask); |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 611 | } |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 612 | |
Prashant P. Shah | 6d98be3 | 2010-06-23 12:15:06 +0530 | [diff] [blame] | 613 | return pBuf; |
Prashant P. Shah | 194a636 | 2010-06-23 12:17:02 +0530 | [diff] [blame] | 614 | } /* DbgEvent */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 615 | /*============================================================================*/ |
| 616 | |
| 617 | #endif /* DBG */ |