summaryrefslogtreecommitdiff
path: root/ucoo/hal/usb
diff options
context:
space:
mode:
authorNicolas Schodet2015-05-15 12:05:06 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commit41fde87ed8d1fcd593777bdfae2fa9e65006d984 (patch)
tree48a82b5ba790741d1f0bcc97eb183ea4b045d7b0 /ucoo/hal/usb
parent751a7d2ba7a0fbb9c6dae2d91891f0cc74897a2a (diff)
build: add support for out of tree modules
Diffstat (limited to 'ucoo/hal/usb')
-rw-r--r--ucoo/hal/usb/Config2
-rw-r--r--ucoo/hal/usb/Module2
-rw-r--r--ucoo/hal/usb/test/Config2
-rw-r--r--ucoo/hal/usb/test/Makefile2
-rw-r--r--ucoo/hal/usb/test/test_usb.cc12
-rw-r--r--ucoo/hal/usb/usb.stm32.cc6
-rw-r--r--ucoo/hal/usb/usb.stm32.hh6
-rw-r--r--ucoo/hal/usb/usb_desc.stm32.c38
8 files changed, 35 insertions, 35 deletions
diff --git a/ucoo/hal/usb/Config b/ucoo/hal/usb/Config
index 80341e8..0ec69c3 100644
--- a/ucoo/hal/usb/Config
+++ b/ucoo/hal/usb/Config
@@ -1,4 +1,4 @@
-[hal/usb]
+[ucoo/hal/usb]
# Theses are APBTeam IDs, given by Openmoko!
vendor_id = 0x1d50
product_id = 0x6052
diff --git a/ucoo/hal/usb/Module b/ucoo/hal/usb/Module
index 433c8b2..e47e0e8 100644
--- a/ucoo/hal/usb/Module
+++ b/ucoo/hal/usb/Module
@@ -1 +1 @@
-hal_usb_SOURCES = usb.stm32.cc usb_desc.stm32.c
+ucoo_hal_usb_SOURCES = usb.stm32.cc usb_desc.stm32.c
diff --git a/ucoo/hal/usb/test/Config b/ucoo/hal/usb/test/Config
index 49b2f0b..a29fd20 100644
--- a/ucoo/hal/usb/test/Config
+++ b/ucoo/hal/usb/test/Config
@@ -1,2 +1,2 @@
-[hal/usb]
+[ucoo/hal/usb]
stream_nb = 1
diff --git a/ucoo/hal/usb/test/Makefile b/ucoo/hal/usb/test/Makefile
index 9ef0eab..95e4648 100644
--- a/ucoo/hal/usb/test/Makefile
+++ b/ucoo/hal/usb/test/Makefile
@@ -4,6 +4,6 @@ TARGETS = stm32f4
PROGS = test_usb
test_usb_SOURCES = test_usb.cc
-MODULES = hal/usb
+MODULES = ucoo/hal/usb
include $(BASE)/build/top.mk
diff --git a/ucoo/hal/usb/test/test_usb.cc b/ucoo/hal/usb/test/test_usb.cc
index a1fe362..914e084 100644
--- a/ucoo/hal/usb/test/test_usb.cc
+++ b/ucoo/hal/usb/test/test_usb.cc
@@ -31,22 +31,22 @@ main (int argc, const char **argv)
ucoo::UsbStreamControl usc ("APBTeam", "USB test");
ucoo::UsbStream us[] = {
ucoo::UsbStream (usc, 0),
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
ucoo::UsbStream (usc, 1),
#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
ucoo::UsbStream (usc, 2),
#endif
};
- if (UCOO_CONFIG_HAL_USB_STREAM_NB > 1)
+ if (CONFIG_UCOO_HAL_USB_STREAM_NB > 1)
{
- for (int i = 0; i < UCOO_CONFIG_HAL_USB_STREAM_NB; i++)
+ for (int i = 0; i < CONFIG_UCOO_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++)
+ for (int i = 0; i < CONFIG_UCOO_HAL_USB_STREAM_NB; i++)
{
int len = us[i].read (buf + 2, sizeof (buf) - 2);
if (len)
@@ -54,7 +54,7 @@ main (int argc, const char **argv)
buf[0] = i + '0';
buf[1] = '>';
len += 2;
- if (UCOO_CONFIG_HAL_USB_STREAM_NB == 1)
+ if (CONFIG_UCOO_HAL_USB_STREAM_NB == 1)
us[i].write (buf, len);
else
{
diff --git a/ucoo/hal/usb/usb.stm32.cc b/ucoo/hal/usb/usb.stm32.cc
index 37595e8..93f1782 100644
--- a/ucoo/hal/usb/usb.stm32.cc
+++ b/ucoo/hal/usb/usb.stm32.cc
@@ -31,7 +31,7 @@
#include "usb_desc.stm32.h"
#if defined (TARGET_stm32f4)
-# if UCOO_CONFIG_HAL_USB_DRIVER_HS
+# if CONFIG_UCOO_HAL_USB_DRIVER_HS
# define usb_isr otg_hs_isr
# define usb_driver otghs_usb_driver
# else
@@ -82,7 +82,7 @@ UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
strings[0] = vendor;
strings[1] = product;
#if defined (TARGET_stm32f4)
-# if UCOO_CONFIG_HAL_USB_DRIVER_HS
+# if CONFIG_UCOO_HAL_USB_DRIVER_HS
rcc_periph_clock_enable (RCC_OTGHS);
rcc_periph_clock_enable (RCC_GPIOB);
gpio_mode_setup (GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE,
@@ -103,7 +103,7 @@ UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
strings, lengthof (strings),
usb_control_buffer, sizeof (usb_control_buffer));
usbd_register_set_config_callback (usbdev, set_config);
-#if UCOO_CONFIG_HAL_USB_DRIVER_HS
+#if CONFIG_UCOO_HAL_USB_DRIVER_HS
nvic_enable_irq (NVIC_OTG_HS_IRQ);
#else
nvic_enable_irq (NVIC_OTG_FS_IRQ);
diff --git a/ucoo/hal/usb/usb.stm32.hh b/ucoo/hal/usb/usb.stm32.hh
index 118e883..11ce16c 100644
--- a/ucoo/hal/usb/usb.stm32.hh
+++ b/ucoo/hal/usb/usb.stm32.hh
@@ -26,7 +26,7 @@
#include "ucoo/intf/stream.hh"
#include "ucoo/common.hh"
-#include "config/hal/usb.hh"
+#include "config/ucoo/hal/usb.hh"
#include <libopencm3/usb/usbd.h>
@@ -54,9 +54,9 @@ class UsbStreamControl
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;
+ static const int ep_size_ = CONFIG_UCOO_HAL_USB_EP_SIZE;
/// Number of streams (also interfaces or pair of endpoints).
- static const int stream_nb_ = UCOO_CONFIG_HAL_USB_STREAM_NB;
+ static const int stream_nb_ = CONFIG_UCOO_HAL_USB_STREAM_NB;
/// Pointer to the one and only instance.
static UsbStreamControl *instance_;
/// Whether device is currently configured.
diff --git a/ucoo/hal/usb/usb_desc.stm32.c b/ucoo/hal/usb/usb_desc.stm32.c
index 8d6fc87..ae14d14 100644
--- a/ucoo/hal/usb/usb_desc.stm32.c
+++ b/ucoo/hal/usb/usb_desc.stm32.c
@@ -23,7 +23,7 @@
* }}} */
#include "usb_desc.stm32.h"
-#include "config/hal/usb.hh"
+#include "config/ucoo/hal/usb.hh"
const struct usb_device_descriptor usb_desc_dev = {
.bLength = USB_DT_DEVICE_SIZE,
@@ -33,8 +33,8 @@ const struct usb_device_descriptor usb_desc_dev = {
.bDeviceSubClass = 0,
.bDeviceProtocol = 0,
.bMaxPacketSize0 = 64,
- .idVendor = UCOO_CONFIG_HAL_USB_VENDOR_ID,
- .idProduct = UCOO_CONFIG_HAL_USB_PRODUCT_ID,
+ .idVendor = CONFIG_UCOO_HAL_USB_VENDOR_ID,
+ .idProduct = CONFIG_UCOO_HAL_USB_PRODUCT_ID,
.bcdDevice = 0x0000,
.iManufacturer = 1,
.iProduct = 2,
@@ -48,7 +48,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_1[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x01,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -56,7 +56,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_1[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x81,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -77,7 +77,7 @@ static const struct usb_interface_descriptor usb_desc_iface_1[] = {
},
};
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
{
@@ -85,7 +85,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x02,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -93,7 +93,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_2[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x82,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -114,9 +114,9 @@ static const struct usb_interface_descriptor usb_desc_iface_2[] = {
},
};
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 2 */
+#endif /* CONFIG_UCOO_HAL_USB_STREAM_NB >= 2 */
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
{
@@ -124,7 +124,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x03,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
{
@@ -132,7 +132,7 @@ static const struct usb_endpoint_descriptor usb_desc_endp_3[] = {
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = 0x83,
.bmAttributes = USB_ENDPOINT_ATTR_BULK,
- .wMaxPacketSize = UCOO_CONFIG_HAL_USB_EP_SIZE,
+ .wMaxPacketSize = CONFIG_UCOO_HAL_USB_EP_SIZE,
.bInterval = 0,
},
};
@@ -153,9 +153,9 @@ static const struct usb_interface_descriptor usb_desc_iface_3[] = {
},
};
-#endif /* UCOO_CONFIG_HAL_USB_STREAM_NB >= 3 */
+#endif /* CONFIG_UCOO_HAL_USB_STREAM_NB >= 3 */
-#if UCOO_CONFIG_HAL_USB_STREAM_NB > 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB > 3
# error "too many streams requested"
#endif
@@ -164,13 +164,13 @@ static const struct usb_interface usb_desc_ifaces[] = {
.num_altsetting = 1,
.altsetting = usb_desc_iface_1,
},
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 2
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 2
{
.num_altsetting = 1,
.altsetting = usb_desc_iface_2,
},
#endif
-#if UCOO_CONFIG_HAL_USB_STREAM_NB >= 3
+#if CONFIG_UCOO_HAL_USB_STREAM_NB >= 3
{
.num_altsetting = 1,
.altsetting = usb_desc_iface_3,
@@ -182,11 +182,11 @@ 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,
+ .bNumInterfaces = CONFIG_UCOO_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,
+ .bmAttributes = 0x80 | (CONFIG_UCOO_HAL_USB_SELF_POWERED ? 0x40 : 0),
+ .bMaxPower = CONFIG_UCOO_HAL_USB_MAX_POWER / 2,
.interface = usb_desc_ifaces,
};