Skip to content

Commit

Permalink
audio: Avoid recalculation of descriptor parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFoxRox committed Jun 9, 2020
1 parent 702f3a1 commit 57defbf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/hal/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,17 @@ void XAudioProvideSamples(unsigned char *buffer, unsigned short bufferLength, in
if (isFinal)
bufferControl |= 0x4000;

unsigned int address = (unsigned int)buffer;
unsigned int address = MmGetPhysicalAddress((PVOID)buffer);
unsigned int wordCount = bufferLength / 2;

pac97device->pcmOutDescriptor[pac97device->nextDescriptorMod31].bufferStartAddress = MmGetPhysicalAddress((PVOID)address);
pac97device->pcmOutDescriptor[pac97device->nextDescriptorMod31].bufferLengthInSamples = bufferLength / (pac97device->sampleSizeInBits / 8);
pac97device->pcmOutDescriptor[pac97device->nextDescriptorMod31].bufferStartAddress = address;
pac97device->pcmOutDescriptor[pac97device->nextDescriptorMod31].bufferLengthInSamples = wordCount;
pac97device->pcmOutDescriptor[pac97device->nextDescriptorMod31].bufferControl = bufferControl;
pb[0x115] = (unsigned char)pac97device->nextDescriptorMod31; // set last active descriptor
analogBufferCount++;

pac97device->pcmSpdifDescriptor[pac97device->nextDescriptorMod31].bufferStartAddress = MmGetPhysicalAddress((PVOID)address);
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptorMod31].bufferLengthInSamples = bufferLength / (pac97device->sampleSizeInBits / 8);
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptorMod31].bufferStartAddress = address;
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptorMod31].bufferLengthInSamples = wordCount;
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptorMod31].bufferControl = bufferControl;
pb[0x175] = (unsigned char)pac97device->nextDescriptorMod31; // set last active descriptor
digitalBufferCount++;
Expand Down

0 comments on commit 57defbf

Please sign in to comment.