summaryrefslogtreecommitdiff
path: root/ucoolib/hal/usb
diff options
context:
space:
mode:
Diffstat (limited to 'ucoolib/hal/usb')
-rw-r--r--ucoolib/hal/usb/Config12
-rw-r--r--ucoolib/hal/usb/Module1
-rw-r--r--ucoolib/hal/usb/test/Config2
-rw-r--r--ucoolib/hal/usb/test/Makefile9
-rw-r--r--ucoolib/hal/usb/test/test_usb.cc73
-rw-r--r--ucoolib/hal/usb/usb.hh33
-rw-r--r--ucoolib/hal/usb/usb.stm32.cc160
-rw-r--r--ucoolib/hal/usb/usb.stm32.hh98
-rw-r--r--ucoolib/hal/usb/usb_desc.stm32.c193
-rw-r--r--ucoolib/hal/usb/usb_desc.stm32.h33
10 files changed, 0 insertions, 614 deletions
diff --git a/ucoolib/hal/usb/Config b/ucoolib/hal/usb/Config
deleted file mode 100644
index 9adaece..0000000
--- a/ucoolib/hal/usb/Config
+++ /dev/null
@@ -1,12 +0,0 @@
-[hal/usb]
-# Theses are APBTeam IDs, given by Openmoko!
-vendor_id = 0x1d50
-product_id = 0x6052
-# Number of streams, interfaces, or pair of endpoints.
-stream_nb = 1
-# Set to 0 if powered from USB cable, 1 if device has its own power supply.
-self_powered = 0
-# Maximum power consumed from USB cable (mA).
-max_power = 100
-# End point size, you should use 64.
-ep_size = 64
diff --git a/ucoolib/hal/usb/Module b/ucoolib/hal/usb/Module
deleted file mode 100644
index 433c8b2..0000000
--- a/ucoolib/hal/usb/Module
+++ /dev/null
@@ -1 +0,0 @@
-hal_usb_SOURCES = usb.stm32.cc usb_desc.stm32.c
diff --git a/ucoolib/hal/usb/test/Config b/ucoolib/hal/usb/test/Config
deleted file mode 100644
index 49b2f0b..0000000
--- a/ucoolib/hal/usb/test/Config
+++ /dev/null
@@ -1,2 +0,0 @@
-[hal/usb]
-stream_nb = 1
diff --git a/ucoolib/hal/usb/test/Makefile b/ucoolib/hal/usb/test/Makefile
deleted file mode 100644
index cec9ded..0000000
--- a/ucoolib/hal/usb/test/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-BASE = ../../../..
-
-TARGETS = stm32f4
-stm32f4_PROGS = test_usb
-test_usb_SOURCES = test_usb.cc
-
-MODULES = hal/usb
-
-include $(BASE)/build/top.mk
diff --git a/ucoolib/hal/usb/test/test_usb.cc b/ucoolib/hal/usb/test/test_usb.cc
deleted file mode 100644
index 4266684..0000000
--- a/ucoolib/hal/usb/test/test_usb.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// ucoolib - Microcontroller object oriented library. {{{
-//
-// Copyright (C) 2012 Nicolas Schodet
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-// }}}
-#include "ucoolib/hal/usb/usb.hh"
-#include "ucoolib/arch/arch.hh"
-
-int
-main (int argc, const char **argv)
-{
- ucoo::arch_init (argc, argv);
- ucoo::UsbStreamControl usc ("APBTeam", "USB test");
- ucoo::UsbStream us[] = {
- ucoo::UsbStream (usc, 0),
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
- ucoo::UsbStream (usc, 1),
-#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
- ucoo::UsbStream (usc, 2),
-#endif
- };
- if (UCOO_CONFIG_HAL_USB_STREAM_NB > 1)
- {
- for (int i = 0; i < UCOO_CONFIG_HAL_USB_STREAM_NB; i++)
- us[i].block (false);
- }
- char buf[6];
- while (1)
- {
- for (int i = 0; i < UCOO_CONFIG_HAL_USB_STREAM_NB; i++)
- {
- int len = us[i].read (buf + 2, sizeof (buf) - 2);
- if (len)
- {
- buf[0] = i + '0';
- buf[1] = '>';
- len += 2;
- if (UCOO_CONFIG_HAL_USB_STREAM_NB == 1)
- us[i].write (buf, len);
- else
- {
- const char *p = buf;
- while (len)
- {
- int r = us[i].write (p, len);
- p += r;
- len -= r;
- }
- }
- }
- }
- }
-}
-
diff --git a/ucoolib/hal/usb/usb.hh b/ucoolib/hal/usb/usb.hh
deleted file mode 100644
index b5bc61f..0000000
--- a/ucoolib/hal/usb/usb.hh
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef ucoolib_hal_usb_usb_hh
-#define ucoolib_hal_usb_usb_hh
-// ucoolib - Microcontroller object oriented library. {{{
-//
-// Copyright (C) 2012 Nicolas Schodet
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-// }}}
-
-#ifdef TARGET_stm32
-# include "usb.stm32.hh"
-#else
-# error "not implemented for this target"
-#endif
-
-#endif // ucoolib_hal_usb_usb_hh
diff --git a/ucoolib/hal/usb/usb.stm32.cc b/ucoolib/hal/usb/usb.stm32.cc
deleted file mode 100644
index 0410df5..0000000
--- a/ucoolib/hal/usb/usb.stm32.cc
+++ /dev/null
@@ -1,160 +0,0 @@
-// ucoolib - Microcontroller object oriented library. {{{
-//
-// Copyright (C) 2012 Nicolas Schodet
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-// }}}
-#include "usb.stm32.hh"
-#include <algorithm>
-
-#include <libopencm3/stm32/f4/rcc.h>
-#include <libopencm3/stm32/f4/gpio.h>
-#include <libopencm3/cm3/nvic.h>
-
-#include "usb_desc.stm32.h"
-
-static usbd_device *usbdev;
-
-extern "C" {
-
-void
-otg_fs_isr ()
-{
- usbd_poll (usbdev);
-}
-
-}
-
-namespace ucoo {
-
-UsbStreamControl *UsbStreamControl::instance_;
-
-const char *strings[] = {
- NULL,
- NULL
-};
-
-UsbStreamControl::RxBuffer::RxBuffer (void)
- : size (0), offset (0)
-{
-}
-
-UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
- : configured_ (false)
-{
- assert (!instance_);
- instance_ = this;
- strings[0] = vendor;
- strings[1] = product;
- rcc_peripheral_enable_clock (&RCC_AHB2ENR, RCC_AHB2ENR_OTGFSEN);
- rcc_peripheral_enable_clock (&RCC_AHB1ENR, RCC_AHB1ENR_IOPAEN);
- gpio_mode_setup (GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE,
- GPIO9 | GPIO11 | GPIO12);
- gpio_set_af (GPIOA, GPIO_AF10, GPIO9 | GPIO11 | GPIO12);
- usbdev = usbd_init (&otgfs_usb_driver, &usb_desc_dev, &usb_desc_config,
- strings, lengthof (strings));
- usbd_register_set_config_callback (usbdev, set_config);
- nvic_enable_irq (NVIC_OTG_FS_IRQ);
-}
-
-void
-UsbStreamControl::set_config (usbd_device *usbdev, uint16_t configured)
-{
- instance_->configured_ = configured;
- if (configured)
- {
- for (int i = 0; i < stream_nb_; i++)
- {
- usbd_ep_setup (usbdev, 0x01 + i, USB_ENDPOINT_ATTR_BULK, ep_size_,
- rx_callback);
- usbd_ep_setup (usbdev, 0x81 + i, USB_ENDPOINT_ATTR_BULK, ep_size_,
- NULL);
- }
- }
-}
-
-void
-UsbStreamControl::rx_callback (usbd_device *usbdev, uint8_t ep)
-{
- assert (ep > 0 && ep <= stream_nb_);
- int num = ep - 1;
- RxBuffer &rb = instance_->rx_buffer_[num];
- assert (rb.size == 0 && rb.offset == 0);
- usbd_ep_nak_set (usbdev, ep, 1);
- rb.size = usbd_ep_read_packet (usbdev, ep, rb.buf, ep_size_);
-}
-
-UsbStream::UsbStream (UsbStreamControl &control, int num)
- : control_ (control), num_ (num)
-{
- assert (num < UsbStreamControl::stream_nb_);
-}
-
-int
-UsbStream::read (char *buf, int count)
-{
- UsbStreamControl::RxBuffer &rb = control_.rx_buffer_[num_];
- /* Wait for reception. */
- if (!rb.size && !block_)
- return 0;
- while (!rb.size)
- barrier ();
- /* Copy to provided buffer. */
- int len = std::min (count, rb.size - rb.offset);
- buf = std::copy (rb.buf + rb.offset, rb.buf + rb.offset + len, buf);
- rb.offset += len;
- /* Reload buffer? */
- if (rb.offset == rb.size)
- {
- rb.offset = rb.size = 0;
- barrier ();
- usbd_ep_nak_set (usbdev, num_ + 1, 0);
- }
- /* Done. */
- return len;
-}
-
-int
-UsbStream::write (const char *buf, int count)
-{
- int left = count;
- while (left)
- {
- if (control_.configured_)
- {
- int len = std::min (left, UsbStreamControl::ep_size_);
- len = usbd_ep_write_packet (usbdev, num_ + 0x81, buf, len);
- buf += len;
- left -= len;
- }
- if (!block_)
- break;
- }
- return count - left;
-}
-
-int
-UsbStream::poll ()
-{
- UsbStreamControl::RxBuffer &rb = control_.rx_buffer_[num_];
- return rb.size - rb.offset;
-}
-
-} // namespace ucoo
diff --git a/ucoolib/hal/usb/usb.stm32.hh b/ucoolib/hal/usb/usb.stm32.hh
deleted file mode 100644
index 0d443ec..0000000
--- a/ucoolib/hal/usb/usb.stm32.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef ucoolib_hal_usb_usb_stm32_hh
-#define ucoolib_hal_usb_usb_stm32_hh
-// ucoolib - Microcontroller object oriented library. {{{
-//
-// Copyright (C) 2012 Nicolas Schodet
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the "Software"),
-// to deal in the Software without restriction, including without limitation
-// the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// and/or sell copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-// DEALINGS IN THE SOFTWARE.
-//
-// }}}
-#include "ucoolib/intf/stream.hh"
-#include "ucoolib/common.hh"
-
-#include "config/hal/usb.hh"
-
-#include <libopencm3/usb/usbd.h>
-
-namespace ucoo {
-
-class UsbStream;
-
-/// Top control class for an USB device. This is a limited implementation
-/// which fulfill most of our needs: one or more interfaces, each of them is
-/// handled as a character stream. This should be instantiated only once.
-class UsbStreamControl
-{
- public:
- /// Construct a new USB control object, with given VENDOR and PRODUCT
- /// strings.
- UsbStreamControl (const char *vendor, const char *product);
- /// Return true if the device is configured. This means that the
- /// connection is done with the host and data can be exchanged.
- bool is_configured () const { return configured_; }
- private:
- /// Called by USB stack when device is configured. This is expected to
- /// setup endpoints.
- static void set_config (usbd_device *usbdev, uint16_t wValue);
- /// Called by USB stack when a frame is received on a OUT endpoint.
- static void rx_callback (usbd_device *usbdev, uint8_t ep);
- private:
- /// Size of endpoints.
- static const int ep_size_ = UCOO_CONFIG_HAL_USB_EP_SIZE;
- /// Number of streams (also interfaces or pair of endpoints).
- static const int stream_nb_ = UCOO_CONFIG_HAL_USB_STREAM_NB;
- /// Pointer to the one and only instance.
- static UsbStreamControl *instance_;
- /// Whether device is currently configured.
- bool configured_;
- /// Internal RX buffer type.
- struct RxBuffer
- {
- char buf[ep_size_];
- int size, offset;
- RxBuffer (void);
- };
- /// Internal RX buffer, one per stream.
- RxBuffer rx_buffer_[stream_nb_];
- friend class UsbStream;
-};
-
-/// One USB stream, instantiated for each stream, interface, or pair of
-/// endpoints.
-class UsbStream : public Stream
-{
- public:
- /// Construct from control object and stream index.
- UsbStream (UsbStreamControl &control, int num);
- /// See Stream::read.
- int read (char *buf, int count);
- /// See Stream::write.
- int write (const char *buf, int count);
- /// See Stream::poll.
- int poll ();
- private:
- /// Reference to control object.
- UsbStreamControl &control_;
- /// Stream index.
- int num_;
-};
-
-} // namespace ucoo
-
-#endif // ucoolib_hal_usb_usb_stm32_hh
diff --git a/ucoolib/hal/usb/usb_desc.stm32.c b/ucoolib/hal/usb/usb_desc.stm32.c
deleted file mode 100644
index 8d6fc87..0000000
--- a/ucoolib/hal/usb/usb_desc.stm32.c
+++ /dev/null
@@ -1,193 +0,0 @@
-/* ucoolib - Microcontroller object oriented library. {{{
- *
- * Copyright (C) 2012 Nicolas Schodet
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * }}} */
-#include "usb_desc.stm32.h"
-
-#include "config/hal/usb.hh"
-
-const struct usb_device_descriptor usb_desc_dev = {
- .bLength = USB_DT_DEVICE_SIZE,
- .bDescriptorType = USB_DT_DEVICE,
- .bcdUSB = 0x0200,
- .bDeviceClass = 0xff,
- .bDeviceSubClass = 0,
- .bDeviceProtocol = 0,
- .bMaxPacketSize0 = 64,
- .idVendor = UCOO_CONFIG_HAL_USB_VENDOR_ID,
- .idProduct = UCOO_CONFIG_HAL_USB_PRODUCT_ID,
- .bcdDevice = 0x0000,
- .iManufacturer = 1,
- .iProduct = 2,
- .iSerialNumber = 0,
- .bNumConfigurations = 1,
-};
-
-static const struct usb_endpoint_descriptor usb_desc_endp_1[] = {
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x01,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x81,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
-};
-
-static const struct usb_interface_descriptor usb_desc_iface_1[] = {
- {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = 0,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = 0xff,
- .bInterfaceSubClass = 0,
- .bInterfaceProtocol = 0,
- .iInterface = 0,
-
- .endpoint = usb_desc_endp_1,
- },
-};
-
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
-
-static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x02,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x82,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
-};
-
-static const struct usb_interface_descriptor usb_desc_iface_2[] = {
- {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = 1,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = 0xff,
- .bInterfaceSubClass = 0,
- .bInterfaceProtocol = 0,
- .iInterface = 0,
-
- .endpoint = usb_desc_endp_2,
- },
-};
-
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 2 */
-
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
-
-static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x03,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
- {
- .bLength = USB_DT_ENDPOINT_SIZE,
- .bDescriptorType = USB_DT_ENDPOINT,
- .bEndpointAddress = 0x83,
- .bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
- .bInterval = 0,
- },
-};
-
-static const struct usb_interface_descriptor usb_desc_iface_3[] = {
- {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = 2,
- .bAlternateSetting = 0,
- .bNumEndpoints = 2,
- .bInterfaceClass = 0xff,
- .bInterfaceSubClass = 0,
- .bInterfaceProtocol = 0,
- .iInterface = 0,
-
- .endpoint = usb_desc_endp_3,
- },
-};
-
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 3 */
-
-#if UCOO_CONFIG_HAL_USB_STREAM_NB > 3
-# error "too many streams requested"
-#endif
-
-static const struct usb_interface usb_desc_ifaces[] = {
- {
- .num_altsetting = 1,
- .altsetting = usb_desc_iface_1,
- },
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
- {
- .num_altsetting = 1,
- .altsetting = usb_desc_iface_2,
- },
-#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
- {
- .num_altsetting = 1,
- .altsetting = usb_desc_iface_3,
- },
-#endif
-};
-
-const struct usb_config_descriptor usb_desc_config = {
- .bLength = USB_DT_CONFIGURATION_SIZE,
- .bDescriptorType = USB_DT_CONFIGURATION,
- .wTotalLength = 0,
- .bNumInterfaces = UCOO_CONFIG_HAL_USB_STREAM_NB,
- .bConfigurationValue = 1,
- .iConfiguration = 0,
- .bmAttributes = 0x80 | (UCOO_CONFIG_HAL_USB_SELF_POWERED ? 0x40 : 0),
- .bMaxPower = UCOO_CONFIG_HAL_USB_MAX_POWER / 2,
-
- .interface = usb_desc_ifaces,
-};
-
diff --git a/ucoolib/hal/usb/usb_desc.stm32.h b/ucoolib/hal/usb/usb_desc.stm32.h
deleted file mode 100644
index c035cb4..0000000
--- a/ucoolib/hal/usb/usb_desc.stm32.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef ucoolib_hal_usb_usb_desc_stm32_h
-#define ucoolib_hal_usb_usb_desc_stm32_h
-/* ucoolib - Microcontroller object oriented library. {{{
- *
- * Copyright (C) 2012 Nicolas Schodet
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * }}} */
-#include <libopencm3/usb/usbstd.h>
-
-/** USB device descriptor. */
-extern const struct usb_device_descriptor usb_desc_dev;
-/** USB configuration descriptor. */
-extern const struct usb_config_descriptor usb_desc_config;
-
-#endif /* ucoolib_hal_usb_usb_desc_stm32_h */