tusb.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2019 Ha Thach (tinyusb.org)
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. *
  24. * This file is part of the TinyUSB stack.
  25. */
  26. #ifndef _TUSB_H_
  27. #define _TUSB_H_
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. //--------------------------------------------------------------------+
  32. // INCLUDE
  33. //--------------------------------------------------------------------+
  34. #include "common/tusb_common.h"
  35. #include "osal/osal.h"
  36. #include "common/tusb_fifo.h"
  37. //------------- HOST -------------//
  38. #if TUSB_OPT_HOST_ENABLED
  39. #include "host/usbh.h"
  40. #if HOST_CLASS_HID
  41. #include "class/hid/hid_host.h"
  42. #endif
  43. #if CFG_TUH_MSC
  44. #include "class/msc/msc_host.h"
  45. #endif
  46. #if CFG_TUH_CDC
  47. #include "class/cdc/cdc_host.h"
  48. #endif
  49. #if CFG_TUH_VENDOR
  50. #include "class/vendor/vendor_host.h"
  51. #endif
  52. #endif
  53. //------------- DEVICE -------------//
  54. #if TUSB_OPT_DEVICE_ENABLED
  55. #include "device/usbd.h"
  56. #if CFG_TUD_HID
  57. #include "class/hid/hid_device.h"
  58. #endif
  59. #if CFG_TUD_CDC
  60. #include "class/cdc/cdc_device.h"
  61. #endif
  62. #if CFG_TUD_MSC
  63. #include "class/msc/msc_device.h"
  64. #endif
  65. #if CFG_TUD_AUDIO
  66. #include "class/audio/audio_device.h"
  67. #endif
  68. #if CFG_TUD_MIDI
  69. #include "class/midi/midi_device.h"
  70. #endif
  71. #if CFG_TUD_VENDOR
  72. #include "class/vendor/vendor_device.h"
  73. #endif
  74. #if CFG_TUD_USBTMC
  75. #include "class/usbtmc/usbtmc_device.h"
  76. #endif
  77. #if CFG_TUD_DFU_RUNTIME
  78. #include "class/dfu/dfu_rt_device.h"
  79. #endif
  80. #if CFG_TUD_NET
  81. #include "class/net/net_device.h"
  82. #endif
  83. #if CFG_TUD_BTH
  84. #include "class/bth/bth_device.h"
  85. #endif
  86. #endif
  87. //--------------------------------------------------------------------+
  88. // APPLICATION API
  89. //--------------------------------------------------------------------+
  90. /** \ingroup group_application_api
  91. * @{ */
  92. // Initialize device/host stack
  93. // Note: when using with RTOS, this should be called after scheduler/kernel is started.
  94. // Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API.
  95. bool tusb_init(void);
  96. // Check if stack is initialized
  97. bool tusb_inited(void);
  98. // TODO
  99. // bool tusb_teardown(void);
  100. /** @} */
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* _TUSB_H_ */