LAN9118 Family Programmer Reference Guide
SMSC AN 12.12 13 Revision 1.0 (12-14-09)
APPLICATION NOTE
The first example works because of the assumption that only one thread will ever write to the flag and
signal the SwInt. The SwInt handler can use the flag to interpret the requested operation. This is known
as a producer-consumer relationship. That is, it is safe for multiple threads to share a variable if only
one thread is the writer, or producer of the variable, and all other threads are readers, or consumers
of that variable.
4.7 Ownership Policy in the Simple DriverAs a convenience to its customers, SMSC provides a simple driver for LAN9118 Family members,
written to run under the Linux, which has been reduced in complexity and function in order to highlight
the function of the device over the capabilities of a Linux device driver. Questions regarding register
usage, synchronization and ownership can generally be resolved through this reference work.
Table4.2 below details the register ownership policy in the simple driver.
Table4.2 Register Ownership Policy in the Simple Driver
REGISTER NAME OWNERSHIP POLICY
RX_DATA_FIFO Only used by the Rx thread, Rx_ProcessPackets
TX_DATA_FIFO Only used by the TX thread, Tx_SendSkb
RX_STATUS_FIFO Only used by the Rx thread, Rx_ProcessPackets
RX_STATUS_FIFO_PEEK Not Used
TX_STATUS_FIFO Used in Tx_CompleteTx in Tx_UpdateTxCounters.
Tx_UpdateTxCounters is called by Tx_SendSkb in Simp911x_hard_start_xmit.
Tx_UpdateTxCounters is also called by Simp911x_stop but only after disabling
the TX queue in a multithreaded safe manner using the xmit_lock
TX_STATUS_FIFO_PEEK Not Used.
ID_REV Read Only
INT_CFG Set i n Lan_Initialize,
Read in Simp911x_ISR
1) ClrBits in Simp911x_ISR
2) ClrBits in Rx_HandleInterrupt
3) SetBits in Rx_PopRxStatus
4) SetBits in Rx_ProcessPacketsTasklet
Items 1, 2, 3, 4 are not in contention because 1 and 2, are part of the ISR, and
3 and 4 is the tasklet which is only called while the ISR is disabled.
INT_STS Sharable
INT_EN Initialized at startup.
Used in Simp911x_stop
BYTE_TEST Read Only
FIFO_INT Initialized at start up.
During run time only accessed by Tx_HandleInterrupt, and Tx_SendSkb and
done in a safe manner.
RX_CFG Only used during initialization
TX_CFG Only used during initialization
HW_CFG Only used during initialization
RX_DP_CTRL Only used in Rx thread, in Rx_FastForward
RX_FIFO_INF Read Only. Only used in Rx Thread, in Rx_PopRxStatus