style cleanup

should fix detection of Audigy2 Value (it was trying to check the revision id instead of the device id)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23399 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2008-01-11 14:17:17 +00:00
parent 45d0ea5605
commit 5e53d38a62
4 changed files with 201 additions and 190 deletions

View File

@ -49,9 +49,11 @@ typedef struct
#define TYPE_AUDIGY 0x01
#define TYPE_AUDIGY2 0x02
#define TYPE_LIVE_5_1 0x04
#define TYPE_AUDIGY2_VALUE 0x04
#define TYPE_LIVE_5_1 0x08
#define IS_AUDIGY(x) ((x)->type & TYPE_AUDIGY)
#define IS_AUDIGY2(x) ((x)->type & TYPE_AUDIGY2)
#define IS_AUDIGY2_VALUE(x) ((x)->type & TYPE_AUDIGY2_VALUE)
#define IS_LIVE_5_1(x) ((x)->type & TYPE_LIVE_5_1)
#endif

View File

@ -50,6 +50,7 @@
#include <math.h>
#include <midi_driver.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "emuxki.h"
@ -1981,7 +1982,7 @@ emuxki_int(void *arg)
break; // avoid loop
}
if (card->info.revision == 4) {
if (!IS_AUDIGY2_VALUE(&card->config)) {
while ((ipr = emuxki_reg_read_32(&card->config, EMU_A2_IPR3))) {
emuxki_reg_write_32(&card->config, EMU_A2_IPR3, ipr);
break; // avoid loop
@ -2021,6 +2022,7 @@ init_hardware(void)
(info.device_id == CREATIVELABS_SBLIVE_DEVICE_ID
#if AUDIGY
|| info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID
|| info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID
#endif
)) {
err = B_OK;
@ -2062,10 +2064,12 @@ emuxki_setup(emuxki_dev * card)
card->config.nabmbar = card->info.u.h0.base_registers[0];
card->config.irq = card->info.u.h0.interrupt_line;
card->config.type = 0;
if(card->info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID)
if (card->info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID) {
card->config.type |= TYPE_AUDIGY;
if(IS_AUDIGY(&card->config) && (card->info.revision == 4 || card->info.revision == 8))
if (card->info.revision == 4)
card->config.type |= TYPE_AUDIGY2;
} else if (card->info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID)
card->config.type |= TYPE_AUDIGY | TYPE_AUDIGY2 | TYPE_AUDIGY2_VALUE;
PRINT(("%s deviceid = %#04x chiprev = %x model = %x enhanced at %lx\n", card->name, card->info.device_id,
card->info.revision, card->info.u.h0.subsystem_id, card->config.nabmbar));
@ -2176,7 +2180,7 @@ emuxki_setup(emuxki_dev * card)
emuxki_reg_write_32(&card->config, EMU_INTE, EMU_INTE_SAMPLERATER | EMU_INTE_PCIERRENABLE);
if (IS_AUDIGY2(&card->config)) {
emuxki_reg_write_32(&card->config, EMU_A2_INTE2, 0);
if (card->info.revision == 4) {
if (!IS_AUDIGY2_VALUE(&card->config)) {
emuxki_reg_write_32(&card->config, EMU_A2_INTE3, 0);
}
}
@ -2682,14 +2686,14 @@ emuxki_init(emuxki_dev * card)
emuxki_p16v_write(&card->config, 0, EMU_A2_SRCSEL,
EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI);
if (card->info.revision == 4) {
emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT);
} else {
if (IS_AUDIGY2_VALUE(&card->config)) {
emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_I2S, EMU_A2_P17V_I2S_ENABLE);
emuxki_p16v_write(&card->config, 0, EMU_A2_P17V_SPDIF, EMU_A2_P17V_SPDIF_ENABLE);
emuxki_reg_write_32(&card->config, EMU_A_IOCFG,
emuxki_reg_read_32(&card->config, EMU_A_IOCFG) & ~0x8);
} else {
emuxki_p16v_write(&card->config, 0, EMU_A2_SRCMULTI, EMU_A2_SRCMULTI_ENABLE_INPUT);
}
}
@ -2823,6 +2827,7 @@ init_driver(void)
(info.device_id == CREATIVELABS_SBLIVE_DEVICE_ID
#if AUDIGY
|| info.device_id == CREATIVELABS_AUDIGY_DEVICE_ID
|| info.device_id == CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID
#endif
)) {
if (num_cards == NUM_CARDS) {

View File

@ -53,6 +53,7 @@
#define CREATIVELABS_VENDOR_ID 0x1102 /* Creative Labs */
#define CREATIVELABS_SBLIVE_DEVICE_ID 0x0002 /* Creative Labs SoundBlaster Live */
#define CREATIVELABS_AUDIGY_DEVICE_ID 0x0004 /* Creative Labs Audigy and Audigy 2 */
#define CREATIVELABS_AUDIGY2_VALUE_DEVICE_ID 0x0008 /* Creative Labs Audigy 2 Value */
#define AUDIGY 1 // Audigy seems to work
#ifdef __HAIKU__
@ -68,6 +69,7 @@
#define FRIENDLY_NAME_LIVE_5_1 FRIENDLY_NAME_LIVE" 5.1"
#define FRIENDLY_NAME_AUDIGY FRIENDLY_NAME" Audigy"
#define FRIENDLY_NAME_AUDIGY2 FRIENDLY_NAME_AUDIGY" 2"
#define FRIENDLY_NAME_AUDIGY2_VALUE FRIENDLY_NAME_AUDIGY2" Value"
#define AUTHOR "Jérôme Duval"
/*

View File

@ -777,7 +777,9 @@ emuxki_get_description(emuxki_dev *card, multi_description *data)
data->interface_version = B_CURRENT_INTERFACE_VERSION;
data->interface_minimum = B_CURRENT_INTERFACE_VERSION;
if(IS_AUDIGY2(&card->config))
if (IS_AUDIGY2_VALUE(&card->config))
strncpy(data->friendly_name, FRIENDLY_NAME_AUDIGY2_VALUE, 32);
else if (IS_AUDIGY2(&card->config))
strncpy(data->friendly_name, FRIENDLY_NAME_AUDIGY2, 32);
else if (IS_AUDIGY(&card->config))
strncpy(data->friendly_name, FRIENDLY_NAME_AUDIGY, 32);