pxa-audio.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/drivers/sound/pxa-audio.h -- audio interface for the Cotula chip
  3.  *
  4.  *  Author: Nicolas Pitre
  5.  *  Created: Aug 15, 2001
  6.  *  Copyright: MontaVista Software Inc.
  7.  *
  8.  *  This program is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License version 2 as
  10.  *  published by the Free Software Foundation.
  11.  */
  12. typedef struct {
  13. int offset; /* current buffer position */
  14. char *data;              /* actual buffer */
  15. pxa_dma_desc *dma_desc; /* pointer to the starting desc */
  16. int master;              /* owner for buffer allocation, contain size whn true */
  17. } audio_buf_t;
  18. typedef struct {
  19. char *name; /* stream identifier */
  20. audio_buf_t *buffers;    /* pointer to audio buffer array */
  21. u_int usr_frag; /* user fragment index */
  22. u_int dma_frag; /* DMA fragment index */
  23. u_int fragsize; /* fragment size */
  24. u_int nbfrags; /* number of fragments */
  25. u_int dma_ch; /* DMA channel number */
  26. dma_addr_t dma_desc_phys; /* phys addr of descriptor ring */
  27. u_int descs_per_frag; /* nbr descriptors per fragment */
  28. int bytecount; /* nbr of processed bytes */
  29. int fragcount; /* nbr of fragment transitions */
  30. struct semaphore sem; /* account for fragment usage */
  31. wait_queue_head_t frag_wq; /* for poll(), etc. */
  32. wait_queue_head_t stop_wq; /* for users of DCSR_STOPIRQEN */
  33. u_long dcmd; /* DMA descriptor dcmd field */
  34. volatile u32 *drcmr; /* the DMA request channel to use */
  35. u_long dev_addr; /* device physical address for DMA */
  36. int mapped:1; /* mmap()'ed buffers */
  37. int output:1; /* 0 for input, 1 for output */
  38. } audio_stream_t;
  39. typedef struct {
  40. audio_stream_t *output_stream;
  41. audio_stream_t *input_stream;
  42. int dev_dsp; /* audio device handle */
  43. int rd_ref:1;           /* open reference for recording */
  44. int wr_ref:1;           /* open reference for playback */
  45. int (*client_ioctl)(struct inode *, struct file *, uint, ulong);
  46. struct semaphore sem; /* prevent races in attach/release */
  47. } audio_state_t;
  48. extern int pxa_audio_attach(struct inode *inode, struct file *file,
  49. audio_state_t *state);
  50. extern void pxa_audio_clear_buf(audio_stream_t *s);