OSDev.org
https://forum.osdev.org/

thinking about some edits of the AC97 page
https://forum.osdev.org/viewtopic.php?f=8&t=56066
Page 1 of 1

Author:  xeyes [ Mon Dec 27, 2021 8:19 pm ]
Post subject:  thinking about some edits of the AC97 page

I've noticed a possible error on the AC97 page, but would like to first make sure that I did understand it correctly myself.

Quote:
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.

Author:  Octocontrabass [ Mon Dec 27, 2021 9:37 pm ]
Post subject:  Re: thinking about some edits of the AC97 page

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.

Author:  xeyes [ Fri Dec 31, 2021 7:27 pm ]
Post subject:  Re: thinking about some edits of the AC97 page

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/