2014-03-05 21:37:53 +07:00
|
|
|
/**************************************************************************/
|
|
|
|
/*!
|
|
|
|
@file tusb.h
|
|
|
|
@author hathach (tinyusb.org)
|
|
|
|
|
|
|
|
@section LICENSE
|
|
|
|
|
|
|
|
Software License Agreement (BSD License)
|
|
|
|
|
|
|
|
Copyright (c) 2013, hathach (tinyusb.org)
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
|
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
3. Neither the name of the copyright holders nor the
|
|
|
|
names of its contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
|
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
|
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
|
|
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
This file is part of the tinyusb stack.
|
|
|
|
*/
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TUSB_H_
|
|
|
|
#define _TUSB_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------+
|
|
|
|
// INCLUDE
|
|
|
|
//--------------------------------------------------------------------+
|
2018-03-12 22:45:35 +07:00
|
|
|
#include "common/tusb_common.h"
|
2018-03-02 18:43:00 +07:00
|
|
|
#include "tusb_hal.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#include "osal/osal.h"
|
2018-11-02 17:26:35 +07:00
|
|
|
#include "common/tusb_fifo.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
|
|
|
|
//------------- HOST -------------//
|
2018-12-07 23:38:52 +07:00
|
|
|
#if TUSB_OPT_HOST_ENABLED
|
2014-03-05 21:37:53 +07:00
|
|
|
#include "host/usbh.h"
|
|
|
|
|
|
|
|
#if HOST_CLASS_HID
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/hid/hid_host.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
2018-12-06 22:24:31 +07:00
|
|
|
#if CFG_TUH_MSC
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/msc/msc_host.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
2018-12-06 22:24:31 +07:00
|
|
|
#if CFG_TUH_CDC
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/cdc/cdc_host.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
2018-04-10 14:31:11 +07:00
|
|
|
#if CFG_TUSB_HOST_CUSTOM_CLASS
|
2018-06-17 14:21:26 +07:00
|
|
|
#include "class/custom_host.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------- DEVICE -------------//
|
2018-07-23 15:25:45 +07:00
|
|
|
#if TUSB_OPT_DEVICE_ENABLED
|
2014-03-05 21:37:53 +07:00
|
|
|
#include "device/usbd.h"
|
|
|
|
|
2018-07-28 12:38:45 +07:00
|
|
|
#if CFG_TUD_HID
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/hid/hid_device.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
2018-04-12 13:23:52 +07:00
|
|
|
#if CFG_TUD_CDC
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/cdc/cdc_device.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
2018-04-12 13:23:52 +07:00
|
|
|
#if CFG_TUD_MSC
|
2018-03-06 17:26:34 +07:00
|
|
|
#include "class/msc/msc_device.h"
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
2018-06-16 12:30:10 +07:00
|
|
|
|
2018-11-16 17:03:33 -08:00
|
|
|
#if CFG_TUD_MIDI
|
|
|
|
#include "class/midi/midi_device.h"
|
|
|
|
#endif
|
|
|
|
|
2018-06-16 12:30:10 +07:00
|
|
|
#if CFG_TUD_CUSTOM_CLASS
|
|
|
|
#include "class/custom/custom_device.h"
|
|
|
|
#endif
|
2014-03-05 21:37:53 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------+
|
|
|
|
// APPLICATION API
|
|
|
|
//--------------------------------------------------------------------+
|
2014-03-25 13:00:37 +07:00
|
|
|
/** \ingroup group_application_api
|
2014-03-18 16:10:25 +07:00
|
|
|
* @{ */
|
|
|
|
|
2018-12-13 14:51:37 +07:00
|
|
|
// Initialize device/host stack
|
2018-12-05 17:30:04 +07:00
|
|
|
bool tusb_init(void);
|
2014-03-05 21:37:53 +07:00
|
|
|
|
2018-12-13 14:51:37 +07:00
|
|
|
// TODO
|
|
|
|
// bool tusb_teardown(void);
|
2018-12-13 13:49:09 +07:00
|
|
|
|
2014-04-17 10:33:59 +07:00
|
|
|
|
2018-12-13 14:51:37 +07:00
|
|
|
// backward compatible only. TODO remove later
|
2018-12-14 13:08:21 +07:00
|
|
|
ATTR_DEPRECATED("Please use either tud_task() or tuh_task()")
|
2018-12-13 14:51:37 +07:00
|
|
|
static inline void tusb_task(void)
|
|
|
|
{
|
|
|
|
#if TUSB_OPT_HOST_ENABLED
|
|
|
|
tuh_task();
|
|
|
|
#endif
|
2018-12-13 13:49:09 +07:00
|
|
|
|
2018-12-13 14:51:37 +07:00
|
|
|
#if TUSB_OPT_DEVICE_ENABLED
|
|
|
|
tud_task();
|
|
|
|
#endif
|
|
|
|
}
|
2014-03-05 21:37:53 +07:00
|
|
|
|
2014-03-18 16:10:25 +07:00
|
|
|
/** @} */
|
|
|
|
|
2014-03-05 21:37:53 +07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _TUSB_H_ */
|