#include #include #include "test00_uut.c" uint32_t xorshift32() { static uint32_t x32 = 314159265; x32 ^= x32 << 13; x32 ^= x32 >> 17; x32 ^= x32 << 5; return x32; } int main() { struct test_state_t state; uint32_t a, b, c, x, y, z, w; bool first_eval = true; for (int i = 0; i < 10; i++) { a = xorshift32(); b = xorshift32(); c = xorshift32(); x = (a & b) | c; y = a & (b | c); z = a ^ b ^ c; w = z; state.a.value_7_0 = a; state.a.value_15_8 = a >> 8; state.a.value_23_16 = a >> 16; state.a.value_31_24 = a >> 24; state.b.value_7_0 = b; state.b.value_15_8 = b >> 8; state.b.value_23_16 = b >> 16; state.b.value_31_24 = b >> 24; state.c.value_7_0 = c; state.c.value_15_8 = c >> 8; state.c.value_23_16 = c >> 16; state.c.value_31_24 = c >> 24; if (first_eval) { first_eval = false; test_init(&state); } else { test_eval(&state); } uint32_t uut_x = 0; uut_x |= (uint32_t)state.x.value_7_0; uut_x |= (uint32_t)state.x.value_15_8 << 8; uut_x |= (uint32_t)state.x.value_23_16 << 16; uut_x |= (uint32_t)state.x.value_31_24 << 24; uint32_t uut_y = 0; uut_y |= (uint32_t)state.y.value_7_0; uut_y |= (uint32_t)state.y.value_15_8 << 8; uut_y |= (uint32_t)state.y.value_23_16 << 16; uut_y |= (uint32_t)state.y.value_31_24 << 24; uint32_t uut_z = 0; uut_z |= (uint32_t)state.z.value_7_0; uut_z |= (uint32_t)state.z.value_15_8 << 8; uut_z |= (uint32_t)state.z.value_23_16 << 16; uut_z |= (uint32_t)state.z.value_31_24 << 24; uint32_t uut_w = 0; uut_w |= (uint32_t)state.w.value_7_0; uut_w |= (uint32_t)state.w.value_15_8 << 8; uut_w |= (uint32_t)state.w.value_23_16 << 16; uut_w |= (uint32_t)state.w.value_31_24 << 24; printf("---\n"); printf("A: 0x%08x\n", a); printf("B: 0x%08x\n", b); printf("C: 0x%08x\n", c); printf("X: 0x%08x 0x%08x\n", x, uut_x); printf("Y: 0x%08x 0x%08x\n", y, uut_y); printf("Z: 0x%08x 0x%08x\n", z, uut_z); printf("W: 0x%08x 0x%08x\n", w, uut_w); assert(x == uut_x); assert(y == uut_y); assert(z == uut_z); assert(w == uut_w); } return 0; } mmaryrefslogtreecommitdiffstats
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