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