3.5. pl08x_prep_dma_memcpy

/*
 * Initialize a descriptor to be used by submit
 */
static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy1(
		struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
		size_t len, unsigned long flags)
{
	struct pl08x_txd *local_txd;
	local_txd = kzalloc(sizeof(struct pl08x_txd), GFP_KERNEL);
	if (!local_txd) {
		dev_err(&pd.dmac->dev,
			"%s - no memory for descriptor\n", __func__);
		return NULL;
	} else {
		dma_async_tx_descriptor_init(&local_txd->tx, chan);
		local_txd->srcbus.addr	= src;
		local_txd->dstbus.addr	= dest;
		local_txd->tx.tx_submit	= pl08x_tx_submit;
		local_txd->len = len;
		/*
		 *  dmaengine.c has these directions hard coded,
		 *  but not acessible
		 */
		local_txd->dstdir = DMA_FROM_DEVICE;
		local_txd->srcdir = DMA_TO_DEVICE;
		INIT_LIST_HEAD(&local_txd->txd_list);
		/*
		 * Ensure the platform data for m2m is set on the channel
		 */
		local_txd->pcd = &pd.pd->sd[PL08X_DMA_SIGNALS];
	}
	return &local_txd->tx;
}
        

1

为DMA的memcpy做一些准备工作,主要就是初始化一些参数,尤其是传输方向