tusb_config.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**************************************************************************/
  2. /*!
  3. @file tusb_config.h
  4. @author hathach (tinyusb.org)
  5. @section LICENSE
  6. Software License Agreement (BSD License)
  7. Copyright (c) 2013, hathach (tinyusb.org)
  8. All rights reserved.
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. 1. Redistributions of source code must retain the above copyright
  12. notice, this list of conditions and the following disclaimer.
  13. 2. Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. 3. Neither the name of the copyright holders nor the
  17. names of its contributors may be used to endorse or promote products
  18. derived from this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
  20. EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
  23. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
  26. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. This file is part of the tinyusb stack.
  30. */
  31. /**************************************************************************/
  32. #ifndef _TUSB_TUSB_CONFIG_H_
  33. #define _TUSB_TUSB_CONFIG_H_
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. //--------------------------------------------------------------------+
  38. // CONTROLLER CONFIGURATION
  39. //--------------------------------------------------------------------+
  40. //#define TUSB_CFG_MCU will be passed from IDE/command line for easy board/mcu switching
  41. #define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
  42. //#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
  43. //--------------------------------------------------------------------+
  44. // DEVICE CONFIGURATION
  45. //--------------------------------------------------------------------+
  46. #define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
  47. //------------- CLASS -------------//
  48. #define TUSB_CFG_DEVICE_HID_KEYBOARD 0
  49. #define TUSB_CFG_DEVICE_HID_MOUSE 0
  50. #define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
  51. #define TUSB_CFG_DEVICE_MSC 0
  52. #define TUSB_CFG_DEVICE_CDC 1
  53. //--------------------------------------------------------------------+
  54. // COMMON CONFIGURATION
  55. //--------------------------------------------------------------------+
  56. #define TUSB_CFG_DEBUG 2
  57. //#define TUSB_CFG_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
  58. //#define TUSB_CFG_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
  59. #define TUSB_CFG_TICKS_HZ 1000
  60. //#define TUSB_CFG_OS TUSB_OS_NONE
  61. //--------------------------------------------------------------------+
  62. // USB RAM PLACEMENT
  63. //--------------------------------------------------------------------+
  64. #ifdef __CODE_RED // compiled with lpcxpresso
  65. #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
  66. #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(.data.$RAM2) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
  67. #elif TUSB_CFG_MCU == MCU_LPC175X_6X
  68. #define TUSB_CFG_ATTR_USBRAM // LPC17xx USB DMA can access all
  69. #elif (TUSB_CFG_MCU == MCU_LPC43XX)
  70. #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(.data.$RAM3)
  71. #endif
  72. #elif defined __CC_ARM // Compiled with Keil armcc, USBRAM_SECTION is defined in scatter files
  73. #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
  74. #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(USBRAM_SECTION) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
  75. #elif (TUSB_CFG_MCU == MCU_LPC175X_6X)
  76. #define TUSB_CFG_ATTR_USBRAM // LPC17xx USB DMA can access all address
  77. #elif (TUSB_CFG_MCU == MCU_LPC43XX)
  78. #define TUSB_CFG_ATTR_USBRAM // Use keil tool configure to have AHB SRAM as default memory
  79. #endif
  80. #elif defined __ICCARM__ // compiled with IAR
  81. #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
  82. #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\"USB_PACKET_MEMORY\"") ATTR_ALIGNED(64)
  83. #elif (TUSB_CFG_MCU == MCU_LPC175X_6X)
  84. #define TUSB_CFG_ATTR_USBRAM
  85. #elif (TUSB_CFG_MCU == MCU_LPC43XX)
  86. #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
  87. #endif
  88. #else
  89. #error compiler not specified
  90. #endif
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif /* _TUSB_TUSB_CONFIG_H_ */