Re: a bulk urb with both PIO and DMA buffer?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 10, 2023 at 05:53:38AM +0800, Randy Li wrote:
> Hello
> 
> I am trying to write a driver for a USB-SPI adapter(WCH347). The protocol of
> this chip would be consist with two parts, operate code and payload length
> would be the first part. SPI framework could prepare the sg_table for the
> second part which is the payload.
> 
> It is worth to do dma transfer for the second part of a bulk packet, but I
> have to prepend a small buffer before it. Then I have to copy the
> scatterlist from the sg_table to append to a new scatter list, that costs
> CPU a lot.
> 
> I wonder if there is a way that I could construct a bulk packet with two
> URBs or anyway to make the URB first try a bytes of PIO then DMA?

It is not possible to do either of those things.

However, it is possible to modify the sg_table by adding a new element 
at the start (or else create a new sg_table that starts with a new 
element and then includes the original sg_table).  The new element can 
point to a buffer in which you store the operate code and payload 
length.  Once that's finished, you can use SG for the entire URB.

Alan Stern



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux