AC97: Difference between revisions
[unchecked revision] | [unchecked revision] |
Line 81: | Line 81: | ||
! Bit |
! Bit |
||
! Type |
! Type |
||
! Name |
|||
! Description |
! Description |
||
|- |
|- |
||
| 0 || RW || Global Interrupt Enable(GIE) 0=Disable Interrupts 1=Enable Interrupts |
| 0 || RW || Global Interrupt Enable(GIE) || 0=Disable Interrupts 1=Enable Interrupts |
||
|- |
|- |
||
| 1 || RW || Cold reset 0= |
| 1 || RW || Cold reset || 0=Device is in reset and can not be used 1=Resume to operational state |
||
|- |
|- |
||
| 2 || RW || Warm reset |
| 2 || RW || Warm reset || |
||
|- |
|- |
||
| 3 || RW || Shut down 0=Device is powered 1=Shut down |
| 3 || RW || Shut down || 0=Device is powered 1=Shut down |
||
|- |
|- |
||
| 6:4 || RW || Interrupt enable when relevant codec is resumed (you do not need this bits) |
| 6:4 || RW || Interrupt enable when relevant codec is resumed (you do not need this bits) || |
||
|- |
|- |
||
| 19:7 || RO || Reserved |
| 19:7 || RO || Reserved || |
||
|- |
|- |
||
| 21:20 || RW || Channels for PCM Output 00=2 channels 01=4 channels 10=6 channels 11=Reserved |
| 21:20 || RW || Channels for PCM Output || 00=2 channels 01=4 channels 10=6 channels 11=Reserved |
||
|- |
|- |
||
| 23:22 || RW || PCM Output mode 00=16 bit samples 01=20 bit samples |
| 23:22 || RW || PCM Output mode || 00=16 bit samples 01=20 bit samples |
||
|- |
|- |
||
|} |
|} |
Revision as of 10:23, 14 January 2021
AC'97 is an audio codec standard developed by Intel Architecture Labs in 1997.
Detecting AC97 sound card
Sound card is connected into PCI with class 0x04 and subclass 0x01. If you found sound card you can check VendorID and DeviceID if it is supporting AC97. But, because today is used Intel HD Audio cards whose has subclass 0x03, you can probably expect every sound card with subclass 0x01 is sound card compatibile with AC97. AC97 use four BARs, but we need only BAR0 - Native Audio Mixer Base Address and BAR1 - Native Audio Bus Master Base Address. Important notice is that these BARs can be I/O or MMIO. Before any work with card, you must set bit 0 and bit 2 in PCI Command Register for right functionality.
Native Audio Mixer registers
Here is list of all useful registers of BAR0 base address.
Offset | Name | Description | Lenght |
---|---|---|---|
0x00 | RESET | Register Reset | word |
0x02 | MASTER_VOL | Set Master Output Volume | word |
0x0E | MIC_VOL | Set Microphone Volume | word |
0x18 | PCM_VOL | Set Output Volume of PCM patterns | word |
0x1A | REC_SLC | Select Input Device | word |
0x1C | REC_GAIN | Set Input Gain | word |
0x1E | MIC_GAIN | Set Gain of Microphone | word |
Native Audio Bus Master registers
Here is list of all useful registers of BAR1 base address.
Offset | Name | Description | Lenght |
---|---|---|---|
0x00 | PCM INPUT REGISTERS | NABM register set for PCM IN | below |
0x10 | PCM OUTPUT REGISTERS | NABM register set for PCM OUT | below |
0x20 | MICROPHONE INPUT REGISTERS | NABM register set for Microphone | below |
0x2C | GLOBAL_CTL | Global Control Register | dword |
0x30 | GLOBAL_STS | Global Status Register | dword |
NABM register set
Offset | Name | Description | Lenght |
---|---|---|---|
0x00 | BUFFER_DSC_ADDR | Physical Address to Buffer Descriptor List | dword |
0x04 | CUR_INDEX_VAL | Number of Actual Processed Buffer Descriptor Entry | byte |
0x05 | LAST_VALID_INDEX | Number of all Descriptor Entries | byte |
0x06 | TRANSFER_ STS | Status of Transferring Data | word |
0x08 | CUR_IDX_PROC_SAMPLES | Number of Transferred Samples in Actual Processed Entry | word |
0x0A | PRFTCH_INDEX | Number of Actual Processed Buffer Entry | byte |
0x0B | BUFFER_CNT | Most Important Register for controlling Transfers | byte |
Describe of NABM registers
NABM registers contains Global Control and Status, so it is better to describe it as first.
0x2C Global Control
Bit | Type | Name | Description |
---|---|---|---|
0 | RW | Global Interrupt Enable(GIE) | 0=Disable Interrupts 1=Enable Interrupts |
1 | RW | Cold reset | 0=Device is in reset and can not be used 1=Resume to operational state |
2 | RW | Warm reset | |
3 | RW | Shut down | 0=Device is powered 1=Shut down |
6:4 | RW | Interrupt enable when relevant codec is resumed (you do not need this bits) | |
19:7 | RO | Reserved | |
21:20 | RW | Channels for PCM Output | 00=2 channels 01=4 channels 10=6 channels 11=Reserved |
23:22 | RW | PCM Output mode | 00=16 bit samples 01=20 bit samples |
Buffer Descriptor List
When you have sound data is memory, you must describe it in Buffer Descriptor List. Every entry of list have following format:
Offset | Description | Lenght |
---|---|---|
0x00 | Physical Address to sound data in memory | dword |
0x04 | Lenght of sound data-1 | word |
0x06 | Bit 15=Interrupt fired when data from this entry is transferred Bit 14=Last entry of buffer, stop playing Other bits=Reserved | word |
Buffer can have max 32 entries. Every entry can transfer max 0xFFFF samples(write value 0xFFFE to lenght entry), but you must have in mind that one sample mean samples of all channels whose are use. Default are samples in 16 bit patterns, stored in 16 bit boxes, but AC97 can also support 20 bit quality. 20 bit pattern is stored in dwords. If entry have set bit 15(called IOC) after succesful transfer of all data from entry is fired interrupt. If you want use it, be sure that IOCE bit in BUFFER_CNT register is set. If is set bit 14(called BUP) it means that this entry is last from this list and AC97 stop playing sound after trasfering this entry.