﻿id,summary,reporter,owner,description,type,status,component,version,resolution,keywords,cc,guest,host
13769,Problem with SoundBlaster 16 Interrupt Flags (fix included),SpyderTL,,"I stumbled across this issue while working on a SoundBlaster 16 driver for my personal OS.

I noticed that the Interrupt Flags, located at Mixer Register 0x82 (bits 0 and 1) are never cleared, even after an interrupt has been acknowledged.

I scanned through the devsb16.cpp file, and found this:
{{{
1164    case 0x0e:                  /* data available status | irq 8 ack */ 
1165        retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80; 
1166        if (s->mixer_regs[0x82] & 1) { 
1167            ack = 1; 
1168            s->mixer_regs[0x82] &= 1;                 // PROBLEM!
1169#ifndef VBOX 
1170            qemu_irq_lower (s->pic[s->irq]); 
1171#else 
1172            PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0); 
1173#endif 
1174        } 
1175        break; 
1176 
1177    case 0x0f:                  /* irq 16 ack */ 
1178        retval = 0xff; 
1179        if (s->mixer_regs[0x82] & 2) { 
1180            ack = 1; 
1181            s->mixer_regs[0x82] &= 2;              // PROBLEM!!
1182#ifndef VBOX 
1183            qemu_irq_lower (s->pic[s->irq]); 
1184#else 
1185            PDMDevHlpISASetIrq(s->pDevIns, s->irq, 0); 
1186#endif 
1187        } 
1188        break;
}}}

The problem appears to be on line 1168 and 1181.  Those flags should be inverted before they are ANDed with the current value:

{{{
1168            s->mixer_regs[0x82] &= ~1;              // FIXED!
1181            s->mixer_regs[0x82] &= ~2;              // FIXED!
}}}

I would submit this patched code myself, but I am not set up on this machine to download and compile VBOX.

Thanks for your help, guys.  Great product.",defect,closed,audio,VirtualBox 4.3.20,fixed,SB16 Sound Blaster 16,,other,all
