drivers: usb: udc_dwc2: Notify upper layer on failed TX
Change ensures that `dwc2_handle_xfer_next` would notify upper layer if `dwc2_tx_fifo_write` fails. This is necessary to ensure that upper layer is aware of the failed TX for the submitted transfer. It also ensures that the submitted transfer is removed from the TX queue. Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no> Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
This commit is contained in:
parent
da97542a6e
commit
8b50d3768f
1 changed files with 12 additions and 3 deletions
|
@ -639,9 +639,18 @@ static void dwc2_handle_xfer_next(const struct device *dev,
|
|||
if (USB_EP_DIR_IS_OUT(cfg->addr)) {
|
||||
dwc2_prep_rx(dev, buf, cfg);
|
||||
} else {
|
||||
if (dwc2_tx_fifo_write(dev, cfg, buf)) {
|
||||
LOG_ERR("Failed to start write to TX FIFO, ep 0x%02x",
|
||||
cfg->addr);
|
||||
int err = dwc2_tx_fifo_write(dev, cfg, buf);
|
||||
|
||||
if (err) {
|
||||
LOG_ERR("Failed to start write to TX FIFO, ep 0x%02x (err: %d)",
|
||||
cfg->addr, err);
|
||||
|
||||
buf = udc_buf_get(dev, cfg->addr);
|
||||
if (udc_submit_ep_event(dev, buf, -ECONNREFUSED)) {
|
||||
LOG_ERR("Failed to submit endpoint event");
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue