1 /*
2  **********************************************************************
3  *     cardwi.h -- header file for card wave input 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 #ifndef _CARDWI_H
32 #define _CARDWI_H
33 
34 #include "icardwav.h"
35 #include "audio.h"
36 #include "timer.h"
37 
38 struct wavein_buffer {
39 	u16 ossfragshift;
40         u32 fragment_size;
41         u32 numfrags;
42 	u32 hw_pos;		/* hardware cursor position */
43 	u32 pos;		/* software cursor position */
44 	u32 bytestocopy;	/* bytes of recorded data available */
45 	u32 size;
46 	u32 pages;
47 	u32 sizereg;
48 	u32 sizeregval;
49         u32 addrreg;
50         u32 idxreg;
51         u32 adcctl;
52 	void *addr;
53 	u8 cov;
54 	dma_addr_t dma_handle;
55 };
56 
57 struct wiinst
58 {
59 	u8 state;
60 	struct emu_timer timer;
61 	struct wave_format format;
62 	struct wavein_buffer buffer;
63 	wait_queue_head_t wait_queue;
64 	u8 mmapped;
65 	u32 total_recorded;	/* total bytes read() from device */
66 	u32 blocks;
67 	spinlock_t lock;
68 	u8 recsrc;
69 	u16 fxwc;
70 };
71 
72 #define WAVEIN_MAXBUFSIZE	65536
73 #define WAVEIN_MINBUFSIZE	368
74 
75 #define WAVEIN_DEFAULTFRAGLEN	100
76 #define WAVEIN_DEFAULTBUFLEN	1000
77 
78 #define WAVEIN_MINFRAGSHIFT	8
79 #define WAVEIN_MINFRAGS		2
80 
81 int emu10k1_wavein_open(struct emu10k1_wavedevice *);
82 void emu10k1_wavein_close(struct emu10k1_wavedevice *);
83 void emu10k1_wavein_start(struct emu10k1_wavedevice *);
84 void emu10k1_wavein_stop(struct emu10k1_wavedevice *);
85 void emu10k1_wavein_getxfersize(struct wiinst *, u32 *);
86 void emu10k1_wavein_xferdata(struct wiinst *, u8 *, u32 *);
87 int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *);
88 void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *);
89 
90 
91 #endif /* _CARDWI_H */
92