lx6464es.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* -*- linux-c -*- *
  3. *
  4. * ALSA driver for the digigram lx6464es interface
  5. *
  6. * Copyright (c) 2009 Tim Blechmann <[email protected]>
  7. */
  8. #ifndef LX6464ES_H
  9. #define LX6464ES_H
  10. #include <linux/spinlock.h>
  11. #include <linux/atomic.h>
  12. #include <sound/core.h>
  13. #include <sound/pcm.h>
  14. #include "lx_core.h"
  15. #define LXP "LX6464ES: "
  16. enum {
  17. ES_cmd_free = 0, /* no command executing */
  18. ES_cmd_processing = 1, /* execution of a read/write command */
  19. ES_read_pending = 2, /* a asynchron read command is pending */
  20. ES_read_finishing = 3, /* a read command has finished waiting (set by
  21. * Interrupt or CancelIrp) */
  22. };
  23. enum lx_stream_status {
  24. LX_STREAM_STATUS_FREE,
  25. /* LX_STREAM_STATUS_OPEN, */
  26. LX_STREAM_STATUS_SCHEDULE_RUN,
  27. /* LX_STREAM_STATUS_STARTED, */
  28. LX_STREAM_STATUS_RUNNING,
  29. LX_STREAM_STATUS_SCHEDULE_STOP,
  30. /* LX_STREAM_STATUS_STOPPED, */
  31. /* LX_STREAM_STATUS_PAUSED */
  32. };
  33. struct lx_stream {
  34. struct snd_pcm_substream *stream;
  35. snd_pcm_uframes_t frame_pos;
  36. enum lx_stream_status status; /* free, open, running, draining
  37. * pause */
  38. unsigned int is_capture:1;
  39. };
  40. struct lx6464es {
  41. struct snd_card *card;
  42. struct pci_dev *pci;
  43. int irq;
  44. u8 mac_address[6];
  45. struct mutex lock; /* interrupt lock */
  46. struct mutex setup_mutex; /* mutex used in hw_params, open
  47. * and close */
  48. /* ports */
  49. unsigned long port_plx; /* io port (size=256) */
  50. void __iomem *port_plx_remapped; /* remapped plx port */
  51. void __iomem *port_dsp_bar; /* memory port (32-bit,
  52. * non-prefetchable,
  53. * size=8K) */
  54. /* messaging */
  55. struct mutex msg_lock; /* message lock */
  56. struct lx_rmh rmh;
  57. u32 irqsrc;
  58. /* configuration */
  59. uint freq_ratio : 2;
  60. uint playback_mute : 1;
  61. uint hardware_running[2];
  62. u32 board_sample_rate; /* sample rate read from
  63. * board */
  64. u16 pcm_granularity; /* board blocksize */
  65. /* dma */
  66. struct snd_dma_buffer capture_dma_buf;
  67. struct snd_dma_buffer playback_dma_buf;
  68. /* pcm */
  69. struct snd_pcm *pcm;
  70. /* streams */
  71. struct lx_stream capture_stream;
  72. struct lx_stream playback_stream;
  73. };
  74. #endif /* LX6464ES_H */