1 /* 2 * ice1712 BeOS/Haiku Driver for VIA - VT1712 Multi Channel Audio Controller 3 * 4 * Copyright (c) 2002, Jerome Duval (jerome.duval@free.fr) 5 * Copyright (c) 2003, Marcus Overhagen (marcus@overhagen.de) 6 * Copyright (c) 2007, Jerome Leveque (leveque.jerome@neuf.fr) 7 * 8 * All rights reserved 9 * Distributed under the terms of the MIT license. 10 */ 11 12 #ifndef _ICE1712_H_ 13 #define _ICE1712_H_ 14 15 #include <PCI.h> 16 #include "hmulti_audio.h" 17 18 #define DRIVER_NAME "ice1712" 19 #define VERSION "0.3" 20 21 #define ICE1712_VENDOR_ID 0x1412 22 #define ICE1712_DEVICE_ID 0x1712 23 24 25 typedef enum product_t { 26 ICE1712_SUBDEVICE_DELTA1010 = 0x121430d6, 27 ICE1712_SUBDEVICE_DELTADIO2496 = 0x121431d6, 28 ICE1712_SUBDEVICE_DELTA66 = 0x121432d6, 29 ICE1712_SUBDEVICE_DELTA44 = 0x121433d6, 30 ICE1712_SUBDEVICE_AUDIOPHILE_2496 = 0x121434d6, 31 ICE1712_SUBDEVICE_DELTA410 = 0x121438d6, 32 ICE1712_SUBDEVICE_DELTA1010LT = 0x12143bd6, 33 ICE1712_SUBDEVICE_VX442 = 0x12143cd6, 34 } product_t; 35 36 #define NUM_CARDS 4 37 #define MAX_ADC 12 // + the output of the Digital mixer 38 #define MAX_DAC 10 39 #define SWAPPING_BUFFERS 2 40 #define SAMPLE_SIZE 4 41 #define MIN_BUFFER_FRAMES 64 42 #define MAX_BUFFER_FRAMES 2048 43 44 #define PLAYBACK_BUFFER_SIZE (MAX_BUFFER_FRAMES * MAX_DAC * SAMPLE_SIZE) 45 #define RECORD_BUFFER_SIZE (MAX_BUFFER_FRAMES * MAX_ADC * SAMPLE_SIZE) 46 47 #define PLAYBACK_BUFFER_TOTAL_SIZE (PLAYBACK_BUFFER_SIZE * SWAPPING_BUFFERS) 48 #define RECORD_BUFFER_TOTAL_SIZE (RECORD_BUFFER_SIZE * SWAPPING_BUFFERS) 49 50 #define SPDIF_LEFT 8 51 #define SPDIF_RIGHT 9 52 #define MIXER_OUT_LEFT 10 53 #define MIXER_OUT_RIGHT 11 54 55 typedef enum { 56 NO_IN_NO_OUT = 0, 57 NO_IN_YES_OUT = 1, 58 YES_IN_NO_OUT = 2, 59 YES_IN_YES_OUT = 3, 60 } _spdif_config_ ; 61 62 typedef struct _midi_dev { 63 struct _ice1712_ *card; 64 void *driver; 65 void *cookie; 66 int32 count; 67 char name[64]; 68 } midi_dev; 69 70 typedef struct codec_info 71 { 72 uint8 clock; 73 uint8 data_in; 74 uint8 data_out; 75 uint8 reserved[5]; 76 } codec_info; 77 78 typedef struct _ice1712_ 79 { 80 uint32 irq; 81 pci_info info; 82 char name[128]; 83 84 midi_dev midi_interf[2]; 85 86 uint32 Controller; //PCI_10 87 uint32 DDMA; //PCI_14 88 uint32 DMA_Path; //PCI_18 89 uint32 Multi_Track; //PCI_1C 90 91 uint8 eeprom_data[32]; 92 93 int8 nb_ADC; //Mono Channel 94 int8 nb_DAC; //Mono Channel 95 _spdif_config_ spdif_config; 96 int8 nb_MPU401; 97 98 product_t product; 99 uint8 gpio_cs_mask; //a Mask for removing all Chip select 100 101 //We hope all manufacturer will not use different codec on the same card 102 codec_info analog_codec; 103 codec_info digital_codec; 104 105 uint32 buffer; 106 bigtime_t played_time; 107 108 //Output 109 area_id mem_id_pb; 110 void *phys_addr_pb, *log_addr_pb; 111 uint32 output_buffer_size; //in frames 112 uint8 total_output_channels; 113 114 //Input 115 area_id mem_id_rec; 116 void *phys_addr_rec, *log_addr_rec; 117 uint32 input_buffer_size; //in frames 118 uint8 total_input_channels; 119 120 sem_id buffer_ready_sem; 121 122 uint8 sampling_rate; //in the format of the register 123 uint32 lock_source; 124 125 } ice1712; 126 127 extern int32 num_cards; 128 extern ice1712 cards[NUM_CARDS]; 129 130 //??????? 131 #define GPIO_SPDIF_STATUS 0x02 //Status 132 #define GPIO_SPDIF_CCLK 0x04 //data Clock 133 #define GPIO_SPDIF_DOUT 0x08 //data output 134 135 //For Delta 66 / Delta 44 136 #define DELTA66_DOUT 0x10 // data output 137 #define DELTA66_CLK 0x20 // clock 138 #define DELTA66_CODEC_CS_0 0x40 // AK4524 #0 139 #define DELTA66_CODEC_CS_1 0x80 // AK4524 #1 140 141 //For AudioPhile 2496 / Delta 410 142 #define AP2496_CLK 0x02 // clock 143 #define AP2496_DIN 0x04 // data input 144 #define AP2496_DOUT 0x08 // data output 145 #define AP2496_SPDIF_CS 0x10 // CS8427 chip select 146 #define AP2496_CODEC_CS 0x20 // AK4528 chip select 147 148 //For Delta 1010 LT 149 #define DELTA1010LT_CLK 0x02 // clock 150 #define DELTA1010LT_DIN 0x04 // data input 151 #define DELTA1010LT_DOUT 0x08 // data output 152 #define DELTA1010LT_CODEC_CS_0 0x00 // AK4524 #0 153 #define DELTA1010LT_CODEC_CS_1 0x10 // AK4524 #1 154 #define DELTA1010LT_CODEC_CS_2 0x20 // AK4524 #2 155 #define DELTA1010LT_CODEC_CS_3 0x30 // AK4524 #3 156 #define DELTA1010LT_SPDIF_CS 0x40 // CS8427 157 #define DELTA1010LT_CS_NONE 0x50 // All CS deselected 158 159 //For VX442 160 #define VX442_CLK 0x02 // clock 161 #define VX442_DIN 0x04 // data input 162 #define VX442_DOUT 0x08 // data output 163 #define VX442_SPDIF_CS 0x10 // CS8427 164 #define VX442_CODEC_CS_0 0x20 // ?? #0 165 #define VX442_CODEC_CS_1 0x40 // ?? #1 166 167 #define AK45xx_BITS_TO_WRITE 16 168 //2 - Chip Address (10b) 169 //1 - R/W (Always 1 for Writing) 170 //5 - Register Address 171 //8 - Data 172 173 //Register definition for the AK45xx codec (xx = 24 or 28) 174 #define AK45xx_DELAY 100 //Clock Delay 175 #define AK45xx_CHIP_ADDRESS 0x02 //Chip address of the codec 176 #define AK45xx_RESET_REGISTER 0x01 177 #define AK45xx_CLOCK_FORMAT_REGISTER 0x02 178 //Other register are not defined cause they are not used, I'm very lazy... 179 180 #define CS84xx_BITS_TO_WRITE 24 181 //7 - Chip Address (0010000b) 182 //1 - R/W (1 for Reading) 183 //8 - Register MAP 184 //8 - Data 185 186 //Register definition for the CS84xx codec (xx = 27) 187 #define CS84xx_DELAY 100 //Clock Delay 188 #define CS84xx_CHIP_ADDRESS 0x10 //Chip address of the codec 189 #define CS84xx_CONTROL_1_PORT_REG 0x01 190 #define CS84xx_CONTROL_2_PORT_REG 0x02 191 #define CS84xx_DATA_FLOW_CONTROL_REG 0x03 192 #define CS84xx_CLOCK_SOURCE_REG 0x04 193 #define CS84xx_SERIAL_INPUT_FORMAT_REG 0x05 194 #define CS84xx_SERIAL_OUTPUT_FORMAT_REG 0x06 195 //Other register are not defined cause they are not used, I'm very lazy... 196 197 198 /* A default switch for all suported product 199 switch (card->product) 200 { 201 case ICE1712_SUBDEVICE_DELTA1010 : 202 break; 203 case ICE1712_SUBDEVICE_DELTADIO2496 : 204 break; 205 case ICE1712_SUBDEVICE_DELTA66 : 206 break; 207 case ICE1712_SUBDEVICE_DELTA44 : 208 break; 209 case ICE1712_SUBDEVICE_AUDIOPHILE : 210 break; 211 case ICE1712_SUBDEVICE_DELTA410 : 212 break; 213 case ICE1712_SUBDEVICE_DELTA1010LT : 214 break; 215 case ICE1712_SUBDEVICE_VX442 : 216 break; 217 } 218 */ 219 220 //This map come from ALSA sound drivers 221 #define E2PROM_MAP_SUBVENDOR_LOW 0x00 222 #define E2PROM_MAP_SUBVENDOR_HIGH 0x01 223 #define E2PROM_MAP_SUBDEVICE_LOW 0x02 224 #define E2PROM_MAP_SUBDEVICE_HIGH 0x03 225 #define E2PROM_MAP_SIZE 0x04 226 #define E2PROM_MAP_VERSION 0x05 227 #define E2PROM_MAP_CONFIG 0x06 228 #define E2PROM_MAP_ACL 0x07 229 #define E2PROM_MAP_I2S 0x08 230 #define E2PROM_MAP_SPDIF 0x09 231 #define E2PROM_MAP_GPIOMASK 0x0A 232 #define E2PROM_MAP_GPIOSTATE 0x0B 233 #define E2PROM_MAP_GPIODIR 0x0C 234 #define E2PROM_MAP_AC97MAIN 0x0D 235 #define E2PROM_MAP_AC97PCM 0x0F 236 #define E2PROM_MAP_AC97REC 0x11 237 #define E2PROM_MAP_AC97REC_SOURCE 0x13 238 #define E2PROM_MAP_DAC_ID 0x14 239 #define E2PROM_MAP_ADC_ID 0x18 240 #define E2PROM_MAP_EXTRA 0x1C 241 242 #endif 243