Page 1 of 1

IOP Dma example?

Posted: Sat Jun 30, 2007 5:25 am
by ubergeek42
I am trying to copy some data from ee ram to iop ram and back again using an iop program. I saw the sifman header file in the ps2sdk, but I got a bit confused because there are 3 different sifDma's(0-2). I looked around in the ps2sdk, but I couldn't find anything that was for the iop.

Or is there a faster/better way to do 2 way transfers from the iop then dma that I am overlooking?

Thanks.

Posted: Sat Jun 30, 2007 6:34 am
by Lukasz
I think the siftoo IOP module by Marcus R. Brown in the ps2sdk is what you are looking for:

http://svn.ps2dev.org/filedetails.php?r ... rev=0&sc=0

I think it should be used with the sbusintr module.

You might also want to check out the ps2link source, it does EE-IOP communication using SIF DMA, since it's from the days when RPC was unstable :-)

Posted: Sat Jun 30, 2007 7:46 am
by ubergeek42
That siftoo module looks rather incomplete(many of the functions are empty and simply return 0), but the source for ps2link looks to be very promising, after a quick glance at the source code. I should be able to figure it out from that.

Again, thank you, you have been very helpful to me.

Posted: Sat Jun 30, 2007 10:25 am
by radad
What about the fileXioRead/Write? They use DMA to send the buffer between EE and IOP ram.

Posted: Sat Jun 30, 2007 10:34 am
by ubergeek42
From looking at the source for fileXio, it seems to be one way, only writing to ee ram, though I imagine swapping the src/dest pointers would reverse it. It seems so simple now that I see some actual code using it. Thanks guys.

Posted: Sat Jun 30, 2007 8:04 pm
by Polo35
Hey,

When you're at iop side you have to suspend interupt before performing dma transfert and resume it after.

Like that:

Code: Select all

		while(SifDmaStat(dma_id) >= 0);

		sifdma.src = src;
		sifdma.dest = dest;
		sifdma.size = size;
		sifdma.attr = 0;
		CpuSuspendIntr(&intr);
		dma_id = SifSetDma(&sifdma, 1);
		CpuResumeIntr(intr);
While at ee side you don't have to use interupts.


Other way to access iop ram from ee is to use sbv code ( smem.c ) which use memory mapping to access iop ram in kernel mode.

From my own experience, it's largely faster to read/write iop ram with memcpy in kernel mode then using dma transfert.

But i don't know if ps2sdk give a way make same ting from iop to ee ram.

Best regards

Polo