lx6464es.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* -*- linux-c -*- *
  2. *
  3. * ALSA driver for the digigram lx6464es interface
  4. *
  5. * Copyright (c) 2009 Tim Blechmann <tim@klingt.org>
  6. *
  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 as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; see the file COPYING. If not, write to
  20. * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. * Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. #ifndef LX6464ES_H
  25. #define LX6464ES_H
  26. #include <linux/spinlock.h>
  27. #include <linux/atomic.h>
  28. #include <sound/core.h>
  29. #include <sound/pcm.h>
  30. #include "lx_core.h"
  31. #define LXP "LX6464ES: "
  32. enum {
  33. ES_cmd_free = 0, /* no command executing */
  34. ES_cmd_processing = 1, /* execution of a read/write command */
  35. ES_read_pending = 2, /* a asynchron read command is pending */
  36. ES_read_finishing = 3, /* a read command has finished waiting (set by
  37. * Interrupt or CancelIrp) */
  38. };
  39. enum lx_stream_status {
  40. LX_STREAM_STATUS_FREE,
  41. /* LX_STREAM_STATUS_OPEN, */
  42. LX_STREAM_STATUS_SCHEDULE_RUN,
  43. /* LX_STREAM_STATUS_STARTED, */
  44. LX_STREAM_STATUS_RUNNING,
  45. LX_STREAM_STATUS_SCHEDULE_STOP,
  46. /* LX_STREAM_STATUS_STOPPED, */
  47. /* LX_STREAM_STATUS_PAUSED */
  48. };
  49. struct lx_stream {
  50. struct snd_pcm_substream *stream;
  51. snd_pcm_uframes_t frame_pos;
  52. enum lx_stream_status status; /* free, open, running, draining
  53. * pause */
  54. unsigned int is_capture:1;
  55. };
  56. struct lx6464es {
  57. struct snd_card *card;
  58. struct pci_dev *pci;
  59. int irq;
  60. u8 mac_address[6];
  61. struct mutex lock; /* interrupt lock */
  62. struct mutex setup_mutex; /* mutex used in hw_params, open
  63. * and close */
  64. /* ports */
  65. unsigned long port_plx; /* io port (size=256) */
  66. void __iomem *port_plx_remapped; /* remapped plx port */
  67. void __iomem *port_dsp_bar; /* memory port (32-bit,
  68. * non-prefetchable,
  69. * size=8K) */
  70. /* messaging */
  71. struct mutex msg_lock; /* message lock */
  72. struct lx_rmh rmh;
  73. u32 irqsrc;
  74. /* configuration */
  75. uint freq_ratio : 2;
  76. uint playback_mute : 1;
  77. uint hardware_running[2];
  78. u32 board_sample_rate; /* sample rate read from
  79. * board */
  80. u16 pcm_granularity; /* board blocksize */
  81. /* dma */
  82. struct snd_dma_buffer capture_dma_buf;
  83. struct snd_dma_buffer playback_dma_buf;
  84. /* pcm */
  85. struct snd_pcm *pcm;
  86. /* streams */
  87. struct lx_stream capture_stream;
  88. struct lx_stream playback_stream;
  89. };
  90. #endif /* LX6464ES_H */