My Marlin configs for Fabrikator Mini and CTC i3 Pro B
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.

udi_cdc_conf.h 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /**
  2. * \file
  3. *
  4. * \brief Default CDC configuration for a USB Device with a single interface
  5. *
  6. * Copyright (c) 2009-2015 Atmel Corporation. All rights reserved.
  7. *
  8. * \asf_license_start
  9. *
  10. * \page License
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. *
  18. * 2. Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. *
  22. * 3. The name of Atmel may not be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * 4. This software may only be redistributed and used in connection with an
  26. * Atmel microcontroller product.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  29. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  30. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  31. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  32. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  34. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  37. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. * POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. * \asf_license_stop
  41. *
  42. */
  43. /*
  44. * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
  45. */
  46. #ifndef _UDI_CDC_CONF_H_
  47. #define _UDI_CDC_CONF_H_
  48. #include "usb_protocol_cdc.h"
  49. #include "conf_usb.h"
  50. #ifndef UDI_CDC_PORT_NB
  51. # define UDI_CDC_PORT_NB 1
  52. #endif
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56. /**
  57. * \addtogroup udi_cdc_group_single_desc
  58. * @{
  59. */
  60. //! Control endpoint size (Endpoint 0)
  61. #define USB_DEVICE_EP_CTRL_SIZE 64
  62. #if XMEGA
  63. /**
  64. * \name Endpoint configuration on XMEGA
  65. * The XMEGA supports a IN and OUT endpoint with the same number endpoint,
  66. * thus XMEGA can support up to 7 CDC interfaces.
  67. */
  68. //@{
  69. #define UDI_CDC_DATA_EP_IN_0 ( 1 | USB_EP_DIR_IN) // TX
  70. #define UDI_CDC_DATA_EP_OUT_0 ( 2 | USB_EP_DIR_OUT) // RX
  71. #define UDI_CDC_COMM_EP_0 ( 2 | USB_EP_DIR_IN) // Notify endpoint
  72. #define UDI_CDC_DATA_EP_IN_1 ( 3 | USB_EP_DIR_IN) // TX
  73. #define UDI_CDC_DATA_EP_OUT_1 ( 4 | USB_EP_DIR_OUT) // RX
  74. #define UDI_CDC_COMM_EP_1 ( 4 | USB_EP_DIR_IN) // Notify endpoint
  75. #define UDI_CDC_DATA_EP_IN_2 ( 5 | USB_EP_DIR_IN) // TX
  76. #define UDI_CDC_DATA_EP_OUT_2 ( 6 | USB_EP_DIR_OUT) // RX
  77. #define UDI_CDC_COMM_EP_2 ( 6 | USB_EP_DIR_IN) // Notify endpoint
  78. #define UDI_CDC_DATA_EP_IN_3 ( 7 | USB_EP_DIR_IN) // TX
  79. #define UDI_CDC_DATA_EP_OUT_3 ( 8 | USB_EP_DIR_OUT) // RX
  80. #define UDI_CDC_COMM_EP_3 ( 8 | USB_EP_DIR_IN) // Notify endpoint
  81. #define UDI_CDC_DATA_EP_IN_4 ( 9 | USB_EP_DIR_IN) // TX
  82. #define UDI_CDC_DATA_EP_OUT_4 (10 | USB_EP_DIR_OUT) // RX
  83. #define UDI_CDC_COMM_EP_4 (10 | USB_EP_DIR_IN) // Notify endpoint
  84. #define UDI_CDC_DATA_EP_IN_5 (11 | USB_EP_DIR_IN) // TX
  85. #define UDI_CDC_DATA_EP_OUT_5 (12 | USB_EP_DIR_OUT) // RX
  86. #define UDI_CDC_COMM_EP_5 (12 | USB_EP_DIR_IN) // Notify endpoint
  87. #define UDI_CDC_DATA_EP_IN_6 (13 | USB_EP_DIR_IN) // TX
  88. #define UDI_CDC_DATA_EP_OUT_6 (14 | USB_EP_DIR_OUT) // RX
  89. #define UDI_CDC_COMM_EP_6 (14 | USB_EP_DIR_IN) // Notify endpoint
  90. //! 2 endpoints numbers used per CDC interface
  91. #define USB_DEVICE_MAX_EP (2*UDI_CDC_PORT_NB)
  92. //@}
  93. #else
  94. /**
  95. * \name Default endpoint configuration
  96. * The USBB, UDP, UDPHS and UOTGHS interfaces can support up to 2 CDC interfaces.
  97. */
  98. //@{
  99. # if UDI_CDC_PORT_NB > 2
  100. # error USBB, UDP, UDPHS and UOTGHS interfaces have not enought endpoints.
  101. # endif
  102. #define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) // TX
  103. #define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) // RX
  104. #define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) // Notify endpoint
  105. # if SAM3U
  106. /* For 3U max endpoint size of 4 is 64, use 5 and 6 as bulk tx and rx */
  107. # define UDI_CDC_DATA_EP_IN_1 (6 | USB_EP_DIR_IN) // TX
  108. # define UDI_CDC_DATA_EP_OUT_1 (5 | USB_EP_DIR_OUT) // RX
  109. # define UDI_CDC_COMM_EP_1 (4 | USB_EP_DIR_IN) // Notify
  110. # else
  111. # define UDI_CDC_DATA_EP_IN_1 (4 | USB_EP_DIR_IN) // TX
  112. # define UDI_CDC_DATA_EP_OUT_1 (5 | USB_EP_DIR_OUT) // RX
  113. # define UDI_CDC_COMM_EP_1 (6 | USB_EP_DIR_IN) // Notify
  114. # endif
  115. //! 3 endpoints used per CDC interface
  116. #undef USB_DEVICE_MAX_EP // undefine this definition in header file
  117. #define USB_DEVICE_MAX_EP (3*UDI_CDC_PORT_NB)
  118. //@}
  119. #endif
  120. /**
  121. * \name Default Interface numbers
  122. */
  123. //@{
  124. #define UDI_CDC_COMM_IFACE_NUMBER_0 0
  125. #define UDI_CDC_DATA_IFACE_NUMBER_0 1
  126. #define UDI_CDC_COMM_IFACE_NUMBER_1 2
  127. #define UDI_CDC_DATA_IFACE_NUMBER_1 3
  128. #define UDI_CDC_COMM_IFACE_NUMBER_2 4
  129. #define UDI_CDC_DATA_IFACE_NUMBER_2 5
  130. #define UDI_CDC_COMM_IFACE_NUMBER_3 6
  131. #define UDI_CDC_DATA_IFACE_NUMBER_3 7
  132. #define UDI_CDC_COMM_IFACE_NUMBER_4 8
  133. #define UDI_CDC_DATA_IFACE_NUMBER_4 9
  134. #define UDI_CDC_COMM_IFACE_NUMBER_5 10
  135. #define UDI_CDC_DATA_IFACE_NUMBER_5 11
  136. #define UDI_CDC_COMM_IFACE_NUMBER_6 12
  137. #define UDI_CDC_DATA_IFACE_NUMBER_6 13
  138. //@}
  139. //@}
  140. #ifdef __cplusplus
  141. }
  142. #endif
  143. #endif // _UDI_CDC_CONF_H_