Hi 
I make patch for usbatm based on patch from Jianliang Lu 
https://mail.gna.org/public/eagleusb-dev/2005-07/msg00011.html
Patch affect only bulk mode, we should also think about iso pipe,
but the main question is: when ADI fix firmware?

__
Regards
Staszek Gruszka


--- usbatm.c-orig	2005-07-30 20:32:29.000000000 +0200
+++ usbatm.c	2005-07-30 20:40:57.000000000 +0200
@@ -305,6 +305,31 @@ static void usbatm_extract_cells(struct 
 	short vpi, cached_vpi = 0;
 	u8 pti;
 
+#define LEN 8*1024
+	static int idx = 0;
+	static unsigned char buf[LEN];
+
+	/* if avail_data isn't multiple of stride we save data in additional
+	 * buffer and wait for that */
+	if (idx != 0 || avail_data % stride != 0) {
+		if (idx + avail_data > LEN) {
+			dbg("%s: no space in additional buffer\n", __func__);
+			idx = 0;
+			// in this case we process source buffer, or mayby we
+			// should return
+		} else {
+			memcpy(buf + idx, source, avail_data);
+			idx += avail_data;
+			if (idx % stride == 0) {
+				avail_data = idx;
+				source = buf;
+				idx = 0;
+			} else
+				return;
+		}
+	} 
+#undef LEN	
+	
 	for (; avail_data >= stride; avail_data -= stride, source += stride) {
 		vpi = ((source[0] & 0x0f) << 4)  | (source[1] >> 4);
 		vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4);

Reply via email to