OK, let's start with the last part of you post:
The difference between
and
is that the first one can be made use of, and the second is absolutely useless. When a transfer is created by the constructor, it merely describes what should be done by the DMA SPI driver. Constructing a transfer does not register it for handling -registerTransfer(trx) must be used to actually queue up a transfer.
This should also clarify why the second line is useless - you cannot register the transfer that was just created, and the compiler might even optimize it away entirely (I'm not sure about that, though).
If you want to handle multiple transfers, one after each other, with the least possible amount of delay between them, here's how (with 3 transfers, pseudo-code):
This can be slightly dangerous, though, because with very short transfers you might mess up their order. I'll now have a closer look at you actual code to see if I can spot potential problems. From what I've already seen, you don't seem to make any serious mistakes here!
The difference between
Code:
trx = DmaSpi0::Transfer(src, DMASIZE, dest);
Code:
DmaSpi0::Transfer trx(src, DMASIZE, dest);
This should also clarify why the second line is useless - you cannot register the transfer that was just created, and the compiler might even optimize it away entirely (I'm not sure about that, though).
If you want to handle multiple transfers, one after each other, with the least possible amount of delay between them, here's how (with 3 transfers, pseudo-code):
Code:
create transfer0 (src, size, dest)
create transfer1 (src, size, dest)
create transfer2 (src, size, dest)
register transfer0
register transfer1
register transfer2
in a loop:
if transfer0.done() == true
register transfer0
do something useful
if transfer1.done() == true
register transfer1
do something useful
if transfer2.done() == true
register transfer2
do something useful