at91rm9200-pcm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * at91rm9200-pcm.h - ALSA PCM interface for the Atmel AT91RM9200 chip
  3. *
  4. * Author: Frank Mandarino <fmandarino@endrelia.com>
  5. * Endrelia Technologies Inc.
  6. * Created: Mar 3, 2006
  7. *
  8. * Based on pxa2xx-pcm.h by:
  9. *
  10. * Author: Nicolas Pitre
  11. * Created: Nov 30, 2004
  12. * Copyright: MontaVista Software, Inc.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. */
  18. /*
  19. * Registers and status bits that are required by the PCM driver.
  20. */
  21. struct at91rm9200_ssc_regs {
  22. void __iomem *cr; /* SSC control */
  23. void __iomem *ier; /* SSC interrupt enable */
  24. void __iomem *idr; /* SSC interrupt disable */
  25. };
  26. struct at91rm9200_pdc_regs {
  27. void __iomem *xpr; /* PDC recv/trans pointer */
  28. void __iomem *xcr; /* PDC recv/trans counter */
  29. void __iomem *xnpr; /* PDC next recv/trans pointer */
  30. void __iomem *xncr; /* PDC next recv/trans counter */
  31. void __iomem *ptcr; /* PDC transfer control */
  32. };
  33. struct at91rm9200_ssc_mask {
  34. u32 ssc_enable; /* SSC recv/trans enable */
  35. u32 ssc_disable; /* SSC recv/trans disable */
  36. u32 ssc_endx; /* SSC ENDTX or ENDRX */
  37. u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */
  38. u32 pdc_enable; /* PDC recv/trans enable */
  39. u32 pdc_disable; /* PDC recv/trans disable */
  40. };
  41. /*
  42. * This structure, shared between the PCM driver and the interface,
  43. * contains all information required by the PCM driver to perform the
  44. * PDC DMA operation. All fields except dma_intr_handler() are initialized
  45. * by the interface. The dms_intr_handler() pointer is set by the PCM
  46. * driver and called by the interface SSC interrupt handler if it is
  47. * non-NULL.
  48. */
  49. typedef struct {
  50. char *name; /* stream identifier */
  51. int pdc_xfer_size; /* PDC counter increment in bytes */
  52. struct at91rm9200_ssc_regs *ssc; /* SSC register addresses */
  53. struct at91rm9200_pdc_regs *pdc; /* PDC receive/transmit registers */
  54. struct at91rm9200_ssc_mask *mask;/* SSC & PDC status bits */
  55. snd_pcm_substream_t *substream;
  56. void (*dma_intr_handler)(u32, snd_pcm_substream_t *);
  57. } at91rm9200_pcm_dma_params_t;
  58. extern struct snd_soc_cpu_dai at91rm9200_i2s_dai[3];
  59. extern struct snd_soc_platform at91rm9200_soc_platform;
  60. /*
  61. * SSC I/O helpers.
  62. * E.g., at91_ssc_write(AT91_SSC(1) + AT91_SSC_CR, AT91_SSC_RXEN);
  63. */
  64. #define AT91_SSC(x) (((x)==0) ? AT91_VA_BASE_SSC0 :\
  65. ((x)==1) ? AT91_VA_BASE_SSC1 : ((x)==2) ? AT91_VA_BASE_SSC2 : NULL)
  66. #define at91_ssc_read(a) ((unsigned long) __raw_readl(a))
  67. #define at91_ssc_write(a,v) __raw_writel((v),(a))