Browse Source

[ALSA] Remove xxx_t typedefs: PCM

Modules: PCM Midlevel

Remove xxx_t typedefs from the core PCM codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
imx_3.10.17_1.0.0_ga
Takashi Iwai 15 years ago
committed by Jaroslav Kysela
parent
commit
877211f5e1
10 changed files with 983 additions and 952 deletions
  1. +14
    -14
      include/sound/pcm-indirect.h
  2. +227
    -250
      include/sound/pcm.h
  3. +43
    -43
      include/sound/pcm_params.h
  4. +114
    -100
      sound/core/pcm.c
  5. +55
    -55
      sound/core/pcm_compat.c
  6. +159
    -161
      sound/core/pcm_lib.c
  7. +23
    -22
      sound/core/pcm_memory.c
  8. +1
    -1
      sound/core/pcm_misc.c
  9. +332
    -291
      sound/core/pcm_native.c
  10. +15
    -15
      sound/core/pcm_timer.c

+ 14
- 14
include/sound/pcm-indirect.h View File

@ -24,7 +24,7 @@
#include <sound/pcm.h>
typedef struct sndrv_pcm_indirect {
struct snd_pcm_indirect {
unsigned int hw_buffer_size; /* Byte size of hardware buffer */
unsigned int hw_queue_size; /* Max queue size of hw buffer (0 = buffer size) */
unsigned int hw_data; /* Offset to next dst (or src) in hw ring buffer */
@ -35,20 +35,20 @@ typedef struct sndrv_pcm_indirect {
unsigned int sw_io; /* Current software pointer in bytes */
int sw_ready; /* Bytes ready to be transferred to/from hw */
snd_pcm_uframes_t appl_ptr; /* Last seen appl_ptr */
} snd_pcm_indirect_t;
};
typedef void (*snd_pcm_indirect_copy_t)(snd_pcm_substream_t *substream,
snd_pcm_indirect_t *rec, size_t bytes);
typedef void (*snd_pcm_indirect_copy_t)(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec, size_t bytes);
/*
* helper function for playback ack callback
*/
static inline void
snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
snd_pcm_indirect_t *rec,
snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec,
snd_pcm_indirect_copy_t copy)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
int qsize;
@ -89,8 +89,8 @@ snd_pcm_indirect_playback_transfer(snd_pcm_substream_t *substream,
* ptr = current byte pointer
*/
static inline snd_pcm_uframes_t
snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
snd_pcm_indirect_t *rec, unsigned int ptr)
snd_pcm_indirect_playback_pointer(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec, unsigned int ptr)
{
int bytes = ptr - rec->hw_io;
if (bytes < 0)
@ -110,11 +110,11 @@ snd_pcm_indirect_playback_pointer(snd_pcm_substream_t *substream,
* helper function for capture ack callback
*/
static inline void
snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
snd_pcm_indirect_t *rec,
snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec,
snd_pcm_indirect_copy_t copy)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_uframes_t appl_ptr = runtime->control->appl_ptr;
snd_pcm_sframes_t diff = appl_ptr - rec->appl_ptr;
@ -154,8 +154,8 @@ snd_pcm_indirect_capture_transfer(snd_pcm_substream_t *substream,
* ptr = current byte pointer
*/
static inline snd_pcm_uframes_t
snd_pcm_indirect_capture_pointer(snd_pcm_substream_t *substream,
snd_pcm_indirect_t *rec, unsigned int ptr)
snd_pcm_indirect_capture_pointer(struct snd_pcm_substream *substream,
struct snd_pcm_indirect *rec, unsigned int ptr)
{
int qsize;
int bytes = ptr - rec->hw_io;


+ 227
- 250
include/sound/pcm.h View File

@ -28,36 +28,9 @@
#include <linux/poll.h>
#include <linux/bitops.h>
typedef sndrv_pcm_uframes_t snd_pcm_uframes_t;
typedef sndrv_pcm_sframes_t snd_pcm_sframes_t;
typedef enum sndrv_pcm_class snd_pcm_class_t;
typedef enum sndrv_pcm_subclass snd_pcm_subclass_t;
typedef enum sndrv_pcm_stream snd_pcm_stream_t;
typedef enum sndrv_pcm_access snd_pcm_access_t;
typedef enum sndrv_pcm_format snd_pcm_format_t;
typedef enum sndrv_pcm_subformat snd_pcm_subformat_t;
typedef enum sndrv_pcm_state snd_pcm_state_t;
typedef union sndrv_pcm_sync_id snd_pcm_sync_id_t;
typedef struct sndrv_pcm_info snd_pcm_info_t;
typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
typedef enum sndrv_pcm_start snd_pcm_start_t;
typedef enum sndrv_pcm_xrun snd_pcm_xrun_t;
typedef enum sndrv_pcm_tstamp snd_pcm_tstamp_t;
typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
typedef struct sndrv_pcm_channel_info snd_pcm_channel_info_t;
typedef struct sndrv_pcm_status snd_pcm_status_t;
typedef struct sndrv_pcm_mmap_status snd_pcm_mmap_status_t;
typedef struct sndrv_pcm_mmap_control snd_pcm_mmap_control_t;
typedef struct sndrv_mask snd_mask_t;
typedef struct snd_sg_buf snd_pcm_sgbuf_t;
#define snd_pcm_substream_chip(substream) ((substream)->private_data)
#define snd_pcm_chip(pcm) ((pcm)->private_data)
typedef struct _snd_pcm_file snd_pcm_file_t;
typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
#include "pcm_oss.h"
#endif
@ -66,7 +39,7 @@ typedef struct _snd_pcm_runtime snd_pcm_runtime_t;
* Hardware (lowlevel) section
*/
typedef struct _snd_pcm_hardware {
struct snd_pcm_hardware {
unsigned int info; /* SNDRV_PCM_INFO_* */
u64 formats; /* SNDRV_PCM_FMTBIT_* */
unsigned int rates; /* SNDRV_PCM_RATE_* */
@ -80,26 +53,29 @@ typedef struct _snd_pcm_hardware {
unsigned int periods_min; /* min # of periods */
unsigned int periods_max; /* max # of periods */
size_t fifo_size; /* fifo size in bytes */
} snd_pcm_hardware_t;
};
typedef struct _snd_pcm_ops {
int (*open)(snd_pcm_substream_t *substream);
int (*close)(snd_pcm_substream_t *substream);
int (*ioctl)(snd_pcm_substream_t * substream,
struct snd_pcm_ops {
int (*open)(struct snd_pcm_substream *substream);
int (*close)(struct snd_pcm_substream *substream);
int (*ioctl)(struct snd_pcm_substream * substream,
unsigned int cmd, void *arg);
int (*hw_params)(snd_pcm_substream_t * substream, snd_pcm_hw_params_t * params);
int (*hw_free)(snd_pcm_substream_t *substream);
int (*prepare)(snd_pcm_substream_t * substream);
int (*trigger)(snd_pcm_substream_t * substream, int cmd);
snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream);
int (*copy)(snd_pcm_substream_t *substream, int channel, snd_pcm_uframes_t pos,
int (*hw_params)(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
int (*hw_free)(struct snd_pcm_substream *substream);
int (*prepare)(struct snd_pcm_substream *substream);
int (*trigger)(struct snd_pcm_substream *substream, int cmd);
snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream);
int (*copy)(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos,
void __user *buf, snd_pcm_uframes_t count);
int (*silence)(snd_pcm_substream_t *substream, int channel,
int (*silence)(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
struct page *(*page)(snd_pcm_substream_t *substream, unsigned long offset);
int (*mmap)(snd_pcm_substream_t *substream, struct vm_area_struct *vma);
int (*ack)(snd_pcm_substream_t *substream);
} snd_pcm_ops_t;
struct page *(*page)(struct snd_pcm_substream *substream,
unsigned long offset);
int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
int (*ack)(struct snd_pcm_substream *substream);
};
/*
*
@ -212,17 +188,16 @@ typedef struct _snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE
#endif
struct _snd_pcm_file {
snd_pcm_substream_t * substream;
struct _snd_pcm_file * next;
struct snd_pcm_file {
struct snd_pcm_substream *substream;
struct snd_pcm_file *next;
};
typedef struct _snd_pcm_hw_rule snd_pcm_hw_rule_t;
struct snd_pcm_hw_rule;
typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule);
typedef int (*snd_pcm_hw_rule_func_t)(snd_pcm_hw_params_t *params,
snd_pcm_hw_rule_t *rule);
struct _snd_pcm_hw_rule {
struct snd_pcm_hw_rule {
unsigned int cond;
snd_pcm_hw_rule_func_t func;
int var;
@ -230,57 +205,57 @@ struct _snd_pcm_hw_rule {
void *private;
};
typedef struct _snd_pcm_hw_constraints {
snd_mask_t masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
struct snd_pcm_hw_constraints {
struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
snd_interval_t intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
unsigned int rules_num;
unsigned int rules_all;
snd_pcm_hw_rule_t *rules;
} snd_pcm_hw_constraints_t;
struct snd_pcm_hw_rule *rules;
};
static inline snd_mask_t *constrs_mask(snd_pcm_hw_constraints_t *constrs,
snd_pcm_hw_param_t var)
static inline struct snd_mask *constrs_mask(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var)
{
return &constrs->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
}
static inline snd_interval_t *constrs_interval(snd_pcm_hw_constraints_t *constrs,
snd_pcm_hw_param_t var)
static inline struct snd_interval *constrs_interval(struct snd_pcm_hw_constraints *constrs,
snd_pcm_hw_param_t var)
{
return &constrs->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
}
typedef struct {
struct snd_ratnum {
unsigned int num;
unsigned int den_min, den_max, den_step;
} ratnum_t;
};
typedef struct {
struct snd_ratden {
unsigned int num_min, num_max, num_step;
unsigned int den;
} ratden_t;
};
typedef struct {
struct snd_pcm_hw_constraint_ratnums {
int nrats;
ratnum_t *rats;
} snd_pcm_hw_constraint_ratnums_t;
struct snd_ratnum *rats;
};
typedef struct {
struct snd_pcm_hw_constraint_ratdens {
int nrats;
ratden_t *rats;
} snd_pcm_hw_constraint_ratdens_t;
struct snd_ratden *rats;
};
typedef struct {
struct snd_pcm_hw_constraint_list {
unsigned int count;
unsigned int *list;
unsigned int mask;
} snd_pcm_hw_constraint_list_t;
};
struct _snd_pcm_runtime {
struct snd_pcm_runtime {
/* -- Status -- */
snd_pcm_substream_t *trigger_master;
struct snd_pcm_substream *trigger_master;
struct timespec trigger_tstamp; /* trigger timestamp */
int overrange;
snd_pcm_uframes_t avail_max;
@ -306,7 +281,7 @@ struct _snd_pcm_runtime {
unsigned int rate_den;
/* -- SW params -- */
snd_pcm_tstamp_t tstamp_mode; /* mmap timestamp is updated */
int tstamp_mode; /* mmap timestamp is updated */
unsigned int period_step;
unsigned int sleep_min; /* min ticks to sleep */
snd_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
@ -320,11 +295,11 @@ struct _snd_pcm_runtime {
snd_pcm_uframes_t silence_start; /* starting pointer to silence area */
snd_pcm_uframes_t silence_filled; /* size filled with silence */
snd_pcm_sync_id_t sync; /* hardware synchronization ID */
union snd_pcm_sync_id sync; /* hardware synchronization ID */
/* -- mmap -- */
volatile snd_pcm_mmap_status_t *status;
volatile snd_pcm_mmap_control_t *control;
volatile struct snd_pcm_mmap_status *status;
volatile struct snd_pcm_mmap_control *control;
atomic_t mmap_count;
/* -- locking / scheduling -- */
@ -334,15 +309,15 @@ struct _snd_pcm_runtime {
/* -- private section -- */
void *private_data;
void (*private_free)(snd_pcm_runtime_t *runtime);
void (*private_free)(struct snd_pcm_runtime *runtime);
/* -- hardware description -- */
snd_pcm_hardware_t hw;
snd_pcm_hw_constraints_t hw_constraints;
struct snd_pcm_hardware hw;
struct snd_pcm_hw_constraints hw_constraints;
/* -- interrupt callbacks -- */
void (*transfer_ack_begin)(snd_pcm_substream_t *substream);
void (*transfer_ack_end)(snd_pcm_substream_t *substream);
void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
void (*transfer_ack_end)(struct snd_pcm_substream *substream);
/* -- timer -- */
unsigned int timer_resolution; /* timer resolution */
@ -356,19 +331,19 @@ struct _snd_pcm_runtime {
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */
snd_pcm_oss_runtime_t oss;
struct snd_pcm_oss_runtime oss;
#endif
};
typedef struct _snd_pcm_group { /* keep linked substreams */
struct snd_pcm_group { /* keep linked substreams */
spinlock_t lock;
struct list_head substreams;
int count;
} snd_pcm_group_t;
};
struct _snd_pcm_substream {
snd_pcm_t *pcm;
snd_pcm_str_t *pstr;
struct snd_pcm_substream {
struct snd_pcm *pcm;
struct snd_pcm_str *pstr;
void *private_data; /* copied from pcm->private_data */
int number;
char name[32]; /* substream name */
@ -378,32 +353,32 @@ struct _snd_pcm_substream {
unsigned int dma_buf_id;
size_t dma_max;
/* -- hardware operations -- */
snd_pcm_ops_t *ops;
struct snd_pcm_ops *ops;
/* -- runtime information -- */
snd_pcm_runtime_t *runtime;
struct snd_pcm_runtime *runtime;
/* -- timer section -- */
snd_timer_t *timer; /* timer */
struct snd_timer *timer; /* timer */
unsigned timer_running: 1; /* time is running */
spinlock_t timer_lock;
/* -- next substream -- */
snd_pcm_substream_t *next;
struct snd_pcm_substream *next;
/* -- linked substreams -- */
struct list_head link_list; /* linked list member */
snd_pcm_group_t self_group; /* fake group for non linked substream (with substream lock inside) */
snd_pcm_group_t *group; /* pointer to current group */
struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */
struct snd_pcm_group *group; /* pointer to current group */
/* -- assigned files -- */
snd_pcm_file_t *file;
struct snd_pcm_file *file;
struct file *ffile;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */
snd_pcm_oss_substream_t oss;
struct snd_pcm_oss_substream oss;
#endif
snd_info_entry_t *proc_root;
snd_info_entry_t *proc_info_entry;
snd_info_entry_t *proc_hw_params_entry;
snd_info_entry_t *proc_sw_params_entry;
snd_info_entry_t *proc_status_entry;
snd_info_entry_t *proc_prealloc_entry;
struct snd_info_entry *proc_root;
struct snd_info_entry *proc_info_entry;
struct snd_info_entry *proc_hw_params_entry;
struct snd_info_entry *proc_sw_params_entry;
struct snd_info_entry *proc_status_entry;
struct snd_info_entry *proc_prealloc_entry;
/* misc flags */
unsigned int no_mmap_ctrl: 1;
};
@ -415,65 +390,65 @@ struct _snd_pcm_substream {
#endif
struct _snd_pcm_str {
struct snd_pcm_str {
int stream; /* stream (direction) */
snd_pcm_t *pcm;
struct snd_pcm *pcm;
/* -- substreams -- */
unsigned int substream_count;
unsigned int substream_opened;
snd_pcm_substream_t *substream;
struct snd_pcm_substream *substream;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */
snd_pcm_oss_stream_t oss;
struct snd_pcm_oss_stream oss;
#endif
snd_pcm_file_t *files;
snd_minor_t *reg;
snd_info_entry_t *proc_root;
snd_info_entry_t *proc_info_entry;
struct snd_pcm_file *files;
struct snd_minor *reg;
struct snd_info_entry *proc_root;
struct snd_info_entry *proc_info_entry;
#ifdef CONFIG_SND_DEBUG
unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */
snd_info_entry_t *proc_xrun_debug_entry;
struct snd_info_entry *proc_xrun_debug_entry;
#endif
};
struct _snd_pcm {
snd_card_t *card;
struct snd_pcm {
struct snd_card *card;
unsigned int device; /* device number */
unsigned int info_flags;
unsigned short dev_class;
unsigned short dev_subclass;
char id[64];
char name[80];
snd_pcm_str_t streams[2];
struct snd_pcm_str streams[2];
struct semaphore open_mutex;
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (snd_pcm_t *pcm);
void (*private_free) (struct snd_pcm *pcm);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
snd_pcm_oss_t oss;
struct snd_pcm_oss oss;
#endif
};
typedef struct _snd_pcm_notify {
int (*n_register) (snd_pcm_t * pcm);
int (*n_disconnect) (snd_pcm_t * pcm);
int (*n_unregister) (snd_pcm_t * pcm);
struct snd_pcm_notify {
int (*n_register) (struct snd_pcm * pcm);
int (*n_disconnect) (struct snd_pcm * pcm);
int (*n_unregister) (struct snd_pcm * pcm);
struct list_head list;
} snd_pcm_notify_t;
};
/*
* Registering
*/
extern snd_pcm_t *snd_pcm_devices[];
extern snd_minor_t snd_pcm_reg[2];
extern struct snd_pcm *snd_pcm_devices[];
extern struct snd_minor snd_pcm_reg[2];
int snd_pcm_new(snd_card_t * card, char *id, int device,
int snd_pcm_new(struct snd_card *card, char *id, int device,
int playback_count, int capture_count,
snd_pcm_t **rpcm);
int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count);
struct snd_pcm **rpcm);
int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
/*
* Native I/O
@ -481,24 +456,26 @@ int snd_pcm_notify(snd_pcm_notify_t *notify, int nfree);
extern rwlock_t snd_pcm_link_rwlock;
int snd_pcm_info(snd_pcm_substream_t * substream, snd_pcm_info_t *info);
int snd_pcm_info_user(snd_pcm_substream_t * substream, snd_pcm_info_t __user *info);
int snd_pcm_status(snd_pcm_substream_t * substream, snd_pcm_status_t *status);
int snd_pcm_prepare(snd_pcm_substream_t *substream);
int snd_pcm_start(snd_pcm_substream_t *substream);
int snd_pcm_stop(snd_pcm_substream_t *substream, int status);
int snd_pcm_drain_done(snd_pcm_substream_t *substream);
int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
int snd_pcm_info_user(struct snd_pcm_substream *substream,
struct snd_pcm_info __user *info);
int snd_pcm_status(struct snd_pcm_substream *substream,
struct snd_pcm_status *status);
int snd_pcm_prepare(struct snd_pcm_substream *substream);
int snd_pcm_start(struct snd_pcm_substream *substream);
int snd_pcm_stop(struct snd_pcm_substream *substream, int status);
int snd_pcm_drain_done(struct snd_pcm_substream *substream);
#ifdef CONFIG_PM
int snd_pcm_suspend(snd_pcm_substream_t *substream);
int snd_pcm_suspend_all(snd_pcm_t *pcm);
int snd_pcm_suspend(struct snd_pcm_substream *substream);
int snd_pcm_suspend_all(struct snd_pcm *pcm);
#endif
int snd_pcm_kernel_playback_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_capture_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_ioctl(snd_pcm_substream_t *substream, unsigned int cmd, void *arg);
int snd_pcm_open_substream(snd_pcm_t *pcm, int stream, snd_pcm_substream_t **rsubstream);
void snd_pcm_release_substream(snd_pcm_substream_t *substream);
int snd_pcm_kernel_playback_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_capture_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg);
int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, struct snd_pcm_substream **rsubstream);
void snd_pcm_release_substream(struct snd_pcm_substream *substream);
void snd_pcm_vma_notify_data(void *client, void *data);
int snd_pcm_mmap_data(snd_pcm_substream_t *substream, struct file *file, struct vm_area_struct *area);
int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
#if BITS_PER_LONG >= 64
@ -578,30 +555,30 @@ static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
* PCM library
*/
static inline int snd_pcm_stream_linked(snd_pcm_substream_t *substream)
static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
{
return substream->group != &substream->self_group;
}
static inline void snd_pcm_stream_lock(snd_pcm_substream_t *substream)
static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream)
{
read_lock(&snd_pcm_link_rwlock);
spin_lock(&substream->self_group.lock);
}
static inline void snd_pcm_stream_unlock(snd_pcm_substream_t *substream)
static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream)
{
spin_unlock(&substream->self_group.lock);
read_unlock(&snd_pcm_link_rwlock);
}
static inline void snd_pcm_stream_lock_irq(snd_pcm_substream_t *substream)
static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
{
read_lock_irq(&snd_pcm_link_rwlock);
spin_lock(&substream->self_group.lock);
}
static inline void snd_pcm_stream_unlock_irq(snd_pcm_substream_t *substream)
static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
{
spin_unlock(&substream->self_group.lock);
read_unlock_irq(&snd_pcm_link_rwlock);
@ -623,56 +600,56 @@ do { \
list_for_each(pos, &substream->group->substreams)
#define snd_pcm_group_substream_entry(pos) \
list_entry(pos, snd_pcm_substream_t, link_list)
list_entry(pos, struct snd_pcm_substream, link_list)
static inline int snd_pcm_running(snd_pcm_substream_t *substream)
static inline int snd_pcm_running(struct snd_pcm_substream *substream)
{
return (substream->runtime->status->state == SNDRV_PCM_STATE_RUNNING ||
(substream->runtime->status->state == SNDRV_PCM_STATE_DRAINING &&
substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
}
static inline ssize_t bytes_to_samples(snd_pcm_runtime_t *runtime, ssize_t size)
static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * 8 / runtime->sample_bits;
}
static inline snd_pcm_sframes_t bytes_to_frames(snd_pcm_runtime_t *runtime, ssize_t size)
static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * 8 / runtime->frame_bits;
}
static inline ssize_t samples_to_bytes(snd_pcm_runtime_t *runtime, ssize_t size)
static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size)
{
return size * runtime->sample_bits / 8;
}
static inline ssize_t frames_to_bytes(snd_pcm_runtime_t *runtime, snd_pcm_sframes_t size)
static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size)
{
return size * runtime->frame_bits / 8;
}
static inline int frame_aligned(snd_pcm_runtime_t *runtime, ssize_t bytes)
static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes)
{
return bytes % runtime->byte_align == 0;
}
static inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream)
static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->buffer_size);
}
static inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream)
static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return frames_to_bytes(runtime, runtime->period_size);
}
/*
* result is: 0 ... (boundary - 1)
*/
static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtime)
static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr + runtime->buffer_size - runtime->control->appl_ptr;
if (avail < 0)
@ -685,7 +662,7 @@ static inline snd_pcm_uframes_t snd_pcm_playback_avail(snd_pcm_runtime_t *runtim
/*
* result is: 0 ... (boundary - 1)
*/
static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime)
static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime)
{
snd_pcm_sframes_t avail = runtime->status->hw_ptr - runtime->control->appl_ptr;
if (avail < 0)
@ -693,12 +670,12 @@ static inline snd_pcm_uframes_t snd_pcm_capture_avail(snd_pcm_runtime_t *runtime
return avail;
}
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(snd_pcm_runtime_t *runtime)
static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime)
{
return runtime->buffer_size - snd_pcm_playback_avail(runtime);
}
static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runtime)
static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime)
{
return runtime->buffer_size - snd_pcm_capture_avail(runtime);
}
@ -711,9 +688,9 @@ static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(snd_pcm_runtime_t *runt
*
* Returns non-zero if available, or zero if not.
*/
static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->control->avail_min;
}
@ -725,9 +702,9 @@ static inline int snd_pcm_playback_ready(snd_pcm_substream_t *substream)
*
* Returns non-zero if available, or zero if not.
*/
static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) >= runtime->control->avail_min;
}
@ -740,9 +717,9 @@ static inline int snd_pcm_capture_ready(snd_pcm_substream_t *substream)
*
* Returns non-zero if exists, or zero if not.
*/
static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->stop_threshold >= runtime->boundary)
return 1;
@ -757,9 +734,9 @@ static inline int snd_pcm_playback_data(snd_pcm_substream_t *substream)
*
* Returns non-zero if empty, or zero if not.
*/
static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_playback_avail(runtime) >= runtime->buffer_size;
}
@ -771,14 +748,14 @@ static inline int snd_pcm_playback_empty(snd_pcm_substream_t *substream)
*
* Returns non-zero if empty, or zero if not.
*/
static inline int snd_pcm_capture_empty(snd_pcm_substream_t *substream)
static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
return snd_pcm_capture_avail(runtime) == 0;
}
static inline void snd_pcm_trigger_done(snd_pcm_substream_t *substream,
snd_pcm_substream_t *master)
static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream,
struct snd_pcm_substream *master)
{
substream->runtime->trigger_master = master;
}
@ -795,28 +772,28 @@ static inline int hw_is_interval(int var)
var <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL;
}
static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params,
static inline struct snd_mask *hw_param_mask(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->masks[var - SNDRV_PCM_HW_PARAM_FIRST_MASK];
}
static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params,
static inline struct snd_interval *hw_param_interval(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return &params->intervals[var - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL];
}
static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params,
static inline const struct snd_mask *hw_param_mask_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var);
return (const struct snd_mask *)hw_param_mask((struct snd_pcm_hw_params*) params, var);
}
static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params,
static inline const struct snd_interval *hw_param_interval_c(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var)
{
return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var);
return (const struct snd_interval *)hw_param_interval((struct snd_pcm_hw_params*) params, var);
}
#define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS))
@ -832,66 +809,66 @@ static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_
#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
int snd_interval_refine(snd_interval_t *i, const snd_interval_t *v);
void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_interval_t *c);
void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
unsigned int k, snd_interval_t *c);
void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
const snd_interval_t *b, snd_interval_t *c);
int snd_interval_list(snd_interval_t *i, unsigned int count, unsigned int *list, unsigned int mask);
int snd_interval_ratnum(snd_interval_t *i,
unsigned int rats_count, ratnum_t *rats,
int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c);
void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b,
unsigned int k, struct snd_interval *c);
void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k,
const struct snd_interval *b, struct snd_interval *c);
int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask);
int snd_interval_ratnum(struct snd_interval *i,
unsigned int rats_count, struct snd_ratnum *rats,
unsigned int *nump, unsigned int *denp);
void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params);
void _snd_pcm_hw_param_setempty(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var);
int snd_pcm_hw_param_near(snd_pcm_substream_t *substream,
snd_pcm_hw_params_t *params,
void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params);
void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var);
int snd_pcm_hw_param_near(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var,
unsigned int val, int *dir);
int snd_pcm_hw_param_set(snd_pcm_substream_t *pcm,
snd_pcm_hw_params_t *params,
int snd_pcm_hw_param_set(struct snd_pcm_substream *pcm,
struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var,
unsigned int val, int dir);
int snd_pcm_hw_params_choose(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params);
int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_refine(snd_pcm_substream_t *substream, snd_pcm_hw_params_t *params);
int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);
int snd_pcm_hw_constraints_init(snd_pcm_substream_t *substream);
int snd_pcm_hw_constraints_complete(snd_pcm_substream_t *substream);
int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);
int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);
int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int32_t mask);
int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
u_int64_t mask);
int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,
unsigned int min, unsigned int max);
int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var);
int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime,
int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var);
int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_list_t *l);
int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime,
struct snd_pcm_hw_constraint_list *l);
int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratnums_t *r);
int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime,
struct snd_pcm_hw_constraint_ratnums *r);
int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
snd_pcm_hw_constraint_ratdens_t *r);
int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime,
struct snd_pcm_hw_constraint_ratdens *r);
int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime,
unsigned int cond,
unsigned int width,
unsigned int msbits);
int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime,
int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var,
unsigned long step);
int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime,
int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime,
unsigned int cond,
snd_pcm_hw_param_t var);
int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime,
int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime,
unsigned int cond,
int var,
snd_pcm_hw_rule_func_t func, void *private,
@ -925,37 +902,37 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int
snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian);
const char *snd_pcm_format_name(snd_pcm_format_t format);
void snd_pcm_set_ops(snd_pcm_t * pcm, int direction, snd_pcm_ops_t *ops);
void snd_pcm_set_sync(snd_pcm_substream_t * substream);
int snd_pcm_lib_interleave_len(snd_pcm_substream_t *substream);
int snd_pcm_lib_ioctl(snd_pcm_substream_t *substream,
void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, struct snd_pcm_ops *ops);
void snd_pcm_set_sync(struct snd_pcm_substream *substream);
int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);
int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream,
unsigned int cmd, void *arg);
int snd_pcm_update_hw_ptr(snd_pcm_substream_t *substream);
int snd_pcm_playback_xrun_check(snd_pcm_substream_t *substream);
int snd_pcm_capture_xrun_check(snd_pcm_substream_t *substream);
int snd_pcm_playback_xrun_asap(snd_pcm_substream_t *substream);
int snd_pcm_capture_xrun_asap(snd_pcm_substream_t *substream);
void snd_pcm_playback_silence(snd_pcm_substream_t *substream, snd_pcm_uframes_t new_hw_ptr);
void snd_pcm_tick_prepare(snd_pcm_substream_t *substream);
void snd_pcm_tick_set(snd_pcm_substream_t *substream, unsigned long ticks);
void snd_pcm_tick_elapsed(snd_pcm_substream_t *substream);
void snd_pcm_period_elapsed(snd_pcm_substream_t *substream);
snd_pcm_sframes_t snd_pcm_lib_write(snd_pcm_substream_t *substream,
int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
const void __user *buf,
snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_read(snd_pcm_substream_t *substream,
snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream,
void __user *buf, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_writev(snd_pcm_substream_t *substream,
snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_lib_readv(snd_pcm_substream_t *substream,
snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream,
void __user **bufs, snd_pcm_uframes_t frames);
int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime);
int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime);
static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream,
struct snd_dma_buffer *bufp)
{
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_runtime *runtime = substream->runtime;
if (bufp) {
runtime->dma_buffer_p = bufp;
runtime->dma_area = bufp->area;
@ -973,47 +950,47 @@ static inline void snd_pcm_set_runtime_buffer(snd_pcm_substream_t *substream,
* Timer interface
*/
void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream);
void snd_pcm_timer_init(snd_pcm_substream_t * substream);
void snd_pcm_timer_done(snd_pcm_substream_t * substream);
void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
void snd_pcm_timer_init(struct snd_pcm_substream *substream);
void snd_pcm_timer_done(struct snd_pcm_substream *substream);
/*
* Memory
*/
int snd_pcm_lib_preallocate_free(snd_pcm_substream_t *substream);
int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm);
int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);
int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);
int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,
int type, struct device *data,
size_t size, size_t max);
int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
int type, void *data,
size_t size, size_t max);
int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size);
int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream);
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
struct page *snd_pcm_sgbuf_ops_page(snd_pcm_substream_t *substream, unsigned long offset);
struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
/* handle mmap counter - PCM mmap callback should handle this counter properly */
static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
{
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data;
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_inc(&substream->runtime->mmap_count);
}
static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area)
{
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)area->vm_private_data;
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)area->vm_private_data;
atomic_dec(&substream->runtime->mmap_count);
}
/* mmap for io-memory area */
#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA)
#define SNDRV_PCM_INFO_MMAP_IOMEM SNDRV_PCM_INFO_MMAP
int snd_pcm_lib_mmap_iomem(snd_pcm_substream_t *substream, struct vm_area_struct *area);
int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_struct *area);
#else
#define SNDRV_PCM_INFO_MMAP_IOMEM 0
#define snd_pcm_lib_mmap_iomem NULL


+ 43
- 43
include/sound/pcm_params.h View File

@ -22,17 +22,17 @@
*
*/
extern int snd_pcm_hw_param_mask(snd_pcm_substream_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, const snd_mask_t *val);
extern unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
extern int snd_pcm_hw_param_mask(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, const struct snd_mask *val);
extern unsigned int snd_pcm_hw_param_value_min(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir);
extern unsigned int snd_pcm_hw_param_value_max(const snd_pcm_hw_params_t *params,
extern unsigned int snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, int *dir);
extern int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params,
extern int _snd_pcm_hw_param_min(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir);
extern int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params,
extern int _snd_pcm_hw_param_setinteger(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var);
extern int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
extern int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params,
snd_pcm_hw_param_t var, unsigned int val, int dir);
/* To share the same code we have alsa-lib */
@ -71,20 +71,20 @@ INLINE unsigned int ld2(u_int32_t v)
INLINE size_t snd_mask_sizeof(void)
{
return sizeof(snd_mask_t);
return sizeof(struct snd_mask);
}
INLINE void snd_mask_none(snd_mask_t *mask)
INLINE void snd_mask_none(struct snd_mask *mask)
{
memset(mask, 0, sizeof(*mask));
}
INLINE void snd_mask_any(snd_mask_t *mask)
INLINE void snd_mask_any(struct snd_mask *mask)
{
memset(mask, 0xff, SNDRV_MASK_SIZE * sizeof(u_int32_t));
}
INLINE int snd_mask_empty(const snd_mask_t *mask)
INLINE int snd_mask_empty(const struct snd_mask *mask)
{
int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++)
@ -93,7 +93,7 @@ INLINE int snd_mask_empty(const snd_mask_t *mask)
return 1;
}
INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
INLINE unsigned int snd_mask_min(const struct snd_mask *mask)
{
int i;
assert(!snd_mask_empty(mask));
@ -104,7 +104,7 @@ INLINE unsigned int snd_mask_min(const snd_mask_t *mask)
return 0;
}
INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
INLINE unsigned int snd_mask_max(const struct snd_mask *mask)
{
int i;
assert(!snd_mask_empty(mask));
@ -115,19 +115,19 @@ INLINE unsigned int snd_mask_max(const snd_mask_t *mask)
return 0;
}
INLINE void snd_mask_set(snd_mask_t *mask, unsigned int val)
INLINE void snd_mask_set(struct snd_mask *mask, unsigned int val)
{
assert(val <= SNDRV_MASK_BITS);
mask->bits[MASK_OFS(val)] |= MASK_BIT(val);
}
INLINE void snd_mask_reset(snd_mask_t *mask, unsigned int val)
INLINE void snd_mask_reset(struct snd_mask *mask, unsigned int val)
{
assert(val <= SNDRV_MASK_BITS);
mask->bits[MASK_OFS(val)] &= ~MASK_BIT(val);
}
INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int to)
INLINE void snd_mask_set_range(struct snd_mask *mask, unsigned int from, unsigned int to)
{
unsigned int i;
assert(to <= SNDRV_MASK_BITS && from <= to);
@ -135,7 +135,7 @@ INLINE void snd_mask_set_range(snd_mask_t *mask, unsigned int from, unsigned int
mask->bits[MASK_OFS(i)] |= MASK_BIT(i);
}
INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned int to)
INLINE void snd_mask_reset_range(struct snd_mask *mask, unsigned int from, unsigned int to)
{
unsigned int i;
assert(to <= SNDRV_MASK_BITS && from <= to);
@ -143,7 +143,7 @@ INLINE void snd_mask_reset_range(snd_mask_t *mask, unsigned int from, unsigned i
mask->bits[MASK_OFS(i)] &= ~MASK_BIT(i);
}
INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
INLINE void snd_mask_leave(struct snd_mask *mask, unsigned int val)
{
unsigned int v;
assert(val <= SNDRV_MASK_BITS);
@ -152,30 +152,30 @@ INLINE void snd_mask_leave(snd_mask_t *mask, unsigned int val)
mask->bits[MASK_OFS(val)] = v;
}
INLINE void snd_mask_intersect(snd_mask_t *mask, const snd_mask_t *v)
INLINE void snd_mask_intersect(struct snd_mask *mask, const struct snd_mask *v)
{
int i;
for (i = 0; i < SNDRV_MASK_SIZE; i++)
mask->bits[i] &= v->bits[i];
}
INLINE int snd_mask_eq(const snd_mask_t *mask, const snd_mask_t *v)
INLINE int snd_mask_eq(const struct snd_mask *mask, const struct snd_mask *v)
{
return ! memcmp(mask, v, SNDRV_MASK_SIZE * sizeof(u_int32_t));
}
INLINE void snd_mask_copy(snd_mask_t *mask, const snd_mask_t *v)
INLINE void snd_mask_copy(struct snd_mask *mask, const struct snd_mask *v)
{
*mask = *v;
}
INLINE int snd_mask_test(const snd_mask_t *mask, unsigned int val)
INLINE int snd_mask_test(const struct snd_mask *mask, unsigned int val)
{
assert(val <= SNDRV_MASK_BITS);
return mask->bits[MASK_OFS(val)] & MASK_BIT(val);
}
INLINE int snd_mask_single(const snd_mask_t *mask)
INLINE int snd_mask_single(const struct snd_mask *mask)
{
int i, c = 0;
assert(!snd_mask_empty(mask));
@ -191,9 +191,9 @@ INLINE int snd_mask_single(const snd_mask_t *mask)
return 1;
}
INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
INLINE int snd_mask_refine(struct snd_mask *mask, const struct snd_mask *v)
{
snd_mask_t old;
struct snd_mask old;
assert(!snd_mask_empty(mask));
snd_mask_copy(&old, mask);
snd_mask_intersect(mask, v);
@ -202,7 +202,7 @@ INLINE int snd_mask_refine(snd_mask_t *mask, const snd_mask_t *v)
return !snd_mask_eq(mask, &old);
}
INLINE int snd_mask_refine_first(snd_mask_t *mask)
INLINE int snd_mask_refine_first(struct snd_mask *mask)
{
assert(!snd_mask_empty(mask));
if (snd_mask_single(mask))
@ -211,7 +211,7 @@ INLINE int snd_mask_refine_first(snd_mask_t *mask)
return 1;
}
INLINE int snd_mask_refine_last(snd_mask_t *mask)
INLINE int snd_mask_refine_last(struct snd_mask *mask)
{
assert(!snd_mask_empty(mask));
if (snd_mask_single(mask))
@ -220,7 +220,7 @@ INLINE int snd_mask_refine_last(snd_mask_t *mask)
return 1;
}
INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
INLINE int snd_mask_refine_min(struct snd_mask *mask, unsigned int val)
{
assert(!snd_mask_empty(mask));
if (snd_mask_min(mask) >= val)
@ -231,7 +231,7 @@ INLINE int snd_mask_refine_min(snd_mask_t *mask, unsigned int val)
return 1;
}
INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
INLINE int snd_mask_refine_max(struct snd_mask *mask, unsigned int val)
{
assert(!snd_mask_empty(mask));
if (snd_mask_max(mask) <= val)
@ -242,7 +242,7 @@ INLINE int snd_mask_refine_max(snd_mask_t *mask, unsigned int val)
return 1;
}
INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
INLINE int snd_mask_refine_set(struct snd_mask *mask, unsigned int val)
{
int changed;
assert(!snd_mask_empty(mask));
@ -253,13 +253,13 @@ INLINE int snd_mask_refine_set(snd_mask_t *mask, unsigned int val)
return changed;
}
INLINE int snd_mask_value(const snd_mask_t *mask)
INLINE int snd_mask_value(const struct snd_mask *mask)
{
assert(!snd_mask_empty(mask));
return snd_mask_min(mask);
}
INLINE void snd_interval_any(snd_interval_t *i)
INLINE void snd_interval_any(struct snd_interval *i)
{
i->min = 0;
i->openmin = 0;
@ -269,42 +269,42 @@ INLINE void snd_interval_any(snd_interval_t *i)
i->empty = 0;
}
INLINE void snd_interval_none(snd_interval_t *i)
INLINE void snd_interval_none(struct snd_interval *i)
{
i->empty = 1;
}
INLINE int snd_interval_checkempty(const snd_interval_t *i)
INLINE int snd_interval_checkempty(const struct snd_interval *i)
{
return (i->min > i->max ||
(i->min == i->max && (i->openmin || i->openmax)));
}
INLINE int snd_interval_empty(const snd_interval_t *i)
INLINE int snd_interval_empty(const struct snd_interval *i)
{
return i->empty;
}
INLINE int snd_interval_single(const snd_interval_t *i)
INLINE int snd_interval_single(const struct snd_interval *i)
{
assert(!snd_interval_empty(i));
return (i->min == i->max ||
(i->min + 1 == i->max && i->openmax));
}
INLINE int snd_interval_value(const snd_interval_t *i)
INLINE int snd_interval_value(const struct snd_interval *i)
{
assert(snd_interval_single(i));
return i->min;
}
INLINE int snd_interval_min(const snd_interval_t *i)
INLINE int snd_interval_min(const struct snd_interval *i)
{
assert(!snd_interval_empty(i));
return i->min;
}
INLINE int snd_interval_max(const snd_interval_t *i)
INLINE int snd_interval_max(const struct snd_interval *i)
{
unsigned int v;
assert(!snd_interval_empty(i));
@ -314,18 +314,18 @@ INLINE int snd_interval_max(const snd_interval_t *i)
return v;
}
INLINE int snd_interval_test(const snd_interval_t *i, unsigned int val)
INLINE int snd_interval_test(const struct snd_interval *i, unsigned int val)
{
return !((i->min > val || (i->min == val && i->openmin) ||
i->max < val || (i->max == val && i->openmax)));
}
INLINE void snd_interval_copy(snd_interval_t *d, const snd_interval_t *s)
INLINE void snd_interval_copy(struct snd_interval *d, const struct snd_interval *s)
{
*d = *s;
}
INLINE int snd_interval_setinteger(snd_interval_t *i)
INLINE int snd_interval_setinteger(struct snd_interval *i)
{
if (i->integer)
return 0;
@ -335,7 +335,7 @@ INLINE int snd_interval_setinteger(snd_interval_t *i)
return 1;
}
INLINE int snd_interval_eq(const snd_interval_t *i1, const snd_interval_t *i2)
INLINE int snd_interval_eq(const struct snd_interval *i1, const struct snd_interval *i2)
{
if (i1->empty)
return i2->empty;


+ 114
- 100
sound/core/pcm.c View File

@ -33,18 +33,18 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-proj
MODULE_DESCRIPTION("Midlevel PCM code for ALSA.");
MODULE_LICENSE("GPL");
snd_pcm_t *snd_pcm_devices[SNDRV_CARDS * SNDRV_PCM_DEVICES];
struct snd_pcm *snd_pcm_devices[SNDRV_CARDS * SNDRV_PCM_DEVICES];
static LIST_HEAD(snd_pcm_notify_list);
static DECLARE_MUTEX(register_mutex);
static int snd_pcm_free(snd_pcm_t *pcm);
static int snd_pcm_dev_free(snd_device_t *device);
static int snd_pcm_dev_register(snd_device_t *device);
static int snd_pcm_dev_disconnect(snd_device_t *device);
static int snd_pcm_dev_unregister(snd_device_t *device);
static int snd_pcm_free(struct snd_pcm *pcm);
static int snd_pcm_dev_free(struct snd_device *device);
static int snd_pcm_dev_register(struct snd_device *device);
static int snd_pcm_dev_disconnect(struct snd_device *device);
static int snd_pcm_dev_unregister(struct snd_device *device);
static int snd_pcm_control_ioctl(snd_card_t * card,
snd_ctl_file_t * control,
static int snd_pcm_control_ioctl(struct snd_card *card,
struct snd_ctl_file *control,
unsigned int cmd, unsigned long arg)
{
unsigned int tmp;
@ -71,13 +71,13 @@ static int snd_pcm_control_ioctl(snd_card_t * card,
}
case SNDRV_CTL_IOCTL_PCM_INFO:
{
snd_pcm_info_t __user *info;
struct snd_pcm_info __user *info;
unsigned int device, subdevice;
snd_pcm_stream_t stream;
snd_pcm_t *pcm;
snd_pcm_str_t *pstr;
snd_pcm_substream_t *substream;
info = (snd_pcm_info_t __user *)arg;
int stream;
struct snd_pcm *pcm;
struct snd_pcm_str *pstr;
struct snd_pcm_substream *substream;
info = (struct snd_pcm_info __user *)arg;
if (get_user(device, &info->device))
return -EFAULT;
if (device >= SNDRV_PCM_DEVICES)
@ -200,7 +200,7 @@ static char *snd_pcm_tstamp_mode_names[] = {
TSTAMP(MMAP),
};
static const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
static const char *snd_pcm_stream_name(int stream)
{
snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return NULL);
return snd_pcm_stream_names[stream];
@ -208,23 +208,20 @@ static const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
static const char *snd_pcm_access_name(snd_pcm_access_t access)
{
snd_assert(access <= SNDRV_PCM_ACCESS_LAST, return NULL);
return snd_pcm_access_names[access];
}
const char *snd_pcm_format_name(snd_pcm_format_t format)
{
snd_assert(format <= SNDRV_PCM_FORMAT_LAST, return NULL);
return snd_pcm_format_names[format];
}
static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
{
snd_assert(subformat <= SNDRV_PCM_SUBFORMAT_LAST, return NULL);
return snd_pcm_subformat_names[subformat];
}
static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
static const char *snd_pcm_tstamp_mode_name(int mode)
{
snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return NULL);
return snd_pcm_tstamp_mode_names[mode];
@ -232,7 +229,6 @@ static const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
static const char *snd_pcm_state_name(snd_pcm_state_t state)
{
snd_assert(state <= SNDRV_PCM_STATE_LAST, return NULL);
return snd_pcm_state_names[state];
}
@ -268,9 +264,10 @@ static const char *snd_pcm_oss_format_name(int format)
#endif
#ifdef CONFIG_PROC_FS
static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buffer_t *buffer)
static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
struct snd_info_buffer *buffer)
{
snd_pcm_info_t *info;
struct snd_pcm_info *info;
int err;
if (! substream)
@ -302,20 +299,25 @@ static void snd_pcm_proc_info_read(snd_pcm_substream_t *substream, snd_info_buff
kfree(info);
}
static void snd_pcm_stream_proc_info_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
static void snd_pcm_stream_proc_info_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
snd_pcm_proc_info_read(((snd_pcm_str_t *)entry->private_data)->substream, buffer);
snd_pcm_proc_info_read(((struct snd_pcm_str *)entry->private_data)->substream,
buffer);
}
static void snd_pcm_substream_proc_info_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
static void snd_pcm_substream_proc_info_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
snd_pcm_proc_info_read((snd_pcm_substream_t *)entry->private_data, buffer);
snd_pcm_proc_info_read((struct snd_pcm_substream *)entry->private_data,
buffer);
}
static void snd_pcm_substream_proc_hw_params_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data;
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_substream *substream = entry->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
if (!runtime) {
snd_iprintf(buffer, "closed\n");
return;
@ -347,10 +349,11 @@ static void snd_pcm_substream_proc_hw_params_read(snd_info_entry_t *entry, snd_i
snd_pcm_stream_unlock_irq(substream);
}
static void snd_pcm_substream_proc_sw_params_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
snd_pcm_substream_t *substream = (snd_pcm_substream_t *)entry->private_data;
snd_pcm_runtime_t *runtime = substream->runtime;
struct snd_pcm_substream *substream = entry->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
if (!runtime) {
snd_iprintf(buffer, "closed\n");