Page 1 of 1

Uploading Microcode

Posted: Thu Mar 16, 2006 6:25 am
by tumnes
Ok, so now I've got a tiny microcode program that I would like to upload to vu1. I have been successful using the code provided by Saotome in a prevous thread, but would like to try it using libpacket and libdma. So according to the EE user's manual I need something like this:

[MPG|num|addr] [NOP|..|..] [NOP|..|..] [NOP|..|..]
[ Code ... ] [ Code ...]

The NOP's are so that it aligns to 128 bits.

So I have my VIFcodes:
0x4a080000 0x00000000 0x00000000 0x00000000
Followed by 64bits x 8 instructions

And then I try to upload the code using:
packet_send(&packet,DMA_CHANNEL_VIF1,DMA_FLAG_NORMAL);

Now, I noticed when I was going through this with uploading data that the figures in the manual appear to be backwards. It showed something like:
[z][y][x][vifcode]
[w]

but I had to do:
[vifcode][x][y][z]
[w]

to get it to work properly.

So I tried the same with this and it still didnt work. It just seems to block at packet_send(). Any ideas what is going wrong here?

Posted: Thu Mar 16, 2006 6:51 am
by tumnes
Alrighty, I found the answer on my own which I will share.

Basically the vifcode MPG has to be aligned to a 64bit boundry, so in my case I want somethign like:

[NOP][MPG]

Code: Select all

[Code]        [Code]
...

Since each instruction is 64 bits and the vifcode is only 32 there needs to be a NOP vifcode before the MPG tag for alignment.

It appears to be backwards from the way its shown in the EE user's manual for some reason.