Il 20/04/2012 04:36, Zhi Hui Li ha scritto:
> If I add the code :
>    if ((0 == (d->mask & mask)) && (0 != (d->status & (mask << 4)))) {
>        channel_run (icont, ichan);
>    }
> Because function DMA_set_return is called in fdctrl_read_DMA_cb and
> fdctrl_write_DMA_cb, the fdctrl_stop_transfer will release the channel,
> but fdctrl_stop_transfer is after the DMA_set_return, so the channel_run
> will run again, so here I delete the above code.

I looked again at the code, and man it is painful! :)  (Both the
synchronous and asynchronous versions).

I think the best bet is to do the transfer one sector at a time even in
the asynchronous code, and reuse the fifo buffer for this).

Remember that your final objective is to execute exactly the same code
that is in QEMU right now, only scattered across multiple function calls.

Some other notes:

- you don't need the opaque_cb.  Just pass the fdctrl, the dma_len can
be stored in there and the channel is already available

- the scan support is completely broken in QEMU already.  It always
returns SEH (scan equal hit), probably because of misplaced gotos.

Paolo

Reply via email to