Technical information

8-25
Sample Driver
Transmit Handling
In the code fragment below, the operating system has called the transmit routine with a
packet to be transmitted. The driver must set up the Transmit Buffer Descriptor(s) for all
buffers in this packet, and then instruct the AIC-6915 controller to transmit the packet.
Example:
// Windows NT driver example
// Type 1 Transmit Buffer Descriptor
// Single Transmit Buffer Descriptor Queue (low priority)
// 8 byte skip field
// Assume the operating system has notified us that we are to transmit
// “Packet”
// Read in the current producer index register
AIC6915_READ_REG(Adapter->RegisterBaseVa->TxDescQProducerIndex,
&TxDescQProducerIndexValue);
// Pull the current descriptor index out of the producer index. The producer
// index points to the next entry in the descriptor queue in units of 8
// bytes.In this example, we are using
// Type 1 descriptors with an 8 byte skip field. The descriptor size is
// therefore 16 bytes. In
// units of 8 bytes, each descriptor is indexed by 2.
CurrentTxDescIndex = (TxDescQProducerIndexValue.LoPrTxProducerIndex * 8) /
sizeof(TransmitBufferDescriptor);
// Get the first buffer in this packet
// This is an operating system-specific call
NdisQueryPacket(
Packet,
&PhysicalSegmentCount,
&NdisBufferCount,
&CurrentBuffer,
&TotalDataLength);
FirstBuffer = TRUE;
// Figure out if we will need to roll the queue for this packet
if (CurrentTxDescIndex+PhysicalSegmentCount >=AIC6915_NUMBER_0F_TxDESC-1)
Rollover = TRUE;
// Loop over all buffers in this packet. Use one Transmit Buffer per packet
// buffer.
// while (CurrentBuffer)
{
// This example utilizes map registers to translate the logical address
// into a physical buffer address
// Get the physical address segments for the current buffer
NdisMStartBufferPhysicalMapping(
Adapter->MiniportAdapterHandle,
CurrentBuffer,