From ffaa7447d3b0c0d9effbc83400031144bf9745f3 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Fri, 10 Apr 2009 01:16:22 +0200 Subject: * digital/avr/modules/usb: - do it more the AVR modules way. --- digital/avr/modules/usb/test/descriptors.c | 20 ++++++++++++++- digital/avr/modules/usb/test/descriptors.h | 20 --------------- digital/avr/modules/usb/test/test_usb.c | 20 ++++++++++++--- digital/avr/modules/usb/test/test_usb.h | 41 ------------------------------ digital/avr/modules/usb/usb.h | 29 +++++++++++++++++++++ 5 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 digital/avr/modules/usb/test/test_usb.h create mode 100644 digital/avr/modules/usb/usb.h (limited to 'digital/avr') diff --git a/digital/avr/modules/usb/test/descriptors.c b/digital/avr/modules/usb/test/descriptors.c index 4ccc7b49..a3b46ee0 100644 --- a/digital/avr/modules/usb/test/descriptors.c +++ b/digital/avr/modules/usb/test/descriptors.c @@ -22,8 +22,26 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * }}} */ +#include "common.h" + +#include "modules/usb/usb.h" + +#include + #include "descriptors.h" +/* Configuration structure. */ +typedef struct +{ + USB_Descriptor_Configuration_Header_t Config; + USB_Descriptor_Interface_t TS1_Interface; + USB_Descriptor_Endpoint_t TS1_DataOutEndpoint; + USB_Descriptor_Endpoint_t TS1_DataInEndpoint; + USB_Descriptor_Interface_t TS2_Interface; + USB_Descriptor_Endpoint_t TS2_DataOutEndpoint; + USB_Descriptor_Endpoint_t TS2_DataInEndpoint; +} USB_Descriptor_Configuration_t; + USB_Descriptor_Device_t PROGMEM DeviceDescriptor = { Header: { Size: sizeof (USB_Descriptor_Device_t), Type: DTYPE_Device }, @@ -144,7 +162,7 @@ USB_Descriptor_String_t PROGMEM ProductString = uint16_t USB_GetDescriptor (const uint16_t wValue, const uint8_t wIndex, - void** const DescriptorAddress) + void ** const DescriptorAddress) { const uint8_t DescriptorType = wValue >> 8; const uint8_t DescriptorNumber = wValue & 0xFF; diff --git a/digital/avr/modules/usb/test/descriptors.h b/digital/avr/modules/usb/test/descriptors.h index f7052672..388f0fd0 100644 --- a/digital/avr/modules/usb/test/descriptors.h +++ b/digital/avr/modules/usb/test/descriptors.h @@ -24,8 +24,6 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * }}} */ -#include -#include /* Endpoints. */ #define TS1_TX_EPNUM 1 @@ -34,22 +32,4 @@ #define TS2_RX_EPNUM 4 #define TS_TXRX_EPSIZE 16 -/* Configuration structure. */ -typedef struct -{ - USB_Descriptor_Configuration_Header_t Config; - USB_Descriptor_Interface_t TS1_Interface; - USB_Descriptor_Endpoint_t TS1_DataOutEndpoint; - USB_Descriptor_Endpoint_t TS1_DataInEndpoint; - USB_Descriptor_Interface_t TS2_Interface; - USB_Descriptor_Endpoint_t TS2_DataOutEndpoint; - USB_Descriptor_Endpoint_t TS2_DataInEndpoint; -} USB_Descriptor_Configuration_t; - -/* Used by LUFA to get descriptors. */ -uint16_t -USB_GetDescriptor (const uint16_t wValue, const uint8_t wIndex, - void** const DescriptorAddress) -ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG (3); - #endif /* descriptors_h */ diff --git a/digital/avr/modules/usb/test/test_usb.c b/digital/avr/modules/usb/test/test_usb.c index 5442c0fd..93a6084b 100644 --- a/digital/avr/modules/usb/test/test_usb.c +++ b/digital/avr/modules/usb/test/test_usb.c @@ -22,12 +22,26 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * }}} */ -#include "test_usb.h" +#include "common.h" -/** Based on DualCDC example from LUFA. Refers to LUFA Demos for more +#include "modules/usb/usb.h" +#include "io.h" + +#include + +#include "descriptors.h" + +/** + * Based on DualCDC example from LUFA. Refers to LUFA Demos for more * comments. There is only 4 endpoints on the at90usb162, therefore a dual * CDC-ACM cannot be implemented. To access this dual "serial port", use a - * generic usb_serial driver. */ + * generic usb_serial driver. + */ + +HANDLES_EVENT (USB_Connect); +HANDLES_EVENT (USB_Disconnect); +HANDLES_EVENT (USB_ConfigurationChanged); +HANDLES_EVENT (USB_UnhandledControlPacket); volatile uint8_t USB_USBTask_run; volatile uint8_t TS1Task_run; diff --git a/digital/avr/modules/usb/test/test_usb.h b/digital/avr/modules/usb/test/test_usb.h deleted file mode 100644 index 36b2e27e..00000000 --- a/digital/avr/modules/usb/test/test_usb.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef test_usb_h -#define test_usb_h -/* test_usb.h */ -/* usb - USB device module using LUFA. {{{ - * - * Copyright (C) 2009 Nicolas Schodet - * - * APBTeam: - * Web: http://apbteam.org/ - * Email: team AT apbteam DOT org - * - * 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 - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * }}} */ -#include -#include -#include - -#include "descriptors.h" - -#include -#include - -HANDLES_EVENT (USB_Connect); -HANDLES_EVENT (USB_Disconnect); -HANDLES_EVENT (USB_ConfigurationChanged); -HANDLES_EVENT (USB_UnhandledControlPacket); - -#endif /* test_usb_h */ diff --git a/digital/avr/modules/usb/usb.h b/digital/avr/modules/usb/usb.h new file mode 100644 index 00000000..3d07f57b --- /dev/null +++ b/digital/avr/modules/usb/usb.h @@ -0,0 +1,29 @@ +#ifndef usb_h +#define usb_h +/* usb.h */ +/* usb - USB device module using LUFA. {{{ + * + * Copyright (C) 2009 Nicolas Schodet + * + * APBTeam: + * Web: http://apbteam.org/ + * Email: team AT apbteam DOT org + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * }}} */ +#include + +#endif /* usb_h */ -- cgit v1.2.3