Beispiel #1
0
/*
 * Function netwave_attach (void)
 *
 *     Creates an "instance" of the driver, allocating local data
 *     structures for one device.  The device is registered with Card
 *     Services.
 *
 *     The dev_link structure is initialized, but we don't actually
 *     configure the card at this point -- we wait until we receive a
 *     card insertion event.
 */
static int netwave_probe(struct pcmcia_device *link)
{
    struct net_device *dev;
    netwave_private *priv;

    DEBUG(0, "netwave_attach()\n");

    /* Initialize the struct pcmcia_device structure */
    dev = alloc_etherdev(sizeof(netwave_private));
    if (!dev)
        return -ENOMEM;
    priv = netdev_priv(dev);
    priv->p_dev = link;
    link->priv = dev;

    /* The io structure describes IO port mapping */
    link->io.NumPorts1 = 16;
    link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
    /* link->io.NumPorts2 = 16;
       link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
    link->io.IOAddrLines = 5;

    /* Interrupt setup */
    link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
    link->irq.IRQInfo1 = IRQ_LEVEL_ID;
    link->irq.Handler = &netwave_interrupt;

    /* General socket configuration */
    link->conf.Attributes = CONF_ENABLE_IRQ;
    link->conf.IntType = INT_MEMORY_AND_IO;
    link->conf.ConfigIndex = 1;

    /* Netwave private struct init. link/dev/node already taken care of,
     * other stuff zero'd - Jean II */
    spin_lock_init(&priv->spinlock);

    /* Netwave specific entries in the device structure */
    dev->hard_start_xmit = &netwave_start_xmit;
    dev->get_stats  = &netwave_get_stats;
    dev->set_multicast_list = &set_multicast_list;
    /* wireless extensions */
    dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def;

    dev->tx_timeout = &netwave_watchdog;
    dev->watchdog_timeo = TX_TIMEOUT;

    dev->open = &netwave_open;
    dev->stop = &netwave_close;
    link->irq.Instance = dev;

    return netwave_pcmcia_config( link);
} /* netwave_attach */
/*
 * Function netwave_attach (void)
 *
 *     Creates an "instance" of the driver, allocating local data 
 *     structures for one device.  The device is registered with Card 
 *     Services.
 *
 *     The dev_link structure is initialized, but we don't actually
 *     configure the card at this point -- we wait until we receive a
 *     card insertion event.
 */
static int netwave_probe(struct pcmcia_device *link)
{
    struct net_device *dev;
    netwave_private *priv;

    dev_dbg(&link->dev, "netwave_attach()\n");

    /* Initialize the struct pcmcia_device structure */
    dev = alloc_etherdev(sizeof(netwave_private));
    if (!dev)
	return -ENOMEM;
    priv = netdev_priv(dev);
    priv->p_dev = link;
    link->priv = dev;

    /* The io structure describes IO port mapping */
    link->io.NumPorts1 = 16;
    link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
    /* link->io.NumPorts2 = 16; 
       link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
    link->io.IOAddrLines = 5;
    
    /* Interrupt setup */
    link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
    link->irq.Handler = &netwave_interrupt;
    
    /* General socket configuration */
    link->conf.Attributes = CONF_ENABLE_IRQ;
    link->conf.IntType = INT_MEMORY_AND_IO;
    link->conf.ConfigIndex = 1;

    /* Netwave private struct init. link/dev/node already taken care of,
     * other stuff zero'd - Jean II */
    spin_lock_init(&priv->spinlock);

    /* Netwave specific entries in the device structure */
    dev->netdev_ops = &netwave_netdev_ops;
    /* wireless extensions */
    dev->wireless_handlers = &netwave_handler_def;

    dev->watchdog_timeo = TX_TIMEOUT;

    return netwave_pcmcia_config( link);
} /* netwave_attach */