mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Merge pull request #854 from hathach/more-housekeeping
More housekeeping
This commit is contained in:
commit
81d238bd46
@ -25,6 +25,10 @@
|
||||
- Improve Audio driver and add uac2_headset example
|
||||
- Improve STM32 Synopsys DCD with various PRs
|
||||
|
||||
- **[J McCarthy](https://github.com/xmos-jmccarthy)**
|
||||
- Add new DFU 1.1 class driver
|
||||
- Add new example for dfu
|
||||
|
||||
- **[Kamil Tomaszewski](https://github.com/kamtom480)**
|
||||
- Add new DCD port for **Sony CXD56** (spresnese board)
|
||||
|
||||
@ -53,10 +57,14 @@
|
||||
|
||||
- **[Raspberry Pi Team](https://github.com/raspberrypi)**
|
||||
- Add new DCD port for **Raspberry Pi RP2040**
|
||||
- Add new HCD port for **Raspberry Pi RP2040**
|
||||
|
||||
- **[Reinhard Panhuber](https://github.com/PanRe)**
|
||||
- Add new class driver for **USB Audio Class 2.0 (UAC2)**
|
||||
- Enhance tu_fifo with unmasked pointer, which better support DMA
|
||||
- Rework tu_fifo with unmasked pointer, add DMA support, and constant address support
|
||||
- Add new DCD/USBD edpt_xfer_fifo() API for optimizing endpoint transfer
|
||||
- Add and greatly improve Isochronous transfer
|
||||
- Add new audio examples: audio_test and audio_4_channel_mic
|
||||
|
||||
- **[Scott Shawcroft](https://github.com/tannewt)**
|
||||
- Add new DCD port for **SAMD21 and SAMD51**
|
||||
|
@ -77,7 +77,7 @@ Supports multiple device configurations by dynamically changing usb descriptors.
|
||||
|
||||
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** : Disabling USB IRQ is used as way to provide mutex
|
||||
- **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)
|
||||
|
||||
|
@ -2,18 +2,65 @@
|
||||
|
||||
## WIP
|
||||
|
||||
- Add new port Silabs EFM32GG12, board EFM32GG12 Thunderboard Kit (SLTB009A)
|
||||
- Add new port Renesas RX63N, board GR-CITRUS
|
||||
- MIDI
|
||||
- Fix MIDI buffer overflow issue
|
||||
- Rework tu_fifo_t with separated mutex for read and write, better support DMA with read/write buffer info. And constant address mode
|
||||
- Improve audio_test example and add audio_4_channel_mic example
|
||||
- Add new dfu example
|
||||
- Remove pico-sdk from submodule
|
||||
|
||||
### Device Controller Driver (DCD)
|
||||
|
||||
- Add new DCD port for Silabs EFM32GG12 with board Thunderboard Kit (SLTB009A)
|
||||
- Add new DCD port Renesas RX63N, board GR-CITRUS
|
||||
- Add new (optional) endpoint API dcd_edpt_xfer_fifo
|
||||
- Fix build with nRF5340
|
||||
- Fix build with lpc15 and lpc54
|
||||
- Fix build with lpc177x_8x
|
||||
- STM32 Synopsys: greatly improve Isochronous transfer with edpt_xfer_fifo API
|
||||
- Support LPC55 port1 highspeed
|
||||
- Add support for Espressif esp32s3
|
||||
- nRF: fix race condition that could cause drop packet of Bulk OUT transfer
|
||||
|
||||
### USB Device Driver (USBD)
|
||||
|
||||
- Add new (optional) endpoint ADPI usbd_edpt_xfer_fifo
|
||||
|
||||
### Device Class Driver
|
||||
|
||||
CDC
|
||||
|
||||
- [Breaking] tud_cdc_peek(), tud_vendor_peek() dropped position parameter. If needed, tu_fifo_get_read_info() can be used to peek at random offset.
|
||||
|
||||
DFU
|
||||
|
||||
- Add new DFU 1.1 class driver (WIP)
|
||||
|
||||
HID
|
||||
|
||||
- Fix keyboard report descriptor template
|
||||
- Add more hid keys constant from 0x6B to 0xA4
|
||||
- [Breaking] rename API
|
||||
- HID_PROTOCOL_NONE/KEYBOARD/MOUST to HID_ITF_PROTOCOL_NONE/KEYBOARD/MOUSE
|
||||
- tud_hid_boot_mode() to tud_hid_get_protocol()
|
||||
- tud_hid_boot_mode_cb() to tud_hid_set_protocol_cb()
|
||||
|
||||
MIDI
|
||||
|
||||
- Fix MIDI buffer overflow issue
|
||||
- [Breaking] rename API
|
||||
- Rename tud_midi_read() to tud_midi_stream_read()
|
||||
- Rename tud_midi_write() to tud_midi_stream_write()
|
||||
- Rename tud_midi_receive() to tud_midi_packet_read()
|
||||
- Rename tud_midi_send() to tud_midi_packet_write()
|
||||
- New board stm32f072-eval
|
||||
- Breaking changes
|
||||
- tud_cdc_peek(), tud_vendor_peek() dropped position parameter. If needed, tu_fifo_get_read_info() can be used to peek
|
||||
at random offset.
|
||||
|
||||
### Host Controller Driver (HCD)
|
||||
|
||||
### USB Host Driver (USBH)
|
||||
|
||||
### Host Class Driver
|
||||
|
||||
HID
|
||||
|
||||
- Rework host hid driver, basically everything changes
|
||||
|
||||
## 0.9.0 - 2021.03.12
|
||||
|
||||
|
@ -55,9 +55,10 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "audio_device.h"
|
||||
//#include "common/tusb_fifo.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
@ -548,7 +549,7 @@ static bool audiod_rx_done_cb(uint8_t rhport, audiod_function_t* audio, uint16_t
|
||||
TU_VERIFY(usbd_edpt_xfer(rhport, audio->ep_out, audio->lin_buf_out, audio->ep_out_sz), false);
|
||||
#else
|
||||
// Data is already placed in EP FIFO, schedule for next receive
|
||||
TU_VERIFY(usbd_edpt_iso_xfer(rhport, audio->ep_out, &audio->ep_out_ff, audio->ep_out_sz), false);
|
||||
TU_VERIFY(usbd_edpt_xfer_fifo(rhport, audio->ep_out, &audio->ep_out_ff, audio->ep_out_sz), false);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -852,7 +853,7 @@ static bool audiod_tx_done_cb(uint8_t rhport, audiod_function_t * audio)
|
||||
TU_VERIFY(usbd_edpt_xfer(rhport, audio->ep_in, audio->lin_buf_in, n_bytes_tx));
|
||||
#else
|
||||
// Send everything in ISO EP FIFO
|
||||
TU_VERIFY(usbd_edpt_iso_xfer(rhport, audio->ep_in, &audio->ep_in_ff, n_bytes_tx));
|
||||
TU_VERIFY(usbd_edpt_xfer_fifo(rhport, audio->ep_in, &audio->ep_in_ff, n_bytes_tx));
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1611,7 +1612,7 @@ static bool audiod_set_interface(uint8_t rhport, tusb_control_request_t const *
|
||||
#if USE_LINEAR_BUFFER_RX
|
||||
TU_VERIFY(usbd_edpt_xfer(rhport, audio->ep_out, audio->lin_buf_out, audio->ep_out_sz), false);
|
||||
#else
|
||||
TU_VERIFY(usbd_edpt_iso_xfer(rhport, audio->ep_out, &audio->ep_out_ff, audio->ep_out_sz), false);
|
||||
TU_VERIFY(usbd_edpt_xfer_fifo(rhport, audio->ep_out, &audio->ep_out_ff, audio->ep_out_sz), false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -28,10 +28,6 @@
|
||||
#ifndef _TUSB_AUDIO_DEVICE_H_
|
||||
#define _TUSB_AUDIO_DEVICE_H_
|
||||
|
||||
#include "assert.h"
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
|
||||
#include "audio.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -32,7 +32,6 @@
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "bth_device.h"
|
||||
#include <common/tusb_types.h>
|
||||
#include <device/usbd_pvt.h>
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,9 +28,11 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC)
|
||||
|
||||
#include "cdc_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "cdc_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,7 +28,6 @@
|
||||
#define _TUSB_CDC_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "cdc.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_CDC)
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "cdc_host.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,8 +27,6 @@
|
||||
#ifndef _TUSB_CDC_HOST_H_
|
||||
#define _TUSB_CDC_HOST_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "cdc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,9 +28,11 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_MODE)
|
||||
|
||||
#include "dfu_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "dfu_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,8 +27,6 @@
|
||||
#ifndef _TUSB_DFU_DEVICE_H_
|
||||
#define _TUSB_DFU_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "dfu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,9 +28,11 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_RUNTIME)
|
||||
|
||||
#include "dfu_rt_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "dfu_rt_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,8 +27,6 @@
|
||||
#ifndef _TUSB_DFU_RT_DEVICE_H_
|
||||
#define _TUSB_DFU_RT_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "dfu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -31,10 +31,11 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "common/tusb_common.h"
|
||||
#include "hid_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "hid_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,8 +27,6 @@
|
||||
#ifndef _TUSB_HID_DEVICE_H_
|
||||
#define _TUSB_HID_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "hid.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HID)
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "hid_host.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -24,14 +24,9 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/** \addtogroup ClassDriver_HID
|
||||
* @{ */
|
||||
|
||||
#ifndef _TUSB_HID_HOST_H_
|
||||
#define _TUSB_HID_HOST_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "hid.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -134,5 +129,3 @@ void hidh_close(uint8_t dev_addr);
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_HID_HOST_H_ */
|
||||
|
||||
/** @} */ // ClassDriver_HID
|
||||
|
@ -31,10 +31,11 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "midi_device.h"
|
||||
#include "class/audio/audio.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "midi_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,9 +27,6 @@
|
||||
#ifndef _TUSB_MIDI_DEVICE_H_
|
||||
#define _TUSB_MIDI_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
|
||||
#include "class/audio/audio.h"
|
||||
#include "midi.h"
|
||||
|
||||
|
@ -24,13 +24,6 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/** \ingroup group_class
|
||||
* \defgroup ClassDriver_MSC MassStorage (MSC)
|
||||
* @{ */
|
||||
|
||||
/** \defgroup ClassDriver_MSC_Common Common Definitions
|
||||
* @{ */
|
||||
|
||||
#ifndef _TUSB_MSC_H_
|
||||
#define _TUSB_MSC_H_
|
||||
|
||||
@ -387,6 +380,3 @@ TU_VERIFY_STATIC(sizeof(scsi_write10_t) == 10, "size is not correct");
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_MSC_H_ */
|
||||
|
||||
/// @}
|
||||
/// @}
|
||||
|
@ -28,11 +28,12 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MSC)
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "msc_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
#include "device/dcd.h" // for faking dcd_event_xfer_complete
|
||||
|
||||
#include "msc_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,7 +28,6 @@
|
||||
#define _TUSB_MSC_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "msc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -51,53 +50,45 @@
|
||||
|
||||
TU_VERIFY_STATIC(CFG_TUD_MSC_EP_BUFSIZE < UINT16_MAX, "Size is not correct");
|
||||
|
||||
/** \addtogroup ClassDriver_MSC
|
||||
* @{
|
||||
* \defgroup MSC_Device Device
|
||||
* @{ */
|
||||
//--------------------------------------------------------------------+
|
||||
// Application API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Set SCSI sense response
|
||||
bool tud_msc_set_sense(uint8_t lun, uint8_t sense_key, uint8_t add_sense_code, uint8_t add_sense_qualifier);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Application Callbacks (WEAK is optional)
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
/**
|
||||
* Invoked when received \ref SCSI_CMD_READ_10 command
|
||||
* \param[in] lun Logical unit number
|
||||
* \param[in] lba Logical Block Address to be read
|
||||
* \param[in] offset Byte offset from LBA
|
||||
* \param[out] buffer Buffer which application need to update with the response data.
|
||||
* \param[in] bufsize Requested bytes
|
||||
*
|
||||
* \return Number of byte read, if it is less than requested bytes by \a \b bufsize. Tinyusb will transfer
|
||||
* this amount first and invoked this again for remaining data.
|
||||
*
|
||||
* \retval zero Indicate application is not ready yet to response e.g disk I/O is not complete.
|
||||
* tinyusb will invoke this callback with the same parameters again some time later.
|
||||
*
|
||||
* \retval negative Indicate error e.g reading disk I/O. tinyusb will \b STALL the corresponding
|
||||
* endpoint and return failed status in command status wrapper phase.
|
||||
*/
|
||||
// Invoked when received SCSI READ10 command
|
||||
// - Address = lba * BLOCK_SIZE + offset
|
||||
// - offset is only needed if CFG_TUD_MSC_EP_BUFSIZE is smaller than BLOCK_SIZE.
|
||||
//
|
||||
// - Application fill the buffer (up to bufsize) with address contents and return number of read byte. If
|
||||
// - read < bufsize : These bytes are transferred first and callback invoked again for remaining data.
|
||||
//
|
||||
// - read == 0 : Indicate application is not ready yet e.g disk I/O busy.
|
||||
// Callback invoked again with the same parameters later on.
|
||||
//
|
||||
// - read < 0 : Indicate application error e.g invalid address. This request will be STALLed
|
||||
// and return failed status in command status wrapper phase.
|
||||
int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize);
|
||||
|
||||
/**
|
||||
* Invoked when received \ref SCSI_CMD_WRITE_10 command
|
||||
* \param[in] lun Logical unit number
|
||||
* \param[in] lba Logical Block Address to be write
|
||||
* \param[in] offset Byte offset from LBA
|
||||
* \param[out] buffer Buffer which holds written data.
|
||||
* \param[in] bufsize Requested bytes
|
||||
*
|
||||
* \return Number of byte written, if it is less than requested bytes by \a \b bufsize. Tinyusb will proceed with
|
||||
* other work and invoked this again with adjusted parameters.
|
||||
*
|
||||
* \retval zero Indicate application is not ready yet e.g disk I/O is not complete.
|
||||
* Tinyusb will invoke this callback with the same parameters again some time later.
|
||||
*
|
||||
* \retval negative Indicate error writing disk I/O. Tinyusb will \b STALL the corresponding
|
||||
* endpoint and return failed status in command status wrapper phase.
|
||||
*/
|
||||
// Invoked when received SCSI WRITE10 command
|
||||
// - Address = lba * BLOCK_SIZE + offset
|
||||
// - offset is only needed if CFG_TUD_MSC_EP_BUFSIZE is smaller than BLOCK_SIZE.
|
||||
//
|
||||
// - Application write data from buffer to address contents (up to bufsize) and return number of written byte. If
|
||||
// - write < bufsize : callback invoked again with remaining data later on.
|
||||
//
|
||||
// - write == 0 : Indicate application is not ready yet e.g disk I/O busy.
|
||||
// Callback invoked again with the same parameters later on.
|
||||
//
|
||||
// - write < 0 : Indicate application error e.g invalid address. This request will be STALLed
|
||||
// and return failed status in command status wrapper phase.
|
||||
//
|
||||
// TODO change buffer to const uint8_t*
|
||||
int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize);
|
||||
|
||||
// Invoked when received SCSI_CMD_INQUIRY
|
||||
@ -152,9 +143,6 @@ TU_ATTR_WEAK void tud_msc_scsi_complete_cb(uint8_t lun, uint8_t const scsi_cmd[1
|
||||
// Hook to make a mass storage device read-only. TODO remove
|
||||
TU_ATTR_WEAK bool tud_msc_is_writable_cb(uint8_t lun);
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Internal Class Driver API
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,10 +28,7 @@
|
||||
|
||||
#if TUSB_OPT_HOST_ENABLED & CFG_TUH_MSC
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "msc_host.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -27,8 +27,6 @@
|
||||
#ifndef _TUSB_MSC_HOST_H_
|
||||
#define _TUSB_MSC_HOST_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "msc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -29,8 +29,10 @@
|
||||
|
||||
#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_NET )
|
||||
|
||||
#include "net_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "net_device.h"
|
||||
#include "rndis_protocol.h"
|
||||
|
||||
void rndis_class_set_handler(uint8_t *data, int size); /* found in ./misc/networking/rndis_reports.c */
|
||||
|
@ -28,8 +28,6 @@
|
||||
#ifndef _TUSB_NET_DEVICE_H_
|
||||
#define _TUSB_NET_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
#include "class/cdc/cdc.h"
|
||||
|
||||
/* declared here, NOT in usb_descriptors.c, so that the driver can intelligently ZLP as needed */
|
||||
|
@ -77,15 +77,11 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_USBTMC)
|
||||
|
||||
#include <string.h>
|
||||
#include "usbtmc.h"
|
||||
#include "usbtmc_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "osal/osal.h"
|
||||
|
||||
// FIXME: I shouldn't need to include _pvt headers, but it is necessary for usbd_edpt_xfer, _stall, and _busy
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "usbtmc_device.h"
|
||||
|
||||
#ifdef xDEBUG
|
||||
#include "uart_util.h"
|
||||
static char logMsg[150];
|
||||
|
4
src/class/vendor/vendor_device.c
vendored
4
src/class/vendor/vendor_device.c
vendored
@ -28,9 +28,11 @@
|
||||
|
||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VENDOR)
|
||||
|
||||
#include "vendor_device.h"
|
||||
#include "device/usbd.h"
|
||||
#include "device/usbd_pvt.h"
|
||||
|
||||
#include "vendor_device.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
1
src/class/vendor/vendor_device.h
vendored
1
src/class/vendor/vendor_device.h
vendored
@ -28,7 +28,6 @@
|
||||
#define _TUSB_VENDOR_DEVICE_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "device/usbd.h"
|
||||
|
||||
#ifndef CFG_TUD_VENDOR_EPSIZE
|
||||
#define CFG_TUD_VENDOR_EPSIZE 64
|
||||
|
2
src/class/vendor/vendor_host.c
vendored
2
src/class/vendor/vendor_host.c
vendored
@ -31,7 +31,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
#include "vendor_host.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
7
src/class/vendor/vendor_host.h
vendored
7
src/class/vendor/vendor_host.h
vendored
@ -24,15 +24,10 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/** \ingroup group_class
|
||||
* \defgroup Group_Custom Custom Class (not supported yet)
|
||||
* @{ */
|
||||
|
||||
#ifndef _TUSB_VENDOR_HOST_H_
|
||||
#define _TUSB_VENDOR_HOST_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "host/usbh.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -70,5 +65,3 @@ void cush_close(uint8_t dev_addr);
|
||||
#endif
|
||||
|
||||
#endif /* _TUSB_VENDOR_HOST_H_ */
|
||||
|
||||
/** @} */
|
||||
|
@ -72,10 +72,11 @@
|
||||
#include "tusb_option.h"
|
||||
#include "tusb_compiler.h"
|
||||
#include "tusb_verify.h"
|
||||
#include "tusb_error.h" // TODO remove
|
||||
#include "tusb_timeout.h"
|
||||
#include "tusb_types.h"
|
||||
|
||||
#include "tusb_error.h" // TODO remove
|
||||
#include "tusb_timeout.h" // TODO remove
|
||||
|
||||
//------------- Mem -------------//
|
||||
#define tu_memclr(buffer, size) memset((buffer), 0, (size))
|
||||
#define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var)))
|
||||
|
@ -25,8 +25,6 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "osal/osal.h"
|
||||
#include "tusb_fifo.h"
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
#ifndef _TUSB_FIFO_H_
|
||||
#define _TUSB_FIFO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Due to the use of unmasked pointers, this FIFO does not suffer from loosing
|
||||
// one item slice. Furthermore, write and read operations are completely
|
||||
// decoupled as write and read functions do not modify a common state. Henceforth,
|
||||
@ -37,25 +41,17 @@
|
||||
// read pointers can be updated from within a DMA ISR. Overflows are detectable
|
||||
// within a certain number (see tu_fifo_overflow()).
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
|
||||
// mutex is only needed for RTOS
|
||||
// for OS None, we don't get preempted
|
||||
#define CFG_FIFO_MUTEX (CFG_TUSB_OS != OPT_OS_NONE)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CFG_FIFO_MUTEX
|
||||
#include "osal/osal.h"
|
||||
#define tu_fifo_mutex_t osal_mutex_t
|
||||
#endif
|
||||
|
||||
/** \struct tu_fifo_t
|
||||
* \brief Simple Circular FIFO
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t* buffer ; ///< buffer pointer
|
||||
@ -104,7 +100,8 @@ bool tu_fifo_clear(tu_fifo_t *f);
|
||||
bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t item_size, bool overwritable);
|
||||
|
||||
#if CFG_FIFO_MUTEX
|
||||
static inline void tu_fifo_config_mutex(tu_fifo_t *f, tu_fifo_mutex_t write_mutex_hdl, tu_fifo_mutex_t read_mutex_hdl)
|
||||
TU_ATTR_ALWAYS_INLINE static inline
|
||||
void tu_fifo_config_mutex(tu_fifo_t *f, tu_fifo_mutex_t write_mutex_hdl, tu_fifo_mutex_t read_mutex_hdl)
|
||||
{
|
||||
f->mutex_wr = write_mutex_hdl;
|
||||
f->mutex_rd = read_mutex_hdl;
|
||||
@ -129,15 +126,16 @@ uint16_t tu_fifo_remaining (tu_fifo_t* f);
|
||||
bool tu_fifo_overflowed (tu_fifo_t* f);
|
||||
void tu_fifo_correct_read_pointer (tu_fifo_t* f);
|
||||
|
||||
static inline uint16_t tu_fifo_depth(tu_fifo_t* f)
|
||||
TU_ATTR_ALWAYS_INLINE static inline
|
||||
uint16_t tu_fifo_depth(tu_fifo_t* f)
|
||||
{
|
||||
return f->depth;
|
||||
}
|
||||
|
||||
// Pointer modifications intended to be used in combinations with DMAs.
|
||||
// USE WITH CARE - NO SAFTY CHECKS CONDUCTED HERE! NOT MUTEX PROTECTED!
|
||||
void tu_fifo_advance_write_pointer (tu_fifo_t *f, uint16_t n);
|
||||
void tu_fifo_advance_read_pointer (tu_fifo_t *f, uint16_t n);
|
||||
void tu_fifo_advance_write_pointer(tu_fifo_t *f, uint16_t n);
|
||||
void tu_fifo_advance_read_pointer (tu_fifo_t *f, uint16_t n);
|
||||
|
||||
// If you want to read/write from/to the FIFO by use of a DMA, you may need to conduct two copies
|
||||
// to handle a possible wrapping part. These functions deliver a pointer to start
|
||||
|
@ -28,6 +28,7 @@
|
||||
#define _TUSB_DCD_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "osal/osal.h"
|
||||
#include "common/tusb_fifo.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1271,7 +1271,7 @@ bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
|
||||
// bytes should be written and second to keep the return value free to give back a boolean
|
||||
// success message. If total_bytes is too big, the FIFO will copy only what is available
|
||||
// into the USB buffer!
|
||||
bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes)
|
||||
bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes)
|
||||
{
|
||||
uint8_t const epnum = tu_edpt_number(ep_addr);
|
||||
uint8_t const dir = tu_edpt_dir(ep_addr);
|
||||
|
@ -70,8 +70,8 @@ bool tud_mounted(void);
|
||||
bool tud_suspended(void);
|
||||
|
||||
// Check if device is ready to transfer
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline bool tud_ready(void)
|
||||
TU_ATTR_ALWAYS_INLINE static inline
|
||||
bool tud_ready(void)
|
||||
{
|
||||
return tud_mounted() && !tud_suspended();
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr);
|
||||
bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
|
||||
|
||||
// Submit a usb ISO transfer by use of a FIFO (ring buffer) - all bytes in FIFO get transmitted
|
||||
bool usbd_edpt_iso_xfer(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes);
|
||||
bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes);
|
||||
|
||||
// Claim an endpoint before submitting a transfer.
|
||||
// If caller does not make any transfer, it must release endpoint for others.
|
||||
@ -94,7 +94,7 @@ void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr);
|
||||
// Check if endpoint is stalled
|
||||
bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr);
|
||||
|
||||
static inline
|
||||
TU_ATTR_ALWAYS_INLINE static inline
|
||||
bool usbd_edpt_ready(uint8_t rhport, uint8_t ep_addr)
|
||||
{
|
||||
return !usbd_edpt_busy(rhport, ep_addr) && !usbd_edpt_stalled(rhport, ep_addr);
|
||||
|
@ -28,9 +28,7 @@
|
||||
|
||||
#if (TUSB_OPT_HOST_ENABLED && CFG_TUH_HUB)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "usbh.h"
|
||||
#include "hub.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -37,7 +37,6 @@
|
||||
#define _TUSB_HUB_H_
|
||||
|
||||
#include "common/tusb_common.h"
|
||||
#include "usbh.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -34,10 +34,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "osal/osal.h" // TODO refractor move to common.h ?
|
||||
#include "common/tusb_common.h"
|
||||
#include "hcd.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
@ -67,10 +64,6 @@ typedef struct {
|
||||
|
||||
typedef bool (*tuh_control_complete_cb_t)(uint8_t dev_addr, tusb_control_request_t const * request, xfer_result_t result);
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// APPLICATION API
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "soc/usb_periph.h"
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
// Since TinyUSB doesn't use SOF for now, and this interrupt too often (1ms interval)
|
||||
|
@ -29,7 +29,6 @@
|
||||
#if CFG_TUSB_MCU == OPT_MCU_SAMG
|
||||
|
||||
#include "sam.h"
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
// TODO should support (SAM3S || SAM4S || SAM4E || SAMG55)
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC120)
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
#include "NUC100Series.h"
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED && ( (CFG_TUSB_MCU == OPT_MCU_NUC121) || (CFG_TUSB_MCU == OPT_MCU_NUC126) )
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
#include "NuMicro.h"
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED && (CFG_TUSB_MCU == OPT_MCU_NUC505)
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
#include "NUC505Series.h"
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
#include "pico/fix/rp2040_usb_device_enumeration.h"
|
||||
#endif
|
||||
|
||||
#include "osal/osal.h"
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "device/dcd.h"
|
||||
#include "osal/osal.h"
|
||||
|
||||
#define CXD56_EPNUM (7)
|
||||
#define CXD56_SETUP_QUEUE_DEPTH (4)
|
||||
|
@ -120,7 +120,6 @@
|
||||
// Some definitions are copied to our private include file.
|
||||
#undef USE_HAL_DRIVER
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
#include "portable/st/stm32_fsdev/dcd_stm32_fsdev_pvt_st.h"
|
||||
|
||||
|
@ -94,10 +94,8 @@
|
||||
|
||||
#else
|
||||
#error "Unsupported MCUs"
|
||||
|
||||
#endif
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_NONE
|
||||
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -30,7 +30,6 @@
|
||||
#if TUSB_OPT_DEVICE_ENABLED && ( CFG_TUSB_MCU == OPT_MCU_MSP430x5xx )
|
||||
|
||||
#include "msp430.h"
|
||||
#include "common/tusb_fifo.h"
|
||||
#include "device/dcd.h"
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
@ -55,11 +55,11 @@
|
||||
#define OPT_MCU_NRF5X 100 ///< Nordic nRF5x series
|
||||
|
||||
// SAM
|
||||
#define OPT_MCU_SAMD11 204 ///< MicroChip SAMD11
|
||||
#define OPT_MCU_SAMD21 200 ///< MicroChip SAMD21
|
||||
#define OPT_MCU_SAMD51 201 ///< MicroChip SAMD51
|
||||
#define OPT_MCU_SAME5X 203 ///< MicroChip SAM E5x
|
||||
#define OPT_MCU_SAMG 202 ///< MicroChip SAMDG series
|
||||
#define OPT_MCU_SAME5X 203 ///< MicroChip SAM E5x
|
||||
#define OPT_MCU_SAMD11 204 ///< MicroChip SAMD11
|
||||
#define OPT_MCU_SAML22 205 ///< MicroChip SAML22
|
||||
|
||||
// STM32
|
||||
|
Loading…
x
Reference in New Issue
Block a user