English
Language : 

MB86967 Datasheet, PDF (80/129 Pages) Fujitsu Component Limited. – LAN Controller with PC Card, ISA Bus, and General-purpose Bus Interfaces
MB86967
3. Operating on the Network
Driver code for operating on the network might be partitioned into three main modules as shown in the example
for the MB86967 controller in this section. The modules, shown in Figures 12, 13, and 14 are Transmit Packet
Write, in which packets to be transmitted are moved from host memory to the point marked TX PKT WRITE.
Transmission takes place in two steps. First, packets to be transmitted are loaded into the transmit buffer.
Secondly, when the transmitter is not busy, it will be started to transmit the stored packets. Each of these steps
may have to wait for resources. The packets cannot be loaded unless there is buffer space available. MB86967
provides the option of a single or two independent transmit buffers. With two buffers there is usually no waiting.
The transmitter cannot transmit but one buffer full of packets at a time. To manage these resources, two software
flags are used, TBUF STAT and TX STAT, the status of the transmit buffer and the transmitter respectively. TBUF
STAT refers to the current buffer which might be available to the driver for loading. Its status can be Busy if no
buffer is available, Loading when in the process of being loaded, in Standby if ready to transmit, but not full,
ready and Full or Empty. The transmitter status can be either Busy or Idle.
Packet length is checked during the loading process to assure that the ISO/ANSI/IEEE 8802-3 length
requirements are met. Packets ready to be loaded can be loaded into an Empty or Standby buffer, the latter
being a buffer with packets waiting for the transmitter to become idle. If a standby buffer has more room for
packets, additional packets can be loaded until it is full. The Empty buffer is available for loading and has no
packets. The driver takes ownership of an Empty or Standby buffer by changing its status to Loading.
After the packets are loaded, the transmit status flag is checked for an idle transmitter. If idle, it can be immediately
started to transmit the contents of either a Full or Standby buffer. When the transmitter of the MB86967 chip is
started, buffer status also changes. In single buffer mode, starting the transmitter makes the single buffer
unavailable to the system. In dual buffer mode, starting the transmitter re-allocates its previously-transmitted
buffer as an empty buffer, available for loading. If the transmitter is busy, the routine will suspend execution at
that point pending an idle transmitter.
Two key interrupts used in this example are the receive packet interrupt (RX PKT), indicating that one or more
packets has been received since the interrupt was last enabled, and the transmitter done interrupt (TX DONE),
indicating that the transmitter has finished transmitting the contents of its current buffer. The interrupt service
routine for network operation, illustrated in Figure 13, is short and sweet. If the receive packet interrupt has
occurred, it calls or queues the routine for reading packets (RX PKT READ). Further receive interrupts are
masked until the driver has emptied the receive buffer. This prevents redundant interrupts which would otherwise
occur if packets come in during the read sequence. If the transmitter done interrupt has occurred, the status
flags are updated, and appropriate action is taken to satisfy pending activity, if any, with the newly available
buffer and/or transmitter resource.
The driver is structured to read all receive packets in the buffer whenever one or more packets arrive. A status
bit in MB86967 (BUF EMPTY) indicates whether the receive buffer is empty or not (indicating whole packets
only). The packet read routine, shown in Figure 14, starts by masking further receive interrupts until it has
emptied the buffer and suspended execution. This prevents redundant interrupts which would otherwise occur
if packets come in during the read sequence. As each packet is read, it can be read in parts. If after reading the
first part the packet is not of interest, the rest can be discarded without being moved to host memory using
MB86967’s Skip Packet feature. Reading will continue until the buffer is empty, as indicated by RBUF EMPTY bit.
The Transmit Packet Write Routine, shown in Figure 12, and the Receive Packet Read Routine, shown in Figure
14, together comprise the driver core, which can be called by the network software or from the Network Interrupt
Service Routine, shown in Figure 13. Once called, this core routine transfers both transmit and receive packets
until there are no more to be transferred, then exits or returns. If packets are transferring, this core routine avoids
locking out either the transmitter or the receiver while the other is very busy, by alternating between the two after
a fixed number of packets, set by TX MAX and RX MAX. While in operation, the core routine polls key status
bits. Interrupts are disabled to prevent unnecessary interrupts while the core is executing.
80