changeset 2971:ea354217b697

* cdl/usb_serial.cdl: Place static endpoint struct options in a CDL component. * src/usbs_serial.c: Use usbs_get_[tr]x_endpoint() when static endpoint structs are disabled. [ Bugzilla 1001024 ] * tests/usbserial_echo.c, tests/usb2serial.c: Eliminate inclusion of the AT91 USB slave driver header file. * doc/usbs_serial.sgml: Mention the new static endpoint struct CDL component.
author jld
date Wed, 27 Oct 2010 10:22:51 +0000
parents b479691ea40f
children 535911f86a6f
files packages/NEWS packages/io/usb/serial/slave/current/ChangeLog packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl packages/io/usb/serial/slave/current/doc/usbs_serial.sgml packages/io/usb/serial/slave/current/src/usbs_serial.c packages/io/usb/serial/slave/current/tests/usb2serial.c packages/io/usb/serial/slave/current/tests/usbserial_echo.c
diffstat 7 files changed, 73 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/packages/NEWS
+++ b/packages/NEWS
@@ -1,3 +1,5 @@
+* Support for dynamic data endpoint configuration in USB serial function
+  device package by John Dallaway
 * Support for dynamic data endpoint configuration in USB slave API by
   Chris Holgate
 * Update to uSTL 1.4 by Simon Kallweit
--- a/packages/io/usb/serial/slave/current/ChangeLog
+++ b/packages/io/usb/serial/slave/current/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-27  John Dallaway  <john@dallaway.org.uk>
+
+	* cdl/usb_serial.cdl: Place static endpoint struct options in a CDL
+	component.
+	* src/usbs_serial.c: Use usbs_get_[tr]x_endpoint() when static
+	endpoint structs are disabled. [ Bugzilla 1001024 ]
+	* tests/usbserial_echo.c, tests/usb2serial.c: Eliminate inclusion of
+	the AT91 USB slave driver header file.
+	* doc/usbs_serial.sgml: Mention the new static endpoint struct CDL
+	component.
+
 2009-11-13  John Dallaway  <john@dallaway.org.uk>
 
 	* cdl/usb_serial.cdl: Specify test executable names for compatibility
@@ -38,7 +49,7 @@ 2008-07-12  Frank Pagliughi <fpagliughi@
 // ####GPLCOPYRIGHTBEGIN####                                                
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008, 2009 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.                        
 //
 // This program is free software; you can redistribute it and/or modify     
 // it under the terms of the GNU General Public License as published by     
--- a/packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl
+++ b/packages/io/usb/serial/slave/current/cdl/usbs_serial.cdl
@@ -8,7 +8,7 @@
 ## ####ECOSGPLCOPYRIGHTBEGIN####                                            
 ## -------------------------------------------                              
 ## This file is part of eCos, the Embedded Configurable Operating System.   
-## Copyright (C) 2008, 2009 Free Software Foundation, Inc.                        
+## Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.                        
 ##
 ## eCos 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     
@@ -40,7 +40,7 @@
 ######DESCRIPTIONBEGIN####
 #
 # Author(s):      Frank M. Pagliughi (fmp), SoRo Systems, Inc.
-# Contributors:
+# Contributors:   jld
 # Date:           2008-06-04
 #
 #####DESCRIPTIONEND####
@@ -105,17 +105,6 @@ cdl_package CYGPKG_IO_USB_SLAVE_SERIAL {
             The endpoint that should be used for the device-side
             transmitter, which is the USB IN direction."
     }
-    cdl_option CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP {
-        display         "The Tx (USB IN) endpoint structure"
-         flavor         data               
-         default_value  { "usbs_at91_ep1" }
-         description    "
-             The endpoint structure that corresponds to the selected
-             Tx endpoint number. This is dependent on the USBS device
-             driver selected, and could be usbs_at91_ep1,
-             usbs_sa11x0_ep1, etc"
-
-    }
     cdl_option CYGNUM_IO_USB_SLAVE_SERIAL_RX_EP_NUM {
         display         "Rx (USB OUT) endpoint number"
         flavor          data
@@ -124,16 +113,39 @@ cdl_package CYGPKG_IO_USB_SLAVE_SERIAL {
             The endpoint that should be used for the device-side
             receiver, which is the USB OUT direction."
     } 
-    cdl_option CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP {
-        display         "The Rx (USB OUT) endpoint structure"
-         flavor         data               
-         default_value  { "usbs_at91_ep2" }
-         description    "
-             The endpoint structure that corresponds to the selected
-             Rx endpoint number. This is dependent on the USBS device
-             driver selected, and could be usbs_at91_ep2,
-             usbs_sa11x0_ep2, etc"
+
+    cdl_component CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP {
+        display         "Use static I/O endpoint structures"
+        flavor          bool
+        default_value   1
+        description     "
+            Enables the use of static I/O endpoint structures. Some
+            USB slave device drivers implement dynamic endpoint
+            configuration and therefore require this component to be
+            disabled."
+
+        cdl_option CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP {
+            display         "The Tx (USB IN) endpoint structure"
+            flavor         data               
+            default_value  { "usbs_at91_ep1" }
+            description    "
+                The endpoint structure that corresponds to the selected
+                Tx endpoint number. This is dependent on the USBS device
+                driver selected, and could be usbs_at91_ep1,
+                usbs_sa11x0_ep1, etc"
+        }
+        cdl_option CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP {
+            display         "The Rx (USB OUT) endpoint structure"
+            flavor         data               
+            default_value  { "usbs_at91_ep2" }
+            description    "
+                The endpoint structure that corresponds to the selected
+                Rx endpoint number. This is dependent on the USBS device
+                driver selected, and could be usbs_at91_ep2,
+                usbs_sa11x0_ep2, etc"
+        }
     }
+    
     cdl_option CYGNUM_IO_USB_SLAVE_SERIAL_INTR_EP_NUM {
         display         "Interrupt IN endpoint number"
         flavor          data
--- a/packages/io/usb/serial/slave/current/doc/usbs_serial.sgml
+++ b/packages/io/usb/serial/slave/current/doc/usbs_serial.sgml
@@ -11,7 +11,7 @@
 <!-- =============================================================== -->
 <!-- ####ECOSDOCCOPYRIGHTBEGIN####                                   -->
 <!-- =============================================================== -->
-<!-- Copyright (C) 2008 Free Software Foundation, Inc.               -->
+<!-- Copyright (C) 2008, 2010 Free Software Foundation, Inc.         -->
 <!-- This material may be distributed only subject to the terms      -->
 <!-- and conditions set forth in the Open Publication License, v1.0  -->
 <!-- or later (the latest version is presently available at          -->
@@ -26,6 +26,7 @@
 <!--                                                                 -->
 <!-- Author(s):   Andrew Lunn, Frank Pagliughi                       -->
 <!-- Contact(s):  asl                                                -->
+<!-- Contributor: jld                                                -->
 <!-- Date:        2008/06/18                                         -->
 <!-- Version:     0.01                                               -->
 <!--                                                                 -->
@@ -111,7 +112,9 @@
       <para>
         The <literal>CYGDAT_IO_USB_SLAVE_SERIAL_EP0</literal> must be
         configured with the control end point of the USB
-        device. <literal>CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP</literal>
+        device. When using static endpoint configuration,
+        <literal>CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP</literal> must be
+        enabled, <literal>CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP</literal>
         must be configured with the endpoint to be used for
         transmission and  
         <literal>CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP</literal> must be
--- a/packages/io/usb/serial/slave/current/src/usbs_serial.c
+++ b/packages/io/usb/serial/slave/current/src/usbs_serial.c
@@ -8,7 +8,7 @@
 // ####ECOSGPLCOPYRIGHTBEGIN####                                            
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2010 Free Software Foundation, Inc.                        
 //
 // eCos 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     
@@ -40,6 +40,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):    Frank M. Pagliughi (fmp), SoRo Systems, Inc.
+// Contributors: jld
 // Date:         2008-06-02
 //
 //####DESCRIPTIONEND####
@@ -67,16 +68,19 @@
 #define EP0_MAX_PACKET_SIZE     CYGNUM_IO_USB_SLAVE_SERIAL_EP0_MAX_PACKET_SIZE
 
 extern usbs_control_endpoint    CYGDAT_IO_USB_SLAVE_SERIAL_EP0;
+
+#if defined(CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP)
 extern usbs_tx_endpoint         CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP;
 extern usbs_rx_endpoint         CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP;
+#define TX_EP                   (&CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP)
+#define RX_EP                   (&CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP)
+#define INTR_EP                 (&CYGDAT_IO_USB_SLAVE_SERIAL_INTR_EP)
+#endif
 
 #define TX_EP_NUM               CYGNUM_IO_USB_SLAVE_SERIAL_TX_EP_NUM
 #define RX_EP_NUM               CYGNUM_IO_USB_SLAVE_SERIAL_RX_EP_NUM
 #define INTR_EP_NUM             CYGNUM_IO_USB_SLAVE_SERIAL_INTR_EP_NUM
 #define EP0                     (&CYGDAT_IO_USB_SLAVE_SERIAL_EP0)
-#define TX_EP                   (&CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP)
-#define RX_EP                   (&CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP)
-#define INTR_EP                 (&CYGDAT_IO_USB_SLAVE_SERIAL_INTR_EP)
 
 
 #define VENDOR_ID               CYGNUM_IO_USB_SLAVE_SERIAL_VENDOR_ID
@@ -279,8 +283,6 @@ cyg_cond_t  usbs_serial_state_cond;
 int usbs_serial_state;
 
 usbs_serial usbs_ser0 = {
-    tx_ep:      TX_EP,
-    rx_ep:      RX_EP,
     tx_result:  0,    
     rx_result:  0,    
 };
@@ -402,6 +404,12 @@ usbs_serial_wait_until_configured(void)
   cyg_mutex_lock(&usbs_serial_lock);
   while (usbs_serial_state != USBS_STATE_CONFIGURED)
     cyg_cond_wait(&usbs_serial_state_cond);
+
+#if !defined(CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP)
+  usbs_ser0.tx_ep = usbs_get_tx_endpoint(usbs_serial_ep0, TX_EP_NUM);
+  usbs_ser0.rx_ep = usbs_get_rx_endpoint(usbs_serial_ep0, RX_EP_NUM);
+#endif
+
   cyg_mutex_unlock(&usbs_serial_lock);
 }
 
@@ -517,7 +525,11 @@ usbs_serial_init(usbs_serial* ser, usbs_
 void
 usbs_serial_start(void)
 {
+#if defined(CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP)
   usbs_serial_init(&usbs_ser0, TX_EP, RX_EP);
+#else  
+  usbs_serial_init(&usbs_ser0, NULL, NULL);
+#endif
   
   cyg_mutex_init(&usbs_serial_lock);
   cyg_cond_init(&usbs_serial_state_cond, &usbs_serial_lock);
--- a/packages/io/usb/serial/slave/current/tests/usb2serial.c
+++ b/packages/io/usb/serial/slave/current/tests/usb2serial.c
@@ -8,7 +8,7 @@
 // ####ECOSGPLCOPYRIGHTBEGIN####                                            
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2010 Free Software Foundation, Inc.                        
 //
 // eCos 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     
@@ -53,8 +53,6 @@
 #include <pkgconf/kernel.h>
 #include <cyg/io/serialio.h>
 
-// Replace this with any other USB driver desired.
-#include <cyg/io/usb/usbs_at91.h>
 #include <cyg/io/usb/usbs_serial.h>
 #include <pkgconf/io_usb_slave_serial.h>
 
--- a/packages/io/usb/serial/slave/current/tests/usbserial_echo.c
+++ b/packages/io/usb/serial/slave/current/tests/usbserial_echo.c
@@ -8,7 +8,7 @@
 // ####ECOSGPLCOPYRIGHTBEGIN####                                            
 // -------------------------------------------                              
 // This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2008 Free Software Foundation, Inc.                        
+// Copyright (C) 2008, 2010 Free Software Foundation, Inc.                        
 //
 // eCos 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     
@@ -51,7 +51,6 @@
 #include <cyg/hal/hal_arch.h>
 #include <cyg/infra/diag.h>
 #include <pkgconf/kernel.h>
-#include <cyg/io/usb/usbs_at91.h>
 #include <cyg/io/usb/usbs_serial.h>
 
 #include <stdio.h>