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

嵌入式Linux

开发平台:

Unix_Linux

  1. /*
  2.  * Common audio handling for the SA11x0
  3.  *
  4.  * Copyright (c) 2000 Nicolas Pitre <nico@cam.org>
  5.  *
  6.  * This program is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU General Public License.
  8.  */
  9. /*
  10.  * Buffer Management
  11.  */
  12. typedef struct {
  13. int size; /* buffer size */
  14. char *start; /* points to actual buffer */
  15. dma_addr_t dma_addr; /* physical buffer address */
  16. struct semaphore sem; /* down before touching the buffer */
  17. int master; /* owner for buffer allocation, contain size when true */
  18. struct audio_stream_s *stream; /* owning stream */
  19. } audio_buf_t;
  20. typedef struct audio_stream_s {
  21. audio_buf_t *buffers; /* pointer to audio buffer structures */
  22. audio_buf_t *buf; /* current buffer used by read/write */
  23. u_int buf_idx; /* index for the pointer above... */
  24. u_int fragsize; /* fragment i.e. buffer size */
  25. u_int nbfrags; /* nbr of fragments i.e. buffers */
  26. int bytecount; /* nbr of processed bytes */
  27. int fragcount; /* nbr of fragment transitions */
  28. dmach_t dma_ch; /* DMA channel ID */
  29. wait_queue_head_t wq; /* for poll */
  30. int mapped:1; /* mmap()'ed buffers */
  31. int active:1; /* actually in progress */
  32. int stopped:1; /* might be active but stopped */
  33. } audio_stream_t;
  34. /*
  35.  * State structure for one instance
  36.  */
  37. typedef struct {
  38. audio_stream_t *output_stream;
  39. audio_stream_t *input_stream;
  40. dma_device_t output_dma;
  41. dma_device_t input_dma;
  42. char *output_id;
  43. char *input_id;
  44. int rd_ref:1; /* open reference for recording */
  45. int wr_ref:1; /* open reference for playback */
  46. int need_tx_for_rx:1; /* if data must be sent while receiving */
  47. int tx_spinning:1; /* tx spinning active */
  48. int skip_dma_init:1; /* hack for the SA1111 */
  49. void *data;
  50. void (*hw_init)(void *);
  51. void (*hw_shutdown)(void *);
  52. int (*client_ioctl)(struct inode *, struct file *, uint, ulong);
  53. struct pm_dev *pm_dev;
  54. struct semaphore sem; /* to protect against races in attach() */
  55. } audio_state_t;
  56. /*
  57.  * Functions exported by this module
  58.  */
  59. extern int sa1100_audio_attach( struct inode *inode, struct file *file,
  60. audio_state_t *state);