crazii / SBEMU

legacy sound blaster emulation for DOS
GNU General Public License v2.0
626 stars 33 forks source link

Intel HDA PIO option #64

Closed jiyunomegami closed 10 months ago

jiyunomegami commented 10 months ago

Adds a PIO option, for when CORB doesn't work. (D945GCLF2 ICH7)

crazii commented 10 months ago

Thanks very much! Is it possible to auto-detect PIO without command line option? as mentioned here, adding a timeout to detect the freeze on CORB, and then try to use PIO? Or PIO might be easy to test if it works, so detect PIO first with port reads/writes, if value not changes, then use CORB/RIRB.

jiyunomegami commented 10 months ago

I don't know if it is possible to detect the freeze, and I didn't think it would be a good idea to use PIO by default. I will investigate further, but it might be safer to just have a simple PIO option that people can try when their system freezes. By the way, I will open two more issues regarding MPU support and X-FI, please look at them if you have the time and interest.

jiyunomegami commented 10 months ago

I think I found the cause of the freeze. According to the spec, you "Must read the value back" when you set CORBCTL to enable DMA, as is done in azx_single_send_cmd. In my case, adding a 10ms delay solved the freezing problem, but reading the response using the RIRB times out. I added a loop to check if the CORBCTL was set properly, and a fallback to PIO when RIRB times out, to my fork. I will prepare a separate pull request later.