Skip to content

Commit

Permalink
Merge pull request #2917 from hathach/board-doc
Browse files Browse the repository at this point in the history
update docs, embed metadata to family.c and board.h
  • Loading branch information
hathach authored Dec 27, 2024
2 parents 86ad6e5 + de38e53 commit 2495563
Show file tree
Hide file tree
Showing 258 changed files with 1,871 additions and 714 deletions.
246 changes: 144 additions & 102 deletions README.rst

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import re
from pathlib import Path

# -- Path setup --------------------------------------------------------------


# -- Project information -----------------------------------------------------

project = 'TinyUSB'
copyright = '2021, Ha Thach'
copyright = '2024, Ha Thach'
author = 'Ha Thach'


Expand Down Expand Up @@ -40,3 +43,16 @@
}

todo_include_todos = True

# pre-process path in README.rst
def preprocess_readme():
"""Modify figure paths in README.rst for Sphinx builds."""
src = Path(__file__).parent.parent / "README.rst"
tgt = Path(__file__).parent.parent / "README_processed.rst"
if src.exists():
content = src.read_text()
content = re.sub(r"docs/", r"", content)
content = re.sub(r".rst", r".html", content)
tgt.write_text(content)

preprocess_readme()
2 changes: 1 addition & 1 deletion docs/contributing/code_of_conduct.rst
1 change: 0 additions & 1 deletion docs/contributing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Index
:maxdepth: 2

code_of_conduct
structure
porting
59 changes: 0 additions & 59 deletions docs/contributing/structure.rst

This file was deleted.

8 changes: 1 addition & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
:hide-toc:

*********
TinyUSB
*********

TinyUSB is an open-source cross-platform USB Host/Device stack for embedded systems,
designed to be memory-safe with no dynamic allocation and thread-safe with all interrupt events being deferred and then handled in the non-ISR task function.

.. include:: ../README_processed.rst

.. toctree::
:caption: Index
Expand Down
2 changes: 0 additions & 2 deletions docs/info/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ General
- Build ARM IAR with CircleCI
- Improve HIL with dual/host_info_to_device_cdc optional for pico/pico2, enable dwc2 dma test


API Changes
-----------

Expand All @@ -31,7 +30,6 @@ API Changes
- ``CFG_TUD/TUH_DWC2_SLAVE_ENABLE`` enable dwc2 slave mode
- ``CFG_TUD/TUH_DWC2_DMA_ENABLE`` enable dwc2 dma mode


Controller Driver (DCD & HCD)
-----------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/info/contributors.rst
1 change: 0 additions & 1 deletion docs/info/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ Index
.. toctree::
:maxdepth: 2

uses
changelog
contributors
17 changes: 0 additions & 17 deletions docs/info/uses.rst

This file was deleted.

320 changes: 320 additions & 0 deletions docs/reference/boards.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/reference/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ It is relatively simple to incorporate tinyusb to your project
Examples
--------

For your convenience, TinyUSB contains a handful of examples for both host and device with/without RTOS to quickly test the functionality as well as demonstrate how API() should be used. Most examples will work on most of `the supported boards <supported.rst>`_. Firstly we need to ``git clone`` if not already
For your convenience, TinyUSB contains a handful of examples for both host and device with/without RTOS to quickly test the functionality as well as demonstrate how API() should be used. Most examples will work on most of `the supported boards <boards.rst>`_. Firstly we need to ``git clone`` if not already

.. code-block::
Expand Down
77 changes: 1 addition & 76 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
@@ -1,85 +1,10 @@
*********
Reference
*********

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

::

.
├── docs # Documentation
├── examples # Examples with make and cmake build system
├── hw
│ ├── bsp # Supported boards source files
│ └── mcu # Low level mcu core & peripheral drivers
├── lib # Sources from 3rd party such as freeRTOS, fatfs ...
├── src # All sources files for TinyUSB stack itself.
├── test # Tests: unit test, fuzzing, hardware test
└── tools # Files used internally


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

Supports multiple device configurations by dynamically changing USB descriptors, low power functions such like suspend, resume, and remote wakeup. The following device classes are supported:

- Audio Class 2.0 (UAC2)
- Bluetooth Host Controller Interface (BTH HCI)
- Communication Device Class (CDC)
- Device Firmware Update (DFU): DFU mode (WIP) and Runtime
- 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, Ethernet Control Model (ECM), Network Control Model (NCM)
- Test and Measurement Class (USBTMC)
- Video class 1.5 (UVC): work in progress
- 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 a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added 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)
- Communication Device Class: CDC-ACM
- Vendor serial over USB: FTDI, CP210x
- Hub with multiple-level support

Similar to the Device Stack, if you have a special requirement, `usbh_app_driver_get_cb()` can be used to write your own class driver without modifying the stack.

TypeC PD Stack
==============

- Power Delivery 3.0 (PD3.0) with USB Type-C support (WIP)
- Super early stage, only for testing purpose
- Only support STM32 G4

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

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

- **No OS**
- **FreeRTOS**
- `RT-Thread <https://github.com/RT-Thread/rt-thread>`_: `repo <https://github.com/RT-Thread-packages/tinyusb>`_
- **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
boards
dependencies
concurrency
Loading

0 comments on commit 2495563

Please sign in to comment.