public void GoToNextDescriptor()
            {
                if (descriptors.Count == 0)
                {
                    // this is the first descriptor - read it from baseAddress
                    descriptors.Add(creator(bus, baseAddress));
                }
                else
                {
                    var shouldInvalidate = true;

                    CurrentDescriptor.Update();

                    if (CurrentDescriptor.Wrap)
                    {
                        currentDescriptorIndex = 0;
                    }
                    else
                    {
                        if (currentDescriptorIndex == descriptors.Count - 1)
                        {
                            // we need to generate new descriptor
                            descriptors.Add(creator(bus, CurrentDescriptor.BaseAddress + DmaBufferDescriptor.LengthInBytes));
                            // there is no need to invalidate newly created descriptor as it is invalidated in the constructor
                            shouldInvalidate = false;
                        }
                        currentDescriptorIndex++;
                    }

                    if (shouldInvalidate)
                    {
                        CurrentDescriptor.Invalidate();
                    }
                }
            }
Beispiel #2
0
 public void GoToNextDescriptor()
 {
     if (descriptors.Count == 0)
     {
         // this is the first descriptor - read it from baseAddress
         descriptors.Add(creator(bus, baseAddress));
         currentDescriptorIndex = 0;
     }
     else
     {
         // If wrap is set, we have reached end of ring and need to start from the beginning
         if (CurrentDescriptor.Wrap)
         {
             currentDescriptorIndex = 0;
         }
         else
         {
             descriptors.Add(creator(bus, CurrentDescriptor.DescriptorAddress + CurrentDescriptor.SizeInBytes));
             currentDescriptorIndex++;
         }
     }
     CurrentDescriptor.Read();
 }
Beispiel #3
0
 public void GoToBaseAddress()
 {
     currentDescriptorIndex = 0;
     CurrentDescriptor.Read();
 }