1 /*
2 * SiS 7018, Trident 4D Wave DX/NX, Acer Lab M5451 Sound Driver.
3 * Copyright (c) 2002, 2008-2011 S.Zharski <imker@gmx.li>
4 * Distributed under the terms of the MIT license.
5 *
6 */
7 #ifndef _SiS7018_STREAM_H_
8 #define _SiS7018_STREAM_H_
9
10
11 #include "hmulti_audio.h"
12
13
14 class Device;
15
16 class Stream {
17 public:
18 Stream(Device* device, bool isInput);
19 ~Stream();
20
21 status_t Init();
22 void Free();
InitCheck()23 status_t InitCheck() { return fStatus; }
24
25 status_t Start();
26 status_t Stop();
IsActive()27 bool IsActive() { return fIsActive; }
28
29 void GetBuffers(uint32& Flags,
30 int32& BuffersCount,
31 int32& ChannelsCount,
32 uint32& BufferSize,
33 buffer_desc** Buffers);
34
35 void ExchangeBuffers(bigtime_t& RealTime,
36 bigtime_t& FramesCount,
37 int32& BufferCycle);
38
39 void GetFormat(multi_format_info *Format);
40 status_t SetFormat(_multi_format& format,
41 uint32 formats, uint32 rates);
42
43 bool InterruptHandler();
44
45 private:
46
47 uint32 _DecodeRate(uint32 rate);
_UseBankB()48 inline bool _UseBankB() { return (fHWChannel & 0x20) == 0x20; }
_HWVoice()49 inline uint32 _HWVoice() { return fHWChannel & 0x1f; }
50 inline uint32 _HWId();
51
52 Device* fDevice;
53 status_t fStatus;
54 bool fIsInput;
55 bool fIsActive;
56 uint32 fHWChannel;
57
58 area_id fBuffersArea;
59 size_t fBuffersAreaSize;
60 size_t fBufferSamplesCount;
61 void* fBuffersAddress;
62 phys_addr_t fBuffersPhysAddress;
63
64 _multi_format fFormat;
65 bigtime_t fRealTime;
66 bigtime_t fFramesCount;
67 int32 fBufferCycle;
68 };
69
70
71 #endif // _SiS7018_STREAM_H_
72
73