00001 /* Name: usbconfig.h 00002 * Project: AVR USB driver 00003 * Author: Christian Starkjohann 00004 * Creation Date: 2007-12-08 00005 * Tabsize: 4 00006 * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH 00007 * License: GNU GPL v2 (see License.txt) 00008 * This Revision: $Id: usbconfig.h,v 1.1 2008-07-09 20:47:11 rschaten Exp $ 00009 */ 00010 00011 #ifndef __usbconfig_h_included__ 00012 #define __usbconfig_h_included__ 00013 00014 /* 00015 General Description: 00016 This file contains the configuration options for the USB driver. 00017 00018 Please note that the usbdrv contains a usbconfig-prototype.h file now. We 00019 recommend that you use that file as a template because it will always list 00020 the newest features and options. 00021 */ 00022 00023 /* Fetch the hardware configuration from bootloaderconfig.h so that we have a 00024 * single file where hardware settings are stored. 00025 * Do not edit the functional settings below. 00026 */ 00027 #include "bootloaderconfig.h" 00028 00029 #define USB_PUBLIC static 00030 /* Use the define above if you #include usbdrv.c instead of linking against it. 00031 * This technique saves a couple of bytes in flash memory. 00032 */ 00033 00034 /* --------------------------- Functional Range ---------------------------- */ 00035 00036 #define USB_CFG_HAVE_INTRIN_ENDPOINT 0 00037 /* Define this to 1 if you want to compile a version with two endpoints: The 00038 * default control endpoint 0 and an interrupt-in endpoint 1. 00039 */ 00040 #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0 00041 /* Define this to 1 if you want to compile a version with three endpoints: The 00042 * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in 00043 * endpoint 3. You must also enable endpoint 1 above. 00044 */ 00045 #define USB_CFG_IMPLEMENT_HALT 0 00046 /* Define this to 1 if you also want to implement the ENDPOINT_HALT feature 00047 * for endpoint 1 (interrupt endpoint). Although you may not need this feature, 00048 * it is required by the standard. We have made it a config option because it 00049 * bloats the code considerably. 00050 */ 00051 #define USB_CFG_INTR_POLL_INTERVAL 200 00052 /* If you compile a version with endpoint 1 (interrupt-in), this is the poll 00053 * interval. The value is in milliseconds and must not be less than 10 ms for 00054 * low speed devices. 00055 */ 00056 #define USB_CFG_IS_SELF_POWERED 0 00057 /* Define this to 1 if the device has its own power supply. Set it to 0 if the 00058 * device is powered from the USB bus. 00059 */ 00060 #define USB_CFG_MAX_BUS_POWER 100 00061 /* Set this variable to the maximum USB bus power consumption of your device. 00062 * The value is in milliamperes. [It will be divided by two since USB 00063 * communicates power requirements in units of 2 mA.] 00064 */ 00065 #define USB_CFG_IMPLEMENT_FN_WRITE 1 00066 /* Set this to 1 if you want usbFunctionWrite() to be called for control-out 00067 * transfers. Set it to 0 if you don't need it and want to save a couple of 00068 * bytes. 00069 */ 00070 #define USB_CFG_IMPLEMENT_FN_READ 1 00071 /* Set this to 1 if you need to send control replies which are generated 00072 * "on the fly" when usbFunctionRead() is called. If you only want to send 00073 * data from a static buffer, set it to 0 and return the data from 00074 * usbFunctionSetup(). This saves a couple of bytes. 00075 */ 00076 #define USB_CFG_IMPLEMENT_FN_WRITEOUT 0 00077 /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1. 00078 * You must implement the function usbFunctionWriteOut() which receives all 00079 * interrupt/bulk data sent to endpoint 1. 00080 */ 00081 #define USB_CFG_HAVE_FLOWCONTROL 0 00082 /* Define this to 1 if you want flowcontrol over USB data. See the definition 00083 * of the macros usbDisableAllRequests() and usbEnableAllRequests() in 00084 * usbdrv.h. 00085 */ 00086 00087 /* -------------------------- Device Description --------------------------- */ 00088 00089 #define USB_CFG_VENDOR_ID 0xc0, 0x16 /* 5824 in dec, stands for VOTI */ 00090 /* USB vendor ID for the device, low byte first. If you have registered your 00091 * own Vendor ID, define it here. Otherwise you use obdev's free shared 00092 * VID/PID pair. Be sure to read USBID-License.txt for rules! 00093 */ 00094 #define USB_CFG_DEVICE_ID 0xdc, 0x05 /* 1500 in dec, obdev's free PID */ 00095 /* This is the ID of the product, low byte first. It is interpreted in the 00096 * scope of the vendor ID. If you have registered your own VID with usb.org 00097 * or if you have licensed a PID from somebody else, define it here. Otherwise 00098 * you use obdev's free shared VID/PID pair. Be sure to read the rules in 00099 * USBID-License.txt! 00100 */ 00101 #define USB_CFG_DEVICE_VERSION 0x02, 0x01 00102 /* Version number of the device: Minor number first, then major number. 00103 */ 00104 #define USB_CFG_VENDOR_NAME 'w', 'w', 'w', '.', 'f', 'i', 's', 'c', 'h', 'l', '.', 'd', 'e' 00105 #define USB_CFG_VENDOR_NAME_LEN 13 00106 /* These two values define the vendor name returned by the USB device. The name 00107 * must be given as a list of characters under single quotes. The characters 00108 * are interpreted as Unicode (UTF-16) entities. 00109 * If you don't want a vendor name string, undefine these macros. 00110 * ALWAYS define a vendor name containing your Internet domain name if you use 00111 * obdev's free shared VID/PID pair. See the file USBID-License.txt for 00112 * details. 00113 */ 00114 #define USB_CFG_DEVICE_NAME 'U', 'S', 'B', 'a', 's', 'p' 00115 #define USB_CFG_DEVICE_NAME_LEN 6 00116 /* Same as above for the device name. If you don't want a device name, undefine 00117 * the macros. See the file USBID-License.txt before you assign a name. 00118 */ 00119 /*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */ 00120 /*#define USB_CFG_SERIAL_NUMBER_LEN 0 */ 00121 /* Same as above for the serial number. If you don't want a serial number, 00122 * undefine the macros. 00123 * It may be useful to provide the serial number through other means than at 00124 * compile time. See the section about descriptor properties below for how 00125 * to fine tune control over USB descriptors such as the string descriptor 00126 * for the serial number. 00127 */ 00128 #define USB_CFG_DEVICE_CLASS 0xff 00129 #define USB_CFG_DEVICE_SUBCLASS 0 00130 /* See USB specification if you want to conform to an existing device class. 00131 */ 00132 #define USB_CFG_INTERFACE_CLASS 0 00133 #define USB_CFG_INTERFACE_SUBCLASS 0 00134 #define USB_CFG_INTERFACE_PROTOCOL 0 00135 /* See USB specification if you want to conform to an existing device class or 00136 * protocol. 00137 */ 00138 #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 0 /* total length of report descriptor */ 00139 /* Define this to the length of the HID report descriptor, if you implement 00140 * an HID device. Otherwise don't define it or define it to 0. 00141 */ 00142 00143 /* ------------------- Fine Control over USB Descriptors ------------------- */ 00144 /* If you don't want to use the driver's default USB descriptors, you can 00145 * provide our own. These can be provided as (1) fixed length static data in 00146 * flash memory, (2) fixed length static data in RAM or (3) dynamically at 00147 * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more 00148 * information about this function. 00149 * Descriptor handling is configured through the descriptor's properties. If 00150 * no properties are defined or if they are 0, the default descriptor is used. 00151 * Possible properties are: 00152 * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched 00153 * at runtime via usbFunctionDescriptor(). 00154 * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found 00155 * in static memory is in RAM, not in flash memory. 00156 * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash), 00157 * the driver must know the descriptor's length. The descriptor itself is 00158 * found at the address of a well known identifier (see below). 00159 * List of static descriptor names (must be declared PROGMEM if in flash): 00160 * char usbDescriptorDevice[]; 00161 * char usbDescriptorConfiguration[]; 00162 * char usbDescriptorHidReport[]; 00163 * char usbDescriptorString0[]; 00164 * int usbDescriptorStringVendor[]; 00165 * int usbDescriptorStringDevice[]; 00166 * int usbDescriptorStringSerialNumber[]; 00167 * Other descriptors can't be provided statically, they must be provided 00168 * dynamically at runtime. 00169 * 00170 * Descriptor properties are or-ed or added together, e.g.: 00171 * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18)) 00172 * 00173 * The following descriptors are defined: 00174 * USB_CFG_DESCR_PROPS_DEVICE 00175 * USB_CFG_DESCR_PROPS_CONFIGURATION 00176 * USB_CFG_DESCR_PROPS_STRINGS 00177 * USB_CFG_DESCR_PROPS_STRING_0 00178 * USB_CFG_DESCR_PROPS_STRING_VENDOR 00179 * USB_CFG_DESCR_PROPS_STRING_PRODUCT 00180 * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 00181 * USB_CFG_DESCR_PROPS_HID 00182 * USB_CFG_DESCR_PROPS_HID_REPORT 00183 * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver) 00184 * 00185 */ 00186 00187 #define USB_CFG_DESCR_PROPS_DEVICE 0 00188 #define USB_CFG_DESCR_PROPS_CONFIGURATION 0 00189 #define USB_CFG_DESCR_PROPS_STRINGS 0 00190 #define USB_CFG_DESCR_PROPS_STRING_0 0 00191 #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0 00192 #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0 00193 #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0 00194 #define USB_CFG_DESCR_PROPS_HID 0 00195 #define USB_CFG_DESCR_PROPS_HID_REPORT 0 00196 #define USB_CFG_DESCR_PROPS_UNKNOWN 0 00197 00198 /* ----------------------- Optional MCU Description ------------------------ */ 00199 00200 /* The following configurations have working defaults in usbdrv.h. You 00201 * usually don't need to set them explicitly. Only if you want to run 00202 * the driver on a device which is not yet supported or with a compiler 00203 * which is not fully supported (such as IAR C) or if you use a differnt 00204 * interrupt than INT0, you may have to define some of these. 00205 */ 00206 /* #define USB_INTR_CFG MCUCR */ 00207 /* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */ 00208 /* #define USB_INTR_CFG_CLR 0 */ 00209 /* #define USB_INTR_ENABLE GIMSK */ 00210 /* #define USB_INTR_ENABLE_BIT INT0 */ 00211 /* #define USB_INTR_PENDING GIFR */ 00212 /* #define USB_INTR_PENDING_BIT INTF0 */ 00213 00214 #endif /* __usbconfig_h_included__ */