DMA DEI

Ask anything your want about the 32X Mushroom programming.

Moderator: BigEvilCorporation

Post Reply
ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

DMA DEI

Post by ob1 » Sat Feb 06, 2021 1:16 pm

Hello fellows.
The Hitachi SH-7604 Hardware Manual defines the IE bit (bit #2) in CHCR register (§9.2.4) as :
Interrupt Enable Bit (IE): Determines whether or not to request a CPU interrupt at the end of a DMA transfer. When the IE bit is set to 1, an interrupt (DEI) request is setnt to the CPU when the TE bit is set.
(typo theirs)

Then, the VCRDMA register (§9.2.5) :
When a transfer-end interrupt occurs, exception handling and interrupt control fetch the vector number and control is transferred to the specified interrupt handling routine.
Finally, regarding the DMA Transfer Flow (§9.3.1)
If the IE bit in CHCR is set to 1 at this time (end of transfer), a DEI interrupt is sent to the CPU.
So, I have tried to raise a DEI at the end of a DMA (initiated by the 32X, with the DREQ circuitry).
I've set the IE bit,
I have defined a vector in the VCRDMA,
defined a function address in the VBR,
then set up CHRC as $44E5 instead of $44E1.

But it failed.

So, my questions are,
- is DEI implemented in any emulator ?
- has anyone ever tested it on real hardware ?

The idea would be to purge the cache lines of the uploaded data as soon as the DMA is complete.

For now, I bypass this with polling : as soon as the 32x is asked for a DMA, I enable HINT. When I HINT, I check CHCR. If CHCR.TE is set, the DMA is finished and I can purge the cache.

I have searched some commercial ROMs (VR, Kolibri, Knuckles), but none of them seem to use the DREQ :/
Last edited by ob1 on Sat Feb 06, 2021 1:20 pm, edited 1 time in total.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: DMA DEI

Post by ob1 » Sat Feb 06, 2021 1:19 pm

ob1 wrote:
Sat Feb 06, 2021 1:16 pm
- is DEI implemented in any emulator ?
Regarding Gens 2.15.4, it looks like it is not implemented.
In sh2a.asm, line 5736 :

Code: Select all

ALIGN32

; void FASTCALL SH2_DMA0_Request(SH2_CONTEXT *sh2, UINT8 state)
; ecx = context pointer
; edx = request line for external (0 = off, !0 = on)
;
; RETURN:
; nothing ...

DECLF SH2_DMA0_Request, 8

	FUNC_IN
	push ebp
	mov [ecx + SH2.DREQ0], dl
	mov ebp, ecx
	mov edx, [ecx + SH2.CHCR0]
	mov ecx, 0xFFFFFF8C
	FUNC_CALL_IN
	call [ebp + SH2.Write_Long + 0xFF * 4]
	FUNC_CALL_OUT
	pop ebp
	FUNC_OUT
I don't see anything related to CHCR.IE, DEI or VCRDMA.

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: DMA DEI

Post by Stef » Sat Feb 06, 2021 11:39 pm

Indeed, Gens only implemented what was used by 32X :oops: and honestly not much was used so the Gens SH-2 core is pretty incomplete on IO side !

srg320
Newbie
Posts: 6
Joined: Sat Feb 06, 2021 9:40 pm
Location: Ukraine

Re: DMA DEI

Post by srg320 » Wed Feb 10, 2021 7:52 am

Some tests of Mars Check Program use the DREQ and almost all 32X hardware. And source code of Mars Check Program is in 32X-DDK.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: DMA DEI

Post by ob1 » Thu Feb 11, 2021 2:54 pm

Thank you.
I have retrieved the DDK.
Though it seems to use all the 32X resources, the SH2 DEI seems left untouched.
Indeed, I found no trace of something like "MOV.*_DMAVECTORN0", _DMAVECTORN0 being the label of DMAVCR0.
Plus, the only value for CHCR I found excluded the IE bit.

So, I guess it's fair to say the DEI was never used on the 32X.

ob1
Very interested
Posts: 463
Joined: Wed Dec 06, 2006 9:01 am
Location: Aix-en-Provence, France

Re: DMA DEI

Post by ob1 » Wed May 19, 2021 7:06 am

I've set the IE bit,
I have defined a vector in the VCRDMA,
defined a function address in the VBR,
then set up CHRC as $44E5 instead of $44E1.
I've done the same test on real PAL hardware, and it doesn't seem to work either :/

Vic
Interested
Posts: 27
Joined: Wed Nov 03, 2021 6:01 pm

Re: DMA DEI

Post by Vic » Mon Jan 15, 2024 11:36 am

Chilly's sound driver uses DMA end interrupts to pass data to the PWM: http://gendev.spritesmind.net/forum/vie ... php?t=1253 , so we do know that setting the 2-nd bitflag in CHCR works on real hardware. Alas, Gens indeed doesn't support this feature, hence no sound effectx in Doom 32X Resurrection there. Works fine everywhere else though.

Post Reply