thinking about some edits of the AC97 page

All about the OSDev Wiki. Discussions about the organization and general structure of articles and how to use the wiki. Request changes here if you don't know how to use the wiki.
Post Reply
xeyes
Member
Member
Posts: 212
Joined: Mon Dec 07, 2020 8:09 am

thinking about some edits of the AC97 page

Post by xeyes »

I've noticed a possible error on the AC97 page, but would like to first make sure that I did understand it correctly myself.
Buffer have 32 entries. Every entry can transfer max 0xFFFF samples(write value 0xFFFE to length entry), but you must have in mind that one sample mean samples of all channels whose are use. So if you have 2 channels 16 bit audio, value 0xFFFE means that (2 bytes pre sample*2 channels*0xFFFF)=256 KB is transfered.
My findings are:

The sample count field indeed means sample count, not (sample_count / channel_count) - 1 as described above.

For example, 0xFFFE actually means 0xFFFE samples. If playing in stereo, the dma will consume them 2 at a time and run through them in 0x7FFF/sample_rate seconds.

What's more troublesome, is that if you program it to an odd value 0xFFFF and run it in stereo mode, the dma will hang at the end and the status/interrupts will still reflect that it is going.

Would appreciate someone to help confirm whether my understanding is correct and the page should be updated.

Also thinking about adding some descriptions about the producer consumer operations which should be helpful for managing the buffers.
Octocontrabass
Member
Member
Posts: 5568
Joined: Mon Mar 25, 2013 7:01 pm

Re: thinking about some edits of the AC97 page

Post by Octocontrabass »

xeyes wrote:The sample count field indeed means sample count, not (sample_count / channel_count) - 1 as described above.
According to the ICH4/ICH5 AC'97 Programmer's Reference Manual, the wiki is wrong and you are correct. The sample count field does indeed indicate the number of samples, not the number of frames. (A frame contains one sample for each channel.)
xeyes wrote:What's more troublesome, is that if you program it to an odd value 0xFFFF and run it in stereo mode, the dma will hang at the end and the status/interrupts will still reflect that it is going.
According to the same manual, buffers are not allowed to be odd lengths or span frame boundaries.
xeyes
Member
Member
Posts: 212
Joined: Mon Dec 07, 2020 8:09 am

Re: thinking about some edits of the AC97 page

Post by xeyes »

Octocontrabass wrote:
xeyes wrote:The sample count field indeed means sample count, not (sample_count / channel_count) - 1 as described above.
According to the ICH4/ICH5 AC'97 Programmer's Reference Manual, the wiki is wrong and you are correct. The sample count field does indeed indicate the number of samples, not the number of frames. (A frame contains one sample for each channel.)
xeyes wrote:What's more troublesome, is that if you program it to an odd value 0xFFFF and run it in stereo mode, the dma will hang at the end and the status/interrupts will still reflect that it is going.
According to the same manual, buffers are not allowed to be odd lengths or span frame boundaries.
Thanks! Edited the wiki and added the points you brought up as well.
Post Reply