/*------------------------------------------------------------------*/
/*
- * Translate PSA irq parameter to irq number
+ * Translate PSA irq parameter to irq number
*/
static int __init wv_psa_to_irq(u8 irqval)
{
*
* One major difference with the PCMCIA hardware (except the port mapping)
* is that we have to keep the state of the Host Control Register
- * because of the interrupt enable & bus size flags.
+ *because of the interrupt enable & bus size flags.
*/
/*------------------------------------------------------------------*/
*/
static inline u16 hasr_read(unsigned long ioaddr)
{
- return (inw(HASR(ioaddr)));
+ return inw(HASR(ioaddr));
} /* hasr_read */
/*------------------------------------------------------------------*/
* Disable interrupts on the WaveLAN hardware.
* (called by wv_82586_stop())
*/
-static inline void wv_ints_off(struct net_device * dev)
+static inline void wv_ints_off(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
-
+
lp->hacr &= ~HACR_INTRON;
hacr_write(ioaddr, lp->hacr);
} /* wv_ints_off */
* Enable interrupts on the WaveLAN hardware.
* (called by wv_hw_reset())
*/
-static inline void wv_ints_on(struct net_device * dev)
+static inline void wv_ints_on(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
/*
* Read bytes from the PSA.
*/
-static void psa_read(unsigned long ioaddr, u16 hacr, int o, /* offset in PSA */
- u8 * b, /* buffer to fill */
- int n)
+static void psa_read(unsigned long ioaddr,
+ u16 hacr,
+ int o, /* offset in PSA */
+ u8 *b, /*buffer to fill */
+ int n)
{ /* size to read */
wv_16_off(ioaddr, hacr);
/*
* Write the Parameter Storage Area to the WaveLAN card's memory.
*/
-static void psa_write(unsigned long ioaddr, u16 hacr, int o, /* Offset in PSA */
- u8 * b, /* Buffer in memory */
- int n)
+static void psa_write(unsigned long ioaddr,
+ u16 hacr,
+ int o, /* Offset in PSA */
+ u8 *b, /*buffer in memory */
+ int n)
{ /* Length of buffer */
int count = 0;
/* Wait for the memory to finish its write cycle */
count = 0;
- while ((count++ < 100) &&
- (hasr_read(ioaddr) & HASR_PSA_BUSY)) mdelay(1);
+ while ((count++ < 100) && (hasr_read(ioaddr) & HASR_PSA_BUSY))
+ mdelay(1);
}
wv_16_on(ioaddr, hacr);
* The Windows drivers don't use the CRC, but the AP and the PtP tool
* depend on it.
*/
-static u16 psa_crc(u8 * psa, /* The PSA */
- int size)
+static u16 psa_crc(u8 *psa, /* The PSA */
+ int size)
{ /* Number of short for CRC */
int byte_cnt; /* Loop on the PSA */
u16 crc_bytes = 0; /* Data in the PSA */
/*
* update the checksum field in the Wavelan's PSA
*/
-static void update_psa_checksum(struct net_device * dev, unsigned long ioaddr, u16 hacr)
+static void update_psa_checksum(struct net_device *dev,
+ unsigned long ioaddr,
+ u16 hacr)
{
#ifdef SET_PSA_CRC
psa_t psa;
if (crc != 0)
printk(KERN_WARNING
- "%s: update_psa_checksum(): CRC does not agree with PSA data (even after recalculating)\n",
+ "%s: update_psa_checksum(): CRC does not \
+ agree with PSA data (even after recalculating)\n",
dev->name);
#endif /* DEBUG_IOCTL_INFO */
#endif /* SET_PSA_CRC */
* Routine to write bytes to the Modem Management Controller.
* We start at the end because it is the way it should be!
*/
-static void mmc_write(unsigned long ioaddr, u8 o, u8 * b, int n)
+static void mmc_write(unsigned long ioaddr, u8 o, u8 *b, int n)
{
o += n;
b += n;
* (code has just been moved in the above function)
* We start at the end because it is the way it should be!
*/
-static inline void mmc_read(unsigned long ioaddr, u8 o, u8 * b, int n)
+static inline void mmc_read(unsigned long ioaddr, u8 o, u8 *b, int n)
{
o += n;
b += n;
* Wait for the frequency EEPROM to complete a command.
* I hope this one will be optimally inlined.
*/
-static inline void fee_wait(unsigned long ioaddr, /* I/O port of the card */
- int delay, /* Base delay to wait for */
+static inline void fee_wait(unsigned long ioaddr, /* I/O port of the card */
+ int delay, /*base delay to wait for */
int number)
{ /* Number of time to wait */
int count = 0; /* Wait only a limited time */
while ((count++ < number) &&
(mmc_in(ioaddr, mmroff(0, mmr_fee_status)) &
- MMR_FEE_STATUS_BUSY)) udelay(delay);
+ MMR_FEE_STATUS_BUSY))
+ udelay(delay);
}
/*------------------------------------------------------------------*/
*/
static void fee_read(unsigned long ioaddr, /* I/O port of the card */
u16 o, /* destination offset */
- u16 * b, /* data buffer */
+ u16 *b, /* data buffer */
int n)
{ /* number of registers */
b += n; /* Position at the end of the area */
/*
* Write bytes from the Frequency EEPROM (frequency select cards).
* This is a bit complicated, because the frequency EEPROM has to
- * be unprotected and the write enabled.
+ *be unprotected and the write enabled.
* Jean II
*/
static void fee_write(unsigned long ioaddr, /* I/O port of the card */
u16 o, /* destination offset */
- u16 * b, /* data buffer */
+ u16 *b, /* data buffer */
int n)
{ /* number of registers */
b += n; /* Position at the end of the area. */
mmc_out(ioaddr, mmwoff(0, mmw_fee_ctrl),
MMW_FEE_CTRL_WRITE);
- /* WaveLAN documentation says to wait at least 10 ms for EEBUSY = 0 */
+ /* WaveLAN documentation says to
+ * wait at least 10 ms for EEBUSY = 0
+ */
mdelay(10);
fee_wait(ioaddr, 10, 100);
}
* Why does inlining this function make it fail?
*/
static /*inline */ void obram_read(unsigned long ioaddr,
- u16 o, u8 * b, int n)
+ u16 o, u8 *b, int n)
{
outw(o, PIOR1(ioaddr));
insw(PIOP1(ioaddr), (unsigned short *) b, (n + 1) >> 1);
/*
* Write bytes to the on-board RAM.
*/
-static inline void obram_write(unsigned long ioaddr, u16 o, u8 * b, int n)
+static inline void obram_write(unsigned long ioaddr, u16 o, u8 *b, int n)
{
outw(o, PIOR1(ioaddr));
outsw(PIOP1(ioaddr), (unsigned short *) b, (n + 1) >> 1);
/*
* Acknowledge the reading of the status issued by the i82586.
*/
-static void wv_ack(struct net_device * dev)
+static void wv_ack(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* Set channel attention bit and busy wait until command has
* completed, then acknowledge completion of the command.
*/
-static int wv_synchronous_cmd(struct net_device * dev, const char *str)
+static int wv_synchronous_cmd(struct net_device *dev, const char *str)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* Check if done, and if OK.
*/
static int
-wv_config_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp)
+wv_config_complete(struct net_device *dev, unsigned long ioaddr, net_local * lp)
{
unsigned short mcs_addr;
unsigned short status;
/* Check mc_config command */
if ((status & AC_SFLD_OK) != AC_SFLD_OK)
printk(KERN_INFO
- "%s: wv_config_complete(): set_multicast_address failed; status = 0x%x\n",
+ "%s: wv_config_complete(): \
+ set_multicast_address failed; status = 0x%x\n",
dev->name, status);
/* check ia-config command */
(unsigned char *) &status, sizeof(status));
if ((status & AC_SFLD_OK) != AC_SFLD_OK)
printk(KERN_INFO
- "%s: wv_config_complete(): set_MAC_address failed; status = 0x%x\n",
+ "%s: wv_config_complete(): set_MAC_address \
+ failed; status = 0x%x\n",
dev->name, status);
/* Check config command. */
(unsigned char *) &status, sizeof(status));
if ((status & AC_SFLD_OK) != AC_SFLD_OK)
printk(KERN_INFO
- "%s: wv_config_complete(): configure failed; status = 0x%x\n",
+ "%s: wv_config_complete(): configure failed; \
+ status = 0x%x\n",
dev->name, status);
#endif /* DEBUG_CONFIG_ERROR */
* (called in wavelan_interrupt()).
* Note : the spinlock is already grabbed for us.
*/
-static int wv_complete(struct net_device * dev, unsigned long ioaddr, net_local * lp)
+static int wv_complete(struct net_device *dev,
+ unsigned long ioaddr,
+ net_local *lp)
{
int nreaped = 0;
/* Next one in the chain */
lp->tx_first_in_use += TXBLOCKZ;
if (lp->tx_first_in_use >=
- OFFSET_CU +
- NTXBLOCKS * TXBLOCKZ) lp->tx_first_in_use -=
- NTXBLOCKS * TXBLOCKZ;
+ OFFSET_CU + NTXBLOCKS * TXBLOCKZ)
+ lp->tx_first_in_use -= NTXBLOCKS * TXBLOCKZ;
}
/* Hack for reconfiguration */
#ifdef DEBUG_TX_INFO
if (ncollisions > 0)
printk(KERN_DEBUG
- "%s: wv_complete(): tx completed after %d collisions.\n",
+ "%s: wv_complete(): tx completed after \
+ %d collisions.\n",
dev->name, ncollisions);
#endif
} else {
dev->stats.tx_carrier_errors++;
#ifdef DEBUG_TX_FAIL
printk(KERN_DEBUG
- "%s: wv_complete(): tx error: lost CTS.\n",
+ "%s: wv_complete(): tx error: \
+ lost CTS.\n",
dev->name);
#endif
}
dev->stats.tx_fifo_errors++;
#ifdef DEBUG_TX_FAIL
printk(KERN_DEBUG
- "%s: wv_complete(): tx error: slow DMA.\n",
+ "%s: wv_complete(): tx error: \
+ slow DMA.\n",
dev->name);
#endif
}
dev->stats.tx_heartbeat_errors++;
#ifdef DEBUG_TX_FAIL
printk(KERN_DEBUG
- "%s: wv_complete(): tx error: heart beat.\n",
+ "%s: wv_complete(): tx error: \
+ heart beat.\n",
dev->name);
#endif
}
dev->stats.tx_aborted_errors++;
#ifdef DEBUG_TX_FAIL
printk(KERN_DEBUG
- "%s: wv_complete(): tx error: too many collisions.\n",
+ "%s: wv_complete(): tx error: \
+ too many collisions.\n",
dev->name);
#endif
}
/*
* Inform upper layers.
*/
- if (lp->tx_n_in_use < NTXBLOCKS - 1) {
+ if (lp->tx_n_in_use < NTXBLOCKS - 1)
netif_wake_queue(dev);
- }
+
#ifdef DEBUG_INTERRUPT_TRACE
printk(KERN_DEBUG "%s: <-wv_complete()\n", dev->name);
#endif
/*------------------------------------------------------------------*/
/*
* Reconfigure the i82586, or at least ask for it.
- * Because wv_82586_config uses a transmission buffer, we must do it
+ *because wv_82586_config uses a transmission buffer, we must do it
* when we are sure that there is one left, so we do it now
* or in wavelan_packet_xmit() (I can't find any better place,
* wavelan_interrupt is not an option), so you may experience
* delays sometimes.
*/
-static void wv_82586_reconfig(struct net_device * dev)
+static void wv_82586_reconfig(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long flags;
lp->reconfig_82586 = 1;
/* Check if we can do it now ! */
- if((netif_running(dev)) && !(netif_queue_stopped(dev))) {
+ if ((netif_running(dev)) && !(netif_queue_stopped(dev))) {
spin_lock_irqsave(&lp->spinlock, flags);
/* May fail */
wv_82586_config(dev);
spin_unlock_irqrestore(&lp->spinlock, flags);
- }
- else {
+ } else {
#ifdef DEBUG_CONFIG_INFO
printk(KERN_DEBUG
"%s: wv_82586_reconfig(): delayed (state = %lX)\n",
/*
* Print the formatted contents of the Parameter Storage Area.
*/
-static void wv_psa_show(psa_t * p)
+static void wv_psa_show(psa_t *p)
{
printk(KERN_DEBUG "##### WaveLAN PSA contents: #####\n");
printk(KERN_DEBUG "psa_io_base_addr_1: 0x%02X %02X %02X %02X\n",
* Print the formatted status of the Modem Management Controller.
* This function needs to be completed.
*/
-static void wv_mmc_show(struct net_device * dev)
+static void wv_mmc_show(struct net_device *dev)
{
unsigned long ioaddr = dev->base_addr;
net_local *lp = netdev_priv(dev);
mmr_t m;
- /* Basic check */
+ /*basic check */
if (hasr_read(ioaddr) & HASR_NO_CLK) {
printk(KERN_WARNING
"%s: wv_mmc_show: modem not connected\n",
/* Read the mmc */
mmc_out(ioaddr, mmwoff(0, mmw_freeze), 1);
- mmc_read(ioaddr, 0, (u8 *) & m, sizeof(m));
+ mmc_read(ioaddr, 0, (u8 *) &m, sizeof(m));
mmc_out(ioaddr, mmwoff(0, mmw_freeze), 0);
/* Don't forget to update statistics */
/*
* Print the formatted status of the i82586's receive unit.
*/
-static void wv_ru_show(struct net_device * dev)
+static void wv_ru_show(struct net_device *dev)
{
printk(KERN_DEBUG
"##### WaveLAN i82586 receiver unit status: #####\n");
/*
* Display info about one control block of the i82586 memory.
*/
-static void wv_cu_show_one(struct net_device * dev, net_local * lp, int i, u16 p)
+static void wv_cu_show_one(struct net_device *dev, net_local * lp, int i, u16 p)
{
unsigned long ioaddr;
ac_tx_t actx;
/*
* Print status of the command unit of the i82586.
*/
-static void wv_cu_show(struct net_device * dev)
+static void wv_cu_show(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned int i;
/*
* Print the formatted status of the WaveLAN PCMCIA device driver.
*/
-static void wv_dev_show(struct net_device * dev)
+static void wv_dev_show(struct net_device *dev)
{
printk(KERN_DEBUG "dev:");
printk(" state=%lX,", dev->state);
* Print the formatted status of the WaveLAN PCMCIA device driver's
* private information.
*/
-static void wv_local_show(struct net_device * dev)
+static void wv_local_show(struct net_device *dev)
{
net_local *lp;
* This is the information which is displayed by the driver at startup.
* There are lots of flags for configuring it to your liking.
*/
-static void wv_init_info(struct net_device * dev)
+static void wv_init_info(struct net_device *dev)
{
short ioaddr = dev->base_addr;
net_local *lp = netdev_priv(dev);
* num_addrs > 0 Multicast mode, receive normal and MC packets,
* and do best-effort filtering.
*/
-static void wavelan_set_multicast_list(struct net_device * dev)
+static void wavelan_set_multicast_list(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
* (Note : it was a nice way to test the reconfigure stuff...)
*/
#ifdef SET_MAC_ADDRESS
-static int wavelan_set_mac_address(struct net_device * dev, void *addr)
+static int wavelan_set_mac_address(struct net_device *dev, void *addr)
{
struct sockaddr *mac = addr;
return 0;
} else
- return -EINVAL; /* Bah, never get there... */
+ return -EINVAL; /*bah, never get there... */
}
/*------------------------------------------------------------------*/
* address with our list, and if they match, get the statistics.
* Sorry, but this function really needs the wireless extensions.
*/
-static inline void wl_spy_gather(struct net_device * dev,
+static inline void wl_spy_gather(struct net_device *dev,
u8 * mac, /* MAC address */
u8 * stats) /* Statistics to gather */
{
* With this histogram you may detect if one WaveLAN is really weak,
* or you may also calculate the mean and standard deviation of the level.
*/
-static inline void wl_his_gather(struct net_device * dev, u8 * stats)
+static inline void wl_his_gather(struct net_device *dev, u8 * stats)
{ /* Statistics to gather */
net_local *lp = netdev_priv(dev);
u8 level = stats[0] & MMR_SIGNAL_LVL;
}
if(!ret) {
- /* Basic checking... */
+ /*basic checking... */
if (wrqu->encoding.length == 8) {
/* Copy the key in the driver */
memcpy(psa.psa_encryption_key, extra,
NULL, /* SIOCGIWTXPOW */
NULL, /* SIOCSIWRETRY */
NULL, /* SIOCGIWRETRY */
- /* Bummer ! Why those are only at the end ??? */
+ /*bummer ! Why those are only at the end ??? */
wavelan_set_encode, /* SIOCSIWENCODE */
wavelan_get_encode, /* SIOCGIWENCODE */
};
* Get wireless statistics.
* Called by /proc/net/wireless
*/
-static iw_stats *wavelan_get_wireless_stats(struct net_device * dev)
+static iw_stats *wavelan_get_wireless_stats(struct net_device *dev)
{
unsigned long ioaddr = dev->base_addr;
net_local *lp = netdev_priv(dev);
* (called by wv_packet_rcv())
*/
static void
-wv_packet_read(struct net_device * dev, u16 buf_off, int sksize)
+wv_packet_read(struct net_device *dev, u16 buf_off, int sksize)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* (called in wavelan_interrupt()).
* Note : the spinlock is already grabbed for us.
*/
-static void wv_receive(struct net_device * dev)
+static void wv_receive(struct net_device *dev)
{
unsigned long ioaddr = dev->base_addr;
net_local *lp = netdev_priv(dev);
*
* (called in wavelan_packet_xmit())
*/
-static int wv_packet_write(struct net_device * dev, void *buf, short length)
+static int wv_packet_write(struct net_device *dev, void *buf, short length)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* to send the packet.
*/
static netdev_tx_t wavelan_packet_xmit(struct sk_buff *skb,
- struct net_device * dev)
+ struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long flags;
#endif
/*
- * Block a timer-based transmit from overlapping.
+ *block a timer-based transmit from overlapping.
* In other words, prevent reentering this routine.
*/
netif_stop_queue(dev);
* Routine to initialize the Modem Management Controller.
* (called by wv_hw_reset())
*/
-static int wv_mmc_init(struct net_device * dev)
+static int wv_mmc_init(struct net_device *dev)
{
unsigned long ioaddr = dev->base_addr;
net_local *lp = netdev_priv(dev);
* Start the receive unit.
* (called by wv_hw_reset())
*/
-static int wv_ru_start(struct net_device * dev)
+static int wv_ru_start(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* self-loop of the first transmit block.
*
* Here we create the list of send buffers used to transmit packets
- * between the PC and the command unit. For each buffer, we create a
- * buffer descriptor (pointing on the buffer), a transmit command
+ *between the PC and the command unit. For each buffer, we create a
+ *buffer descriptor (pointing on the buffer), a transmit command
* (pointing to the buffer descriptor) and a NOP command.
* The transmit command is linked to the NOP, and the NOP to itself.
* When we will have finished executing the transmit command, we will
*
* (called by wv_hw_reset())
*/
-static int wv_cu_start(struct net_device * dev)
+static int wv_cu_start(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
*
* (called by wv_hw_reset())
*/
-static int wv_82586_start(struct net_device * dev)
+static int wv_82586_start(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
*
* (called by wv_hw_reset(), wv_82586_reconfig(), wavelan_packet_xmit())
*/
-static void wv_82586_config(struct net_device * dev)
+static void wv_82586_config(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
tx_addr = txblock;
nop_addr = tx_addr + sizeof(tx);
tbd_addr = nop_addr + sizeof(nop);
- cfg_addr = tbd_addr + sizeof(tbd_t); /* beginning of the buffer */
+ cfg_addr = tbd_addr + sizeof(tbd_t); /*beginning of the buffer */
ias_addr = cfg_addr + sizeof(cfg);
mcs_addr = ias_addr + sizeof(ias);
* WaveLAN controller (i82586).
* (called by wavelan_close())
*/
-static void wv_82586_stop(struct net_device * dev)
+static void wv_82586_stop(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* 5. Start the LAN controller's receive unit
* (called by wavelan_interrupt(), wavelan_watchdog() & wavelan_open())
*/
-static int wv_hw_reset(struct net_device * dev)
+static int wv_hw_reset(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
* Configure and start up the WaveLAN PCMCIA adaptor.
* Called by NET3 when it "opens" the device.
*/
-static int wavelan_open(struct net_device * dev)
+static int wavelan_open(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long flags;
* Shut down the WaveLAN ISA card.
* Called by NET3 when it "closes" the device.
*/
-static int wavelan_close(struct net_device * dev)
+static int wavelan_close(struct net_device *dev)
{
net_local *lp = netdev_priv(dev);
unsigned long flags;
/*------------------------------------------------------------------*/
/*
* Probe an I/O address, and if the WaveLAN is there configure the
- * device structure
+ *device structure
* (called by wavelan_probe() and via init_module()).
*/
static int __init wavelan_config(struct net_device *dev, unsigned short ioaddr)
memset(netdev_priv(dev), 0, sizeof(net_local));
lp = netdev_priv(dev);
- /* Back link to the device structure. */
+ /*back link to the device structure. */
lp->dev = dev;
/* Add the device at the beginning of the linked list. */
lp->next = wavelan_list;
*
* Please send bug reports, updates, comments to:
*
- * Bruce Janson Email: bruce@cs.usyd.edu.au
- * Basser Department of Computer Science Phone: +61-2-9351-3423
+ *bruce Janson Email: bruce@cs.usyd.edu.au
+ *basser Department of Computer Science Phone: +61-2-9351-3423
* University of Sydney, N.S.W., 2006, AUSTRALIA Fax: +61-2-9351-3838
*/