1 | /* $Id: waudio.hpp 142 2000-04-23 14:55:46Z ktk $ */
|
---|
2 |
|
---|
3 | /* SCCSID = %W% %E% */
|
---|
4 | /****************************************************************************
|
---|
5 | * *
|
---|
6 | * Copyright (c) IBM Corporation 1994 - 1997. *
|
---|
7 | * *
|
---|
8 | * The following IBM OS/2 source code is provided to you solely for the *
|
---|
9 | * the purpose of assisting you in your development of OS/2 device drivers. *
|
---|
10 | * You may use this code in accordance with the IBM License Agreement *
|
---|
11 | * provided in the IBM Device Driver Source Kit for OS/2. *
|
---|
12 | * *
|
---|
13 | ****************************************************************************/
|
---|
14 | /**@internal %W%
|
---|
15 | * Defines, class definations and prototypes for
|
---|
16 | * @version %I%
|
---|
17 | * @context Unless otherwise noted, all interfaces are Ring-0, 16-bit,
|
---|
18 | * <stack context>.
|
---|
19 | * @history
|
---|
20 | *
|
---|
21 | */
|
---|
22 | #ifndef WAUDIO_INCLUDED
|
---|
23 | #define WAUDIO_INCLUDED
|
---|
24 |
|
---|
25 | #ifndef OS2_INCLUDED
|
---|
26 | #define INCL_NOPMAPI
|
---|
27 | #include <os2.h>
|
---|
28 | #include <os2medef.h>
|
---|
29 | #include <audio.h>
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include "audiohw.hpp"
|
---|
33 | #include "irq.hpp"
|
---|
34 |
|
---|
35 | // defines used to define the PCM, MULAW, and ALAW tables used by
|
---|
36 | // virtual void DevCaps(PAUDIO_CAPS pCaps)
|
---|
37 | #define NUMFREQS 4
|
---|
38 | #define BPSTYPES 2
|
---|
39 | #define MONOSTEREO 2
|
---|
40 |
|
---|
41 | #define DMA_BUFFER_SIZE (ULONG)0x4000
|
---|
42 |
|
---|
43 | // FREQ_TABLE_TYPE class is specific to CS4232 it holds a particular sample
|
---|
44 | // rate and the calue that is required to be written into Clock select bits
|
---|
45 | // indexed register 8 bits 0-3) but this class can be easly update for other
|
---|
46 | // devices
|
---|
47 | class FREQ_TABLE_TYPE {
|
---|
48 | public:
|
---|
49 | ULONG freq;
|
---|
50 | UCHAR clock_select;
|
---|
51 | };
|
---|
52 | // The WaveConfigInfo Class
|
---|
53 | // Built the the WAVESTREAM class, at Audio Ioctl Init time, the WaveConfigInfo
|
---|
54 | // is used to suppply the WAVEAUDIO class with information about a particular
|
---|
55 | // instance and the WAVEAUDIO calss also returns information to the WAVESTREAM
|
---|
56 | // class it needs to calculate the stream time and keep the device quiet if
|
---|
57 | // the stream runs out of data.. All values supplyed by the WAVESTREAM are
|
---|
58 | // noted as Input and values returned by the WAVEAUDIO class are noted as
|
---|
59 | // Output.
|
---|
60 | class WaveConfigInfo {
|
---|
61 | public:
|
---|
62 | ULONG ulSampleRate; // Samples Per Second Input
|
---|
63 | ULONG ulBitsPerSample; // Number of Bits in a Sample Input
|
---|
64 | ULONG ulNumChannels; // Number of Channels (mono or stereo) Input
|
---|
65 | ULONG ulDataType; // type of data (PCM, MuLaw, ALaw etc) Input
|
---|
66 | ULONG ulPCMConsumeRate; // number of bytes consumed/produced per sec Output
|
---|
67 | ULONG ulBytesPerIRQ; // Number of bytes consumed/produced per IRQ Output
|
---|
68 | USHORT usSilence; // Value that produces silence Output
|
---|
69 | };
|
---|
70 | typedef WaveConfigInfo * PWAVECONFIGINFO;
|
---|
71 |
|
---|
72 | class STREAM;
|
---|
73 |
|
---|
74 | class WAVEAUDIO : public AUDIOHW {
|
---|
75 | public:
|
---|
76 | virtual int Pause(STREAM *stream); // Pause the operation
|
---|
77 | virtual int Resume(STREAM *stream); // Resume the operation
|
---|
78 |
|
---|
79 | // Report the Device Capabilities to MMPM/2
|
---|
80 | // This member function is called from
|
---|
81 | // IoctlAudioInit() (IOCTL.CPP) and is the
|
---|
82 | // only MMPM/2 specific call made into the
|
---|
83 | // WAUDIO Class.
|
---|
84 | virtual void DevCaps(PAUDIO_CAPS pCaps);
|
---|
85 | // configure the device for an operation
|
---|
86 | virtual void ConfigDev(STREAM *stream, PWAVECONFIGINFO pConfigInfo);
|
---|
87 |
|
---|
88 |
|
---|
89 | protected:
|
---|
90 | WAVEAUDIO(ULONG devicetype) :
|
---|
91 | AUDIOHW(devicetype)
|
---|
92 | {};
|
---|
93 |
|
---|
94 | UCHAR _ucClockData; // The Clock Select Data on the CS4232 this data
|
---|
95 | // is written into bits 0-3 of the FS and Playback
|
---|
96 | // Data Format Reg (indexed reg 8)
|
---|
97 | UCHAR _ucFormatData; // The Data Format bits on the CS4232 this corresponds
|
---|
98 | // to bits 4-7 indexed registers 8 (playback) and
|
---|
99 | // 28 (capture)
|
---|
100 | USHORT _usCountData; // The count register data (indexed registers 14 and
|
---|
101 | // 15 or 30 and 31)
|
---|
102 | void _vSetup(void); // Common setup code called by both the WAVEPLAY and
|
---|
103 | // WAVEREC constructors
|
---|
104 |
|
---|
105 | private:
|
---|
106 | USHORT _usfind_matching_sample_rate(PULONG pulSampleRate);
|
---|
107 |
|
---|
108 | };
|
---|
109 | typedef WAVEAUDIO *PWAVEAUDIO;
|
---|
110 |
|
---|
111 | #endif
|
---|