mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-07 05:54:11 +08:00
include clean up
This commit is contained in:
parent
c7cecf28c8
commit
9736e54734
@ -55,9 +55,10 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
#include "audio_device.h"
|
#include "audio_device.h"
|
||||||
//#include "common/tusb_fifo.h"
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
|
@ -28,10 +28,6 @@
|
|||||||
#ifndef _TUSB_AUDIO_DEVICE_H_
|
#ifndef _TUSB_AUDIO_DEVICE_H_
|
||||||
#define _TUSB_AUDIO_DEVICE_H_
|
#define _TUSB_AUDIO_DEVICE_H_
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "bth_device.h"
|
#include "bth_device.h"
|
||||||
#include <common/tusb_types.h>
|
|
||||||
#include <device/usbd_pvt.h>
|
#include <device/usbd_pvt.h>
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -28,9 +28,11 @@
|
|||||||
|
|
||||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC)
|
||||||
|
|
||||||
#include "cdc_device.h"
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "cdc_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#define _TUSB_CDC_DEVICE_H_
|
#define _TUSB_CDC_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
#include "device/usbd.h"
|
|
||||||
#include "cdc.h"
|
#include "cdc.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -28,9 +28,11 @@
|
|||||||
|
|
||||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_MODE)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_MODE)
|
||||||
|
|
||||||
#include "dfu_device.h"
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "dfu_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#ifndef _TUSB_DFU_DEVICE_H_
|
#ifndef _TUSB_DFU_DEVICE_H_
|
||||||
#define _TUSB_DFU_DEVICE_H_
|
#define _TUSB_DFU_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
|
||||||
#include "dfu.h"
|
#include "dfu.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -28,9 +28,11 @@
|
|||||||
|
|
||||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_RUNTIME)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_DFU_RUNTIME)
|
||||||
|
|
||||||
#include "dfu_rt_device.h"
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "dfu_rt_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#ifndef _TUSB_DFU_RT_DEVICE_H_
|
#ifndef _TUSB_DFU_RT_DEVICE_H_
|
||||||
#define _TUSB_DFU_RT_DEVICE_H_
|
#define _TUSB_DFU_RT_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
|
||||||
#include "dfu.h"
|
#include "dfu.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -31,10 +31,11 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "common/tusb_common.h"
|
#include "device/usbd.h"
|
||||||
#include "hid_device.h"
|
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "hid_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#ifndef _TUSB_HID_DEVICE_H_
|
#ifndef _TUSB_HID_DEVICE_H_
|
||||||
#define _TUSB_HID_DEVICE_H_
|
#define _TUSB_HID_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
|
||||||
#include "hid.h"
|
#include "hid.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -31,10 +31,11 @@
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// INCLUDE
|
// INCLUDE
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
#include "midi_device.h"
|
#include "device/usbd.h"
|
||||||
#include "class/audio/audio.h"
|
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "midi_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -27,9 +27,6 @@
|
|||||||
#ifndef _TUSB_MIDI_DEVICE_H_
|
#ifndef _TUSB_MIDI_DEVICE_H_
|
||||||
#define _TUSB_MIDI_DEVICE_H_
|
#define _TUSB_MIDI_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
|
||||||
|
|
||||||
#include "class/audio/audio.h"
|
#include "class/audio/audio.h"
|
||||||
#include "midi.h"
|
#include "midi.h"
|
||||||
|
|
||||||
|
@ -28,11 +28,12 @@
|
|||||||
|
|
||||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MSC)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_MSC)
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "device/usbd.h"
|
||||||
#include "msc_device.h"
|
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
#include "device/dcd.h" // for faking dcd_event_xfer_complete
|
#include "device/dcd.h" // for faking dcd_event_xfer_complete
|
||||||
|
|
||||||
|
#include "msc_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#define _TUSB_MSC_DEVICE_H_
|
#define _TUSB_MSC_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
#include "device/usbd.h"
|
|
||||||
#include "msc.h"
|
#include "msc.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -51,53 +50,45 @@
|
|||||||
|
|
||||||
TU_VERIFY_STATIC(CFG_TUD_MSC_EP_BUFSIZE < UINT16_MAX, "Size is not correct");
|
TU_VERIFY_STATIC(CFG_TUD_MSC_EP_BUFSIZE < UINT16_MAX, "Size is not correct");
|
||||||
|
|
||||||
/** \addtogroup ClassDriver_MSC
|
//--------------------------------------------------------------------+
|
||||||
* @{
|
// Application API
|
||||||
* \defgroup MSC_Device Device
|
//--------------------------------------------------------------------+
|
||||||
* @{ */
|
|
||||||
|
|
||||||
|
// 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);
|
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)
|
// Application Callbacks (WEAK is optional)
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
|
||||||
/**
|
// Invoked when received SCSI READ10 command
|
||||||
* Invoked when received \ref SCSI_CMD_READ_10 command
|
// - Address = lba * BLOCK_SIZE + offset
|
||||||
* \param[in] lun Logical unit number
|
// - offset is only needed if CFG_TUD_MSC_EP_BUFSIZE is smaller than BLOCK_SIZE.
|
||||||
* \param[in] lba Logical Block Address to be read
|
//
|
||||||
* \param[in] offset Byte offset from LBA
|
// - Application fill the buffer (up to bufsize) with address contents and return number of read byte. If
|
||||||
* \param[out] buffer Buffer which application need to update with the response data.
|
// - read < bufsize : These bytes are transferred first and callback invoked again for remaining data.
|
||||||
* \param[in] bufsize Requested bytes
|
//
|
||||||
*
|
// - read == 0 : Indicate application is not ready yet e.g disk I/O busy.
|
||||||
* \return Number of byte read, if it is less than requested bytes by \a \b bufsize. Tinyusb will transfer
|
// Callback invoked again with the same parameters later on.
|
||||||
* this amount first and invoked this again for remaining data.
|
//
|
||||||
*
|
// - read < 0 : Indicate application error e.g invalid address. This request will be STALLed
|
||||||
* \retval zero Indicate application is not ready yet to response e.g disk I/O is not complete.
|
// and return failed status in command status wrapper phase.
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize);
|
int32_t tud_msc_read10_cb (uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize);
|
||||||
|
|
||||||
/**
|
// Invoked when received SCSI WRITE10 command
|
||||||
* Invoked when received \ref SCSI_CMD_WRITE_10 command
|
// - Address = lba * BLOCK_SIZE + offset
|
||||||
* \param[in] lun Logical unit number
|
// - offset is only needed if CFG_TUD_MSC_EP_BUFSIZE is smaller than BLOCK_SIZE.
|
||||||
* \param[in] lba Logical Block Address to be write
|
//
|
||||||
* \param[in] offset Byte offset from LBA
|
// - Application write data from buffer to address contents (up to bufsize) and return number of written byte. If
|
||||||
* \param[out] buffer Buffer which holds written data.
|
// - write < bufsize : callback invoked again with remaining data later on.
|
||||||
* \param[in] bufsize Requested bytes
|
//
|
||||||
*
|
// - write == 0 : Indicate application is not ready yet e.g disk I/O busy.
|
||||||
* \return Number of byte written, if it is less than requested bytes by \a \b bufsize. Tinyusb will proceed with
|
// Callback invoked again with the same parameters later on.
|
||||||
* other work and invoked this again with adjusted parameters.
|
//
|
||||||
*
|
// - write < 0 : Indicate application error e.g invalid address. This request will be STALLed
|
||||||
* \retval zero Indicate application is not ready yet e.g disk I/O is not complete.
|
// and return failed status in command status wrapper phase.
|
||||||
* Tinyusb will invoke this callback with the same parameters again some time later.
|
//
|
||||||
*
|
// TODO change buffer to const uint8_t*
|
||||||
* \retval negative Indicate error writing disk I/O. Tinyusb will \b STALL the corresponding
|
|
||||||
* endpoint and return failed status in command status wrapper phase.
|
|
||||||
*/
|
|
||||||
int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* buffer, uint32_t bufsize);
|
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
|
// 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
|
// Hook to make a mass storage device read-only. TODO remove
|
||||||
TU_ATTR_WEAK bool tud_msc_is_writable_cb(uint8_t lun);
|
TU_ATTR_WEAK bool tud_msc_is_writable_cb(uint8_t lun);
|
||||||
|
|
||||||
/** @} */
|
|
||||||
/** @} */
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Internal Class Driver API
|
// Internal Class Driver API
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
|
|
||||||
#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_NET )
|
#if ( TUSB_OPT_DEVICE_ENABLED && CFG_TUD_NET )
|
||||||
|
|
||||||
#include "net_device.h"
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "net_device.h"
|
||||||
#include "rndis_protocol.h"
|
#include "rndis_protocol.h"
|
||||||
|
|
||||||
void rndis_class_set_handler(uint8_t *data, int size); /* found in ./misc/networking/rndis_reports.c */
|
void rndis_class_set_handler(uint8_t *data, int size); /* found in ./misc/networking/rndis_reports.c */
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#ifndef _TUSB_NET_DEVICE_H_
|
#ifndef _TUSB_NET_DEVICE_H_
|
||||||
#define _TUSB_NET_DEVICE_H_
|
#define _TUSB_NET_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
|
||||||
#include "device/usbd.h"
|
#include "device/usbd.h"
|
||||||
#include "class/cdc/cdc.h"
|
#include "class/cdc/cdc.h"
|
||||||
|
|
||||||
|
@ -77,15 +77,11 @@
|
|||||||
|
|
||||||
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_USBTMC)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_USBTMC)
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "usbtmc.h"
|
|
||||||
#include "usbtmc_device.h"
|
|
||||||
#include "device/usbd.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 "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "usbtmc_device.h"
|
||||||
|
|
||||||
#ifdef xDEBUG
|
#ifdef xDEBUG
|
||||||
#include "uart_util.h"
|
#include "uart_util.h"
|
||||||
static char logMsg[150];
|
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)
|
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_VENDOR)
|
||||||
|
|
||||||
#include "vendor_device.h"
|
#include "device/usbd.h"
|
||||||
#include "device/usbd_pvt.h"
|
#include "device/usbd_pvt.h"
|
||||||
|
|
||||||
|
#include "vendor_device.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// 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_
|
#define _TUSB_VENDOR_DEVICE_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
#include "device/usbd.h"
|
|
||||||
|
|
||||||
#ifndef CFG_TUD_VENDOR_EPSIZE
|
#ifndef CFG_TUD_VENDOR_EPSIZE
|
||||||
#define CFG_TUD_VENDOR_EPSIZE 64
|
#define CFG_TUD_VENDOR_EPSIZE 64
|
||||||
|
@ -72,10 +72,11 @@
|
|||||||
#include "tusb_option.h"
|
#include "tusb_option.h"
|
||||||
#include "tusb_compiler.h"
|
#include "tusb_compiler.h"
|
||||||
#include "tusb_verify.h"
|
#include "tusb_verify.h"
|
||||||
#include "tusb_error.h" // TODO remove
|
|
||||||
#include "tusb_timeout.h"
|
|
||||||
#include "tusb_types.h"
|
#include "tusb_types.h"
|
||||||
|
|
||||||
|
#include "tusb_error.h" // TODO remove
|
||||||
|
#include "tusb_timeout.h" // TODO remove
|
||||||
|
|
||||||
//------------- Mem -------------//
|
//------------- Mem -------------//
|
||||||
#define tu_memclr(buffer, size) memset((buffer), 0, (size))
|
#define tu_memclr(buffer, size) memset((buffer), 0, (size))
|
||||||
#define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var)))
|
#define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var)))
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define _TUSB_DCD_H_
|
#define _TUSB_DCD_H_
|
||||||
|
|
||||||
#include "common/tusb_common.h"
|
#include "common/tusb_common.h"
|
||||||
|
#include "osal/osal.h"
|
||||||
#include "common/tusb_fifo.h"
|
#include "common/tusb_fifo.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user