# HG changeset patch # User jld # Date 1288174971 0 # Node ID ea354217b697039329aae4e33a55be365926af6c # Parent b479691ea40f97b13101495382eb644779110e46 * 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. diff --git a/packages/NEWS b/packages/NEWS --- 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 diff --git a/packages/io/usb/serial/slave/current/ChangeLog b/packages/io/usb/serial/slave/current/ChangeLog --- 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 + + * 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 * cdl/usb_serial.cdl: Specify test executable names for compatibility @@ -38,7 +49,7 @@ 2008-07-12 Frank Pagliughi - + @@ -26,6 +26,7 @@ + @@ -111,7 +112,9 @@ The CYGDAT_IO_USB_SLAVE_SERIAL_EP0 must be configured with the control end point of the USB - device. CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP + device. When using static endpoint configuration, + CYGPKG_IO_USB_SLAVE_SERIAL_STATIC_EP must be + enabled, CYGDAT_IO_USB_SLAVE_SERIAL_TX_EP must be configured with the endpoint to be used for transmission and CYGDAT_IO_USB_SLAVE_SERIAL_RX_EP must be diff --git a/packages/io/usb/serial/slave/current/src/usbs_serial.c b/packages/io/usb/serial/slave/current/src/usbs_serial.c --- 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); diff --git a/packages/io/usb/serial/slave/current/tests/usb2serial.c b/packages/io/usb/serial/slave/current/tests/usb2serial.c --- 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 #include -// Replace this with any other USB driver desired. -#include #include #include diff --git a/packages/io/usb/serial/slave/current/tests/usbserial_echo.c b/packages/io/usb/serial/slave/current/tests/usbserial_echo.c --- 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 #include #include -#include #include #include