OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Oct 01, 2022 1:53 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: thinking about some edits of the AC97 page
PostPosted: Mon Dec 27, 2021 8:19 pm 
Offline
Member
Member

Joined: Mon Dec 07, 2020 8:09 am
Posts: 212
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.


Top
 Profile  
 
 Post subject: Re: thinking about some edits of the AC97 page
PostPosted: Mon Dec 27, 2021 9:37 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 4149
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.


Top
 Profile  
 
 Post subject: Re: thinking about some edits of the AC97 page
PostPosted: Fri Dec 31, 2021 7:27 pm 
Offline
Member
Member

Joined: Mon Dec 07, 2020 8:09 am
Posts: 212
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group