usb_config.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /********************************************************************
  2. FileName: usb_config.h
  3. Dependencies: Always: GenericTypeDefs.h, usb_device.h
  4. Situational: usb_function_hid.h, usb_function_cdc.h, usb_function_msd.h, etc.
  5. Processor: PIC18 or PIC24 USB Microcontrollers
  6. Hardware: The code is natively intended to be used on the following
  7. hardware platforms: PICDEM™ FS USB Demo Board,
  8. PIC18F87J50 FS USB Plug-In Module, or
  9. Explorer 16 + PIC24 USB PIM. The firmware may be
  10. modified for use on other USB platforms by editing the
  11. HardwareProfile.h file.
  12. Complier: Microchip C18 (for PIC18) or C30 (for PIC24)
  13. Company: Microchip Technology, Inc.
  14. Software License Agreement:
  15. The software supplied herewith by Microchip Technology Incorporated
  16. (the “Company”) for its PIC® Microcontroller is intended and
  17. supplied to you, the Company’s customer, for use solely and
  18. exclusively on Microchip PIC Microcontroller products. The
  19. software is owned by the Company and/or its supplier, and is
  20. protected under applicable copyright laws. All rights are reserved.
  21. Any use in violation of the foregoing restrictions may subject the
  22. user to criminal sanctions under applicable laws, as well as to
  23. civil liability for the breach of the terms and conditions of this
  24. license.
  25. THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
  26. WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
  27. TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  28. PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
  29. IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
  30. CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  31. ********************************************************************
  32. File Description:
  33. Change History:
  34. Rev Date Description
  35. 1.0 11/19/2004 Initial release
  36. 2.1 02/26/2007 Updated for simplicity and to use common
  37. coding style
  38. *******************************************************************/
  39. /*********************************************************************
  40. * Descriptor specific type definitions are defined in: usbd.h
  41. ********************************************************************/
  42. #ifndef USBCFG_H
  43. #define USBCFG_H
  44. // DESCRIPTOR CONFIGURATION /////////////////////////////////////////
  45. // If defined, creates a dual interfaces device with two separate
  46. // benchmark interfaces.
  47. //
  48. //#define DUAL_INTERFACE
  49. /////////////////////////////////////////////////////////////////////
  50. // HARDWARE ID CONFIGURATION ////////////////////////////////////////
  51. #define VENDOR_ID 0xFFFE
  52. #define PRODUCT_ID 0x0001
  53. #define BCD_RELEASE_NUMBER 0x0001
  54. /////////////////////////////////////////////////////////////////////
  55. // DESCRIPTOR STRING CONFIGURATION //////////////////////////////////
  56. #define MANUFACTURER_STRING_LENGTH 8
  57. #define MANUFACTURER_STRING 'M','x','y','z','p','7','l','k' // sorry Travis removing your credit, but it is
  58. // only to stay backward compatible with my old firmware
  59. #if !defined(DUAL_INTERFACE)
  60. #define SERIAL_NUMBER_LENGTH 6
  61. #define SERIAL_NUMBER 'B','M','D','0','0','1'
  62. #define PRODUCT_STRING_LENGTH 5
  63. #define PRODUCT_STRING 'P','y','U','S','B'
  64. #else
  65. #define SERIAL_NUMBER_LENGTH 6
  66. #define SERIAL_NUMBER 'B','M','D','0','0','2'
  67. #define PRODUCT_STRING_LENGTH 21
  68. #define PRODUCT_STRING 'D','u','a','l',' ','B','e','n','c','h','m','a','r','k',' ','D','e','v','i','c','e'
  69. #define INTF0_STRING_LENGTH 13
  70. #define INTF0_STRING 'B','e','n','c','h','m','a','r','k',' ','O','n','e'
  71. #define INTF1_STRING_LENGTH 13
  72. #define INTF1_STRING 'B','e','n','c','h','m','a','r','k',' ','T','w','o'
  73. #endif
  74. /////////////////////////////////////////////////////////////////////
  75. #define EP_ISO 0x01 // Isochronous Transfer
  76. #define EP_BULK 0x02 // Bulk Transfer
  77. #define EP_INT 0x03 // Interrupt Transfer
  78. // INTERFACE & ENDPOINT CONFIGURATION ///////////////////////////////
  79. /////////////////////////////////////////////////////////////////////
  80. // ENDPOINT #1 (IN,OUT) Size & Type
  81. #define USBGEN_EP_SIZE_INTF0 64
  82. //#define INTF0 EP_ISO
  83. #define INTF0_1 EP_BULK
  84. #define INTF0_2 EP_INT
  85. /////////////////////////////////////////////////////////////////////
  86. /////////////////////////////////////////////////////////////////////
  87. // ENDPOINT #2 (IN,OUT) Size & Type
  88. #define USBGEN_EP_SIZE_INTF1 64
  89. #define INTF1 EP_ISO
  90. //#define INTF1 EP_BULK
  91. // #define INTF1 EP_INT
  92. /////////////////////////////////////////////////////////////////////
  93. /////////////////////////////////////////////////////////////////////
  94. // USB SERVICE MODE
  95. #define USB_POLLING
  96. //#define USB_INTERRUPT
  97. /////////////////////////////////////////////////////////////////////
  98. // INTERFACE & ENDPOINT INTERNAL SETUP //////////////////////////////
  99. #if (INTF0_1==EP_BULK)
  100. #define USBGEN_EP_ATTRIBUTES_INTF0_1 EP_BULK
  101. #define USBGEN_EP_HANDSHAKE_INTF0_1 USB_HANDSHAKE_ENABLED
  102. #define USBGEN_EP_INTERVAL_INTF0_1 0
  103. #elif (INTF0_1==EP_INT)
  104. #define USBGEN_EP_ATTRIBUTES_INTF0_1 EP_INT
  105. #define USBGEN_EP_HANDSHAKE_INTF0_1 USB_HANDSHAKE_ENABLED
  106. #define USBGEN_EP_INTERVAL_INTF0_1 1
  107. #elif (INTF0_1==EP_ISO)
  108. #define USBGEN_EP_ATTRIBUTES_INTF0_1 EP_ISO|_AS|_DE
  109. #define USBGEN_EP_HANDSHAKE_INTF0_1 0
  110. #define USBGEN_EP_INTERVAL_INTF0_1 1
  111. #endif
  112. #if (INTF0_2==EP_BULK)
  113. #define USBGEN_EP_ATTRIBUTES_INTF0_2 EP_BULK
  114. #define USBGEN_EP_HANDSHAKE_INTF0_2 USB_HANDSHAKE_ENABLED
  115. #define USBGEN_EP_INTERVAL_INTF0_2 0
  116. #elif (INTF0_2==EP_INT)
  117. #define USBGEN_EP_ATTRIBUTES_INTF0_2 EP_INT
  118. #define USBGEN_EP_HANDSHAKE_INTF0_2 USB_HANDSHAKE_ENABLED
  119. #define USBGEN_EP_INTERVAL_INTF0_2 1
  120. #elif (INTF0_2==EP_ISO)
  121. #define USBGEN_EP_ATTRIBUTES_INTF0_2 EP_ISO|_AS|_DE
  122. #define USBGEN_EP_HANDSHAKE_INTF0_2 0
  123. #define USBGEN_EP_INTERVAL_INTF0_2 1
  124. #endif
  125. #if (INTF1==EP_BULK)
  126. #define USBGEN_EP_ATTRIBUTES_INTF1 EP_BULK
  127. #define USBGEN_EP_HANDSHAKE_INTF1 USB_HANDSHAKE_ENABLED
  128. #define USBGEN_EP_INTERVAL_INTF1 0
  129. #elif (INTF1==EP_INT)
  130. #define USBGEN_EP_ATTRIBUTES_INTF1 EP_INT
  131. #define USBGEN_EP_HANDSHAKE_INTF1 USB_HANDSHAKE_ENABLED
  132. #define USBGEN_EP_INTERVAL_INTF1 1
  133. #elif (INTF1==EP_ISO)
  134. #define USBGEN_EP_ATTRIBUTES_INTF1 EP_ISO|_AS|_DE
  135. #define USBGEN_EP_HANDSHAKE_INTF1 0
  136. #define USBGEN_EP_INTERVAL_INTF1 1
  137. #endif
  138. /////////////////////////////////////////////////////////////////////
  139. /** DEFINITIONS ****************************************************/
  140. #define USBGEN_EP_NUM_INTF0_1 1
  141. #define USBGEN_EP_NUM_INTF0_2 2
  142. #define USBGEN_EP_NUM_INTF1 2
  143. #define USB_EP0_BUFF_SIZE 16 // Valid Options: 8, 16, 32, or 64 bytes.
  144. // Using larger options take more SRAM, but
  145. // does not provide much advantage in most types
  146. // of applications. Exceptions to this, are applications
  147. // that use EP0 IN or OUT for sending large amounts of
  148. // application related data.
  149. #if defined(DUAL_INTERFACE)
  150. #define USB_MAX_NUM_INT 2 // For tracking Alternate Setting
  151. #define USB_MAX_EP_NUMBER 2
  152. #define USB_NUM_STRING_DESCRIPTORS 6
  153. #else
  154. #define USB_MAX_NUM_INT 1 // For tracking Alternate Setting
  155. #define USB_MAX_EP_NUMBER 2
  156. #define USB_NUM_STRING_DESCRIPTORS 4
  157. #endif
  158. //Device descriptor - if these two definitions are not defined then
  159. // a ROM USB_DEVICE_DESCRIPTOR variable by the exact name of device_dsc
  160. // must exist.
  161. #define USB_USER_DEVICE_DESCRIPTOR &device_dsc
  162. #define USB_USER_DEVICE_DESCRIPTOR_INCLUDE extern ROM USB_DEVICE_DESCRIPTOR device_dsc
  163. //Configuration descriptors - if these two definitions do not exist then
  164. // a ROM BYTE *ROM variable named exactly USB_CD_Ptr[] must exist.
  165. #define USB_USER_CONFIG_DESCRIPTOR USB_CD_Ptr
  166. #define USB_USER_CONFIG_DESCRIPTOR_INCLUDE extern ROM BYTE *ROM USB_CD_Ptr[]
  167. //Make sure only one of the below "#define USB_PING_PONG_MODE"
  168. //is uncommented.
  169. //#define USB_PING_PONG_MODE USB_PING_PONG__NO_PING_PONG
  170. #define USB_PING_PONG_MODE USB_PING_PONG__FULL_PING_PONG
  171. //#define USB_PING_PONG_MODE USB_PING_PONG__EP0_OUT_ONLY
  172. //#define USB_PING_PONG_MODE USB_PING_PONG__ALL_BUT_EP0 //NOTE: This mode is not supported in PIC18F4550 family rev A3 devices
  173. /* Parameter definitions are defined in usb_device.h */
  174. #define USB_PULLUP_OPTION USB_PULLUP_ENABLE
  175. //#define USB_PULLUP_OPTION USB_PULLUP_DISABLED
  176. #define USB_TRANSCEIVER_OPTION USB_INTERNAL_TRANSCEIVER
  177. //External Transceiver support is not available on all product families. Please
  178. // refer to the product family datasheet for more information if this feature
  179. // is available on the target processor.
  180. //#define USB_TRANSCEIVER_OPTION USB_EXTERNAL_TRANSCEIVER
  181. #define USB_SPEED_OPTION USB_FULL_SPEED
  182. //#define USB_SPEED_OPTION USB_LOW_SPEED //(not valid option for PIC24F devices)
  183. #define USB_SUPPORT_DEVICE
  184. // The USB_ENABLE_xx are not implemented in the MCP 2.7 stack.
  185. #define USB_ENABLE_ALL_HANDLERS
  186. /** DEVICE CLASS USAGE *********************************************/
  187. #define USB_USE_GEN
  188. #define EVN 0
  189. #define ODD 1
  190. #endif //USBCFG_H