Re: USB controller driver usb_dc_ep_write

Loic Poulain

On Tue, 11 Dec 2018 at 12:28, Cufi, Carles <carles.cufi@...> wrote:

+ Johann, Andrei, Pawel


From: devel@... <devel@...> On Behalf Of Mark Wang
Sent: 10 December 2018 13:37
To: devel@...
Subject: [Zephyr-devel] USB controller driver usb_dc_ep_write


Hi all,

I see many USB controller drivers implement usb_dc_ep_write function with one copy, copy the data (passed to usb_dc_ep_write) to one selfs buffer then do the transfer.

Do I need do this when implementing one new USB controller driver?

There is no requirement to copy the data, but usually, usb device drivers copy the data to the controller FIFO.

Does the Zephyr USB stack limit the data (pass to usb_dc_ep_write) is in RAM?

There is no defined data size limit when calling the function, but at then end, driver decides how much data is written (e.g. size of the FIFO).

The function prototype is as follow:

int usb_dc_ep_write(const u8_t ep, const u8_t *const data,

                  const u32_t data_len, u32_t *const ret_bytes)

For USB users (e.g. class/gadget drivers, app) the high level usb_transfer() function can be used to execute USB data transfer.




Mark Wang



Join to automatically receive all group messages.