Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
core.h File Reference
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/rwsem.h>
#include <linux/pm.h>
#include <linux/stringify.h>

Go to the source code of this file.

Data Structures

struct  snd_device_ops
 
struct  snd_device
 
struct  snd_card
 
struct  snd_minor
 

Macros

#define SNDRV_CARDS   8 /* don't change - minor numbers */
 
#define CONFIG_SND_MAJOR   116 /* standard configuration */
 
#define SNDRV_DEV_TYPE_RANGE_SIZE   0x1000
 
#define SNDRV_DEV_TOPLEVEL   ((__force snd_device_type_t) 0)
 
#define SNDRV_DEV_CONTROL   ((__force snd_device_type_t) 1)
 
#define SNDRV_DEV_LOWLEVEL_PRE   ((__force snd_device_type_t) 2)
 
#define SNDRV_DEV_LOWLEVEL_NORMAL   ((__force snd_device_type_t) 0x1000)
 
#define SNDRV_DEV_PCM   ((__force snd_device_type_t) 0x1001)
 
#define SNDRV_DEV_RAWMIDI   ((__force snd_device_type_t) 0x1002)
 
#define SNDRV_DEV_TIMER   ((__force snd_device_type_t) 0x1003)
 
#define SNDRV_DEV_SEQUENCER   ((__force snd_device_type_t) 0x1004)
 
#define SNDRV_DEV_HWDEP   ((__force snd_device_type_t) 0x1005)
 
#define SNDRV_DEV_INFO   ((__force snd_device_type_t) 0x1006)
 
#define SNDRV_DEV_BUS   ((__force snd_device_type_t) 0x1007)
 
#define SNDRV_DEV_CODEC   ((__force snd_device_type_t) 0x1008)
 
#define SNDRV_DEV_JACK   ((__force snd_device_type_t) 0x1009)
 
#define SNDRV_DEV_COMPRESS   ((__force snd_device_type_t) 0x100A)
 
#define SNDRV_DEV_LOWLEVEL   ((__force snd_device_type_t) 0x2000)
 
#define SNDRV_DEV_BUILD   ((__force snd_device_state_t) 0)
 
#define SNDRV_DEV_REGISTERED   ((__force snd_device_state_t) 1)
 
#define SNDRV_DEV_DISCONNECTED   ((__force snd_device_state_t) 2)
 
#define SNDRV_DEV_CMD_PRE   ((__force snd_device_cmd_t) 0)
 
#define SNDRV_DEV_CMD_NORMAL   ((__force snd_device_cmd_t) 1)
 
#define SNDRV_DEV_CMD_POST   ((__force snd_device_cmd_t) 2)
 
#define snd_device(n)   list_entry(n, struct snd_device, list)
 
#define snd_power_lock(card)   do { (void)(card); } while (0)
 
#define snd_power_unlock(card)   do { (void)(card); } while (0)
 
#define snd_power_get_state(card)   ({ (void)(card); SNDRV_CTL_POWER_D0; })
 
#define snd_power_change_state(card, state)   do { (void)(card); } while (0)
 

Typedefs

typedef int __bitwise snd_device_type_t
 
typedef int __bitwise snd_device_state_t
 
typedef int __bitwise snd_device_cmd_t
 

Functions

void snd_request_card (int card)
 
int snd_register_device_for_dev (int type, struct snd_card *card, int dev, const struct file_operations *f_ops, void *private_data, const char *name, struct device *device)
 

Variables

int snd_major
 
int snd_ecards_limit
 
struct classsound_class
 

: the device file name

snd_register_device - Register the ALSA device file for the card : the device type, SNDRV_DEVICE_TYPE_XXX : the card instance : the device index : the file operations : user pointer for f_ops->open()

Registers an ALSA device file for the given card. The operators have to be set in reg parameter.

This function uses the card's device pointer to link to the correct &struct device.

Returns zero if successful, or a negative error code on failure.

#define snd_card_set_dev(card, devptr)   ((card)->dev = (devptr))
 
#define __snd_printk(level, file, line, format, args...)   printk(format, ##args)
 
#define snd_printk(fmt, args...)   __snd_printk(0, __FILE__, __LINE__, fmt, ##args)
 
#define snd_printd(fmt, args...)   do { } while (0)
 
#define _snd_printd(level, fmt, args...)   do { } while (0)
 
#define snd_BUG()   do { } while (0)
 
#define snd_BUG_ON(cond)   __snd_bug_on(0 && (cond)) /* always false */
 
#define snd_printdd(format, args...)   do { } while (0)
 
#define SNDRV_OSS_VERSION   ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */
 
enum  { SND_PR_ALWAYS, SND_PR_DEBUG, SND_PR_VERBOSE }
 
struct snd_cardsnd_cards [SNDRV_CARDS]
 
int snd_unregister_device (int type, struct snd_card *card, int dev)
 
voidsnd_lookup_minor_data (unsigned int minor, int type)
 
int snd_add_device_sysfs_file (int type, struct snd_card *card, int dev, struct device_attribute *attr)
 
int snd_minor_info_init (void)
 
int snd_minor_info_done (void)
 
int copy_to_user_fromio (void __user *dst, const volatile void __iomem *src, size_t count)
 
int copy_from_user_toio (volatile void __iomem *dst, const void __user *src, size_t count)
 
int snd_card_locked (int card)
 
int snd_card_create (int idx, const char *id, struct module *module, int extra_size, struct snd_card **card_ret)
 
int snd_card_disconnect (struct snd_card *card)
 
int snd_card_free (struct snd_card *card)
 
int snd_card_free_when_closed (struct snd_card *card)
 
void snd_card_set_id (struct snd_card *card, const char *id)
 
int snd_card_register (struct snd_card *card)
 
int snd_card_info_init (void)
 
int snd_card_info_done (void)
 
int snd_component_add (struct snd_card *card, const char *component)
 
int snd_card_file_add (struct snd_card *card, struct file *file)
 
int snd_card_file_remove (struct snd_card *card, struct file *file)
 
void snd_card_unref (struct snd_card *card)
 
int snd_device_new (struct snd_card *card, snd_device_type_t type, void *device_data, struct snd_device_ops *ops)
 
int snd_device_register (struct snd_card *card, void *device_data)
 
int snd_device_register_all (struct snd_card *card)
 
int snd_device_disconnect (struct snd_card *card, void *device_data)
 
int snd_device_disconnect_all (struct snd_card *card)
 
int snd_device_free (struct snd_card *card, void *device_data)
 
int snd_device_free_all (struct snd_card *card, snd_device_cmd_t cmd)
 
void release_and_free_resource (struct resource *res)
 

Macro Definition Documentation

#define __snd_printk (   level,
  file,
  line,
  format,
  args... 
)    printk(format, ##args)

Definition at line 343 of file core.h.

#define _snd_printd (   level,
  fmt,
  args... 
)    do { } while (0)

Definition at line 398 of file core.h.

#define CONFIG_SND_MAJOR   116 /* standard configuration */

Definition at line 38 of file core.h.

#define snd_BUG ( )    do { } while (0)

Definition at line 399 of file core.h.

#define snd_BUG_ON (   cond)    __snd_bug_on(0 && (cond)) /* always false */

Definition at line 404 of file core.h.

#define snd_card_set_dev (   card,
  devptr 
)    ((card)->dev = (devptr))

Definition at line 302 of file core.h.

#define snd_device (   n)    list_entry(n, struct snd_device, list)

Definition at line 94 of file core.h.

#define snd_power_change_state (   card,
  state 
)    do { (void)(card); } while (0)

Definition at line 182 of file core.h.

#define snd_power_get_state (   card)    ({ (void)(card); SNDRV_CTL_POWER_D0; })

Definition at line 181 of file core.h.

#define snd_power_lock (   card)    do { (void)(card); } while (0)

Definition at line 178 of file core.h.

#define snd_power_unlock (   card)    do { (void)(card); } while (0)

Definition at line 179 of file core.h.

#define snd_printd (   fmt,
  args... 
)    do { } while (0)

Definition at line 397 of file core.h.

#define snd_printdd (   format,
  args... 
)    do { } while (0)

Definition at line 419 of file core.h.

#define snd_printk (   fmt,
  args... 
)    __snd_printk(0, __FILE__, __LINE__, fmt, ##args)

snd_printk - printk wrapper : format string

Works like printk() but prints the file and the line of the caller when configured with CONFIG_SND_VERBOSE_PRINTK.

Definition at line 354 of file core.h.

#define SNDRV_CARDS   8 /* don't change - minor numbers */

Definition at line 35 of file core.h.

#define SNDRV_DEV_BUILD   ((__force snd_device_state_t) 0)

Definition at line 68 of file core.h.

#define SNDRV_DEV_BUS   ((__force snd_device_type_t) 0x1007)

Definition at line 61 of file core.h.

#define SNDRV_DEV_CMD_NORMAL   ((__force snd_device_cmd_t) 1)

Definition at line 74 of file core.h.

#define SNDRV_DEV_CMD_POST   ((__force snd_device_cmd_t) 2)

Definition at line 75 of file core.h.

#define SNDRV_DEV_CMD_PRE   ((__force snd_device_cmd_t) 0)

Definition at line 73 of file core.h.

#define SNDRV_DEV_CODEC   ((__force snd_device_type_t) 0x1008)

Definition at line 62 of file core.h.

#define SNDRV_DEV_COMPRESS   ((__force snd_device_type_t) 0x100A)

Definition at line 64 of file core.h.

#define SNDRV_DEV_CONTROL   ((__force snd_device_type_t) 1)

Definition at line 52 of file core.h.

#define SNDRV_DEV_DISCONNECTED   ((__force snd_device_state_t) 2)

Definition at line 70 of file core.h.

#define SNDRV_DEV_HWDEP   ((__force snd_device_type_t) 0x1005)

Definition at line 59 of file core.h.

#define SNDRV_DEV_INFO   ((__force snd_device_type_t) 0x1006)

Definition at line 60 of file core.h.

#define SNDRV_DEV_JACK   ((__force snd_device_type_t) 0x1009)

Definition at line 63 of file core.h.

#define SNDRV_DEV_LOWLEVEL   ((__force snd_device_type_t) 0x2000)

Definition at line 65 of file core.h.

#define SNDRV_DEV_LOWLEVEL_NORMAL   ((__force snd_device_type_t) 0x1000)

Definition at line 54 of file core.h.

#define SNDRV_DEV_LOWLEVEL_PRE   ((__force snd_device_type_t) 2)

Definition at line 53 of file core.h.

#define SNDRV_DEV_PCM   ((__force snd_device_type_t) 0x1001)

Definition at line 55 of file core.h.

#define SNDRV_DEV_RAWMIDI   ((__force snd_device_type_t) 0x1002)

Definition at line 56 of file core.h.

#define SNDRV_DEV_REGISTERED   ((__force snd_device_state_t) 1)

Definition at line 69 of file core.h.

#define SNDRV_DEV_SEQUENCER   ((__force snd_device_type_t) 0x1004)

Definition at line 58 of file core.h.

#define SNDRV_DEV_TIMER   ((__force snd_device_type_t) 0x1003)

Definition at line 57 of file core.h.

#define SNDRV_DEV_TOPLEVEL   ((__force snd_device_type_t) 0)

Definition at line 51 of file core.h.

#define SNDRV_DEV_TYPE_RANGE_SIZE   0x1000

Definition at line 48 of file core.h.

#define SNDRV_OSS_VERSION   ((3<<16)|(8<<8)|(1<<4)|(0)) /* 3.8.1a */

Definition at line 423 of file core.h.

Typedef Documentation

Definition at line 72 of file core.h.

Definition at line 67 of file core.h.

Definition at line 50 of file core.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
SND_PR_ALWAYS 
SND_PR_DEBUG 
SND_PR_VERBOSE 

Definition at line 332 of file core.h.

Function Documentation

int copy_from_user_toio ( volatile void __iomem dst,
const void __user src,
size_t  count 
)

copy_from_user_toio - copy data from user-space to mmio-space : the destination pointer on mmio-space : the source pointer on user-space : the data size to copy in bytes

Copies the data from user-space to mmio-space.

Returns zero if successful, or non-zero on failure.

Definition at line 71 of file memory.c.

int copy_to_user_fromio ( void __user dst,
const volatile void __iomem src,
size_t  count 
)

copy_to_user_fromio - copy data from mmio-space to user-space : the destination pointer on user-space : the source pointer on mmio : the data size to copy in bytes

Copies the data from mmio-space to user-space.

Returns zero if successful, or non-zero on failure.

Definition at line 38 of file memory.c.

void release_and_free_resource ( struct resource res)

Definition at line 44 of file misc.c.

int snd_add_device_sysfs_file ( int  type,
struct snd_card card,
int  dev,
struct device_attribute attr 
)

Definition at line 365 of file sound.c.

int snd_card_create ( int  idx,
const char xid,
struct module module,
int  extra_size,
struct snd_card **  card_ret 
)

snd_card_create - create and initialize a soundcard structure : card index (address) [0 ... (SNDRV_CARDS-1)] : card identification (ASCII string) : top level module for locking : allocate this extra size after the main soundcard structure : the pointer to store the created card instance

Creates and initializes a soundcard structure.

The function allocates snd_card instance via kzalloc with the given space for the driver to use freely. The allocated struct is stored in the given card_ret pointer.

Returns zero if successful or a negative error code.

Definition at line 149 of file init.c.

int snd_card_disconnect ( struct snd_card card)

snd_card_disconnect - disconnect all APIs from the file-operations (user space) : soundcard structure

Disconnects all APIs from the file-operations (user space).

Returns zero, otherwise a negative error code.

Note: The current implementation replaces all active file->f_op with special dummy file operations (they do nothing except release).

Definition at line 345 of file init.c.

int snd_card_file_add ( struct snd_card card,
struct file file 
)

Definition at line 888 of file init.c.

int snd_card_file_remove ( struct snd_card card,
struct file file 
)

Definition at line 925 of file init.c.

int snd_card_free ( struct snd_card card)

Definition at line 486 of file init.c.

int snd_card_free_when_closed ( struct snd_card card)

Definition at line 467 of file init.c.

int snd_card_info_done ( void  )
int snd_card_info_init ( void  )
int snd_card_locked ( int  card)

Definition at line 247 of file init.c.

int snd_card_register ( struct snd_card card)

snd_card_register - register the soundcard : soundcard structure

This function registers all the devices assigned to the soundcard. Until calling this, the ALSA control interface is blocked from the external accesses. Thus, you should call this function at the end of the initialization of the card.

Returns zero otherwise a negative error code if the registration failed.

Definition at line 682 of file init.c.

void snd_card_set_id ( struct snd_card card,
const char nid 
)

snd_card_set_id - set card identification name : soundcard structure : new identification string

This function sets the card identification and checks for name collisions.

Definition at line 608 of file init.c.

void snd_card_unref ( struct snd_card card)

snd_card_unref - release the reference counter : the card instance

Decrements the reference counter. When it reaches to zero, wake up the sleeper and call the destructor if needed.

Definition at line 457 of file init.c.

int snd_component_add ( struct snd_card card,
const char component 
)

snd_component_add - add a component string : soundcard structure : the component id string

This function adds the component id string to the supported list. The component can be referred from the alsa-lib.

Returns zero otherwise a negative error code.

Definition at line 855 of file init.c.

int snd_device_disconnect ( struct snd_card card,
void device_data 
)

snd_device_disconnect - disconnect the device : the card instance : the data pointer to disconnect

Turns the device into the disconnection state, invoking dev_disconnect callback, if the device was already registered.

Usually called from snd_card_disconnect().

Returns zero if successful, or a negative error code on failure or if the device not found.

Definition at line 122 of file device.c.

int snd_device_disconnect_all ( struct snd_card card)

Definition at line 207 of file device.c.

int snd_device_free ( struct snd_card card,
void device_data 
)

snd_device_free - release the device from the card : the card instance : the data pointer to release

Removes the device from the list on the card and invokes the callbacks, dev_disconnect and dev_free, corresponding to the state. Then release the device.

Returns zero if successful, or a negative error code on failure or if the device not found.

Definition at line 79 of file device.c.

int snd_device_free_all ( struct snd_card card,
snd_device_cmd_t  cmd 
)

Definition at line 225 of file device.c.

int snd_device_new ( struct snd_card card,
snd_device_type_t  type,
void device_data,
struct snd_device_ops ops 
)

snd_device_new - create an ALSA device component : the card instance : the device type, SNDRV_DEV_XXX : the data pointer of this device : the operator table

Creates a new device component for the given data pointer. The device will be assigned to the card and managed together by the card.

The data pointer plays a role as the identifier, too, so the pointer address must be unique and unchanged.

Returns zero if successful, or a negative error code on failure.

Definition at line 44 of file device.c.

int snd_device_register ( struct snd_card card,
void device_data 
)

snd_device_register - register the device : the card instance : the data pointer to register

Registers the device which was already created via snd_device_new(). Usually this is called from snd_card_register(), but it can be called later if any new devices are created after invocation of snd_card_register().

Returns zero if successful, or a negative error code on failure or if the device not found.

Definition at line 157 of file device.c.

int snd_device_register_all ( struct snd_card card)

Definition at line 186 of file device.c.

void* snd_lookup_minor_data ( unsigned int  minor,
int  type 
)

snd_lookup_minor_data - get user data of a registered device : the minor number : device type (SNDRV_DEVICE_TYPE_XXX)

Checks that a minor device with the specified type is registered, and returns its user data pointer.

This function increments the reference counter of the card instance if an associated instance with the given minor number and type is found. The caller must call snd_card_unref() appropriately later.

Definition at line 106 of file sound.c.

int snd_minor_info_done ( void  )
int snd_minor_info_init ( void  )
int snd_register_device_for_dev ( int  type,
struct snd_card card,
int  dev,
const struct file_operations f_ops,
void private_data,
const char name,
struct device device 
)

Definition at line 266 of file sound.c.

void snd_request_card ( int  card)
int snd_unregister_device ( int  type,
struct snd_card card,
int  dev 
)

snd_unregister_device - unregister the device on the given card : the device type, SNDRV_DEVICE_TYPE_XXX : the card instance : the device index

Unregisters the device file already registered via snd_register_device().

Returns zero if sucecessful, or a negative error code on failure

Definition at line 344 of file sound.c.

Variable Documentation

Definition at line 50 of file init.c.

int snd_ecards_limit

Definition at line 54 of file sound.c.

int snd_major

Definition at line 36 of file sound.c.

struct class* sound_class

Definition at line 25 of file sound_core.c.