Austin Schuh | 41baf20 | 2022-01-01 14:33:40 -0800 | [diff] [blame^] | 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 | |
| 27 | #ifndef _TUSB_H_ |
| 28 | #define _TUSB_H_ |
| 29 | |
| 30 | #ifdef __cplusplus |
| 31 | extern "C" { |
| 32 | #endif |
| 33 | |
| 34 | //--------------------------------------------------------------------+ |
| 35 | // INCLUDE |
| 36 | //--------------------------------------------------------------------+ |
| 37 | #include "common/tusb_common.h" |
| 38 | #include "osal/osal.h" |
| 39 | #include "common/tusb_fifo.h" |
| 40 | |
| 41 | //------------- HOST -------------// |
| 42 | #if TUSB_OPT_HOST_ENABLED |
| 43 | #include "host/usbh.h" |
| 44 | |
| 45 | #if CFG_TUH_HID |
| 46 | #include "class/hid/hid_host.h" |
| 47 | #endif |
| 48 | |
| 49 | #if CFG_TUH_MSC |
| 50 | #include "class/msc/msc_host.h" |
| 51 | #endif |
| 52 | |
| 53 | #if CFG_TUH_CDC |
| 54 | #include "class/cdc/cdc_host.h" |
| 55 | #endif |
| 56 | |
| 57 | #if CFG_TUH_VENDOR |
| 58 | #include "class/vendor/vendor_host.h" |
| 59 | #endif |
| 60 | |
| 61 | #endif |
| 62 | |
| 63 | //------------- DEVICE -------------// |
| 64 | #if TUSB_OPT_DEVICE_ENABLED |
| 65 | #include "device/usbd.h" |
| 66 | |
| 67 | #if CFG_TUD_HID |
| 68 | #include "class/hid/hid_device.h" |
| 69 | #endif |
| 70 | |
| 71 | #if CFG_TUD_CDC |
| 72 | #include "class/cdc/cdc_device.h" |
| 73 | #endif |
| 74 | |
| 75 | #if CFG_TUD_MSC |
| 76 | #include "class/msc/msc_device.h" |
| 77 | #endif |
| 78 | |
| 79 | #if CFG_TUD_AUDIO |
| 80 | #include "class/audio/audio_device.h" |
| 81 | #endif |
| 82 | |
| 83 | #if CFG_TUD_VIDEO |
| 84 | #include "class/video/video_device.h" |
| 85 | #endif |
| 86 | |
| 87 | #if CFG_TUD_MIDI |
| 88 | #include "class/midi/midi_device.h" |
| 89 | #endif |
| 90 | |
| 91 | #if CFG_TUD_VENDOR |
| 92 | #include "class/vendor/vendor_device.h" |
| 93 | #endif |
| 94 | |
| 95 | #if CFG_TUD_USBTMC |
| 96 | #include "class/usbtmc/usbtmc_device.h" |
| 97 | #endif |
| 98 | |
| 99 | #if CFG_TUD_DFU_RUNTIME |
| 100 | #include "class/dfu/dfu_rt_device.h" |
| 101 | #endif |
| 102 | |
| 103 | #if CFG_TUD_DFU |
| 104 | #include "class/dfu/dfu_device.h" |
| 105 | #endif |
| 106 | |
| 107 | #if CFG_TUD_ECM_RNDIS || CFG_TUD_NCM |
| 108 | #include "class/net/net_device.h" |
| 109 | #endif |
| 110 | |
| 111 | #if CFG_TUD_BTH |
| 112 | #include "class/bth/bth_device.h" |
| 113 | #endif |
| 114 | #endif |
| 115 | |
| 116 | |
| 117 | //--------------------------------------------------------------------+ |
| 118 | // APPLICATION API |
| 119 | //--------------------------------------------------------------------+ |
| 120 | /** \ingroup group_application_api |
| 121 | * @{ */ |
| 122 | |
| 123 | // Initialize device/host stack |
| 124 | // Note: when using with RTOS, this should be called after scheduler/kernel is started. |
| 125 | // Otherwise it could cause kernel issue since USB IRQ handler does use RTOS queue API. |
| 126 | bool tusb_init(void); |
| 127 | |
| 128 | // Check if stack is initialized |
| 129 | bool tusb_inited(void); |
| 130 | |
| 131 | // TODO |
| 132 | // bool tusb_teardown(void); |
| 133 | |
| 134 | /** @} */ |
| 135 | |
| 136 | #ifdef __cplusplus |
| 137 | } |
| 138 | #endif |
| 139 | |
| 140 | #endif /* _TUSB_H_ */ |