Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /* Name: usbconfig.h
  2. * Project: AVR USB driver
  3. * Author: Christian Starkjohann
  4. * Creation Date: 2007-06-23
  5. * Tabsize: 4
  6. * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
  7. * License: GNU GPL v2 (see License.txt) or proprietary (CommercialLicense.txt)
  8. * This Revision: $Id: usbconfig.h 362 2007-06-25 14:38:21Z cs $
  9. */
  10. #ifndef __usbconfig_h_included__
  11. #define __usbconfig_h_included__
  12. /* ---------------------------- Hardware Config ---------------------------- */
  13. #define USB_CFG_IOPORTNAME D
  14. /* This is the port where the USB bus is connected. When you configure it to
  15. * "B", the registers PORTB, PINB and DDRB will be used.
  16. */
  17. #define USB_CFG_DMINUS_BIT 4
  18. /* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
  19. * This may be any bit in the port.
  20. */
  21. #define USB_CFG_DPLUS_BIT 2
  22. /* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
  23. * This may be any bit in the port. Please note that D+ must also be connected
  24. * to interrupt pin INT0!
  25. */
  26. #define USB_CFG_CLOCK_KHZ (F_CPU/1000)
  27. /* Clock rate of the AVR in MHz. Legal values are 12000, 16000 or 16500.
  28. * The 16.5 MHz version of the code requires no crystal, it tolerates +/- 1%
  29. * deviation from the nominal frequency. All other rates require a precision
  30. * of 2000 ppm and thus a crystal!
  31. * Default if not specified: 12 MHz
  32. */
  33. /* ----------------------- Optional Hardware Config ------------------------ */
  34. #define USB_CFG_PULLUP_IOPORTNAME D
  35. /* If you connect the 1.5k pullup resistor from D- to a port pin instead of
  36. * V+, you can connect and disconnect the device from firmware by calling
  37. * the macros usbDeviceConnect() and usbDeviceDisconnect() (see usbdrv.h).
  38. * This constant defines the port on which the pullup resistor is connected.
  39. */
  40. #define USB_CFG_PULLUP_BIT 5
  41. /* This constant defines the bit number in USB_CFG_PULLUP_IOPORT (defined
  42. * above) where the 1.5k pullup resistor is connected. See description
  43. * above for details.
  44. */
  45. /* --------------------------- Functional Range ---------------------------- */
  46. #define USB_CFG_HAVE_INTRIN_ENDPOINT 1
  47. /* Define this to 1 if you want to compile a version with two endpoints: The
  48. * default control endpoint 0 and an interrupt-in endpoint 1.
  49. */
  50. #define USB_CFG_HAVE_INTRIN_ENDPOINT3 0
  51. /* Define this to 1 if you want to compile a version with three endpoints: The
  52. * default control endpoint 0, an interrupt-in endpoint 1 and an interrupt-in
  53. * endpoint 3. You must also enable endpoint 1 above.
  54. */
  55. #define USB_CFG_IMPLEMENT_HALT 0
  56. /* Define this to 1 if you also want to implement the ENDPOINT_HALT feature
  57. * for endpoint 1 (interrupt endpoint). Although you may not need this feature,
  58. * it is required by the standard. We have made it a config option because it
  59. * bloats the code considerably.
  60. */
  61. #define USB_CFG_INTR_POLL_INTERVAL 10
  62. /* If you compile a version with endpoint 1 (interrupt-in), this is the poll
  63. * interval. The value is in milliseconds and must not be less than 10 ms for
  64. * low speed devices.
  65. */
  66. #define USB_CFG_IS_SELF_POWERED 0
  67. /* Define this to 1 if the device has its own power supply. Set it to 0 if the
  68. * device is powered from the USB bus.
  69. */
  70. #define USB_CFG_MAX_BUS_POWER 100
  71. /* Set this variable to the maximum USB bus power consumption of your device.
  72. * The value is in milliamperes. [It will be divided by two since USB
  73. * communicates power requirements in units of 2 mA.]
  74. */
  75. #define USB_CFG_IMPLEMENT_FN_WRITE 0
  76. /* Set this to 1 if you want usbFunctionWrite() to be called for control-out
  77. * transfers. Set it to 0 if you don't need it and want to save a couple of
  78. * bytes.
  79. */
  80. #define USB_CFG_IMPLEMENT_FN_READ 0
  81. /* Set this to 1 if you need to send control replies which are generated
  82. * "on the fly" when usbFunctionRead() is called. If you only want to send
  83. * data from a static buffer, set it to 0 and return the data from
  84. * usbFunctionSetup(). This saves a couple of bytes.
  85. */
  86. #define USB_CFG_IMPLEMENT_FN_WRITEOUT 0
  87. /* Define this to 1 if you want to use interrupt-out (or bulk out) endpoint 1.
  88. * You must implement the function usbFunctionWriteOut() which receives all
  89. * interrupt/bulk data sent to endpoint 1.
  90. */
  91. #define USB_CFG_HAVE_FLOWCONTROL 0
  92. /* Define this to 1 if you want flowcontrol over USB data. See the definition
  93. * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
  94. * usbdrv.h.
  95. */
  96. /* -------------------------- Device Description --------------------------- */
  97. #define USB_CFG_VENDOR_ID 0x42, 0x42
  98. /* USB vendor ID for the device, low byte first. If you have registered your
  99. * own Vendor ID, define it here. Otherwise you use obdev's free shared
  100. * VID/PID pair. Be sure to read USBID-License.txt for rules!
  101. * This template uses obdev's shared VID/PID pair for HIDs: 0x16c0/0x5df.
  102. * Use this VID/PID pair ONLY if you understand the implications!
  103. */
  104. #define USB_CFG_DEVICE_ID 0x31, 0xe1
  105. /* This is the ID of the product, low byte first. It is interpreted in the
  106. * scope of the vendor ID. If you have registered your own VID with usb.org
  107. * or if you have licensed a PID from somebody else, define it here. Otherwise
  108. * you use obdev's free shared VID/PID pair. Be sure to read the rules in
  109. * USBID-License.txt!
  110. * This template uses obdev's shared VID/PID pair for HIDs: 0x16c0/0x5df.
  111. * Use this VID/PID pair ONLY if you understand the implications!
  112. */
  113. #define USB_CFG_DEVICE_VERSION 0x00, 0x01
  114. /* Version number of the device: Minor number first, then major number.
  115. */
  116. #define USB_CFG_VENDOR_NAME 'A', 'r', 'd', 'u', 'i','n','o'
  117. #define USB_CFG_VENDOR_NAME_LEN 7
  118. /* These two values define the vendor name returned by the USB device. The name
  119. * must be given as a list of characters under single quotes. The characters
  120. * are interpreted as Unicode (UTF-16) entities.
  121. * If you don't want a vendor name string, undefine these macros.
  122. * ALWAYS define a vendor name containing your Internet domain name if you use
  123. * obdev's free shared VID/PID pair. See the file USBID-License.txt for
  124. * details.
  125. */
  126. #define USB_CFG_DEVICE_NAME 'U', 's', 'b', 'J', 'o', 'y', 's', 't', 'i','c','k'
  127. #define USB_CFG_DEVICE_NAME_LEN 11
  128. /* Same as above for the device name. If you don't want a device name, undefine
  129. * the macros. See the file USBID-License.txt before you assign a name if you
  130. * use a shared VID/PID.
  131. */
  132. /*#define USB_CFG_SERIAL_NUMBER 'N', 'o', 'n', 'e' */
  133. /*#define USB_CFG_SERIAL_NUMBER_LEN 0 */
  134. /* Same as above for the serial number. If you don't want a serial number,
  135. * undefine the macros.
  136. * It may be useful to provide the serial number through other means than at
  137. * compile time. See the section about descriptor properties below for how
  138. * to fine tune control over USB descriptors such as the string descriptor
  139. * for the serial number.
  140. */
  141. #define USB_CFG_DEVICE_CLASS 0
  142. #define USB_CFG_DEVICE_SUBCLASS 0
  143. /* See USB specification if you want to conform to an existing device class.
  144. */
  145. #define USB_CFG_INTERFACE_CLASS 3 /* HID */
  146. #define USB_CFG_INTERFACE_SUBCLASS 0 /* no boot interface */
  147. #define USB_CFG_INTERFACE_PROTOCOL 0 /* no protocol */
  148. /* See USB specification if you want to conform to an existing device class or
  149. * protocol.
  150. */
  151. #define USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH 105 /* total length of report descriptor */
  152. /* Define this to the length of the HID report descriptor, if you implement
  153. * an HID device. Otherwise don't define it or define it to 0.
  154. * Since this template defines a HID device, it must also specify a HID
  155. * report descriptor length. You must add a PROGMEM character array named
  156. * "usbHidReportDescriptor" to your code which contains the report descriptor.
  157. * Don't forget to keep the array and this define in sync!
  158. */
  159. /* #define USB_PUBLIC static */
  160. /* Use the define above if you #include usbdrv.c instead of linking against it.
  161. * This technique saves a couple of bytes in flash memory.
  162. */
  163. /* ------------------- Fine Control over USB Descriptors ------------------- */
  164. /* If you don't want to use the driver's default USB descriptors, you can
  165. * provide our own. These can be provided as (1) fixed length static data in
  166. * flash memory, (2) fixed length static data in RAM or (3) dynamically at
  167. * runtime in the function usbFunctionDescriptor(). See usbdrv.h for more
  168. * information about this function.
  169. * Descriptor handling is configured through the descriptor's properties. If
  170. * no properties are defined or if they are 0, the default descriptor is used.
  171. * Possible properties are:
  172. * + USB_PROP_IS_DYNAMIC: The data for the descriptor should be fetched
  173. * at runtime via usbFunctionDescriptor().
  174. * + USB_PROP_IS_RAM: The data returned by usbFunctionDescriptor() or found
  175. * in static memory is in RAM, not in flash memory.
  176. * + USB_PROP_LENGTH(len): If the data is in static memory (RAM or flash),
  177. * the driver must know the descriptor's length. The descriptor itself is
  178. * found at the address of a well known identifier (see below).
  179. * List of static descriptor names (must be declared PROGMEM if in flash):
  180. * char usbDescriptorDevice[];
  181. * char usbDescriptorConfiguration[];
  182. * char usbDescriptorHidReport[];
  183. * char usbDescriptorString0[];
  184. * int usbDescriptorStringVendor[];
  185. * int usbDescriptorStringDevice[];
  186. * int usbDescriptorStringSerialNumber[];
  187. * Other descriptors can't be provided statically, they must be provided
  188. * dynamically at runtime.
  189. *
  190. * Descriptor properties are or-ed or added together, e.g.:
  191. * #define USB_CFG_DESCR_PROPS_DEVICE (USB_PROP_IS_RAM | USB_PROP_LENGTH(18))
  192. *
  193. * The following descriptors are defined:
  194. * USB_CFG_DESCR_PROPS_DEVICE
  195. * USB_CFG_DESCR_PROPS_CONFIGURATION
  196. * USB_CFG_DESCR_PROPS_STRINGS
  197. * USB_CFG_DESCR_PROPS_STRING_0
  198. * USB_CFG_DESCR_PROPS_STRING_VENDOR
  199. * USB_CFG_DESCR_PROPS_STRING_PRODUCT
  200. * USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER
  201. * USB_CFG_DESCR_PROPS_HID
  202. * USB_CFG_DESCR_PROPS_HID_REPORT
  203. * USB_CFG_DESCR_PROPS_UNKNOWN (for all descriptors not handled by the driver)
  204. *
  205. */
  206. #define USB_CFG_DESCR_PROPS_DEVICE 0
  207. #define USB_CFG_DESCR_PROPS_CONFIGURATION 0
  208. #define USB_CFG_DESCR_PROPS_STRINGS 0
  209. #define USB_CFG_DESCR_PROPS_STRING_0 0
  210. #define USB_CFG_DESCR_PROPS_STRING_VENDOR 0
  211. #define USB_CFG_DESCR_PROPS_STRING_PRODUCT 0
  212. #define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER 0
  213. #define USB_CFG_DESCR_PROPS_HID 0
  214. #define USB_CFG_DESCR_PROPS_HID_REPORT 0
  215. #define USB_CFG_DESCR_PROPS_UNKNOWN 0
  216. /* ----------------------- Optional MCU Description ------------------------ */
  217. /* The following configurations have working defaults in usbdrv.h. You
  218. * usually don't need to set them explicitly. Only if you want to run
  219. * the driver on a device which is not yet supported or with a compiler
  220. * which is not fully supported (such as IAR C) or if you use a differnt
  221. * interrupt than INT0, you may have to define some of these.
  222. */
  223. /* #define USB_INTR_CFG MCUCR */
  224. /* #define USB_INTR_CFG_SET ((1 << ISC00) | (1 << ISC01)) */
  225. /* #define USB_INTR_CFG_CLR 0 */
  226. /* #define USB_INTR_ENABLE GIMSK */
  227. /* #define USB_INTR_ENABLE_BIT INT0 */
  228. /* #define USB_INTR_PENDING GIFR */
  229. /* #define USB_INTR_PENDING_BIT INTF0 */
  230. #endif /* __usbconfig_h_included__ */