Intel 82801EB Manuale Utente

Pagina di 53
 
 
 
Intel® ICH5 AC ’97 Modem Driver 
R
   
AC ’97 Programmer’s Reference Manual 53 
 
 
while (tail <= Prefetched_Index) 

    tail++;  // Happens IFF Spurious Data was used 

if (   ((tail    <= LastValidIndex) ||  (tail    == free)) 
    &&(((tail+1) <= LastValidIndex) || ((tail+1) == free)) ) 

    Descriptor.BufferPtr[tail] = &buffer; 
Descriptor.BufferLength[tail] = 
    length(buffer) – MinBufferLength; 
    Descriptor.BufferPtr[tail+1] =  
        &buffer + length(buffer) – MinBufferLength; 
Descriptor.BufferLength[tail+1] = 
    MinBufferLength; 
    tail += 2; 
 } 
else 

    ;    //error: no space for this data buffer 

if ((tail <= LastValid index) || (tail == free)) 
    Descriptor.BufferPtr[tail] =  
        &(SpuriousBufferList[LastState(buffer)]); 
    Descriptor.BufferLength[tail] = 
        SpuriousBufferLength[LastState(buffer)]; 
    LastValidIndex = tail; 
//Note: tail is NOT incremented, so next time we’ll overwrite 
//      this descriptor, which is the whole point of this 
//      algorithm 

else 
LastValidIndex = tail-1; //warning: no space for spurious 
                         // data buffer 
The above implementation can be improved upon in a number of ways. First, rather than adding a 
single (large) spurious buffer, a number of smaller ones could be chained together. In this way, the 
amount of spurious data actually transmitted would be reduced while still maintaining a given level 
of protection against long latencies for the host-based software. Additionally, the implementation 
could be extended to handle multiple buffers at once, inserting several buffers in a row and only 
splitting the last one and then appending a spurious buffer or buffers. Finally, the descriptor list is 
a circular buffer and a real implementation would have to check tail and tail+1 against 
base_address + 31 * 8