Keyboard firmwares for Atmel AVR and Cortex-M
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.

USBEndpoints_Maxim.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*******************************************************************************
  2. * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included
  12. * in all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  17. * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
  18. * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Except as contained in this notice, the name of Maxim Integrated
  23. * Products, Inc. shall not be used except as stated in the Maxim Integrated
  24. * Products, Inc. Branding Policy.
  25. *
  26. * The mere transfer of this software does not imply any licenses
  27. * of trade secrets, proprietary technology, copyrights, patents,
  28. * trademarks, maskwork rights, or any other form of intellectual
  29. * property whatsoever. Maxim Integrated Products, Inc. retains all
  30. * ownership rights.
  31. *******************************************************************************
  32. */
  33. #define NUMBER_OF_LOGICAL_ENDPOINTS (8)
  34. #define NUMBER_OF_PHYSICAL_ENDPOINTS (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
  35. #define DIR_OUT 0x00
  36. #define DIR_IN 0x01
  37. #define EP_NUM(ep) (ep >> 1)
  38. #define IN_EP(ep) (ep & DIR_IN)
  39. #define OUT_EP(ep) (!(ep & DIR_IN))
  40. /* Define physical endpoint numbers */
  41. /* Endpoint No. */
  42. /* ---------------- */
  43. #define EP0OUT ((0 << 1) | DIR_OUT)
  44. #define EP0IN ((0 << 1) | DIR_IN)
  45. #define EP1OUT ((1 << 1) | DIR_OUT)
  46. #define EP1IN ((1 << 1) | DIR_IN)
  47. #define EP2OUT ((2 << 1) | DIR_OUT)
  48. #define EP2IN ((2 << 1) | DIR_IN)
  49. #define EP3OUT ((3 << 1) | DIR_OUT)
  50. #define EP3IN ((3 << 1) | DIR_IN)
  51. #define EP4OUT ((4 << 1) | DIR_OUT)
  52. #define EP4IN ((4 << 1) | DIR_IN)
  53. #define EP5OUT ((5 << 1) | DIR_OUT)
  54. #define EP5IN ((5 << 1) | DIR_IN)
  55. #define EP6OUT ((6 << 1) | DIR_OUT)
  56. #define EP6IN ((6 << 1) | DIR_IN)
  57. #define EP7OUT ((7 << 1) | DIR_OUT)
  58. #define EP7IN ((7 << 1) | DIR_IN)
  59. /* Maximum Packet sizes */
  60. #define MAX_PACKET_SIZE_EP0 (64)
  61. #define MAX_PACKET_SIZE_EP1 (64)
  62. #define MAX_PACKET_SIZE_EP2 (64)
  63. #define MAX_PACKET_SIZE_EP3 (64)
  64. #define MAX_PACKET_SIZE_EP4 (64)
  65. #define MAX_PACKET_SIZE_EP5 (64)
  66. #define MAX_PACKET_SIZE_EP6 (64)
  67. #define MAX_PACKET_SIZE_EP7 (64)
  68. /* Generic endpoints - intended to be portable accross devices */
  69. /* and be suitable for simple USB devices. */
  70. /* Bulk endpoints */
  71. #define EPBULK_OUT (EP1OUT)
  72. #define EPBULK_IN (EP2IN)
  73. #define EPBULK_OUT_callback EP1_OUT_callback
  74. #define EPBULK_IN_callback EP2_IN_callback
  75. /* Interrupt endpoints */
  76. #define EPINT_OUT (EP3OUT)
  77. #define EPINT_IN (EP4IN)
  78. #define EPINT_OUT_callback EP3_OUT_callback
  79. #define EPINT_IN_callback EP4_IN_callback
  80. #define MAX_PACKET_SIZE_EPBULK (64)
  81. #define MAX_PACKET_SIZE_EPINT (64)