passthrough.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. **********************************************************************
  3. * passthrough.h -- Emu10k1 digital passthrough header file
  4. * Copyright (C) 2001 Juha Yrjölä <jyrjola@cc.hut.fi>
  5. *
  6. **********************************************************************
  7. *
  8. * Date Author Summary of changes
  9. * ---- ------ ------------------
  10. * May 15, 2001 Juha Yrjölä base code release
  11. *
  12. **********************************************************************
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public
  25. * License along with this program; if not, write to the Free
  26. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
  27. * USA.
  28. *
  29. **********************************************************************
  30. */
  31. #ifndef _PASSTHROUGH_H
  32. #define _PASSTHROUGH_H
  33. #include "audio.h"
  34. /* number of 16-bit stereo samples in XTRAM buffer */
  35. #define PT_SAMPLES 0x8000
  36. #define PT_BLOCKSAMPLES 0x400
  37. #define PT_BLOCKSIZE (PT_BLOCKSAMPLES*4)
  38. #define PT_BLOCKSIZE_LOG2 12
  39. #define PT_BLOCKCOUNT (PT_SAMPLES/PT_BLOCKSAMPLES)
  40. #define PT_INITPTR (PT_SAMPLES/2-1)
  41. #define PT_STATE_INACTIVE 0
  42. #define PT_STATE_ACTIVATED 1
  43. #define PT_STATE_PLAYING 2
  44. /* passthrough struct */
  45. struct pt_data
  46. {
  47. u8 selected, state, spcs_to_use;
  48. int intr_gpr, enable_gpr, pos_gpr;
  49. u32 blocks_played, blocks_copied, old_spcs[3];
  50. u32 playptr, copyptr;
  51. u32 prepend_size;
  52. u8 *buf;
  53. u8 ac3data;
  54. char *patch_name, *intr_gpr_name, *enable_gpr_name, *pos_gpr_name;
  55. wait_queue_head_t wait;
  56. spinlock_t lock;
  57. };
  58. /*
  59. Passthrough can be done in two methods:
  60. Method 1 : tram
  61. In original emu10k1, we couldn't bypass the sample rate converters. Even at 48kHz
  62. (the internal sample rate of the emu10k1) the samples would get messed up.
  63. To over come this, samples are copied into the tram and a special dsp patch copies
  64. the samples out and generates interrupts when a block has finnished playing.
  65. Method 2 : Interpolator bypass
  66. Creative fixed the sample rate convert problem in emu10k1 rev 7 and higher
  67. (including the emu10k2 (audigy)). This allows us to use the regular, and much simpler
  68. playback method.
  69. In both methods, dsp code is used to mux audio and passthrough. This ensures that the spdif
  70. doesn't receive audio and pasthrough data at the same time. The spdif flag SPCS_NOTAUDIODATA
  71. is set to tell
  72. */
  73. // emu10k1 revs greater than or equal to 7 can use method2
  74. #define USE_PT_METHOD2 (card->is_audigy)
  75. #define USE_PT_METHOD1 !USE_PT_METHOD2
  76. ssize_t emu10k1_pt_write(struct file *file, const char __user *buf, size_t count);
  77. int emu10k1_pt_setup(struct emu10k1_wavedevice *wave_dev);
  78. void emu10k1_pt_stop(struct emu10k1_card *card);
  79. void emu10k1_pt_waveout_update(struct emu10k1_wavedevice *wave_dev);
  80. #endif /* _PASSTHROUGH_H */