Change in osmo-asf4-dfu[master]: fix USB transfer

2019-02-14 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/12909 )

Change subject: fix USB transfer
..

fix USB transfer

this ASFv4 USB library change fixes USB transfer.
two transfer-size issues existed:
- on multi-packet transfer if the last packet was less than the
USB transfer packet size, the packet would be received but not
acknowledged
- during normal transfer the packet size of a previous packet set
the size of the current packet, ignoring the actual transfer size

transfer with a combination of partial or full USB single packet,
USB multi-packet, max transfer, and control endpoint sizes was
successfully tested (in bytes): 4, 32, 64, 128, 129, 512, 516,
544, 576, 640, 641, 1024, 1028

Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
---
M hpl/usb/hpl_usb.c
1 file changed, 1 insertion(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/hpl/usb/hpl_usb.c b/hpl/usb/hpl_usb.c
index 6bf09ab..cc6cc41 100644
--- a/hpl/usb/hpl_usb.c
+++ b/hpl/usb/hpl_usb.c
@@ -1135,6 +1135,7 @@
/* Short packet. */
ept->flags.bits.need_zlp = 0;
ept->trans_count += last_trans;
+   _usbd_ep_set_out_trans(epn, 0, ept->size, 0);
} else {
/* Full packets. */
ept->trans_count += trans_size;
@@ -1154,9 +1155,6 @@
if (trans_next > ept->size) {
if (trans_next > USB_D_DEV_TRANS_MAX) {
trans_next = 
USB_D_DEV_TRANS_MAX;
-   } else {
-   /* Must expect multiple of ep 
size. */
-   trans_next -= trans_next & 
size_mask;
}
} else if (trans_next < ept->size) {
/* Last un-aligned packet should be 
cached. */

--
To view, visit https://gerrit.osmocom.org/12909
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
Gerrit-Change-Number: 12909
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-asf4-dfu[master]: fix USB transfer

2019-02-14 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/12909 )

Change subject: fix USB transfer
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/12909
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
Gerrit-Change-Number: 12909
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 14 Feb 2019 21:42:09 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-asf4-dfu[master]: fix USB transfer

2019-02-14 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/12909


Change subject: fix USB transfer
..

fix USB transfer

this ASFv4 USB library change fixes USB transfer.
two transfer-size issues existed:
- on multi-packet transfer if the last packet was less than the
USB transfer packet size, the packet would be received but not
acknowledged
- during normal transfer the packet size of a previous packet set
the size of the current packet, ignoring the actual transfer size

transfer with a combination of partial or full USB single packet,
USB multi-packet, max transfer, and control endpoint sizes was
successfully tested (in bytes): 4, 32, 64, 128, 129, 512, 516,
544, 576, 640, 641, 1024, 1028

Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
---
M hpl/usb/hpl_usb.c
1 file changed, 1 insertion(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/09/12909/1

diff --git a/hpl/usb/hpl_usb.c b/hpl/usb/hpl_usb.c
index 6bf09ab..cc6cc41 100644
--- a/hpl/usb/hpl_usb.c
+++ b/hpl/usb/hpl_usb.c
@@ -1135,6 +1135,7 @@
/* Short packet. */
ept->flags.bits.need_zlp = 0;
ept->trans_count += last_trans;
+   _usbd_ep_set_out_trans(epn, 0, ept->size, 0);
} else {
/* Full packets. */
ept->trans_count += trans_size;
@@ -1154,9 +1155,6 @@
if (trans_next > ept->size) {
if (trans_next > USB_D_DEV_TRANS_MAX) {
trans_next = 
USB_D_DEV_TRANS_MAX;
-   } else {
-   /* Must expect multiple of ep 
size. */
-   trans_next -= trans_next & 
size_mask;
}
} else if (trans_next < ept->size) {
/* Last un-aligned packet should be 
cached. */

--
To view, visit https://gerrit.osmocom.org/12909
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-asf4-dfu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4e64168e865362e12e0b76386f964895b8b6c20
Gerrit-Change-Number: 12909
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon