| 1 |
|
|---|
| 2 | #ifndef __AD1816A_H
|
|---|
| 3 | #define __AD1816A_H
|
|---|
| 4 |
|
|---|
| 5 | /*
|
|---|
| 6 | ad1816a.h - definitions for ADI SoundPort AD1816A chip.
|
|---|
| 7 | Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
|
|---|
| 8 |
|
|---|
| 9 | This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | it under the terms of the GNU General Public License as published by
|
|---|
| 11 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | (at your option) any later version.
|
|---|
| 13 |
|
|---|
| 14 | This program is distributed in the hope that it will be useful,
|
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | GNU General Public License for more details.
|
|---|
| 18 |
|
|---|
| 19 | You should have received a copy of the GNU General Public License
|
|---|
| 20 | along with this program; if not, write to the Free Software
|
|---|
| 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 | #include "control.h"
|
|---|
| 25 | #include "pcm.h"
|
|---|
| 26 | #include "timer.h"
|
|---|
| 27 |
|
|---|
| 28 | #define AD1816A_REG(r) (chip->port + r)
|
|---|
| 29 |
|
|---|
| 30 | #define AD1816A_CHIP_STATUS 0x00
|
|---|
| 31 | #define AD1816A_INDIR_ADDR 0x00
|
|---|
| 32 | #define AD1816A_INTERRUPT_STATUS 0x01
|
|---|
| 33 | #define AD1816A_INDIR_DATA_LOW 0x02
|
|---|
| 34 | #define AD1816A_INDIR_DATA_HIGH 0x03
|
|---|
| 35 | #define AD1816A_PIO_DEBUG 0x04
|
|---|
| 36 | #define AD1816A_PIO_STATUS 0x05
|
|---|
| 37 | #define AD1816A_PIO_DATA 0x06
|
|---|
| 38 | #define AD1816A_RESERVED_7 0x07
|
|---|
| 39 | #define AD1816A_PLAYBACK_CONFIG 0x08
|
|---|
| 40 | #define AD1816A_CAPTURE_CONFIG 0x09
|
|---|
| 41 | #define AD1816A_RESERVED_10 0x0a
|
|---|
| 42 | #define AD1816A_RESERVED_11 0x0b
|
|---|
| 43 | #define AD1816A_JOYSTICK_RAW_DATA 0x0c
|
|---|
| 44 | #define AD1816A_JOYSTICK_CTRL 0x0d
|
|---|
| 45 | #define AD1816A_JOY_POS_DATA_LOW 0x0e
|
|---|
| 46 | #define AD1816A_JOY_POS_DATA_HIGH 0x0f
|
|---|
| 47 |
|
|---|
| 48 | #define AD1816A_LOW_BYTE_TMP 0x00
|
|---|
| 49 | #define AD1816A_INTERRUPT_ENABLE 0x01
|
|---|
| 50 | #define AD1816A_EXTERNAL_CTRL 0x01
|
|---|
| 51 | #define AD1816A_PLAYBACK_SAMPLE_RATE 0x02
|
|---|
| 52 | #define AD1816A_CAPTURE_SAMPLE_RATE 0x03
|
|---|
| 53 | #define AD1816A_VOICE_ATT 0x04
|
|---|
| 54 | #define AD1816A_FM_ATT 0x05
|
|---|
| 55 | #define AD1816A_I2S_1_ATT 0x06
|
|---|
| 56 | #define AD1816A_I2S_0_ATT 0x07
|
|---|
| 57 | #define AD1816A_PLAYBACK_BASE_COUNT 0x08
|
|---|
| 58 | #define AD1816A_PLAYBACK_CURR_COUNT 0x09
|
|---|
| 59 | #define AD1816A_CAPTURE_BASE_COUNT 0x0a
|
|---|
| 60 | #define AD1816A_CAPTURE_CURR_COUNT 0x0b
|
|---|
| 61 | #define AD1816A_TIMER_BASE_COUNT 0x0c
|
|---|
| 62 | #define AD1816A_TIMER_CURR_COUNT 0x0d
|
|---|
| 63 | #define AD1816A_MASTER_ATT 0x0e
|
|---|
| 64 | #define AD1816A_CD_GAIN_ATT 0x0f
|
|---|
| 65 | #define AD1816A_SYNTH_GAIN_ATT 0x10
|
|---|
| 66 | #define AD1816A_VID_GAIN_ATT 0x11
|
|---|
| 67 | #define AD1816A_LINE_GAIN_ATT 0x12
|
|---|
| 68 | #define AD1816A_MIC_GAIN_ATT 0x13
|
|---|
| 69 | #define AD1816A_PHONE_IN_GAIN_ATT 0x13
|
|---|
| 70 | #define AD1816A_ADC_SOURCE_SEL 0x14
|
|---|
| 71 | #define AD1816A_ADC_PGA 0x14
|
|---|
| 72 | #define AD1816A_CHIP_CONFIG 0x20
|
|---|
| 73 | #define AD1816A_DSP_CONFIG 0x21
|
|---|
| 74 | #define AD1816A_FM_SAMPLE_RATE 0x22
|
|---|
| 75 | #define AD1816A_I2S_1_SAMPLE_RATE 0x23
|
|---|
| 76 | #define AD1816A_I2S_0_SAMPLE_RATE 0x24
|
|---|
| 77 | #define AD1816A_RESERVED_37 0x25
|
|---|
| 78 | #define AD1816A_PROGRAM_CLOCK_RATE 0x26
|
|---|
| 79 | #define AD1816A_3D_PHAT_CTRL 0x27
|
|---|
| 80 | #define AD1816A_PHONE_OUT_ATT 0x27
|
|---|
| 81 | #define AD1816A_RESERVED_40 0x28
|
|---|
| 82 | #define AD1816A_HW_VOL_BUT 0x29
|
|---|
| 83 | #define AD1816A_DSP_MAILBOX_0 0x2a
|
|---|
| 84 | #define AD1816A_DSP_MAILBOX_1 0x2b
|
|---|
| 85 | #define AD1816A_POWERDOWN_CTRL 0x2c
|
|---|
| 86 | #define AD1816A_TIMER_CTRL 0x2c
|
|---|
| 87 | #define AD1816A_VERSION_ID 0x2d
|
|---|
| 88 | #define AD1816A_RESERVED_46 0x2e
|
|---|
| 89 |
|
|---|
| 90 | #define AD1816A_READY 0x80
|
|---|
| 91 |
|
|---|
| 92 | #define AD1816A_PLAYBACK_IRQ_PENDING 0x80
|
|---|
| 93 | #define AD1816A_CAPTURE_IRQ_PENDING 0x40
|
|---|
| 94 | #define AD1816A_TIMER_IRQ_PENDING 0x20
|
|---|
| 95 |
|
|---|
| 96 | #define AD1816A_PLAYBACK_ENABLE 0x01
|
|---|
| 97 | #define AD1816A_PLAYBACK_PIO 0x02
|
|---|
| 98 | #define AD1816A_CAPTURE_ENABLE 0x01
|
|---|
| 99 | #define AD1816A_CAPTURE_PIO 0x02
|
|---|
| 100 |
|
|---|
| 101 | #define AD1816A_FMT_LINEAR_8 0x00
|
|---|
| 102 | #define AD1816A_FMT_ULAW_8 0x08
|
|---|
| 103 | #define AD1816A_FMT_LINEAR_16_LIT 0x10
|
|---|
| 104 | #define AD1816A_FMT_ALAW_8 0x18
|
|---|
| 105 | #define AD1816A_FMT_LINEAR_16_BIG 0x30
|
|---|
| 106 | #define AD1816A_FMT_ALL 0x38
|
|---|
| 107 | #define AD1816A_FMT_STEREO 0x04
|
|---|
| 108 |
|
|---|
| 109 | #define AD1816A_PLAYBACK_IRQ_ENABLE 0x8000
|
|---|
| 110 | #define AD1816A_CAPTURE_IRQ_ENABLE 0x4000
|
|---|
| 111 | #define AD1816A_TIMER_IRQ_ENABLE 0x2000
|
|---|
| 112 | #define AD1816A_TIMER_ENABLE 0x0080
|
|---|
| 113 |
|
|---|
| 114 | #define AD1816A_SRC_LINE 0x00
|
|---|
| 115 | #define AD1816A_SRC_OUT 0x10
|
|---|
| 116 | #define AD1816A_SRC_CD 0x20
|
|---|
| 117 | #define AD1816A_SRC_SYNTH 0x30
|
|---|
| 118 | #define AD1816A_SRC_VIDEO 0x40
|
|---|
| 119 | #define AD1816A_SRC_MIC 0x50
|
|---|
| 120 | #define AD1816A_SRC_MONO 0x50
|
|---|
| 121 | #define AD1816A_SRC_PHONE_IN 0x60
|
|---|
| 122 | #define AD1816A_SRC_MASK 0x70
|
|---|
| 123 |
|
|---|
| 124 | #define AD1816A_CAPTURE_NOT_EQUAL 0x1000
|
|---|
| 125 | #define AD1816A_WSS_ENABLE 0x8000
|
|---|
| 126 |
|
|---|
| 127 | typedef struct _snd_ad1816a ad1816a_t;
|
|---|
| 128 |
|
|---|
| 129 | struct _snd_ad1816a {
|
|---|
| 130 | unsigned long port;
|
|---|
| 131 | struct resource *res_port;
|
|---|
| 132 | int irq;
|
|---|
| 133 | int dma1;
|
|---|
| 134 | int dma2;
|
|---|
| 135 |
|
|---|
| 136 | unsigned short hardware;
|
|---|
| 137 | unsigned short version;
|
|---|
| 138 |
|
|---|
| 139 | spinlock_t lock;
|
|---|
| 140 |
|
|---|
| 141 | unsigned short mode;
|
|---|
| 142 |
|
|---|
| 143 | snd_card_t *card;
|
|---|
| 144 | snd_pcm_t *pcm;
|
|---|
| 145 |
|
|---|
| 146 | snd_pcm_substream_t *playback_substream;
|
|---|
| 147 | snd_pcm_substream_t *capture_substream;
|
|---|
| 148 | unsigned int p_dma_size;
|
|---|
| 149 | unsigned int c_dma_size;
|
|---|
| 150 |
|
|---|
| 151 | snd_timer_t *timer;
|
|---|
| 152 | };
|
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 | #define AD1816A_HW_AUTO 0
|
|---|
| 156 | #define AD1816A_HW_AD1816A 1
|
|---|
| 157 | #define AD1816A_HW_AD1815 2
|
|---|
| 158 | #define AD1816A_HW_AD18MAX10 3
|
|---|
| 159 |
|
|---|
| 160 | #define AD1816A_MODE_PLAYBACK 0x01
|
|---|
| 161 | #define AD1816A_MODE_CAPTURE 0x02
|
|---|
| 162 | #define AD1816A_MODE_TIMER 0x04
|
|---|
| 163 | #define AD1816A_MODE_OPEN (AD1816A_MODE_PLAYBACK | \
|
|---|
| 164 | AD1816A_MODE_CAPTURE | \
|
|---|
| 165 | AD1816A_MODE_TIMER)
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 | extern int snd_ad1816a_create(snd_card_t *card, unsigned long port,
|
|---|
| 169 | int irq, int dma1, int dma2,
|
|---|
| 170 | ad1816a_t **chip);
|
|---|
| 171 |
|
|---|
| 172 | extern int snd_ad1816a_pcm(ad1816a_t *chip, int device, snd_pcm_t **rpcm);
|
|---|
| 173 | extern int snd_ad1816a_mixer(ad1816a_t *chip);
|
|---|
| 174 |
|
|---|
| 175 | #endif /* __AD1816A_H */
|
|---|
| 176 |
|
|---|