1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
/*
**********************************************************************
* recmgr.c -- Recording manager for emu10k1 driver
* Copyright 1999, 2000 Creative Labs, Inc.
*
**********************************************************************
*
* Date Author Summary of changes
* ---- ------ ------------------
* October 20, 1999 Bertrand Lee base code release
*
**********************************************************************
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
* USA.
*
**********************************************************************
*/
#include "hwaccess.h"
#include "recmgr.h"
void emu10k1_start_record(struct record *rec_ptr)
{
struct emu10k1_card *hw_ptr = rec_ptr->card;
DPF(2, "emu10k1_start_record()\n");
DPD(2, "bus addx: %lx\n", rec_ptr->busaddx);
sblive_writeptr(hw_ptr, rec_ptr->bufaddrreg, 0, rec_ptr->busaddx);
sblive_writeptr(hw_ptr, rec_ptr->bufsizereg, 0, rec_ptr->bufsize);
if (rec_ptr->adcctl)
sblive_writeptr(hw_ptr, ADCCR, 0, rec_ptr->adcctl);
return;
}
void emu10k1_stop_record(struct record *rec_ptr)
{
struct emu10k1_card *hw_ptr = rec_ptr->card;
DPF(2, "emu10k1_stop_record()\n");
/* Disable record transfer */
if (rec_ptr->adcctl)
sblive_writeptr(hw_ptr, ADCCR, 0, 0);
sblive_writeptr(hw_ptr, rec_ptr->bufsizereg, 0, ADCBS_BUFSIZE_NONE);
return;
}
void emu10k1_set_record_src(struct record *rec_ptr, u8 recsrc)
{
DPF(2, "emu10k1_set_record_src()\n");
switch (recsrc) {
case WAVERECORD_AC97:
DPF(2, "recording source: AC97\n");
rec_ptr->bufsizereg = ADCBS;
rec_ptr->bufaddrreg = ADCBA;
rec_ptr->bufidxreg = ADCIDX_IDX;
switch (rec_ptr->samplingrate) {
case 0xBB80:
rec_ptr->adcctl = ADCCR_SAMPLERATE_48;
break;
case 0xAC44:
rec_ptr->adcctl = ADCCR_SAMPLERATE_44;
break;
case 0x7D00:
rec_ptr->adcctl = ADCCR_SAMPLERATE_32;
break;
case 0x5DC0:
rec_ptr->adcctl = ADCCR_SAMPLERATE_24;
break;
case 0x5622:
rec_ptr->adcctl = ADCCR_SAMPLERATE_22;
break;
case 0x3E80:
rec_ptr->adcctl = ADCCR_SAMPLERATE_16;
break;
case 0x2B11:
rec_ptr->adcctl = ADCCR_SAMPLERATE_11;
break;
case 0x1F40:
rec_ptr->adcctl = ADCCR_SAMPLERATE_8;
break;
default:
break;
}
rec_ptr->adcctl |= ADCCR_LCHANENABLE;
if (rec_ptr->is_stereo)
rec_ptr->adcctl |= ADCCR_RCHANENABLE;
// rec_ptr->fxwc = 0;
break;
case WAVERECORD_MIC:
DPF(2, "recording source: MIC\n");
rec_ptr->bufsizereg = MICBS;
rec_ptr->bufaddrreg = MICBA;
rec_ptr->bufidxreg = MICIDX_IDX;
rec_ptr->adcctl = 0;
// rec_ptr->fxwc = 0;
break;
case WAVERECORD_FX:
DPF(2, "recording source: FX\n");
rec_ptr->bufsizereg = FXBS;
rec_ptr->bufaddrreg = FXBA;
rec_ptr->bufidxreg = FXIDX_IDX;
rec_ptr->adcctl = 0;
// rec_ptr->fxwc = 0x000ffff;
break;
default:
break;
}
return;
}
|