1dece8853e5ce1b7838318d74d09bc84d83aa0fc
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / sound / oss / emu10k1 / cardwo.h
1 /*
2 **********************************************************************
3 * cardwo.h -- header file for card wave out functions
4 * Copyright 1999, 2000 Creative Labs, Inc.
5 *
6 **********************************************************************
7 *
8 * Date Author Summary of changes
9 * ---- ------ ------------------
10 * October 20, 1999 Bertrand Lee 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
32 #ifndef _CARDWO_H
33 #define _CARDWO_H
34
35 #include "icardwav.h"
36 #include "audio.h"
37 #include "voicemgr.h"
38 #include "timer.h"
39
40 /* setting this to other than a power of two may break some applications */
41 #define WAVEOUT_MAXBUFSIZE MAXBUFSIZE
42
43 #define WAVEOUT_DEFAULTFRAGLEN 20 /* Time to play a fragment in ms (latency) */
44 #define WAVEOUT_DEFAULTBUFLEN 500 /* Time to play the entire buffer in ms */
45
46 #define WAVEOUT_MINFRAGSHIFT 6 /* Minimum fragment size in bytes is 2^6 */
47 #define WAVEOUT_MINFRAGS 3 /* _don't_ go bellow 3, it would break silence filling */
48 #define WAVEOUT_MAXVOICES 6
49
50 struct waveout_buffer {
51 u16 ossfragshift;
52 u32 numfrags;
53 u32 fragment_size; /* in bytes units */
54 u32 size; /* in bytes units */
55 u32 pages; /* buffer size in page units*/
56 u32 silence_pos; /* software cursor position (including silence bytes) */
57 u32 hw_pos; /* hardware cursor position */
58 u32 free_bytes; /* free bytes available on the buffer (not including silence bytes) */
59 u8 fill_silence;
60 u32 silence_bytes; /* silence bytes on the buffer */
61 };
62
63 struct woinst
64 {
65 u8 state;
66 u8 num_voices;
67 struct emu_voice voice[WAVEOUT_MAXVOICES];
68 struct emu_timer timer;
69 struct wave_format format;
70 struct waveout_buffer buffer;
71 wait_queue_head_t wait_queue;
72 u8 mmapped;
73 u32 total_copied; /* total number of bytes written() to the buffer (excluding silence) */
74 u32 total_played; /* total number of bytes played including silence */
75 u32 blocks;
76 u8 device;
77 spinlock_t lock;
78 };
79
80 int emu10k1_waveout_open(struct emu10k1_wavedevice *);
81 void emu10k1_waveout_close(struct emu10k1_wavedevice *);
82 void emu10k1_waveout_start(struct emu10k1_wavedevice *);
83 void emu10k1_waveout_stop(struct emu10k1_wavedevice *);
84 void emu10k1_waveout_getxfersize(struct woinst*, u32 *);
85 void emu10k1_waveout_xferdata(struct woinst*, u8 __user *, u32 *);
86 void emu10k1_waveout_fillsilence(struct woinst*);
87 int emu10k1_waveout_setformat(struct emu10k1_wavedevice*, struct wave_format*);
88 void emu10k1_waveout_update(struct woinst*);
89
90 #endif /* _CARDWO_H */