Skip to content

Commit

Permalink
audio: Rename nextDescriptorMod31 to nextDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
JayFoxRox committed Jun 9, 2020
1 parent 57defbf commit 94eb218
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions lib/hal/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void XAudioInit(int sampleSizeInBits, int numChannels, XAudioCallback callback,
MmLockUnlockBufferPages((PVOID)pac97device, sizeof(AC97_DEVICE), FALSE);

pac97device->mmio = (unsigned int *)0xfec00000;
pac97device->nextDescriptorMod31 = 0;
pac97device->nextDescriptor = 0;
pac97device->callback = callback;
pac97device->callbackData = data;
pac97device->sampleSizeInBits = sampleSizeInBits;
Expand Down Expand Up @@ -248,18 +248,18 @@ void XAudioProvideSamples(unsigned char *buffer, unsigned short bufferLength, in
unsigned int address = MmGetPhysicalAddress((PVOID)buffer);
unsigned int wordCount = bufferLength / 2;

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
pac97device->pcmOutDescriptor[pac97device->nextDescriptor].bufferStartAddress = address;
pac97device->pcmOutDescriptor[pac97device->nextDescriptor].bufferLengthInSamples = wordCount;
pac97device->pcmOutDescriptor[pac97device->nextDescriptor].bufferControl = bufferControl;
pb[0x115] = (unsigned char)pac97device->nextDescriptor; // set last active descriptor
analogBufferCount++;

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
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptor].bufferStartAddress = address;
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptor].bufferLengthInSamples = wordCount;
pac97device->pcmSpdifDescriptor[pac97device->nextDescriptor].bufferControl = bufferControl;
pb[0x175] = (unsigned char)pac97device->nextDescriptor; // set last active descriptor
digitalBufferCount++;

// increment to the next buffer descriptor (rolling around to 0 once you get to 31)
pac97device->nextDescriptorMod31 = (pac97device->nextDescriptorMod31 +1 ) & 0x1f;
pac97device->nextDescriptor = (pac97device->nextDescriptor + 1) % 32;
}
2 changes: 1 addition & 1 deletion lib/hal/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ typedef struct
AC97_DESCRIPTOR pcmSpdifDescriptor[32];
AC97_DESCRIPTOR pcmOutDescriptor[32];
volatile unsigned int *mmio;
volatile unsigned int nextDescriptorMod31;
volatile unsigned int nextDescriptor;
XAudioCallback callback;
void *callbackData;
int sampleSizeInBits;
Expand Down

0 comments on commit 94eb218

Please sign in to comment.