Writing an ALSA Driver
iv
Constructor .............................................................................................................. 23
... And the Destructor? ............................................................................................... 24
Runtime Pointer - The Chest of PCM Information .......................................................... 25
Hardware Description ........................................................................................ 27
PCM Configurations .......................................................................................... 29
DMA Buffer Information ................................................................................... 29
Running Status ................................................................................................. 29
Private Data ..................................................................................................... 30
Interrupt Callbacks ............................................................................................ 30
Operators ................................................................................................................. 30
open callback ................................................................................................... 31
close callback ................................................................................................... 31
ioctl callback .................................................................................................... 32
hw_params callback .......................................................................................... 32
hw_free callback ............................................................................................... 32
prepare callback ................................................................................................ 33
trigger callback ................................................................................................. 33
pointer callback ................................................................................................ 34
copy and silence callbacks .................................................................................. 34
ack callback ..................................................................................................... 34
page callback ................................................................................................... 34
Interrupt Handler ...................................................................................................... 35
Interrupts at the period (fragment) boundary .......................................................... 35
High frequency timer interrupts ........................................................................... 35
On calling snd_pcm_period_elapsed() ....................................................... 36
Atomicity ................................................................................................................ 36
Constraints ............................................................................................................... 37
6. Control Interface ........................................................................................................... 40
General ................................................................................................................... 40
Definition of Controls ................................................................................................ 40
Control Names ......................................................................................................... 41
Global capture and playback ............................................................................... 41
Tone-controls ................................................................................................... 41
3D controls ...................................................................................................... 41
Mic boost ........................................................................................................ 41
Access Flags ............................................................................................................ 42
Callbacks ................................................................................................................. 42
info callback .................................................................................................... 42
get callback ..................................................................................................... 43
put callback ..................................................................................................... 44
Callbacks are not atomic .................................................................................... 44
Constructor .............................................................................................................. 44
Change Notification .................................................................................................. 45
Metadata ................................................................................................................. 45
7. API for AC97 Codec ..................................................................................................... 47
General ................................................................................................................... 47
Full Code Example ................................................................................................... 48
Constructor .............................................................................................................. 49
Callbacks ................................................................................................................. 49
Updating Registers in The Driver ................................................................................ 50
Clock Adjustment ..................................................................................................... 51
Proc Files ................................................................................................................ 51
Multiple Codecs ....................................................................................................... 51
8. MIDI (MPU401-UART) Interface .................................................................................... 52