upd985xx USB slave patch
Andrew Lunn
andrew.lunn@ascom.ch
Thu Nov 28 05:48:00 GMT 2002
Hi Folks
Attached is a patch for the upd985xx USB slave. This patch fixes a
problem when the ep0 maximum payload length is not 8. RedHat have an
internal patch which has not yet been contributed which changes the
default to 64. (This patch does not require that patch).
The problem occurs when replying with less bytes then requested. If
this happens and the reply is a multiple of the maximum payload size,
a zero byte packet must be appended. The current code has a hardcoded
8 for the maximum packet size. This patch changes it to use the CDL
configured value.
The patch also adds some clarification has to how the maximum
payload size is determined from the CDL options.
Andrew
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /data/cvs/plc1g/ecos/packages/devs/usb/nec_upd985xx/v1_5_2/ChangeLog,v
retrieving revision 1.1.1.1.6.1
diff -c -u -r1.1.1.1.6.1 ChangeLog
--- ChangeLog 2002/11/18 14:48:11 1.1.1.1.6.1
+++ ChangeLog 2002/11/28 13:30:02
@@ -1,3 +1,10 @@
+2002-11-28 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * src/usbs_upd985xx.c (ep0_rx_dsr): Use the correct maximum packet
+ size when determining if a zero byte packet is needed.
+ * cdl/usbs_upd985xx.cdl: Comment to clarify how the maximum packet
+ size is determined, and ensure the RX buffer is big enough.
+
2002-08-22 Clark Williams <williams@redhat.com>
* src/usbs_upd985xx.c (ep0_init):
Index: cdl/usbs_upd985xx.cdl
===================================================================
RCS file: /data/cvs/plc1g/ecos/packages/devs/usb/nec_upd985xx/v1_5_2/cdl/usbs_upd985xx.cdl,v
retrieving revision 1.1.1.1
diff -c -u -r1.1.1.1 usbs_upd985xx.cdl
--- cdl/usbs_upd985xx.cdl 2002/03/19 09:46:12 1.1.1.1
+++ cdl/usbs_upd985xx.cdl 2002/11/28 13:30:04
@@ -100,7 +100,9 @@
display "Size of statically-allocated endpoint 0 transmit buffer"
flavor data
default_value 64
- requires { CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE >= 8 }
+ requires { CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE >= 8 }
+ requires { CYGNUM_DEVS_USB_UPD985XX_EPO_TXBUFSIZE >=
+ CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE }
description "
The implementation of the support for endpoint 0 uses
a single static buffer to hold incoming control messages.
@@ -108,7 +110,11 @@
involve an initial eight-byte header, sometimes followed by
a small amount of additional data. However if some
application-specific protocol depends on larger control
- messages then this buffer size may need to be increased.
+ messages then this buffer size may need to be
+ increased.
+
+ Note: The maximum data payload size for both transmit
+ and receive for endpoint 0 are determined by this option.
"
}
}
Index: src/usbs_upd985xx.c
===================================================================
RCS file: /data/cvs/plc1g/ecos/packages/devs/usb/nec_upd985xx/v1_5_2/src/usbs_upd985xx.c,v
retrieving revision 1.2.6.1
diff -c -u -r1.2.6.1 usbs_upd985xx.c
--- src/usbs_upd985xx.c 2002/11/18 14:48:15 1.2.6.1
+++ src/usbs_upd985xx.c 2002/11/28 13:32:24
@@ -1517,7 +1517,14 @@
if (actual_length > length) {
actual_length = length;
}
- if ((length != actual_length) && (0 == (actual_length % 8))) {
+ // Note the use of the RXBUFSIZE even thought we
+ // are TXing. This is because the protocol uses
+ // the same size in both directions. We used the
+ // TXBUFSIZE when setting up the endpoint so we
+ // have to decide to send zero byte packets using
+ // that size.
+ if ((length != actual_length) &&
+ (0 == (actual_length % CYGNUM_DEVS_USB_UPD985XX_EP0_RXBUFSIZE))) {
ep0.tx_needs_zero_transfer = true;
} else {
ep0.tx_needs_zero_transfer = false;
More information about the Ecos-patches
mailing list