/* * Retrieve the value of one of the IDT77105's counters. * `counter' is one of the IDT77105_CTRSEL_* constants.
*/ static u16 get_counter(struct atm_dev *dev, int counter)
{
u16 val;
/* write the counter bit into PHY register 6 */
PUT(counter, CTRSEL); /* read the low 8 bits from register 4 */
val = GET(CTRLO); /* read the high 8 bits from register 5 */
val |= GET(CTRHI)<<8;
return val;
}
/* * Timer function called every second to gather statistics * from the 77105. This is done because the h/w registers * will overflow if not read at least once per second. The * kernel's stats are much higher precision. Also, having * a separate copy of the stats allows implementation of * an ioctl which gathers the stats *without* zero'ing them.
*/ staticvoid idt77105_stats_timer_func(struct timer_list *unused)
{ struct idt77105_priv *walk; struct atm_dev *dev; struct idt77105_stats *stats;
DPRINTK("IDT77105 gathering statistics\n"); for (walk = idt77105_all; walk; walk = walk->next) {
dev = walk->dev;
/* * A separate timer func which handles restarting PHY chips which * have had the cable re-inserted after being pulled out. This is * done by polling the Good Signal Bit in the Interrupt Status * register every 5 seconds. The other technique (checking Good * Signal Bit in the interrupt handler) cannot be used because PHY * interrupts need to be disabled when the cable is pulled out * to avoid lots of spurious cell error interrupts.
*/ staticvoid idt77105_restart_timer_func(struct timer_list *unused)
{ struct idt77105_priv *walk; struct atm_dev *dev; unsignedchar istat;
DPRINTK("IDT77105 checking for cable re-insertion\n"); for (walk = idt77105_all; walk; walk = walk->next) {
dev = walk->dev;
if (dev->signal != ATM_PHY_SIG_LOST) continue;
istat = GET(ISTAT); /* side effect: clears all interrupt status bits */ if (istat & IDT77105_ISTAT_GOODSIG) { /* Found signal again */
atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
printk(KERN_NOTICE "%s(itf %d): signal detected again\n",
dev->type,dev->number); /* flush the receive FIFO */
PUT( GET(DIAG) | IDT77105_DIAG_RFLUSH, DIAG); /* re-enable interrupts */
PUT( walk->old_mcr ,MCR);
}
} if (!start_timer) mod_timer(&restart_timer,jiffies+IDT77105_RESTART_TIMER_PERIOD);
}
istat = GET(ISTAT); /* side effect: clears all interrupt status bits */
DPRINTK("IDT77105 generated an interrupt, istat=%02x\n", (unsigned)istat);
if (istat & IDT77105_ISTAT_RSCC) { /* Rx Signal Condition Change - line went up or down */ if (istat & IDT77105_ISTAT_GOODSIG) { /* signal detected again */ /* This should not happen (restart timer does it) but JIC */
atm_dev_signal_change(dev, ATM_PHY_SIG_FOUND);
} else { /* signal lost */ /* * Disable interrupts and stop all transmission and * reception - the restart timer will restore these.
*/
PRIV(dev)->old_mcr = GET(MCR);
PUT(
(PRIV(dev)->old_mcr|
IDT77105_MCR_DREC|
IDT77105_MCR_DRIC|
IDT77105_MCR_HALTTX
) & ~IDT77105_MCR_EIP, MCR);
atm_dev_signal_change(dev, ATM_PHY_SIG_LOST);
printk(KERN_NOTICE "%s(itf %d): signal lost\n",
dev->type,dev->number);
}
}
if (istat & IDT77105_ISTAT_RFO) { /* Rx FIFO Overrun -- perform a FIFO flush */
PUT( GET(DIAG) | IDT77105_DIAG_RFLUSH, DIAG);
printk(KERN_NOTICE "%s(itf %d): receive FIFO overrun\n",
dev->type,dev->number);
} #ifdef GENERAL_DEBUG if (istat & (IDT77105_ISTAT_HECERR | IDT77105_ISTAT_SCR |
IDT77105_ISTAT_RSE)) { /* normally don't care - just report in stats */
printk(KERN_NOTICE "%s(itf %d): received cell with error\n",
dev->type,dev->number);
} #endif
}
/* initialise dev->signal from Good Signal Bit */
atm_dev_signal_change(dev,
GET(ISTAT) & IDT77105_ISTAT_GOODSIG ?
ATM_PHY_SIG_FOUND : ATM_PHY_SIG_LOST); if (dev->signal == ATM_PHY_SIG_LOST)
printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
dev->number);
/* initialise loop mode from hardware */ switch ( GET(DIAG) & IDT77105_DIAG_LCMASK ) { case IDT77105_DIAG_LC_NORMAL:
PRIV(dev)->loop_mode = ATM_LM_NONE; break; case IDT77105_DIAG_LC_PHY_LOOPBACK:
PRIV(dev)->loop_mode = ATM_LM_LOC_ATM; break; case IDT77105_DIAG_LC_LINE_LOOPBACK:
PRIV(dev)->loop_mode = ATM_LM_RMT_ATM; break;
}
/* enable interrupts, e.g. on loss of signal */
PRIV(dev)->old_mcr = GET(MCR); if (dev->signal == ATM_PHY_SIG_FOUND) {
PRIV(dev)->old_mcr |= IDT77105_MCR_EIP;
PUT(PRIV(dev)->old_mcr, MCR);
}
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.