atmel-pcm.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * at91-pcm.h - ALSA PCM interface for the Atmel AT91 SoC.
  3. *
  4. * Copyright (C) 2005 SAN People
  5. * Copyright (C) 2008 Atmel
  6. *
  7. * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com>
  8. *
  9. * Based on at91-pcm. by:
  10. * Frank Mandarino <fmandarino@endrelia.com>
  11. * Copyright 2006 Endrelia Technologies Inc.
  12. *
  13. * Based on pxa2xx-pcm.c by:
  14. *
  15. * Author: Nicolas Pitre
  16. * Created: Nov 30, 2004
  17. * Copyright: (C) 2004 MontaVista Software, Inc.
  18. *
  19. * This program is free software; you can redistribute it and/or modify
  20. * it under the terms of the GNU General Public License as published by
  21. * the Free Software Foundation; either version 2 of the License, or
  22. * (at your option) any later version.
  23. *
  24. * This program is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. * GNU General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU General Public License
  30. * along with this program; if not, write to the Free Software
  31. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  32. */
  33. #ifndef _ATMEL_PCM_H
  34. #define _ATMEL_PCM_H
  35. #include <linux/atmel-ssc.h>
  36. /*
  37. * Registers and status bits that are required by the PCM driver.
  38. */
  39. struct atmel_pdc_regs {
  40. unsigned int xpr; /* PDC recv/trans pointer */
  41. unsigned int xcr; /* PDC recv/trans counter */
  42. unsigned int xnpr; /* PDC next recv/trans pointer */
  43. unsigned int xncr; /* PDC next recv/trans counter */
  44. unsigned int ptcr; /* PDC transfer control */
  45. };
  46. struct atmel_ssc_mask {
  47. u32 ssc_enable; /* SSC recv/trans enable */
  48. u32 ssc_disable; /* SSC recv/trans disable */
  49. u32 ssc_endx; /* SSC ENDTX or ENDRX */
  50. u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */
  51. u32 pdc_enable; /* PDC recv/trans enable */
  52. u32 pdc_disable; /* PDC recv/trans disable */
  53. };
  54. /*
  55. * This structure, shared between the PCM driver and the interface,
  56. * contains all information required by the PCM driver to perform the
  57. * PDC DMA operation. All fields except dma_intr_handler() are initialized
  58. * by the interface. The dms_intr_handler() pointer is set by the PCM
  59. * driver and called by the interface SSC interrupt handler if it is
  60. * non-NULL.
  61. */
  62. struct atmel_pcm_dma_params {
  63. char *name; /* stream identifier */
  64. int pdc_xfer_size; /* PDC counter increment in bytes */
  65. struct ssc_device *ssc; /* SSC device for stream */
  66. struct atmel_pdc_regs *pdc; /* PDC receive or transmit registers */
  67. struct atmel_ssc_mask *mask; /* SSC & PDC status bits */
  68. struct snd_pcm_substream *substream;
  69. void (*dma_intr_handler)(u32, struct snd_pcm_substream *);
  70. };
  71. /*
  72. * SSC register access (since ssc_writel() / ssc_readl() require literal name)
  73. */
  74. #define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
  75. #define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
  76. #endif /* _ATMEL_PCM_H */