예제 #1
0
/*******************************************************************************
 *	wl_adapter_open()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Open the device.
 *
 *  PARAMETERS:
 *
 *      dev - a pointer to a net_device structure representing the network
 *            device to open.
 *
 *  RETURNS:
 *
 *      0 on success
 *      errno value otherwise
 *
 ******************************************************************************/
int wl_adapter_open(struct net_device *dev)
{
	struct wl_private *lp = wl_priv(dev);
	struct pcmcia_device *link = lp->link;
	int result = 0;
	int hcf_status = HCF_SUCCESS;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_open");
	DBG_ENTER(DbgInfo);
	DBG_PRINT("%s\n", VERSION_INFO);
	DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);

	if (!pcmcia_dev_present(link)) {
		DBG_LEAVE(DbgInfo);
		return -ENODEV;
	}

	link->open++;

	hcf_status = wl_open(dev);

	if (hcf_status != HCF_SUCCESS) {
		link->open--;
		result = -ENODEV;
	}

	DBG_LEAVE(DbgInfo);
	return result;
} /* wl_adapter_open */
예제 #2
0
void wl_adapter_insert(struct pcmcia_device *link)
{
	struct net_device *dev;
	int i;
	int ret;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_insert");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "link", "0x%p", link);

	dev     = link->priv;

	/* Do we need to allocate an interrupt? */
	link->config_flags |= CONF_ENABLE_IRQ;
	link->io_lines = 6;

	ret = pcmcia_request_io(link);
	if (ret != 0)
		goto failed;

	ret = pcmcia_request_irq(link, (void *) wl_isr);
	if (ret != 0)
		goto failed;

	ret = pcmcia_enable_device(link);
	if (ret != 0)
		goto failed;

	dev->irq        = link->irq;
	dev->base_addr  = link->resource[0]->start;

	SET_NETDEV_DEV(dev, &link->dev);
	if (register_netdev(dev) != 0) {
;
		goto failed;
	}

	register_wlags_sysfs(dev);

//	printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
;
	for (i = 0; i < ETH_ALEN; i++)
;

	DBG_LEAVE(DbgInfo);
	return;

failed:
	wl_adapter_release(link);

	DBG_LEAVE(DbgInfo);
	return;
} /* wl_adapter_insert */
예제 #3
0
void wl_adapter_insert( struct pcmcia_device *link )
{
    struct net_device       *dev;
    int i;
    int                     ret;
    /*------------------------------------------------------------------------*/

    DBG_FUNC( "wl_adapter_insert" );
    DBG_ENTER( DbgInfo );
    DBG_PARAM( DbgInfo, "link", "0x%p", link );

    dev     = link->priv;

    /* Do we need to allocate an interrupt? */
    link->conf.Attributes |= CONF_ENABLE_IRQ;

    ret = pcmcia_request_io(link, &link->io);
    if (ret != 0)
        goto failed;

    ret = pcmcia_request_irq(link, (void *) wl_isr);
    if (ret != 0)
        goto failed;

    ret = pcmcia_request_configuration(link, &link->conf);
    if (ret != 0)
        goto failed;

    dev->irq        = link->irq;
    dev->base_addr  = link->io.BasePort1;

    SET_NETDEV_DEV(dev, &link->dev);
    if (register_netdev(dev) != 0) {
	printk("%s: register_netdev() failed\n", MODULE_NAME);
	goto failed;
    }

    register_wlags_sysfs(dev);

    printk(KERN_INFO "%s: Wireless, io_addr %#03lx, irq %d, ""mac_address ",
               dev->name, dev->base_addr, dev->irq);
    for( i = 0; i < ETH_ALEN; i++ ) {
        printk("%02X%c", dev->dev_addr[i], ((i < (ETH_ALEN-1)) ? ':' : '\n'));
    }

    DBG_LEAVE( DbgInfo );
    return;

failed:
    wl_adapter_release( link );

    DBG_LEAVE(DbgInfo);
    return;
} // wl_adapter_insert
예제 #4
0
void wl_adapter_release(struct pcmcia_device *link)
{
	DBG_FUNC("wl_adapter_release");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "link", "0x%p", link);

	/* Stop hardware */
	wl_remove(link->priv);

	pcmcia_disable_device(link);

	DBG_LEAVE(DbgInfo);
} /* wl_adapter_release */
예제 #5
0
static void wl_adapter_detach(struct pcmcia_device *link)
{
	struct net_device   *dev = link->priv;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_detach");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "link", "0x%p", link);

	wl_adapter_release(link);

	if (dev) {
		unregister_wlags_sysfs(dev);
		unregister_netdev(dev);
		wl_device_dealloc(dev);
	}

	DBG_LEAVE(DbgInfo);
} /* wl_adapter_detach */
예제 #6
0
/*******************************************************************************
 *	wl_adapter_close()
 *******************************************************************************
 *
 *  DESCRIPTION:
 *
 *      Close the device.
 *
 *  PARAMETERS:
 *
 *      dev - a pointer to a net_device structure representing the network
 *            device to close.
 *
 *  RETURNS:
 *
 *      0 on success
 *      errno value otherwise
 *
 ******************************************************************************/
int wl_adapter_close(struct net_device *dev)
{
	struct wl_private *lp = wl_priv(dev);
	struct pcmcia_device *link = lp->link;
	/*--------------------------------------------------------------------*/

	DBG_FUNC("wl_adapter_close");
	DBG_ENTER(DbgInfo);
	DBG_PARAM(DbgInfo, "dev", "%s (0x%p)", dev->name, dev);

	if (link == NULL) {
		DBG_LEAVE(DbgInfo);
		return -ENODEV;
	}

	DBG_TRACE(DbgInfo, "%s: Shutting down adapter.\n", dev->name);
	wl_close(dev);

	link->open--;

	DBG_LEAVE(DbgInfo);
	return 0;
} /* wl_adapter_close */