ecard.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. **********************************************************************
  3. * ecard.h
  4. * Copyright 1999, 2000 Creative Labs, Inc.
  5. *
  6. **********************************************************************
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (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
  19. * License along with this program; if not, write to the Free
  20. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  21. * USA.
  22. *
  23. **********************************************************************
  24. */
  25. #ifndef _ECARD_H
  26. #define _ECARD_H
  27. #include "8010.h"
  28. #include "hwaccess.h"
  29. #include <linux/init.h>
  30. /* In A1 Silicon, these bits are in the HC register */
  31. #define HOOKN_BIT (1L << 12)
  32. #define HANDN_BIT (1L << 11)
  33. #define PULSEN_BIT (1L << 10)
  34. #define EC_GDI1 (1 << 13)
  35. #define EC_GDI0 (1 << 14)
  36. #define EC_NUM_CONTROL_BITS 20
  37. #define EC_AC3_DATA_SELN 0x0001L
  38. #define EC_EE_DATA_SEL 0x0002L
  39. #define EC_EE_CNTRL_SELN 0x0004L
  40. #define EC_EECLK 0x0008L
  41. #define EC_EECS 0x0010L
  42. #define EC_EESDO 0x0020L
  43. #define EC_TRIM_CSN 0x0040L
  44. #define EC_TRIM_SCLK 0x0080L
  45. #define EC_TRIM_SDATA 0x0100L
  46. #define EC_TRIM_MUTEN 0x0200L
  47. #define EC_ADCCAL 0x0400L
  48. #define EC_ADCRSTN 0x0800L
  49. #define EC_DACCAL 0x1000L
  50. #define EC_DACMUTEN 0x2000L
  51. #define EC_LEDN 0x4000L
  52. #define EC_SPDIF0_SEL_SHIFT 15
  53. #define EC_SPDIF1_SEL_SHIFT 17
  54. #define EC_SPDIF0_SEL_MASK (0x3L << EC_SPDIF0_SEL_SHIFT)
  55. #define EC_SPDIF1_SEL_MASK (0x7L << EC_SPDIF1_SEL_SHIFT)
  56. #define EC_SPDIF0_SELECT(_x) (((_x) << EC_SPDIF0_SEL_SHIFT) & EC_SPDIF0_SEL_MASK)
  57. #define EC_SPDIF1_SELECT(_x) (((_x) << EC_SPDIF1_SEL_SHIFT) & EC_SPDIF1_SEL_MASK)
  58. #define EC_CURRENT_PROM_VERSION 0x01 /* Self-explanatory. This should
  59. * be incremented any time the EEPROM's
  60. * format is changed. */
  61. #define EC_EEPROM_SIZE 0x40 /* ECARD EEPROM has 64 16-bit words */
  62. /* Addresses for special values stored in to EEPROM */
  63. #define EC_PROM_VERSION_ADDR 0x20 /* Address of the current prom version */
  64. #define EC_BOARDREV0_ADDR 0x21 /* LSW of board rev */
  65. #define EC_BOARDREV1_ADDR 0x22 /* MSW of board rev */
  66. #define EC_LAST_PROMFILE_ADDR 0x2f
  67. #define EC_SERIALNUM_ADD 0x30 /* First word of serial number. The number
  68. * can be up to 30 characters in length
  69. * and is stored as a NULL-terminated
  70. * ASCII string. Any unused bytes must be
  71. * filled with zeros */
  72. #define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */
  73. /* Most of this stuff is pretty self-evident. According to the hardware
  74. * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
  75. * offset problem. Weird.
  76. */
  77. #define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | EC_TRIM_CSN)
  78. #define EC_DEFAULT_ADC_GAIN 0xC4C4
  79. #define EC_DEFAULT_SPDIF0_SEL 0x0
  80. #define EC_DEFAULT_SPDIF1_SEL 0x4
  81. #define HC_EA 0x01L
  82. /* ECARD state structure. This structure maintains the state
  83. * for various portions of the ECARD's onboard hardware.
  84. */
  85. struct ecard_state {
  86. u32 control_bits;
  87. u16 adc_gain;
  88. u16 mux0_setting;
  89. u16 mux1_setting;
  90. u16 mux2_setting;
  91. };
  92. void emu10k1_ecard_init(struct emu10k1_card *) __devinit;
  93. #endif /* _ECARD_H */