openvortex-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openvortex-dev] spdif init


From: Manuel Jander
Subject: Re: [Openvortex-dev] spdif init
Date: Sat, 15 Nov 2003 14:03:09 -0400

Hi,

> -       hwwrite(vortex->mmio, VORTEX_SPDIF_CFG0, this_38 & 0xffff);
> -       hwwrite(vortex->mmio, VORTEX_SPDIF_CFG1, this_38 >> 0x10);
> -       hwwrite(vortex->mmio, VORTEX_SPDIF_SMPRATE, spdif_sr);
> +       /* looks like the next 2 lines transfer a 16-bit value into 2 8-bit 
> registers.
> +          seems to be for the standard IEC/SPDIF initialization stuff */
> +       hwwrite(vortex->mmio, VORTEX_SPDIF_CFG0, this_38 & 0xffff);
> +       hwwrite(vortex->mmio, VORTEX_SPDIF_CFG1, this_38 >> 0x0f);
> +       hwwrite(vortex->mmio, VORTEX_SPDIF_SMPRATE, spdif_sr);  /* for a 
> samplerate converter I think */
>  }

Bad news. The shift of 0x10 is correct. The bug must be something else.
I just checked the disassembled win32 driver, and its clearly 0x10, not
0xf. If you shift by 0xf, the result would not be 8 bit aligned. I guess
it's some kind of coincidence that made it work. I would suggest to play
with the initial value of this_38 instead of messing with the shift
value, because the this shift value is only thing we know for sure to be
correct. So it doesn't make any sense to change that.


> Theres a lot of stuff there, but the important change is the 0x10
> becoming an 0x0f on the second hwwrite line.  I'm convinced thats just
> somebodys off-by-one error, and with that change my receiver *finally*
> initializes correctly.  Also, in the switch statement where I changed
> 0x03000000 to 0x00000000, that was necessary to get sound from the spdif
> when its set to 44.1khz once I'd made the hwwrite change.  

See for yourself:

mov     ecx, [esi+38h]
shr     ecx, 10h ; <===========
push    ecx
mov     ecx, [esi+18h]
push    291D4h
call    address@hidden@@address@hidden ; CAsp4HwIO::Write(ulong,ulong)


> Looking at the way emu10k1 uses their spdif, I'm convinced its the
> correct way to do things.  And now my spdif will play mostly correct
> sound when its set to either 44.1khz or 48khz, regardless of the
> frequency of the source.  Theres a touch of distortion playing 44.1k
> sounds at 48k, but nowheres near what I used to get.  For some reason,
> 32khz still doesn't work at all for me.  I think it must have to do with
> spdif_sr being set incorrectly for that frequency, but that variable's
> pretty cryptic and I don't know what to do other than trial and error to
> fix it.

I guess the best way to reverse engineer the unknown parts of this, is
to use Jeff's win2k driver hook. I would really recommend it.

Best Regards

Manuel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]