summaryrefslogtreecommitdiffstats
path: root/tinyusb/docs/reference/index.rst
blob: fcff03590302f1d2840544fa4de6a98f90615349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
*********
Reference
*********

.. figure:: ../assets/stack.svg
   :width: 1600px
   :alt: stackup

   representation of the TinyUSB stack.

Device Stack
============

Supports multiple device configurations by dynamically changing usb descriptors. Low power functions such like suspend, resume, and remote wakeup. Following device classes are supported:

-  Audio Class 2.0 (UAC2)
-  Bluetooth Host Controller Interface (BTH HCI)
-  Communication Class (CDC)
-  Device Firmware Update (DFU): DFU mode (WIP) and Runtinme
-  Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad etc ...
-  Mass Storage Class (MSC): with multiple LUNs
-  Musical Instrument Digital Interface (MIDI)
-  Network with RNDIS, CDC-ECM (work in progress)
-  USB Test and Measurement Class (USBTMC)
-  Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file.
-  `WebUSB <https://github.com/WICG/webusb>`__ with vendor-specific class

If you have special need, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how RPi team add their reset interface [raspberrypi/pico-sdk#197](https://github.com/raspberrypi/pico-sdk/pull/197)

Host Stack
==========

- Human Interface Device (HID): Keyboard, Mouse, Generic
- Mass Storage Class (MSC)
- Hub currently only supports 1 level of hub (due to my laziness)

OS Abstraction layer
====================

TinyUSB is completely thread-safe by pushing all ISR events into a central queue, then process it later in the non-ISR context task function. It also uses semaphore/mutex to access shared resources such as CDC FIFO. Therefore the stack needs to use some of OS's basic APIs. Following OSes are already supported out of the box.

- **No OS**
- **FreeRTOS**
- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its [own repo](https://github.com/hathach/mynewt-tinyusb-example)

License
=======

All TinyUSB sources in the `src` folder are licensed under MIT license. However, each file can be individually licensed especially those in `lib` and `hw/mcu` folder. Please make sure you understand all the license term for files you use in your project.

Index
=====

.. toctree::
   :maxdepth: 2

   supported
   getting_started
   concurrency
aluates to @p TRUE if the specified threads queue or list is * not empty. * * @notapi */ #define notempty(p) ((p)->p_next != (Thread *)(p)) /** * @brief Data part of a static threads queue initializer. * @details This macro should be used when statically initializing a threads * queue that is part of a bigger structure. * * @param[in] name the name of the threads queue variable */ #define _THREADSQUEUE_DATA(name) {(Thread *)&name, (Thread *)&name} /** * @brief Static threads queue initializer. * @details Statically initialized threads queues require no explicit * initialization using @p queue_init(). * * @param[in] name the name of the threads queue variable */ #define THREADSQUEUE_DECL(name) ThreadsQueue name = _THREADSQUEUE_DATA(name) /** * @extends ThreadsList * * @brief Generic threads bidirectional linked list header and element. */ typedef struct { Thread *p_next; /**< First @p Thread in the queue, or @p ThreadQueue when empty. */ Thread *p_prev; /**< Last @p Thread in the queue, or @p ThreadQueue when empty. */ } ThreadsQueue; /** * @brief Generic threads single link list, it works like a stack. */ typedef struct { Thread *p_next; /**< Last pushed @p Thread on the stack list, or pointer to itself if empty. */ } ThreadsList; #if !CH_OPTIMIZE_SPEED #ifdef __cplusplus extern "C" { #endif void prio_insert(Thread *tp, ThreadsQueue *tqp); void queue_insert(Thread *tp, ThreadsQueue *tqp); Thread *fifo_remove(ThreadsQueue *tqp); Thread *lifo_remove(ThreadsQueue *tqp); Thread *dequeue(Thread *tp); void list_insert(Thread *tp, ThreadsList *tlp); Thread *list_remove(ThreadsList *tlp); #ifdef __cplusplus } #endif #endif /* !CH_OPTIMIZE_SPEED */ #endif /* _CHLISTS_H_ */ /** @} */