kernels/linux-2.4.0/drivers/net/tlan.c
/***************************************************************
	 *	TLan_Timer
	 *
	 *	Returns:
	 *		Nothing
	 *	Parms:
	 *		data	A value given to add timer when
	 *			add_timer was called.
	 *
	 *	This function handles timed functionality for the
	 *	TLAN driver.  The two current timer uses are for
	 *	delaying for autonegotionation and driving the ACT LED.
	 *	-	Autonegotiation requires being allowed about
	 *		2 1/2 seconds before attempting to transmit a
	 *		packet.  It would be a very bad thing to hang
	 *		the kernel this long, so the driver doesn't
	 *		allow transmission 'til after this time, for
	 *		certain PHYs.  It would be much nicer if all
	 *		PHYs were interrupt-capable like the internal
	 *		PHY.
	 *	-	The ACT LED, which shows adapter activity, is
	 *		driven by the driver, and so must be left on
	 *		for a short period to power up the LED so it
	 *		can be seen.  This delay can be changed by
	 *		changing the TLAN_TIMER_ACT_DELAY in tlan.h,
	 *		if desired.  100 ms  produces a slightly
	 *		sluggish response.
	 *
	 **************************************************************/
TLan_Timer
Returns:
Nothing
Parms:
data    A value given to add timer when
add_timer was called.

This function handles timed functionality for the
TLAN driver.  The two current timer uses are for
delaying for autonegotionation and driving the ACT LED.
-       Autonegotiation requires being allowed about
2 1/2 seconds before attempting to transmit a
packet.  It would be a very bad thing to hang
the kernel this long, so the driver doesn't
allow transmission 'til after this time, for
certain PHYs.  It would be much nicer if all
PHYs were interrupt-capable like the internal
PHY.
-       The ACT LED, which shows adapter activity, is
driven by the driver, and so must be left on
for a short period to power up the LED so it
can be seen.  This delay can be changed by
changing the TLAN_TIMER_ACT_DELAY in tlan.h,
if desired.  100 ms  produces a slightly
sluggish response.
TLan_Timer Returns : Nothing Parms : data A value given to add timer when add_timer was called . This function handles timed functionality for the TLAN driver . The two current timer uses are for delaying for autonegotionation and driving the ACT LED . - Autonegotiation requires being allowed about 2 1 / 2 seconds before attempting to transmit a packet . It would be a very bad thing to hang the kernel this long so the driver doesn ' t allow transmission ' til after this time for certain PHYs . It would be much nicer if all PHYs were interrupt - capable like the internal PHY . - The ACT LED which shows adapter activity is driven by the driver and so must be left on for a short period to power up the LED so it can be seen . This delay can be changed by changing the TLAN_TIMER_ACT_DELAY in tlan . h if desired . 100 ms produces a slightly sluggish response .
void TLan_Timer( unsigned long data )
{
	struct net_device	*dev = (struct net_device *) data;
	TLanPrivateInfo	*priv = (TLanPrivateInfo *) dev->priv;
	u32		elapsed;
	unsigned long	flags = 0;
	priv->timer.function = NULL;
	switch ( priv->timerType ) {
#ifdef MONITOR		
		case TLAN_TIMER_LINK_BEAT:
			TLan_PhyMonitor( dev );
			break;
#endif
		case TLAN_TIMER_PHY_PDOWN:
			TLan_PhyPowerDown( dev );
			break;
		case TLAN_TIMER_PHY_PUP:
			TLan_PhyPowerUp( dev );
			break;
		case TLAN_TIMER_PHY_RESET:
			TLan_PhyReset( dev );
			break;
		case TLAN_TIMER_PHY_START_LINK:
			TLan_PhyStartLink( dev );
			break;
		case TLAN_TIMER_PHY_FINISH_AN:
			TLan_PhyFinishAutoNeg( dev );
			break;
		case TLAN_TIMER_FINISH_RESET:
			TLan_FinishReset( dev );
			break;
		case TLAN_TIMER_ACTIVITY:
			spin_lock_irqsave(&priv->lock, flags);
			if ( priv->timer.function == NULL ) {
				elapsed = jiffies - priv->timerSetAt;
				if ( elapsed >= TLAN_TIMER_ACT_DELAY ) {
					TLan_DioWrite8( dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK );
				} else  {
					priv->timer.function = &TLan_Timer;
					priv->timer.expires = priv->timerSetAt + TLAN_TIMER_ACT_DELAY;
					spin_unlock_irqrestore(&priv->lock, flags);
					add_timer( &priv->timer );
					break;
				}
			}
			spin_unlock_irqrestore(&priv->lock, flags);
			break;
		default:
			break;
	}
}
void TLan_Timer ( unsigned long data ) { struct net_device * dev = ( struct net_device * ) data ; TLanPrivateInfo * priv = ( TLanPrivateInfo * ) dev -> priv ; u32 elapsed ; unsigned long flags = 0 ; priv -> timer . function = NULL ; switch ( priv -> timerType ) { #ifdef MONITOR case TLAN_TIMER_LINK_BEAT : TLan_PhyMonitor ( dev ) ; break ; #endif case TLAN_TIMER_PHY_PDOWN : TLan_PhyPowerDown ( dev ) ; break ; case TLAN_TIMER_PHY_PUP : TLan_PhyPowerUp ( dev ) ; break ; case TLAN_TIMER_PHY_RESET : TLan_PhyReset ( dev ) ; break ; case TLAN_TIMER_PHY_START_LINK : TLan_PhyStartLink ( dev ) ; break ; case TLAN_TIMER_PHY_FINISH_AN : TLan_PhyFinishAutoNeg ( dev ) ; break ; case TLAN_TIMER_FINISH_RESET : TLan_FinishReset ( dev ) ; break ; case TLAN_TIMER_ACTIVITY : spin_lock_irqsave ( & priv -> lock , flags ) ; if ( priv -> timer . function == NULL ) { elapsed = jiffies - priv -> timerSetAt ; if ( elapsed >= TLAN_TIMER_ACT_DELAY ) { TLan_DioWrite8 ( dev -> base_addr , TLAN_LED_REG , TLAN_LED_LINK ) ; } else { priv -> timer . function = & TLan_Timer ; priv -> timer . expires = priv -> timerSetAt + TLAN_TIMER_ACT_DELAY ; spin_unlock_irqrestore ( & priv -> lock , flags ) ; add_timer ( & priv -> timer ) ; break ; } } spin_unlock_irqrestore ( & priv -> lock , flags ) ; break ; default : break ; } }
TLan_Timer
      Returns:
              Nothing
      Parms:
              data    A value given to add timer when
                      add_timer was called.
TLan_Timer Returns : Nothing Parms : data A value given to add timer when add_timer was called .