[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Update Aranym's USB Native Feature driver.



Please commit this patch. Thanks!

Commit message:

Update driver to follow the changes done in Aranym's USB Native Feature.
Driver doesn't pass anymore the usb_device struct, driver updates now
some of its members.
Index: aranym-hcd.c
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/aranym/aranym-hcd.c,v
retrieving revision 1.2
diff -u -8 -r1.2 aranym-hcd.c
--- aranym-hcd.c	4 Feb 2014 09:54:53 -0000	1.2
+++ aranym-hcd.c	12 Feb 2014 16:49:04 -0000
@@ -1,12 +1,12 @@
 /*
  * Aranym USB (virtual) Controller Driver.
  *
- * Copyright (c) 2012 David Galvez.
+ * Copyright (c) 2012-2014 David Galvez.
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
  *
  * This file is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -30,29 +30,29 @@
 #include "aranym.h"
 #include "usbhost_nfapi.h"
 
 #include "../../usb.h"
 #include "../ucd_defs.h"
 
 
 #define VER_MAJOR	0
-#define VER_MINOR	1
+#define VER_MINOR	2
 #define VER_STATUS	
 
-#define DRIVER_VERSION	"16 Jan 2012"
+#define DRIVER_VERSION	"12 Feb 2014"
 
 #define MSG_VERSION	str (VER_MAJOR) "." str (VER_MINOR) str (VER_STATUS) 
 #define MSG_BUILDDATE	__DATE__
 
 #define MSG_BOOT	\
-	"\033p Aranym USB controller driver " MSG_VERSION " \033q\r\n"
+	"\033pAranym USB controller driver " MSG_VERSION " \033q\r\n"
 
 #define MSG_GREET	\
-	"(c) 2012 by David Galvez.\r\n" \
+	"(c) 2012-2014 by David Galvez.\r\n" \
 	"Compiled " MSG_BUILDDATE ".\r\n\r\n"
 
 #define MSG_MINT	\
 	"\033pMiNT too old!\033q\r\n"
 
 #define MSG_FAILURE	\
 	"\7\r\nSorry, failed!\r\n\r\n"
 
@@ -171,45 +171,63 @@
 
 long
 submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		   long len, long interval)
 {
 	DEBUG(("dev=0x%lx pipe=%lx buf=0x%lx size=%d int=%d",
 	    dev, pipe, buffer, len, interval));
 	
-	int r;
+	long r;
 
-	r = nf_call(USBHOST(USBHOST_SUBMIT_INT_MSG), dev, pipe, buffer, len, interval);
+	r = nf_call(USBHOST(USBHOST_SUBMIT_INT_MSG), pipe, buffer, len, interval);
 
-	return r;
+	if(r >= 0) {
+		dev->status = 0;
+		dev->act_len = r;
+		return 0;
+	}
+
+	return -1;
 }
 
 
 long
 submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		       long len, struct devrequest *setup)
 {
-	int r;
+	long r;
 
-	r = nf_call(USBHOST(USBHOST_SUBMIT_CONTROL_MSG), dev, pipe, buffer, len, setup);
+	r = nf_call(USBHOST(USBHOST_SUBMIT_CONTROL_MSG), pipe, buffer, len, setup);
 
-	return r;
+	if(r >= 0) {
+		dev->status = 0;
+		dev->act_len = r;
+		return 0;
+	}
+
+	return -1;
 }
 
 
 long
 submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		    long len, long flags)
 {
-	int r;
+	long r;
 
-	r = nf_call(USBHOST(USBHOST_SUBMIT_BULK_MSG), dev, pipe, buffer, len);
+	r = nf_call(USBHOST(USBHOST_SUBMIT_BULK_MSG), pipe, buffer, len);
 
-	return r;
+	if(r >= 0) {
+		dev->status = 0;
+		dev->act_len = r;
+		return 0;
+	}
+
+	return -1;
 }
 
 
 /* --- Interrupt functions ----------------------------------------------------- */
 
 static void
 int_handle_tophalf (PROC *process, long arg)
 {
@@ -313,19 +331,19 @@
 long 
 usb_lowlevel_init(long dummy1, const struct pci_device_id *dummy2)
 {
 	int r;
 	
 	r = nf_call(USBHOST(USBHOST_LOWLEVEL_INIT));
 
 	if (!r) 
-		(void) Cconws(" Aranym USB Controller Driver init \r\n");
+		(void) Cconws("Aranym USB Controller Driver init \r\n");
 	else
-		(void) Cconws(" Couldn't init aranym host chip emulator \r\n");
+		(void) Cconws("Couldn't init aranym host chip emulator \r\n");
 
 	return 0;
 }
 
 
 long 
 usb_lowlevel_stop(void)
 {
Index: usbhost_nfapi.h
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/aranym/usbhost_nfapi.h,v
retrieving revision 1.1
diff -u -8 -r1.1 usbhost_nfapi.h
--- usbhost_nfapi.h	20 Jan 2012 22:37:17 -0000	1.1
+++ usbhost_nfapi.h	12 Feb 2014 16:49:04 -0000
@@ -1,12 +1,12 @@
 /*
  * Aranym USB (virtual) Controller Driver.
  *
- * Copyright (c) 2012 David Galvez.
+ * Copyright (c) 2012-2014 David Galvez.
  *
  * This file is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2, or (at your option)
  * any later version.
  *
  * This file is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,17 +20,17 @@
  */
 
 #ifndef _USBHOST_NFAPI_H
 #define _USBHOST_NFAPI_H
 
 /* if you change anything in the enum {} below you have to increase 
    this NFUSBHOST_NFAPI_VERSION!
 */
-#define USBHOST_NFAPI_VERSION	0x00000002
+#define USBHOST_NFAPI_VERSION	0x00000003
 
 enum {
 	GET_VERSION = 0,	/* no parameters, return NFAPI_VERSION in d0 */
 	USBHOST_INTLEVEL,
 	USBHOST_RH_PORT_STATUS,
 	USBHOST_LOWLEVEL_INIT,
 	USBHOST_LOWLEVEL_STOP,
 	USBHOST_SUBMIT_CONTROL_MSG,