Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.0 KiB

  1. /***************************************************************************
  2. *
  3. * dsp.h
  4. *
  5. * Copyright (c) 1991-1996 Microsoft Corporation. All Rights Reserved.
  6. *
  7. * This code provides VDD support for SB 2.0 sound output, specifically:
  8. * DSP 2.01+ (excluding SB-MIDI port)
  9. *
  10. ***************************************************************************/
  11. /*****************************************************************************
  12. *
  13. * #defines
  14. *
  15. *****************************************************************************/
  16. /*
  17. * DSP Ports
  18. */
  19. #define RESET_PORT 0x06 // used to reset SoundBlaster
  20. #define READ_STATUS 0x0E // 0xFF-data to read, 0x7F-no data to read
  21. #define READ_DATA 0x0A // App reads data from this port
  22. #define WRITE_STATUS 0x0C // 0x7f-port ready, 0xFF-port not ready
  23. #define WRITE_PORT 0x0C // Data or command
  24. /*
  25. * Only implemented commands are defined
  26. */
  27. /*
  28. * DSP commands - miscellaneous
  29. */
  30. #define DSP_GET_VERSION 0xE1 // dsp version command
  31. #define DSP_CARD_IDENTIFY 0xE0 // byte inverter
  32. #define DSP_TABLE_MUNGE 0xE2 // jump table munging
  33. #define DSP_LOAD_RES_REG 0xE4 // load byte into reserved register
  34. #define DSP_READ_RES_REG 0xE8 // read byte from reserved register
  35. #define DSP_GENERATE_INT 0xF2 // generate an interrupt
  36. /*
  37. * DSP commands - speaker
  38. */
  39. #define DSP_SPEAKER_ON 0xD1 // speaker on command
  40. #define DSP_SPEAKER_OFF 0xD3 // speaker off command
  41. /*
  42. * DSP commands - DMA mode
  43. */
  44. #define DSP_SET_SAMPLE_RATE 0x40 // set the sample rate (one byte format)
  45. #define DSP_SET_BLOCK_SIZE 0x48 // set dma block size
  46. #define DSP_PAUSE_DMA 0xD0 // pause dma
  47. #define DSP_CONTINUE_DMA 0xD4 // continue dma
  48. #define DSP_STOP_AUTO 0xDA // Stop auto init dma
  49. #define DSP_WRITE 0x14 // Start single cycle output (8-bit PCM mono)
  50. #define DSP_WRITE_HS 0x91 // Start single cycle high-speed output (8-bit PCM mono)
  51. #define DSP_WRITE_AUTO 0x1C // Start auto init output (8-bit PCM mono)
  52. #define DSP_WRITE_HS_AUTO 0x90 // Start auto init high=speed output (8-bit PCM mono)
  53. #define DSP_READ 0x24 // Start single cycle input (not implemented)
  54. /*
  55. * Performance parameters for single and auto-init DMA fine tuning
  56. */
  57. #define AUTO_BLOCK_SIZE 0x100 // size of each buffer in auto
  58. #define DEFAULT_LOOKAHEAD 0x600 // target # of bytes to queue to kernel driver
  59. #define MAX_WAVE_BYTES 0x2000 // maximum # of bytes to queue to kernel driver
  60. #define SINGLE_PIECES 2 // number of pieces in each single write
  61. #define SINGLE_SLEEP_ADJ 15 // number of overhead milliseconds in single
  62. /*****************************************************************************
  63. *
  64. * Function Prototypes
  65. *
  66. *****************************************************************************/
  67. /*
  68. * General function prototypes
  69. */
  70. BOOL DspProcessAttach(VOID);
  71. VOID DspProcessDetach(VOID);
  72. VOID DspReadData(BYTE * data);
  73. VOID DspReadStatus(BYTE * data);
  74. VOID DspResetWrite(BYTE data);
  75. VOID DspWrite(BYTE data);
  76. void WriteCommandByte(BYTE command);
  77. VOID ResetDSP(VOID);
  78. void TableMunger(BYTE data);
  79. DWORD GetSamplingRate(void);
  80. void GenerateInterrupt(void);
  81. void SetSpeaker(BOOL);
  82. /*
  83. * Wave function prototypes
  84. */
  85. UINT FindWaveDevice(void);
  86. BOOL OpenWaveDevice(VOID);
  87. void ResetWaveDevice(void);
  88. void CloseWaveDevice(void);
  89. BOOL TestWaveFormat(DWORD sampleRate);
  90. BOOL SetWaveFormat(void);
  91. void PauseDMA(void);
  92. void ContinueDMA(void);
  93. ULONG GetDMATransferAddress(void);
  94. void SetDMAStatus(BOOL requesting, BOOL tc);
  95. BOOL StartAutoWave(void);
  96. void StopAutoWave(BOOL wait);
  97. BOOL StartSingleWave(void);
  98. void StopSingleWave(BOOL wait);
  99. DWORD WINAPI AutoThreadEntry(LPVOID context);
  100. DWORD WINAPI SingleThreadEntry(LPVOID context);
  101. DWORD WINAPI SingleSynchThreadEntry(LPVOID context);