[tuxdroid-svn] r1166 - firmware/fuxusb/trunk/src
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-16 13:08:38
|
Author: Paul_R Date: 2008-05-16 15:08:02 +0200 (Fri, 16 May 2008) New Revision: 1166 Modified: firmware/fuxusb/trunk/src/config.h firmware/fuxusb/trunk/src/usb_desc.c firmware/fuxusb/trunk/src/usb_desc.h firmware/fuxusb/trunk/src/usb_enum.c Log: * Removed the directive to compile with/without the TTS interface * Added a directive to compile a HID or LIBUSB device (see config.h - HID_DEVICE) Modified: firmware/fuxusb/trunk/src/config.h =================================================================== --- firmware/fuxusb/trunk/src/config.h 2008-05-16 10:25:56 UTC (rev 1165) +++ firmware/fuxusb/trunk/src/config.h 2008-05-16 13:08:02 UTC (rev 1166) @@ -29,8 +29,8 @@ #include "lib_mcu/5131_drv.h" #include <stdio.h> -/* Enable the TTS interface */ -#define TTS_INTERFACE_ENABLED +/* Enable the HID interface */ +#define HID_DEVICE /* Debug modes : Don't forget to define MAIN_DEBUG to be able to use printf */ //#define MAIN_DEBUG @@ -77,13 +77,13 @@ (0x0001*VER_MAJOR) /* CONFIGURATION DESCRIPTOR */ -#define SIZE_OF_REPORT 0x22 -#ifdef TTS_INTERFACE_ENABLED +#ifdef HID_DEVICE +# define SIZE_OF_REPORT 0x22 # define CONF_LENGTH 0x2901 // 297 # define NB_INTERFACE 6 #else -# define CONF_LENGTH 0xCE00 // 206 -# define NB_INTERFACE 4 +# define CONF_LENGTH 0x2001 // 288 +# define NB_INTERFACE 6 #endif #define CONF_NB 1 Modified: firmware/fuxusb/trunk/src/usb_desc.c =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.c 2008-05-16 10:25:56 UTC (rev 1165) +++ firmware/fuxusb/trunk/src/usb_desc.c 2008-05-16 13:08:02 UTC (rev 1166) @@ -321,7 +321,7 @@ 0x00, // bLockDelayUnits Unused 0x0000 // LockDelay }, - +#ifdef HID_DEVICE //------------------------------------------------------------------------- // "HID" LIB USB //------------------------------------------------------------------------- @@ -366,7 +366,49 @@ 0x4000, // Maximum packet size 0x01 // Polling interval }, -#ifdef TTS_INTERFACE_ENABLED +#else + //---------------------------------------------------------------------------- + // "HID" LIB USB + //---------------------------------------------------------------------------- + // Interface 3 :: Command / Status Interface + //-------------------------------------------------------------------------- + + // HIDInterfaceDescriptor[] = + //------------------------------------- + { + 0x09, // length of descriptor (9 bytes) + 0x04, // descriptor type (INTERFACE) + 0x03, // interface number Index of this interface + 0x00, // alternate setting Index of this alternate setting + 0x02, // number of endpoints + 0x00, // interface class HID + 0x00, // interface sub-class + 0x00, // interface protocol + 0x00 // interface string index + }, + + // HID_InEndpointDescriptor[] = + //------------------------------------- + { + 0x07, // descriptor length (7 bytes) + 0x05, // descriptor type + IN_ENDPOINT4, + 0x03, // bMAttributes (interrupt) bit 7 :: max paket + 0x4000, // Max packet size (64 Bytes) + 0x01 // polling interval 1ms + }, + // HID_OutEndpointDescriptor[] = + //------------------------------------- + { + 0x07, // descriptor length (7 bytes) + 0x05, // descriptor type + OUT_ENDPOINT5, + 0x03, // bMAttributes (interrupt) bit 7 :: max paket + 0x4000, // Max packet size (64 Bytes) + 0x01 // polling interval 1ms + }, +#endif + //------------------------------------------------------------------------- // Audio //------------------------------------------------------------------------- @@ -509,9 +551,11 @@ 0x01, // DescriptorSubType GENERAL subtype 0x00, // bMAttributes bit 7 :: max paket 0x00, // bLockDelayUnits Unused - 0x0000 // LockDelay + 0x0000 // LockDelay +#ifndef HID_DEVICE + } +#else }, -#endif //------------------------------------------------------------------------- // HID Report descriptor //------------------------------------------------------------------------- @@ -537,5 +581,6 @@ 0x91, 0x02, // output (data, variable, absolute) 0xC0 // End collection - } + } +#endif }; Modified: firmware/fuxusb/trunk/src/usb_desc.h =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.h 2008-05-16 10:25:56 UTC (rev 1165) +++ firmware/fuxusb/trunk/src/usb_desc.h 2008-05-16 13:08:02 UTC (rev 1166) @@ -402,12 +402,17 @@ //------------------------------------------------------------------------- // Interface 3 :: Command / Status Interface //------------------------------------------------------------------------- +#ifdef HID_DEVICE struct usb_st_interface_descriptor HIDInterfaceDescriptor; struct usb_hid_descriptor HIDStandardDescriptor; struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; +#else + struct usb_st_interface_descriptor HIDInterfaceDescriptor; + struct usb_st_endpoint_descriptor HID_InEndpointDescriptor; + struct usb_st_endpoint_descriptor HID_OutEndpointDescriptor; +#endif -#ifdef TTS_INTERFACE_ENABLED // Interface 4 :: Audio Control //------------------------------------------------------------------------- struct usb_Audio_st_ACinterface_descriptor StandardACInterfaceDescriptor_TTS; @@ -423,11 +428,12 @@ struct usb_Audio_TYPEI_FormatType_descriptor SpkFormatTypeDescriptor_TTS; struct usb_Audio_st_endpoint_descriptor SpkStandardEndpointDescriptor_TTS; struct usb_Audio_cs_ASendpoint_descriptor SpkEndpointDescriptor_TTS; -#endif +#ifdef HID_DEVICE // Report descriptor //------------------------------------------------------------------------- uint8_t rep[SIZE_OF_REPORT]; +#endif }; Modified: firmware/fuxusb/trunk/src/usb_enum.c =================================================================== --- firmware/fuxusb/trunk/src/usb_enum.c 2008-05-16 10:25:56 UTC (rev 1165) +++ firmware/fuxusb/trunk/src/usb_enum.c 2008-05-16 13:08:02 UTC (rev 1166) @@ -340,6 +340,7 @@ #endif break; } +#ifdef HID_DEVICE case REPORT: { data_to_transfer = SIZE_OF_REPORT; @@ -352,6 +353,7 @@ pbuffer = &(usb_configuration.HIDStandardDescriptor.bLength); break; } +#endif case STRING: { #ifdef USB_ENUM_DEBUG |