The ALSA Driver API

This document is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This document is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Table of Contents
1. Management of Cards and Devices
Card Management
snd_card_new --  create and initialize a soundcard structure
snd_card_disconnect --  disconnect all APIs from the file-operations (user space)
snd_card_register --  register the soundcard
snd_component_add --  add a component string
snd_card_file_add --  add the file to the file list of the card
snd_card_file_remove --  remove the file from the file list
snd_power_wait --  wait until the power-state is changed.
Device Components
snd_device_new --  create an ALSA device component
snd_device_free --  release the device from the card
snd_device_register --  register the device
KMOD and Device File Entries
snd_request_card --  try to load the card module
snd_lookup_minor_data --  get user data of a registered device
snd_register_device_for_dev --  Register the ALSA device file for the card
snd_unregister_device --  unregister the device on the given card
Memory Management Helpers
copy_to_user_fromio --  copy data from mmio-space to user-space
copy_from_user_toio --  copy data from user-space to mmio-space
snd_malloc_pages --  allocate pages with the given size
snd_free_pages --  release the pages
snd_dma_alloc_pages --  allocate the buffer area according to the given type
snd_dma_alloc_pages_fallback --  allocate the buffer area according to the given type with fallback
snd_dma_free_pages --  release the allocated buffer
snd_dma_get_reserved_buf --  get the reserved buffer for the given device
snd_dma_reserve_buf --  reserve the buffer
2. PCM API
PCM Core
snd_pcm_new_stream --  create a new PCM stream
snd_pcm_new --  create a new PCM instance
snd_pcm_set_ops --  set the PCM operators
snd_pcm_set_sync --  set the PCM sync id
snd_interval_refine --  refine the interval value of configurator
snd_interval_ratnum --  refine the interval value
snd_interval_list --  refine the interval value from the list
snd_pcm_hw_rule_add --  add the hw-constraint rule
snd_pcm_hw_constraint_integer -- 
snd_pcm_hw_constraint_minmax -- 
snd_pcm_hw_constraint_list -- 
snd_pcm_hw_constraint_ratnums -- 
snd_pcm_hw_constraint_ratdens -- 
snd_pcm_hw_constraint_msbits -- 
snd_pcm_hw_constraint_step -- 
snd_pcm_hw_constraint_pow2 -- 
snd_pcm_hw_param_value -- 
snd_pcm_hw_param_first -- 
snd_pcm_hw_param_last -- 
snd_pcm_lib_ioctl --  a generic PCM ioctl callback
snd_pcm_period_elapsed --  update the pcm status for the next period
snd_pcm_stop -- 
snd_pcm_suspend -- 
snd_pcm_suspend_all -- 
PCM Format Helpers
snd_pcm_format_signed --  Check the PCM format is signed linear
snd_pcm_format_unsigned --  Check the PCM format is unsigned linear
snd_pcm_format_linear --  Check the PCM format is linear
snd_pcm_format_little_endian --  Check the PCM format is little-endian
snd_pcm_format_big_endian --  Check the PCM format is big-endian
snd_pcm_format_width --  return the bit-width of the format
snd_pcm_format_physical_width --  return the physical bit-width of the format
snd_pcm_format_size --  return the byte size of samples on the given format
snd_pcm_format_silence_64 --  return the silent data in 8 bytes array
snd_pcm_format_set_silence --  set the silence data on the buffer
snd_pcm_build_linear_format --  return the suitable linear format for the given condition
snd_pcm_limit_hw_rates --  determine rate_min/rate_max fields
PCM Memory Management
snd_pcm_lib_preallocate_free_for_all --  release all pre-allocated buffers on the pcm
snd_pcm_lib_preallocate_pages --  pre-allocation for the given DMA type
snd_pcm_lib_preallocate_pages_for_all --  pre-allocation for continous memory type (all substreams)
snd_pcm_sgbuf_ops_page --  get the page struct at the given offset
snd_pcm_lib_malloc_pages --  allocate the DMA buffer
snd_pcm_lib_free_pages --  release the allocated DMA buffer.
3. Control/Mixer API
General Control Interface
snd_ctl_new1 --  create a control instance from the template
snd_ctl_free_one --  release the control instance
snd_ctl_add --  add the control instance to the card
snd_ctl_remove --  remove the control from the card and release it
snd_ctl_remove_id --  remove the control of the given id and release it
snd_ctl_rename_id --  replace the id of a control on the card
snd_ctl_find_numid --  find the control instance with the given number-id
snd_ctl_find_id --  find the control instance with the given id
AC97 Codec API
snd_ac97_write --  write a value on the given register
snd_ac97_read --  read a value from the given register
snd_ac97_write_cache --  write a value on the given register and update the cache
snd_ac97_update --  update the value on the given register
snd_ac97_update_bits --  update the bits on the given register
snd_ac97_get_short_name --  retrieve codec name
snd_ac97_bus --  create an AC97 bus component
snd_ac97_mixer --  create an Codec97 component
snd_ac97_update_power --  update the powerdown register
snd_ac97_suspend --  General suspend function for AC97 codec
snd_ac97_resume --  General resume function for AC97 codec
snd_ac97_tune_hardware --  tune up the hardware
snd_ac97_set_rate --  change the rate of the given input/output.
snd_ac97_pcm_assign --  assign AC97 slots to given PCM streams
snd_ac97_pcm_open --  opens the given AC97 pcm
snd_ac97_pcm_close --  closes the given AC97 pcm
snd_ac97_pcm_double_rate_rules --  set double rate constraints
4. MIDI API
Raw MIDI API
snd_rawmidi_receive --  receive the input data from the device
snd_rawmidi_transmit_empty --  check whether the output buffer is empty
snd_rawmidi_transmit_peek --  copy data from the internal buffer
snd_rawmidi_transmit_ack --  acknowledge the transmission
snd_rawmidi_transmit --  copy from the buffer to the device
snd_rawmidi_new --  create a rawmidi instance
snd_rawmidi_set_ops --  set the rawmidi operators
MPU401-UART API
snd_mpu401_uart_interrupt --  generic MPU401-UART interrupt handler
snd_mpu401_uart_interrupt_tx --  generic MPU401-UART transmit irq handler
snd_mpu401_uart_new --  create an MPU401-UART instance
5. Proc Info API
Proc Info Interface
snd_iprintf --  printf on the procfs buffer
snd_info_get_line --  read one line from the procfs buffer
snd_info_get_str --  parse a string token
snd_info_create_module_entry --  create an info entry for the given module
snd_info_create_card_entry --  create an info entry for the given card
snd_card_proc_new --  create an info entry for the given card
snd_info_free_entry --  release the info entry
snd_info_register --  register the info entry
6. Miscellaneous Functions
Hardware-Dependent Devices API
snd_hwdep_new --  create a new hwdep instance
ISA DMA Helpers
snd_dma_program --  program an ISA DMA transfer
snd_dma_disable --  stop the ISA DMA transfer
snd_dma_pointer --  return the current pointer to DMA transfer buffer in bytes
Other Helper Macros
snd_register_device --  Register the ALSA device file for the card
snd_printk --  printk wrapper
snd_printd --  debug printk
snd_assert --  run-time assertion macro
snd_printdd --  debug printk