update from Jerome Leveque

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23444 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2008-01-12 17:05:13 +00:00
parent a7f59ef8eb
commit 751232fbe0
6 changed files with 203 additions and 80 deletions
@@ -13,4 +13,3 @@ KernelAddon ice1712 :
util.c util.c
; ;
@@ -17,7 +17,6 @@
#include <fcntl.h> #include <fcntl.h>
#include <image.h> #include <image.h>
#include <string.h> #include <string.h>
#include <PCI.h>
#include "debug.h" #include "debug.h"
#include "ice1712.h" #include "ice1712.h"
@@ -25,7 +24,6 @@
#include "io.h" #include "io.h"
#include "midi_driver.h" #include "midi_driver.h"
#include "multi.h" #include "multi.h"
#include "multi_audio.h"
#include "util.h" #include "util.h"
@@ -57,7 +55,8 @@ char *names[NUM_CARDS*20+1];
int32 api_version = B_CUR_DRIVER_API_VERSION; int32 api_version = B_CUR_DRIVER_API_VERSION;
#define MODULE_TEST_PATH "audio/hmulti/ice1712" #define HMULTI_AUDIO_DEV_PATH "audio/hmulti/ice1712"
//#define HMULTI_AUDIO_DEV_PATH "audio/multi/ice1712"
//------------------------------------------------------ //------------------------------------------------------
//------------------------------------------------------ //------------------------------------------------------
@@ -139,7 +138,6 @@ ice1712_setup(ice1712 *ice)
{ {
int result, i; int result, i;
long result_l = 0; long result_l = 0;
uint8 eeprom_data[32];
uint8 reg8 = 0; uint8 reg8 = 0;
ice->irq = ice->info.u.h0.interrupt_line; ice->irq = ice->info.u.h0.interrupt_line;
@@ -154,51 +152,74 @@ ice1712_setup(ice1712 *ice)
write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x01); write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x01);
snooze(200000); snooze(200000);
result = read_eeprom(ice, eeprom_data); result = read_eeprom(ice, ice->eeprom_data);
TRACE_ICE(("EEprom -> ")); /* TRACE_ICE(("EEprom -> "));
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
TRACE_ICE(("%x, ", eeprom_data[i])); TRACE_ICE(("%x, ", eeprom_data[i]));
TRACE_ICE(("<- EEprom\n")); TRACE_ICE(("<- EEprom\n"));*/
write_ccs_uint8(ice, CCS_SERR_SHADOW, 0x01); write_ccs_uint8(ice, CCS_SERR_SHADOW, 0x01);
//Write all configurations register from EEProm //Write all configurations register from EEProm
ice->info.device_id = ice->eeprom_data[E2PROM_MAP_SUBVENDOR_HIGH] << 8 | ice->eeprom_data[E2PROM_MAP_SUBVENDOR_LOW];
//Write enable SVID ice->info.vendor_id = ice->eeprom_data[E2PROM_MAP_SUBDEVICE_HIGH] << 8 | ice->eeprom_data[E2PROM_MAP_SUBDEVICE_LOW];
// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x42, 2, 0x86);
//Change SVID
ice->info.device_id = eeprom_data[1] << 8 | eeprom_data[0];
ice->info.vendor_id = eeprom_data[3] << 8 | eeprom_data[2];
ice->product = ice->info.vendor_id << 16 | ice->info.device_id; ice->product = ice->info.vendor_id << 16 | ice->info.device_id;
// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x2C, 4, ice->product);
//Write Disable SVID
// (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x42, 2, 0x06);
TRACE_ICE(("Product ID : 0x%x\n", ice->product)); TRACE_ICE(("Product ID : 0x%x\n", ice->product));
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x60, 1, eeprom_data[6]); write_cci_uint8(ice, CCI_GPIO_WRITE_MASK, ice->eeprom_data[E2PROM_MAP_GPIOMASK]);
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x61, 1, eeprom_data[7]); write_cci_uint8(ice, CCI_GPIO_DATA, ice->eeprom_data[E2PROM_MAP_GPIOSTATE]);
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x62, 1, eeprom_data[8]); write_cci_uint8(ice, CCI_GPIO_DIRECTION_CONTROL, ice->eeprom_data[E2PROM_MAP_GPIODIR]);
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x63, 1, eeprom_data[9]);
write_cci_uint8(ice, CCI_GPIO_WRITE_MASK, eeprom_data[10]); TRACE_ICE(("CCI_GPIO_WRITE_MASK : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIOMASK]));
write_cci_uint8(ice, CCI_GPIO_DATA, eeprom_data[11]); TRACE_ICE(("CCI_GPIO_DATA : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIOSTATE]));
write_cci_uint8(ice, CCI_GPIO_DIRECTION_CONTROL, eeprom_data[12]); TRACE_ICE(("CCI_GPIO_DIRECTION_CONTROL : 0x%x\n", ice->eeprom_data[E2PROM_MAP_GPIODIR]));
write_cci_uint8(ice, CCI_CONS_POWER_DOWN, eeprom_data[13]);
write_cci_uint8(ice, CCI_MULTI_POWER_DOWN, eeprom_data[14]);
ice->nb_MPU401 = ((eeprom_data[6] & 0x20) >> 5) + 1;
ice->nb_ADC = (((eeprom_data[6] & 0x0C) >> 2) + 1 ) * 2; //Write Configuration in the PCI configuration Register
ice->nb_DAC = ((eeprom_data[6] & 0x03) + 1) * 2; (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x60, 1, ice->eeprom_data[E2PROM_MAP_CONFIG]);
ice->spdif_config = eeprom_data[9] & 0x03; (pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x61, 1, ice->eeprom_data[E2PROM_MAP_ACL]);
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x62, 1, ice->eeprom_data[E2PROM_MAP_I2S]);
(pci->write_pci_config)(ice->info.bus, ice->info.device, ice->info.function, 0x63, 1, ice->eeprom_data[E2PROM_MAP_SPDIF]);
TRACE_ICE(("E2PROM_MAP_CONFIG : 0x%x\n", ice->eeprom_data[E2PROM_MAP_CONFIG]));
reg8 = ice->eeprom_data[E2PROM_MAP_CONFIG];
//Bits signification for E2PROM_MAP_CONFIG Byte
//
// 8 7 6 5 4 3 2 1 0
// |-D-|-C-|---B---|---A---
//
// D : MPU401 number minus 1
// C : AC'97
// B : Stereo ADC number minus 1 (=> 1 to 4)
// A : Stereo DAC number minus 1 (=> 1 to 4)
ice->nb_DAC = ((reg8 & 0x03) + 1) * 2;
reg8 >>= 2;
ice->nb_ADC = ((reg8 & 0x03) + 1) * 2;
reg8 >>= 2;
if ((reg8 & 0x01) != 0) {//Consumer AC'97 Exist
TRACE_ICE(("Consumer AC'97 does exist\n"));
//For now do nothing
/* write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x40);
snooze(10000);
write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x00);
snooze(20000);
*/ } else {
TRACE_ICE(("Consumer AC'97 does NOT exist\n"));
}
reg8 >>= 1;
ice->nb_MPU401 = (reg8 & 0x1) + 1;
for (i = 0; i < ice->nb_MPU401; i++) { for (i = 0; i < ice->nb_MPU401; i++) {
sprintf(ice->midi_interf[i].name, "midi/ice1712/%ld/%d", ice - cards + 1, i + 1); sprintf(ice->midi_interf[i].name, "midi/ice1712/%ld/%d", ice - cards + 1, i + 1);
names[num_names++] = ice->midi_interf[i].name; names[num_names++] = ice->midi_interf[i].name;
} }
TRACE_ICE(("E2PROM_MAP_SPDIF : 0x%x\n", ice->eeprom_data[E2PROM_MAP_SPDIF]));
ice->spdif_config = ice->eeprom_data[E2PROM_MAP_SPDIF];
switch (ice->product) switch (ice->product)
{ {
case ICE1712_SUBDEVICE_DELTA66 : case ICE1712_SUBDEVICE_DELTA66 :
@@ -223,20 +244,10 @@ ice1712_setup(ice1712 *ice)
break; break;
} }
sprintf(ice->name, "%s/%ld", MODULE_TEST_PATH, ice - cards + 1); sprintf(ice->name, "%s/%ld", HMULTI_AUDIO_DEV_PATH, ice - cards + 1);
names[num_names++] = ice->name; names[num_names++] = ice->name;
names[num_names] = NULL; names[num_names] = NULL;
if ((eeprom_data[6] & 0x10) == 0) {//Consumer AC'97 Exist
TRACE_ICE(("Consumer AC'97 does exist\n"));
write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x40);
snooze(10000);
write_ccs_uint8(ice, CCS_CONS_AC97_COMMAND_STATUS, 0x00);
snooze(20000);
} else {
TRACE_ICE(("Consumer AC'97 does NOT exist\n"));
}
ice->buffer_ready_sem = create_sem(0, "Buffer Exchange"); ice->buffer_ready_sem = create_sem(0, "Buffer Exchange");
// TRACE_ICE(("installing interrupt : %0x\n", ice->irq)); // TRACE_ICE(("installing interrupt : %0x\n", ice->irq));
@@ -275,10 +286,21 @@ ice1712_setup(ice1712 *ice)
//Deselect CS //Deselect CS
write_cci_uint8(ice, CCI_GPIO_DATA, ice->gpio_cs_mask); write_cci_uint8(ice, CCI_GPIO_DATA, ice->gpio_cs_mask);
//Just to route input to output //Just to route all input to all output
// write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0x0101); // write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0xAAAA);
// write_mt_uint32(ice, MT_CAPTURED_DATA, 0x0000); // write_mt_uint32(ice, MT_CAPTURED_DATA, 0x76543210);
//Just to route SPDIF Input to DAC 0
// write_mt_uint16(ice, MT_ROUTING_CONTROL_PSDOUT, 0xAAAF);
// write_mt_uint32(ice, MT_CAPTURED_DATA, 0x76543280);
//Mute all input
/* for (i = 0; i < 20; i++)
{
write_mt_uint8(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, i);
write_mt_uint16(ice, MT_VOLUME_CONTROL_CHANNEL_INDEX, 0x7F7F);
}
*/
//Unmask Interrupt //Unmask Interrupt
write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x41); write_ccs_uint8(ice, CCS_CONTROL_STATUS, 0x41);
@@ -13,6 +13,7 @@
#define _ICE1712_H_ #define _ICE1712_H_
#include <PCI.h> #include <PCI.h>
#include "hmulti_audio.h"
#define DRIVER_NAME "ice1712" #define DRIVER_NAME "ice1712"
#define VERSION "0.3" #define VERSION "0.3"
@@ -87,6 +88,8 @@ typedef struct _ice1712_
uint32 DMA_Path; //PCI_18 uint32 DMA_Path; //PCI_18
uint32 Multi_Track; //PCI_1C uint32 Multi_Track; //PCI_1C
uint8 eeprom_data[32];
int8 nb_ADC; //Mono Channel int8 nb_ADC; //Mono Channel
int8 nb_DAC; //Mono Channel int8 nb_DAC; //Mono Channel
_spdif_config_ spdif_config; _spdif_config_ spdif_config;
@@ -117,6 +120,7 @@ typedef struct _ice1712_
sem_id buffer_ready_sem; sem_id buffer_ready_sem;
uint8 sampling_rate; //in the format of the register uint8 sampling_rate; //in the format of the register
uint32 lock_source;
} ice1712; } ice1712;
@@ -213,4 +217,26 @@ extern ice1712 cards[NUM_CARDS];
} }
*/ */
//This map come from ALSA sound drivers
#define E2PROM_MAP_SUBVENDOR_LOW 0x00
#define E2PROM_MAP_SUBVENDOR_HIGH 0x01
#define E2PROM_MAP_SUBDEVICE_LOW 0x02
#define E2PROM_MAP_SUBDEVICE_HIGH 0x03
#define E2PROM_MAP_SIZE 0x04
#define E2PROM_MAP_VERSION 0x05
#define E2PROM_MAP_CONFIG 0x06
#define E2PROM_MAP_ACL 0x07
#define E2PROM_MAP_I2S 0x08
#define E2PROM_MAP_SPDIF 0x09
#define E2PROM_MAP_GPIOMASK 0x0A
#define E2PROM_MAP_GPIOSTATE 0x0B
#define E2PROM_MAP_GPIODIR 0x0C
#define E2PROM_MAP_AC97MAIN 0x0D
#define E2PROM_MAP_AC97PCM 0x0F
#define E2PROM_MAP_AC97REC 0x11
#define E2PROM_MAP_AC97REC_SOURCE 0x13
#define E2PROM_MAP_DAC_ID 0x14
#define E2PROM_MAP_ADC_ID 0x18
#define E2PROM_MAP_EXTRA 0x1C
#endif #endif
@@ -438,6 +438,7 @@ cs84xx_write_gpio(ice1712 *ice, uint8 reg_addr, uint8 data, uint8 chip_select)
// drop clock and Data // drop clock and Data
tmp &= ~(ice->digital_codec.clock | ice->digital_codec.data_out); tmp &= ~(ice->digital_codec.clock | ice->digital_codec.data_out);
tmp |= ice->gpio_cs_mask; tmp |= ice->gpio_cs_mask;
write_gpio(ice, tmp); write_gpio(ice, tmp);
snooze(CS84xx_DELAY); snooze(CS84xx_DELAY);
+102 -26
View File
@@ -17,8 +17,8 @@
#include <string.h> #include <string.h>
#define AUTORIZED_RATE (B_SR_96000 | B_SR_88200 | B_SR_48000 | B_SR_44100) #define AUTORIZED_RATE (B_SR_SAME_AS_INPUT | B_SR_IS_GLOBAL | B_SR_96000 | B_SR_88200 | B_SR_48000 | B_SR_44100)
#define AUTORIZED_SAMPLE_SIZE (B_FMT_24BIT) #define AUTORIZED_SAMPLE_SIZE (B_FMT_32BIT)
static void static void
start_DMA(ice1712 *card) start_DMA(ice1712 *card)
@@ -30,7 +30,7 @@ start_DMA(ice1712 *card)
write_mt_uint32(card, MT_PROF_PB_DMA_BASE_ADDRESS, (uint32)card->phys_addr_pb); write_mt_uint32(card, MT_PROF_PB_DMA_BASE_ADDRESS, (uint32)card->phys_addr_pb);
write_mt_uint16(card, MT_PROF_PB_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1); write_mt_uint16(card, MT_PROF_PB_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1);
//We want interrupt only from playback //We want interrupt only from playback
write_mt_uint16(card, MT_PROF_PB_DMA_TERM_COUNT, size - 1/*0*/); write_mt_uint16(card, MT_PROF_PB_DMA_TERM_COUNT, size - 1);
TRACE_ICE(("SIZE DMA PLAYBACK %#x\n", size)); TRACE_ICE(("SIZE DMA PLAYBACK %#x\n", size));
size = card->input_buffer_size * MAX_ADC; size = card->input_buffer_size * MAX_ADC;
@@ -38,7 +38,7 @@ start_DMA(ice1712 *card)
write_mt_uint32(card, MT_PROF_REC_DMA_BASE_ADDRESS, (uint32)card->phys_addr_rec); write_mt_uint32(card, MT_PROF_REC_DMA_BASE_ADDRESS, (uint32)card->phys_addr_rec);
write_mt_uint16(card, MT_PROF_REC_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1); write_mt_uint16(card, MT_PROF_REC_DMA_COUNT_ADDRESS, (size * SWAPPING_BUFFERS) - 1);
//We do not want any interrupt from the record //We do not want any interrupt from the record
write_mt_uint16(card, MT_PROF_REC_DMA_TERM_COUNT, /*size - 1*/0); write_mt_uint16(card, MT_PROF_REC_DMA_TERM_COUNT, 0);
TRACE_ICE(("SIZE DMA RECORD %#x\n", size)); TRACE_ICE(("SIZE DMA RECORD %#x\n", size));
//Enable output AND Input from Analog CODEC //Enable output AND Input from Analog CODEC
@@ -75,7 +75,7 @@ start_DMA(ice1712 *card)
case ICE1712_SUBDEVICE_AUDIOPHILE_2496 : case ICE1712_SUBDEVICE_AUDIOPHILE_2496 :
spdif_write(card, CS84xx_SERIAL_INPUT_FORMAT_REG, 0x85); spdif_write(card, CS84xx_SERIAL_INPUT_FORMAT_REG, 0x85);
spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x85); spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x85);
spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x41); // spdif_write(card, CS84xx_SERIAL_OUTPUT_FORMAT_REG, 0x41);
break; break;
case ICE1712_SUBDEVICE_DELTA410 : case ICE1712_SUBDEVICE_DELTA410 :
break; break;
@@ -91,11 +91,10 @@ start_DMA(ice1712 *card)
break; break;
} }
card->buffer = 0; card->buffer = 1;
write_mt_uint8(card, MT_PROF_PB_CONTROL, 5); write_mt_uint8(card, MT_PROF_PB_CONTROL, 5);
} }
status_t status_t
ice1712_get_description(ice1712 *card, multi_description *data) ice1712_get_description(ice1712 *card, multi_description *data)
{ {
@@ -136,7 +135,7 @@ ice1712_get_description(ice1712 *card, multi_description *data)
break; break;
} }
strncpy(data->vendor_info, "Jerome Leveque", 32); strncpy(data->vendor_info, "J. H Leveque", 32);
data->output_channel_count = card->total_output_channels; data->output_channel_count = card->total_output_channels;
data->input_channel_count = card->total_input_channels; data->input_channel_count = card->total_input_channels;
@@ -144,6 +143,7 @@ ice1712_get_description(ice1712 *card, multi_description *data)
data->input_bus_channel_count = 0; data->input_bus_channel_count = 0;
data->aux_bus_channel_count = 0; data->aux_bus_channel_count = 0;
TRACE_ICE(("request_channel_count = %d\n", data->request_channel_count)); TRACE_ICE(("request_channel_count = %d\n", data->request_channel_count));
if (data->request_channel_count >= (card->total_output_channels + card->total_input_channels)) { if (data->request_channel_count >= (card->total_output_channels + card->total_input_channels)) {
for (i = 0; i < card->nb_DAC; i++) { for (i = 0; i < card->nb_DAC; i++) {
@@ -151,7 +151,7 @@ ice1712_get_description(ice1712 *card, multi_description *data)
data->channels[chan].channel_id = chan; data->channels[chan].channel_id = chan;
data->channels[chan].kind = B_MULTI_OUTPUT_CHANNEL; data->channels[chan].kind = B_MULTI_OUTPUT_CHANNEL;
data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \ data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \
(i & 1) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; ((i & 1) == 0) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT;
data->channels[chan].connectors = 0; data->channels[chan].connectors = 0;
chan++; chan++;
} }
@@ -175,7 +175,7 @@ ice1712_get_description(ice1712 *card, multi_description *data)
data->channels[chan].channel_id = chan; data->channels[chan].channel_id = chan;
data->channels[chan].kind = B_MULTI_INPUT_CHANNEL; data->channels[chan].kind = B_MULTI_INPUT_CHANNEL;
data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \ data->channels[chan].designations = B_CHANNEL_STEREO_BUS | \
(i & 1) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT; ((i & 1) == 0) ? B_CHANNEL_LEFT : B_CHANNEL_RIGHT;
data->channels[chan].connectors = 0; data->channels[chan].connectors = 0;
chan++; chan++;
} }
@@ -217,7 +217,7 @@ ice1712_get_description(ice1712 *card, multi_description *data)
data->max_cvsr_rate = 96000; data->max_cvsr_rate = 96000;
data->output_formats = data->input_formats = AUTORIZED_SAMPLE_SIZE; data->output_formats = data->input_formats = AUTORIZED_SAMPLE_SIZE;
data->lock_sources = B_MULTI_LOCK_INTERNAL /*| B_MULTI_LOCK_SPDIF*/; data->lock_sources = B_MULTI_LOCK_INTERNAL | B_MULTI_LOCK_SPDIF;
data->timecode_sources = 0; data->timecode_sources = 0;
data->interface_flags = B_MULTI_INTERFACE_PLAYBACK | B_MULTI_INTERFACE_RECORD; data->interface_flags = B_MULTI_INTERFACE_PLAYBACK | B_MULTI_INTERFACE_RECORD;
data->start_latency = 0; data->start_latency = 0;
@@ -262,6 +262,8 @@ ice1712_set_enabled_channels(ice1712 *card, multi_channel_enable *data)
else else
write_mt_uint8(card, MT_SAMPLING_RATE_SELECT, card->sampling_rate); write_mt_uint8(card, MT_SAMPLING_RATE_SELECT, card->sampling_rate);
card->lock_source = data->lock_source;
return B_OK; return B_OK;
} }
@@ -310,7 +312,8 @@ ice1712_set_global_format(ice1712 *card, multi_format_info *data)
TRACE_ICE(("Input Sampling Rate = %#x\n", data->input.rate)); TRACE_ICE(("Input Sampling Rate = %#x\n", data->input.rate));
TRACE_ICE(("Output Sampling Rate = %#x\n", data->output.rate)); TRACE_ICE(("Output Sampling Rate = %#x\n", data->output.rate));
if (data->input.rate == data->output.rate) { if ((data->input.rate == data->output.rate) &&
(card->lock_source == B_MULTI_LOCK_INTERNAL)) {
switch (data->input.rate) switch (data->input.rate)
{ {
case B_SR_96000 : case B_SR_96000 :
@@ -335,14 +338,14 @@ ice1712_set_global_format(ice1712 *card, multi_format_info *data)
status_t status_t
ice1712_get_mix(ice1712 *card, multi_mix_value_info *MMVI) ice1712_get_mix(ice1712 *card, multi_mix_value_info *data)
{//Not Implemented {//Not Implemented
return B_ERROR; return B_ERROR;
} }
status_t status_t
ice1712_set_mix(ice1712 *card, multi_mix_value_info *MMVI) ice1712_set_mix(ice1712 *card, multi_mix_value_info *data)
{//Not Implemented {//Not Implemented
return B_ERROR; return B_ERROR;
} }
@@ -355,10 +358,70 @@ ice1712_list_mix_channels(ice1712 *card, multi_mix_channel_info *data)
} }
#define MULTI_AUDIO_BASE_ID 1024
#define MULTI_AUDIO_MASTER_ID 0
#ifndef B_MULTI_MIX_GROUP
#define B_MULTI_MIX_GROUP 10
#endif
#ifndef S_null
#define S_null 10
#endif
#ifndef S_STEREO_MIX
#define S_STEREO_MIX 10
#endif
static int32
create_group_control(multi_mix_control *multi, int32 idx, int32 parent, int32 string, const char* name)
{
multi->id = MULTI_AUDIO_BASE_ID + idx;
multi->master = parent;
multi->flags = B_MULTI_MIX_GROUP;
multi->master = MULTI_AUDIO_MASTER_ID;
// multi->string = string;
if (name != NULL)
strcpy(multi->name, name);
return multi->id;
}
static int32
create_slider_control(multi_mix_control *multi, int32 idx, int32 parent, int32 string, const char* name)
{
multi->id = MULTI_AUDIO_BASE_ID + idx;
multi->master = parent;
multi->flags = B_MULTI_MIX_GAIN;
multi->master = MULTI_AUDIO_MASTER_ID + 1;
// multi->string = string;
multi->u.gain.min_gain = -144.0;
multi->u.gain.max_gain = 0.0;
multi->u.gain.granularity = 1.5;
if (name != NULL)
strcpy(multi->name, name);
return multi->id;
}
status_t status_t
ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *MMCI) ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *data)
{//Not Implemented {
return B_ERROR; int32 parent;
TRACE_ICE(("count = %d\n", data->control_count));
parent = create_group_control (data->controls + 0, 0, 0, S_null, "Playback");
create_slider_control (data->controls + 1, 1, parent, S_STEREO_MIX, "Master Output");
parent = create_group_control (data->controls + 2, 2, 0, S_null, "Record");
create_slider_control (data->controls + 3, 3, parent, S_STEREO_MIX, "Master Input");
data->control_count = 4;
return B_OK;
} }
@@ -382,13 +445,13 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list *data)
TRACE_ICE(("request_record_channels = %#x\n", data->request_record_channels)); TRACE_ICE(("request_record_channels = %#x\n", data->request_record_channels));
TRACE_ICE(("request_record_buffer_size = %#x\n", data->request_record_buffer_size)); TRACE_ICE(("request_record_buffer_size = %#x\n", data->request_record_buffer_size));
// MIN_BUFFER_FRAMES <= requested value are <= MAX_BUFFER_FRAMES // MIN_BUFFER_FRAMES <= requested value <= MAX_BUFFER_FRAMES
card->output_buffer_size = data->request_playback_buffer_size <= MAX_BUFFER_FRAMES ? \ card->output_buffer_size = data->request_playback_buffer_size <= MAX_BUFFER_FRAMES ? \
data->request_playback_buffer_size >= MIN_BUFFER_FRAMES ? \ data->request_playback_buffer_size >= MIN_BUFFER_FRAMES ? \
data->request_playback_buffer_size : MIN_BUFFER_FRAMES \ data->request_playback_buffer_size : MIN_BUFFER_FRAMES \
: MAX_BUFFER_FRAMES; : MAX_BUFFER_FRAMES;
// MIN_BUFFER_FRAMES <= requested value are <= MAX_BUFFER_FRAMES // MIN_BUFFER_FRAMES <= requested value <= MAX_BUFFER_FRAMES
card->input_buffer_size = data->request_record_buffer_size <= MAX_BUFFER_FRAMES ? \ card->input_buffer_size = data->request_record_buffer_size <= MAX_BUFFER_FRAMES ? \
data->request_record_buffer_size >= MIN_BUFFER_FRAMES ? \ data->request_record_buffer_size >= MIN_BUFFER_FRAMES ? \
data->request_record_buffer_size : MIN_BUFFER_FRAMES \ data->request_record_buffer_size : MIN_BUFFER_FRAMES \
@@ -490,6 +553,7 @@ ice1712_get_buffers(ice1712 *card, multi_buffer_list *data)
data->return_record_buffers = SWAPPING_BUFFERS; data->return_record_buffers = SWAPPING_BUFFERS;
data->return_record_channels = card->total_input_channels; data->return_record_channels = card->total_input_channels;
data->return_record_channels = chan_i;
data->return_record_buffer_size = card->input_buffer_size; data->return_record_buffer_size = card->input_buffer_size;
TRACE_ICE(("return_record_buffers = %#x\n", data->return_record_buffers)); TRACE_ICE(("return_record_buffers = %#x\n", data->return_record_buffers));
@@ -521,12 +585,12 @@ ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data)
// do playback // do playback
data->played_real_time = card->played_time; data->played_real_time = card->played_time;
data->played_frames_count += card->output_buffer_size; data->played_frames_count += card->output_buffer_size;
data->playback_buffer_cycle = (card->buffer - 1) & 0x1; //Buffer TO fill data->playback_buffer_cycle = (card->buffer/* - 1*/) & 0x1; //Buffer TO fill
// do record // do record
data->recorded_real_time = card->played_time; data->recorded_real_time = card->played_time;
data->recorded_frames_count += card->input_buffer_size; data->recorded_frames_count += card->input_buffer_size;
data->record_buffer_cycle = (card->buffer - 1) & 0x1; //Buffer filled data->record_buffer_cycle = (card->buffer/* - 1*/) & 0x1; //Buffer filled
data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD;
@@ -552,12 +616,16 @@ ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data)
case B_TIMED_OUT : case B_TIMED_OUT :
TRACE_ICE(("B_TIMED_OUT\n")); TRACE_ICE(("B_TIMED_OUT\n"));
start_DMA(card); start_DMA(card);
cpu_status = lock(); cpu_status = lock();
data->record_buffer_cycle = 0; data->played_real_time = card->played_time;
data->playback_buffer_cycle = 1; data->playback_buffer_cycle = 0;
data->played_frames_count += card->output_buffer_size; data->played_frames_count += card->output_buffer_size;
data->recorded_frames_count += card->input_buffer_size;
data->recorded_real_time = card->played_time;
data->record_buffer_cycle = 0;
data->recorded_frames_count += card->input_buffer_size;
data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD; data->flags = B_MULTI_BUFFER_PLAYBACK | B_MULTI_BUFFER_RECORD;
unlock(cpu_status); unlock(cpu_status);
@@ -568,12 +636,20 @@ ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data)
break; break;
} }
/* if ((card->buffer % 500) == 0)
{
uint8 reg8, reg8_dir;
reg8 = read_gpio(card);
reg8_dir = read_cci_uint8(card, CCI_GPIO_DIRECTION_CONTROL);
TRACE_ICE(("B_NO_ERROR buffer = %d : GPIO = %d (%d)\n", card->buffer, reg8, reg8_dir));
}
*/
return B_OK; return B_OK;
} }
status_t ice1712_buffer_force_stop(ice1712 *card) status_t ice1712_buffer_force_stop(ice1712 *card)
{ {
// write_mt_uint8(card, MT_PROF_PB_CONTROL, 0); write_mt_uint8(card, MT_PROF_PB_CONTROL, 0);
return B_OK; return B_OK;
} }
@@ -9,7 +9,6 @@
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
*/ */
#include "multi_audio.h"
#include "ice1712.h" #include "ice1712.h"
status_t ice1712_get_description(ice1712 *card, multi_description *data); status_t ice1712_get_description(ice1712 *card, multi_description *data);
@@ -17,10 +16,10 @@ status_t ice1712_get_enabled_channels(ice1712 *card, multi_channel_enable *data)
status_t ice1712_set_enabled_channels(ice1712 *card, multi_channel_enable *data); status_t ice1712_set_enabled_channels(ice1712 *card, multi_channel_enable *data);
status_t ice1712_get_global_format(ice1712 *card, multi_format_info *data); status_t ice1712_get_global_format(ice1712 *card, multi_format_info *data);
status_t ice1712_set_global_format(ice1712 *card, multi_format_info *data); status_t ice1712_set_global_format(ice1712 *card, multi_format_info *data);
status_t ice1712_get_mix(ice1712 *card, multi_mix_value_info *MMVI); status_t ice1712_get_mix(ice1712 *card, multi_mix_value_info *data);
status_t ice1712_set_mix(ice1712 *card, multi_mix_value_info *MMVI); status_t ice1712_set_mix(ice1712 *card, multi_mix_value_info *data);
status_t ice1712_list_mix_channels(ice1712 *card, multi_mix_channel_info *data); status_t ice1712_list_mix_channels(ice1712 *card, multi_mix_channel_info *data);
status_t ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *MMCI); status_t ice1712_list_mix_controls(ice1712 *card, multi_mix_control_info *data);
status_t ice1712_list_mix_connections(ice1712 *card, multi_mix_connection_info *data); status_t ice1712_list_mix_connections(ice1712 *card, multi_mix_connection_info *data);
status_t ice1712_get_buffers(ice1712 *card, multi_buffer_list *data); status_t ice1712_get_buffers(ice1712 *card, multi_buffer_list *data);
status_t ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data); status_t ice1712_buffer_exchange(ice1712 *card, multi_buffer_info *data);