Technical information

8-27
Sample Driver
&CurrentBuffer);
} // while (CurrentBuffer)
// We’ve placed all the buffers in this packet into Transmit Buffer
// Descriptors.
// We’re ready to tell the chip to transmit the packet.
// Advance the Tx Producer Index causing the chip to transmit the packet out.
// The Producer index is incremented by units of 8 bytes. For this example,
// we are using a Type 1 descriptor (8 bytes) with an 8 byte skip field.
// Therefore, we must increment the producer index by 2 for each buffer
// transmitted
TxDescQProducerIndexValue.LoPrTxProducerIndex =
(CurrentTxDescIndex * sizeof(TransmitBufferDescriptor) / 8;
// and write the updated register value back to the chip
AIC6915_WRITE_REG(Adapter->RegisterbaseVa->TxDescQueueProducerIndex,
TxDescQProducerIndexValue);
// Our transmit is complete!
Transmit Completion Interrupt Handling
After the AIC-6915 has transmitted a packet, it places that packet in the Transmit
Completion Descriptor Queue and initiates a
T
X
F
RAME
C
OMPLETE
interrupt or a
T
X
D
MA
D
ONE
interrupt. The driver must process this interrupt and return the transmitted
packet resource to the operating system. In the code fragment below, we have received a
transmit complete interrupt.
Example:
// Windows NT example
// Single Transmit Completion and Buffer Descriptor Queue
// 32-bit addressing, 8-byte skip field
// Read the Completion QueueProducer and Consumer indices
AIC6915_READ_REG(CompletionQueue1ProducerIndex,
&CompletionQueue1ProducerReg);
AIC6915_READ_REG(CompletionQueue1ConsumerIndex,
&CompletionQueue1ConsumerReg);
TxComQProducerIndex =
CompletionQueue1ProducerReg.b.TxCompletionProducerIndex;
TxComQConsumerIndex =
CompletionQueue1ConsumerReg.b.TxCompletionConsumerIndex;
// Repeat until we’ve processed all transmit complete entries
while ( TxComQConsumerIndex != TxComQProducerIndex )
{
// Get the TX Complete entry
TxCompletionDesc = Adapter->TxCompletionDesc[TxComQConsumerIndex];
// Get the TX buffer descriptor index from the completion descriptor.