/* * Linux ARCnet driver - COM20020 chipset support * * Written 1997 by David Woodhouse. * Written 1994-1999 by Avery Pennarun. * Written 1999 by Martin Mares <mj@ucw.cz>. * Derived from skeleton.c by Donald Becker. * * Special thanks to Contemporary Controls, Inc. (www.ccontrols.com) * for sponsoring the further development of this driver. * * ********************** * * The original copyright of skeleton.c was as follows: * * skeleton.c Written 1993 by Donald Becker. * Copyright 1993 United States Government as represented by the * Director, National Security Agency. This software may only be used * and distributed according to the terms of the GNU General Public License as * modified by SRC, incorporated herein by reference. * * ********************** * * For more details, see drivers/net/arcnet.c * * **********************
*/
staticvoid com20020_command(struct net_device *dev, int command); staticint com20020_status(struct net_device *dev); staticvoid com20020_setmask(struct net_device *dev, int mask); staticint com20020_reset(struct net_device *dev, int really_reset); staticvoid com20020_copy_to_card(struct net_device *dev, int bufnum, int offset, void *buf, int count); staticvoid com20020_copy_from_card(struct net_device *dev, int bufnum, int offset, void *buf, int count); staticvoid com20020_set_mc_list(struct net_device *dev); staticvoid com20020_close(struct net_device *);
staticvoid com20020_copy_from_card(struct net_device *dev, int bufnum, int offset, void *buf, int count)
{ int ioaddr = dev->base_addr, ofs = 512 * bufnum + offset;
/* set up the address register */
arcnet_outb((ofs >> 8) | RDDATAflag | AUTOINCflag,
ioaddr, COM20020_REG_W_ADDR_HI);
arcnet_outb(ofs & 0xff, ioaddr, COM20020_REG_W_ADDR_LO);
/* copy the data */
TIME(dev, "insb", count,
arcnet_insb(ioaddr, COM20020_REG_RW_MEMDATA, buf, count));
}
staticvoid com20020_copy_to_card(struct net_device *dev, int bufnum, int offset, void *buf, int count)
{ int ioaddr = dev->base_addr, ofs = 512 * bufnum + offset;
/* set up the address register */
arcnet_outb((ofs >> 8) | AUTOINCflag, ioaddr, COM20020_REG_W_ADDR_HI);
arcnet_outb(ofs & 0xff, ioaddr, COM20020_REG_W_ADDR_LO);
/* copy the data */
TIME(dev, "outsb", count,
arcnet_outsb(ioaddr, COM20020_REG_RW_MEMDATA, buf, count));
}
/* Reset the card and check some basic stuff during the detection stage. */ int com20020_check(struct net_device *dev)
{ int ioaddr = dev->base_addr, status; struct arcnet_local *lp = netdev_priv(dev);
/* Set up the struct net_device associated with this card. Called after * probing succeeds.
*/ int com20020_found(struct net_device *dev, int shared)
{ struct arcnet_local *lp; int ioaddr = dev->base_addr;
/* Initialize the rest of the device structure. */
/* reserve the irq */ if (request_irq(dev->irq, arcnet_interrupt, shared, "arcnet (COM20020)", dev)) {
arc_printk(D_NORMAL, dev, "Can't get IRQ %d!\n", dev->irq); return -ENODEV;
}
arc_printk(D_NORMAL, dev, "%s: station %02Xh found at %03lXh, IRQ %d.\n",
lp->card_name, dev->dev_addr[0], dev->base_addr, dev->irq);
if (lp->backplane)
arc_printk(D_NORMAL, dev, "Using backplane mode.\n");
if (lp->timeout != 3)
arc_printk(D_NORMAL, dev, "Using extended timeout value of %d\n",
lp->timeout);
arc_printk(D_NORMAL, dev, "Using CKP %d - data rate %s\n",
lp->setup >> 1,
clockrates[3 -
((lp->setup2 & 0xF0) >> 4) +
((lp->setup & 0x0F) >> 1)]); /* The clockrates array index looks very fragile. * It seems like it could have negative indexing.
*/
/* Do a hardware reset on the card, and set up necessary registers. * * This should be called as little as possible, because it disrupts the * token on the network (causes a RECON) and requires a significant delay. * * However, it does make sure the card is in a defined state.
*/ staticint com20020_reset(struct net_device *dev, int really_reset)
{ struct arcnet_local *lp = netdev_priv(dev);
u_int ioaddr = dev->base_addr;
u_char inbyte;
/* Set or clear the multicast filter for this adaptor. * num_addrs == -1 Promiscuous mode, receive all packets * num_addrs == 0 Normal mode, clear multicast list * num_addrs > 0 Multicast mode, receive normal and MC packets, and do * best-effort filtering. * FIXME - do multicast stuff, not just promiscuous.
*/ staticvoid com20020_set_mc_list(struct net_device *dev)
{ struct arcnet_local *lp = netdev_priv(dev); int ioaddr = dev->base_addr;
staticint __init com20020_module_init(void)
{ if (BUGLVL(D_NORMAL))
pr_info("%s\n", "COM20020 chipset support (by David Woodhouse et al.)"); return 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.