📄 vxsound.bak
字号:
/* snd_pcm_hw_rule_func_t func; */
int var;
int deps[4];
void *private_data;
};
typedef sndrv_interval snd_interval_t;
typedef sndrv_mask snd_mask_t;
//typedef _snd_pcm_hw_rule snd_pcm_hw_rule_t;
//typedef sndrv_pcm_hw_params sndrv_pcm_hw_params_t;
typedef unsigned long sndrv_pcm_uframes_t;
#define snd_pcm_sframes_t sndrv_pcm_uframes_t
struct sndrv_pcm_hw_params {
unsigned int flags;
struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
struct sndrv_mask mres[5]; /* reserved masks */
struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
struct sndrv_interval ires[9]; /* reserved intervals */
unsigned int rmask; /* W: requested masks */
unsigned int cmask; /* R: changed masks */
unsigned int info; /* R: Info flags for returned setup */
unsigned int msbits; /* R: used most significant bits */
unsigned int rate_num; /* R: rate numerator */
unsigned int rate_den; /* R: rate denominator */
sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
unsigned char reserved[64]; /* reserved for future */
};
typedef struct _snd_pcm_hw_constraints {
/* snd_mask_t _masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1 ];
snd_interval_t 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;
/* these definitions taken from memalloc.h */
struct snd_dma_device {
int type; /* SNDRV_DMA_TYPE_XXX */
struct device *dev; /* generic device */
};
struct snd_device_ops {
int (*dev_free)(snd_device_t *device);
};
typedef snd_device_ops snd_device_ops_t;
struct _snd_device {
struct list_head list; /* list of registered devices */
snd_card_t *card; /* card which holds this device */
snd_device_state_t state; /* state of the device */
snd_device_type_t type; /* device type */
void *device_data; /* device structure */
snd_device_ops_t *ops; /* operations */
};
struct snd_dma_buffer {
struct snd_dma_device dev; /* device type */
unsigned char *area; /* virtual pointer */
dma_addr_t addr; /* physical address */
size_t bytes; /* buffer size in bytes */
void *private_data; /* private for allocator; don't touch */
};
typedef unsigned long snd_pcm_uframes_t;
/* lots of items left out of this array.. re-add as needed */
struct _snd_pcm_runtime {
unsigned char *dma_area; /* DMA area */
dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */
size_t dma_bytes; /* size of DMA area */
unsigned int channels; /* channels */
struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */
/* -- hardware description -- */
snd_pcm_hardware_t hw;
snd_pcm_format_t format; /* SNDRV_PCM_FORMAT_* */
unsigned int rate_num;
unsigned int rate_den;
unsigned int rate; /* rate in Hz */
snd_pcm_uframes_t period_size; /* period size */
unsigned int periods; /* periods */
snd_pcm_uframes_t buffer_size; /* buffer size */
unsigned int frame_bits;
#if VXWORKS_UNUSED
snd_pcm_hw_constraints_t hw_constraints;
unsigned int tick_time; /* tick time */
unsigned int sample_bits;
unsigned int info;
#endif
};
typedef struct {
unsigned int num;
unsigned int den_min, den_max, den_step;
} ratnum_t;
typedef struct {
int nrats;
ratnum_t *rats;
} snd_pcm_hw_constraint_ratnums_t;
struct _snd_pcm_str {
int stream; /* stream (direction) */
snd_pcm_t *pcm;
/* -- substreams -- */
unsigned int substream_count;
unsigned int substream_opened;
snd_pcm_substream_t *substream;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */
snd_pcm_oss_stream_t oss;
#endif
/* DW - KEEP THESE OUT FOR NOW
snd_pcm_file_t *files;
snd_minor_t *reg;
snd_info_entry_t *proc_root;
snd_info_entry_t *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;
#endif
};
struct _snd_pcm {
snd_card_t *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 semaphore open_mutex;
wait_queue_head_t open_wait;
void *private_data;
void (*private_free) (snd_pcm_t *pcm);
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
snd_pcm_oss_t oss;
#endif
};
struct _snd_pcm_substream {
snd_pcm_t *pcm;
snd_pcm_str_t *pstr;
void *private_data; /* copied from pcm->private_data */
int number;
char name[32]; /* substream name */
int stream; /* stream (direction) */
size_t buffer_bytes_max; /* limit ring buffer size */
struct snd_dma_buffer dma_buffer;
unsigned int dma_buf_id;
size_t dma_max;
/* -- hardware operations -- */
unsigned int open_flag: 1; /* lowlevel device has been opened */
snd_pcm_ops_t *ops;
/* -- runtime information -- */
snd_pcm_runtime_t *runtime;
/* -- timer section -- */
#if VX_BUILD_NO_INCLUDE
snd_timer_t *timer; /* timer */
#endif
unsigned timer_running: 1; /* time is running */
spinlock_t timer_lock;
/* -- next substream -- */
snd_pcm_substream_t *next;
/* -- linked substreams -- */
struct list_head link_list; /* linked list member */
#if VX_BUILD_NO_INCLUDE
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 */
/* -- assigned files -- */
snd_pcm_file_t *file;
#endif
struct file *ffile;
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
/* -- OSS things -- */
snd_pcm_oss_substream_t oss;
#endif
#if VX_BUILD_NO_INCLUDE
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;
#endif
/* misc flags */
unsigned int no_mmap_ctrl: 1;
/* VxWorks added variables */
SEM_ID sem_period_elapsed;
uint32 interrupt_cnt;
int substr_taskID;
};
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,
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);
int (*volume)(snd_pcm_substream_t * substream, uint8 val);
snd_pcm_uframes_t (*pointer)(snd_pcm_substream_t * substream);
/* int (*copy)(snd_pcm_substream_t *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,
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;
/* sound macros -- don't use dev member of sound card struct*/
#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
/* sound #defines */
#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */
struct _snd_card {
int number; /* number of soundcard (index to snd_cards) */
char id[16]; /* id string of this card */
char driver[16]; /* driver name */
char shortname[32]; /* short name of this soundcard */
char longname[80]; /* name of this soundcard */
char mixername[80]; /* mixer name */
char components[80]; /* card components delimited with space */
void *private_data; /* private data for soundcard */
device_s *dev;
void (*private_free) (snd_card_t *card); /* callback for freeing of private data */
struct list_head devices; /* devices */
#if VX_UNUSED
unsigned int last_numid; /* last used numeric ID */
int controls_count; /* count of all controls */
int user_ctl_count; /* count of all user controls */
struct list_head controls; /* all controls for this card */
int shutdown; /* this card is going down */
#endif
/* VxWorks added variable-- store the PCM pointer here instead of
registering it as done with linux */
snd_pcm_t *pcm;
};
struct sndrv_ctl_elem_id {
unsigned int numid; /* numeric identifier, zero = invalid */
enum sndrv_ctl_elem_iface iface; /* interface identifier */
unsigned int device; /* device/client number */
unsigned int subdevice; /* subdevice (substream) number */
unsigned char name[44]; /* ASCII name of item */
unsigned int index; /* index of item */
};
struct _snd_kcontrol {
snd_ctl_elem_id_t id;
#if VX_UNUSED
struct list_head list; /* list of controls */
unsigned int count; /* count of same elements */
snd_kcontrol_info_t *info;
snd_kcontrol_get_t *get;
snd_kcontrol_put_t *put;
unsigned long private_value;
void *private_data;
void (*private_free)(snd_kcontrol_t *kcontrol);
snd_kcontrol_volatile_t vd[0]; /* volatile data */
#endif
};
typedef struct snd_info_entry snd_info_entry_t;
struct snd_info_entry{
int Unused;
};
struct vx_snd_ap_function
{
int priority;
void (*pfunc) (snd_pcm_substream_t *substr );
};
struct vx_snd_application{
vx_snd_ap_function playback;
vx_snd_ap_function capture;
};
typedef _snd_kcontrol snd_kcontrol_t;
/* sound function prototypes */
snd_card_t *snd_card_new( int idx, const char *xid, void *module, int extra_size);
void snd_card_free( snd_card_t *pcard );
int snd_pcm_lib_preallocate_free_for_all(snd_pcm_t *pcm);
int snd_pcm_new(snd_card_t * card, char *id, int device,
int playback_count, int capture_count,
snd_pcm_t ** rpcm);
void snd_pcm_set_ops(snd_pcm_t *pcm, int direction, snd_pcm_ops_t *ops);
int snd_pcm_format_width(snd_pcm_format_t format);
int snd_pcm_format_unsigned(snd_pcm_format_t format);
int vx_snd_device_new(snd_card_t *card, snd_device_type_t type,
void *device_data, snd_device_ops_t *ops, pci_dev *pci );
int snd_pcm_lib_preallocate_pages_for_all(snd_pcm_t *pcm,
int type, void *data,
size_t size, size_t max);
void vx_snd_pcm_period_elapsed( snd_pcm_substream_t *substream );
int vx_snd_start_driver( pci_dev *pci );
int vx_snd_card_register( snd_card_t *card, snd_pcm_t *pcm );
inline size_t snd_pcm_lib_buffer_bytes(snd_pcm_substream_t *substream);
inline size_t snd_pcm_lib_period_bytes(snd_pcm_substream_t *substream);
/* vxworks sound functions */
#define snd_pcm_substream_proc_done vx_snd_pcm_substream_proc_done
#define snd_pcm_substream_proc_init vx_snd_pcm_substream_proc_init
#define snd_pcm_period_elapsed vx_snd_pcm_period_elapsed
#define snd_card_register vx_snd_card_register
/* unused (for now) sound functions */
#define snd_card_set_pm_callback( card, es1938_suspend, es1938_resume, chip ) /* don't use power management */
#define snd_device_new( card, type, devdta, ops ) vx_snd_device_new( card, type, devdta, ops, pci )
#define SND_PCI_PM_CALLBACKS
#define snd_pcm_stream_proc_done(proc)
#define snd_pcm_substream_chip(substream) ((substream)->private_data)
#define snd_BUG() assert(0)
#define snd_dma_pci_data(struct_) (void *)struct_
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -