[b0c194d] | 1 | /**
|
---|
| 2 | * \file firmware/usbconfig.h
|
---|
| 3 | * \brief Configuration options for the USB-driver.
|
---|
| 4 | *
|
---|
| 5 | * This file is almost identical to the original usbconfig.h by Christian
|
---|
| 6 | * Starkjohann, in structure and content.
|
---|
| 7 | *
|
---|
| 8 | * It contains parts of the USB driver which can be configured and can or must
|
---|
| 9 | * be adapted to your hardware.
|
---|
| 10 | * \author Ronald Schaten <ronald@schatenseite.de>
|
---|
| 11 | * \version $Id: usbconfig.h,v 1.1 2008-07-09 20:47:12 rschaten Exp $
|
---|
| 12 | *
|
---|
| 13 | * License: GNU GPL v2 (see License.txt)
|
---|
| 14 | */
|
---|
| 15 |
|
---|
| 16 | #ifndef __usbconfig_h_included__
|
---|
| 17 | #define __usbconfig_h_included__
|
---|
| 18 |
|
---|
| 19 | /* ---------------------------- Hardware Config ---------------------------- */
|
---|
| 20 |
|
---|
| 21 | /** This is the port where the USB bus is connected. When you configure it to
|
---|
| 22 | * "B", the registers PORTB, PINB and DDRB will be used.
|
---|
| 23 | */
|
---|
| 24 | #define USB_CFG_IOPORTNAME D
|
---|
| 25 | /** This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
|
---|
| 26 | * This may be any bit in the port.
|
---|
| 27 | */
|
---|
| 28 | #define USB_CFG_DMINUS_BIT 5
|
---|
| 29 | /** This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
|
---|
| 30 | * This may be any bit in the port. Please note that D+ must also be connected
|
---|
| 31 | * to interrupt pin INT0!
|
---|
| 32 | */
|
---|
| 33 | #define USB_CFG_DPLUS_BIT 2
|
---|
| 34 |
|
---|
| 35 | /* ----------------------- Optional Hardware Config ------------------------ */
|
---|
| 36 |
|
---|
| 37 | /* If you connect the 1.5k pullup resistor from D- to a port pin instead of
|
---|
| 38 | * V+, you can connect and disconnect the device from firmware by calling
|
---|
| 39 | * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
|
---|
| 40 | * This constant defines the port on which the pullup resistor is connected.
|
---|
| 41 | */
|
---|
| 42 | /* #define USB_CFG_PULLUP_IOPORTNAME D */
|
---|
| 43 | /* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
|
---|
| 44 | * above) where the 1.5k pullup resistor is connected. See description
|
---|
| 45 | * above for details.
|
---|
| 46 | */
|
---|
| 47 | /* #define USB_CFG_PULLUP_BIT 4 */
|
---|
| 48 |
|
---|
| 49 | /* --------------------------- Functional Range ---------------------------- */
|
---|
| 50 |
|
---|
| 51 | /** Define this to 1 if you want to compile a version with two endpoints: The
|
---|
| 52 | * default control endpoint 0 and an interrupt-in endpoint 1.
|
---|
| 53 | */
|
---|
| 54 | #define USB_CFG_HAVE_INTRIN_ENDPOINT 1
|
---|
| 55 | /** Define this to 1 if you want to compile a version with three endpoints: The
|
---|
| 56 | * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in
|
---|
| 57 | * endpoint 3. You must also enable endpoint 1 above.
|
---|
| 58 | */
|
---|
| 59 | #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
|
---|
| 60 | /** Define this to 1 if you also want to implement the ENDPOINT_HALT feature
|
---|
| 61 | * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
|
---|
| 62 | * it is required by the standard. We have made it a config option because it
|
---|
| 63 | * bloats the code considerably.
|
---|
| 64 | */
|
---|
| 65 | #define USB_CFG_IMPLEMENT_HALT 0
|
---|
| 66 | /** If you compile a version with endpoint 1 (interrupt-in), this is the poll
|
---|
| 67 | * interval. The value is in milliseconds and must not be less than 10 ms for
|
---|
| 68 | * low speed devices.
|
---|
| 69 | */
|
---|
| 70 | #define USB_CFG_INTR_POLL_INTERVAL 20
|
---|
| 71 | /** Define this to 1 if the device has its own power supply. Set it to 0 if the
|
---|
| 72 | * device is powered from the USB bus.
|
---|
| 73 | */
|
---|
| 74 | #define USB_CFG_IS_SELF_POWERED 0
|
---|
| 75 | /** Set this variable to the maximum USB bus power consumption of your device.
|
---|
| 76 | * The value is in milliamperes. [It will be divided by two since USB
|
---|
| 77 | * communicates power requirements in units of 2 mA.]
|
---|
| 78 | */
|
---|
| 79 | #define USB_CFG_MAX_BUS_POWER 100
|
---|
| 80 | /** Set this to 1 if you want usbFunctionWrite() to be called for control-out
|
---|
| 81 | * transfers. Set it to 0 if you don't need it and want to save a couple of
|
---|
| 82 | * bytes.
|
---|
| 83 | */
|
---|
| 84 | #define USB_CFG_IMPLEMENT_FN_WRITE 0
|
---|
| 85 | /** Set this to 1 if you need to send control replies which are generated
|
---|
| 86 | * "on the fly" when usbFunctionRead() is called. If you only want to send
|
---|
| 87 | * data from a static buffer, set it to 0 and return the data from
|
---|
| 88 | * usbFunctionSetup(). This saves a couple of bytes.
|
---|
| 89 | */
|
---|
| 90 | #define USB_CFG_IMPLEMENT_FN_READ 0
|
---|
| 91 | /** Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1.
|
---|
| 92 | * You must implement the function usbFunctionWriteOut() which receives all
|
---|
| 93 | * interrupt/bulk data sent to endpoint 1.
|
---|
| 94 | */
|
---|
| 95 | #define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
|
---|
| 96 | /** Define this to 1 if you want flowcontrol over USB data. See the definition
|
---|
| 97 | * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
|
---|
| 98 | * usbdrv.h.
|
---|
| 99 | */
|
---|
| 100 | #define USB_CFG_HAVE_FLOWCONTROL 0
|
---|
| 101 |
|
---|
| 102 | /* -------------------------- Device Description --------------------------- */
|
---|
| 103 |
|
---|
| 104 | /** We cannot use Obdev's free shared VID/PID pair because this is a HID.
|
---|
| 105 | * We use John Hyde's VID (author of the book "USB Design By Example") for
|
---|
| 106 | * this example instead. John has offered this VID for use by students for
|
---|
| 107 | * non-commercial devices. Well... This example is for demonstration and
|
---|
| 108 | * education only... DO NOT LET DEVICES WITH THIS VID ESCAPE YOUR LAB!
|
---|
| 109 | * The Product-ID is a random number.
|
---|
| 110 | *
|
---|
| 111 | * USB vendor ID for the device, low byte first. If you have registered your
|
---|
| 112 | * own Vendor ID, define it here. Otherwise you use obdev's free shared
|
---|
| 113 | * VID/PID pair. Be sure to read USBID-License.txt for rules!
|
---|
| 114 | */
|
---|
| 115 | #define USB_CFG_VENDOR_ID 0x42, 0x42
|
---|
| 116 | /** This is the ID of the product, low byte first. It is interpreted in the
|
---|
| 117 | * scope of the vendor ID. If you have registered your own VID with usb.org
|
---|
| 118 | * or if you have licensed a PID from somebody else, define it here. Otherwise
|
---|
| 119 | * you use obdev's free shared VID/PID pair. Be sure to read the rules in
|
---|
| 120 | * USBID-License.txt!
|
---|
| 121 | */
|
---|
| 122 | #define USB_CFG_DEVICE_ID 0x31, 0x17
|
---|
| 123 | /** Version number of the device: Minor number first, then major number.
|
---|
| 124 | */
|
---|
| 125 | #define USB_CFG_DEVICE_VERSION 0x00, 0x01
|
---|
| 126 | /** These two values define the vendor name returned by the USB device. The name
|
---|
| 127 | * must be given as a list of characters under single quotes. The characters
|
---|
| 128 | * are interpreted as Unicode (UTF-16) entities.
|
---|
| 129 | * If you don't want a vendor name string, undefine these macros.
|
---|
| 130 | * ALWAYS define a vendor name containing your Internet domain name if you use
|
---|
| 131 | * obdev's free shared VID/PID pair. See the file USBID-License.txt for
|
---|
| 132 | * details.
|
---|
| 133 | */
|
---|
| 134 | #define USB_CFG_VENDOR_NAME 'p','u','l','k','o','m','a','n','d','y','.','a','t','h','.','c','x'
|
---|
| 135 | /** Length of USB_CFG_DEVICE_VERSION
|
---|
| 136 | */
|
---|
| 137 | #define USB_CFG_VENDOR_NAME_LEN 17
|
---|
| 138 | /** Same as above for the device name. If you don't want a device name, undefine
|
---|
| 139 | * the macros. See the file USBID-License.txt before you assign a name.
|
---|
| 140 | */
|
---|
| 141 | #define USB_CFG_DEVICE_NAME 'S','t','a','r','k','a','d','r','o','i','d'
|
---|
| 142 | /** Length of USB_CFG_DEVICE_NAME
|
---|
| 143 | */
|
---|
| 144 | #define USB_CFG_DEVICE_NAME_LEN 11
|
---|
| 145 | /** See USB specification if you want to conform to an existing device class.
|
---|
| 146 | * This setting means to specify the class at the interface level.
|
---|
| 147 | */
|
---|
| 148 | #define USB_CFG_DEVICE_CLASS 0
|
---|
| 149 | /** See USB specification if you want to conform to an existing device subclass.
|
---|
| 150 | */
|
---|
| 151 | #define USB_CFG_DEVICE_SUBCLASS 0
|
---|
| 152 | /** See USB specification if you want to conform to an existing device class or
|
---|
| 153 | * protocol. This is HID class.
|
---|
| 154 | */
|
---|
| 155 | #define USB_CFG_INTERFACE_CLASS 0x03
|
---|
| 156 | /** See USB specification if you want to conform to an existing device class or
|
---|
| 157 | * protocol. This is not a boot device.
|
---|
| 158 | */
|
---|
| 159 | #define USB_CFG_INTERFACE_SUBCLASS 0x00
|
---|
| 160 | /** See USB specification if you want to conform to an existing device class or
|
---|
| 161 | * protocol.
|
---|
| 162 | */
|
---|
| 163 | #define USB_CFG_INTERFACE_PROTOCOL 0x00
|
---|
| 164 | /** Define this to the length of the HID report descriptor, if you implement
|
---|
| 165 | * an HID device. Otherwise don't define it or define it to 0.
|
---|
| 166 | */
|
---|
| 167 | #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 44
|
---|
| 168 |
|
---|
| 169 | /* ------------------- Fine Control over USB Descriptors ------------------- */
|
---|
| 170 | /* If you don't want to use the driver's default USB descriptors, you can
|
---|
| 171 | * provide our own. These can be provided as (1) fixed length static data in
|
---|
| 172 | * flash memory, (2) fixed length static data in RAM or (3) dynamically at
|
---|
| 173 | * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
|
---|
| 174 | * information about this function.
|
---|
| 175 | * Descriptor handling is configured through the descriptor's properties. If
|
---|
| 176 | * no properties are defined or if they are 0, the default descriptor is used.
|
---|
| 177 | * Possible properties are:
|
---|
| 178 | * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
|
---|
| 179 | * at runtime via usbFunctionDescriptor().
|
---|
| 180 | * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
|
---|
| 181 | * in static memory is in RAM, not in flash memory.
|
---|
| 182 | * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
|
---|
| 183 | * the driver must know the descriptor's length. The descriptor itself is
|
---|
| 184 | * found at the address of a well known identifier (see below).
|
---|
| 185 | * List of static descriptor names (must be declared PROGMEM if in flash):
|
---|
| 186 | * char usbDescriptorDevice[];
|
---|
| 187 | * char usbDescriptorConfiguration[];
|
---|
| 188 | * char usbDescriptorHidReport[];
|
---|
| 189 | * char usbDescriptorString0[];
|
---|
| 190 | * int usbDescriptorStringVendor[];
|
---|
| 191 | * int usbDescriptorStringDevice[];
|
---|
| 192 | * int usbDescriptorStringSerialNumber[];
|
---|
| 193 | * Other descriptors can't be provided statically, they must be provided
|
---|
| 194 | * dynamically at runtime.
|
---|
| 195 | *
|
---|
| 196 | * Descriptor properties are or-ed or added together, e.g.:
|
---|
| 197 | * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
|
---|
| 198 | *
|
---|
| 199 | * The following descriptors are defined:
|
---|
| 200 | * USB_CFG_DESCR_PROPS_DEVICE
|
---|
| 201 | * USB_CFG_DESCR_PROPS_CONFIGURATION
|
---|
| 202 | * USB_CFG_DESCR_PROPS_STRINGS
|
---|
| 203 | * USB_CFG_DESCR_PROPS_STRING_0
|
---|
| 204 | * USB_CFG_DESCR_PROPS_STRING_VENDOR
|
---|
| 205 | * USB_CFG_DESCR_PROPS_STRING_PRODUCT
|
---|
| 206 | * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
|
---|
| 207 | * USB_CFG_DESCR_PROPS_HID
|
---|
| 208 | * USB_CFG_DESCR_PROPS_HID_REPORT
|
---|
| 209 | * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
|
---|
| 210 | *
|
---|
| 211 | */
|
---|
| 212 |
|
---|
| 213 | #define USB_CFG_DESCR_PROPS_DEVICE 0
|
---|
| 214 | #define USB_CFG_DESCR_PROPS_CONFIGURATION 0
|
---|
| 215 | #define USB_CFG_DESCR_PROPS_STRINGS 0
|
---|
| 216 | #define USB_CFG_DESCR_PROPS_STRING_0 0
|
---|
| 217 | #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
|
---|
| 218 | #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
|
---|
| 219 | #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
|
---|
| 220 | #define USB_CFG_DESCR_PROPS_HID 0
|
---|
| 221 | #define USB_CFG_DESCR_PROPS_HID_REPORT 0
|
---|
| 222 | #define USB_CFG_DESCR_PROPS_UNKNOWN 0
|
---|
| 223 |
|
---|
| 224 | #endif /* __usbconfig_h_included__ */
|
---|