mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-23 13:20:54 +00:00
change TUSB_CFG_CONTROLLER0/1_MODE to TUSB_CFG_CONTROLLER_0/1_MODE for clearance
adding configuration docs for tinyusb_config.h document HID mouse & keyboard API
This commit is contained in:
parent
2076e57d70
commit
b71ffe3d5a
@ -59,8 +59,8 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_CFG_CONTROLLER0_MODE (TUSB_MODE_DEVICE)
|
||||
#define TUSB_CFG_CONTROLLER1_MODE (TUSB_MODE_NONE)
|
||||
#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
|
||||
#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
|
@ -59,8 +59,8 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_CFG_CONTROLLER0_MODE (TUSB_MODE_HOST)
|
||||
#define TUSB_CFG_CONTROLLER1_MODE (TUSB_MODE_NONE)
|
||||
#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_HOST)
|
||||
#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
|
@ -458,10 +458,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>25</ColumnNumber>
|
||||
<ColumnNumber>11</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>156</TopLine>
|
||||
<CurrentLine>160</CurrentLine>
|
||||
<TopLine>144</TopLine>
|
||||
<CurrentLine>152</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
@ -554,10 +554,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>18</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>226</TopLine>
|
||||
<CurrentLine>237</CurrentLine>
|
||||
<TopLine>242</TopLine>
|
||||
<CurrentLine>250</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\cli.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cli.c</FilenameWithoutPath>
|
||||
@ -812,7 +812,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>357</TopLine>
|
||||
<TopLine>359</TopLine>
|
||||
<CurrentLine>362</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
|
||||
@ -828,8 +828,8 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<TopLine>276</TopLine>
|
||||
<CurrentLine>284</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\ehci\ehci.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ehci.c</FilenameWithoutPath>
|
||||
@ -874,10 +874,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>40</ColumnNumber>
|
||||
<ColumnNumber>26</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<TopLine>61</TopLine>
|
||||
<CurrentLine>69</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\hal\hal_lpc43xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>hal_lpc43xx.c</FilenameWithoutPath>
|
||||
@ -908,8 +908,8 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>9</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\common\errors.c</PathWithFileName>
|
||||
<FilenameWithoutPath>errors.c</FilenameWithoutPath>
|
||||
@ -1060,7 +1060,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>3</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>577</TopLine>
|
||||
<TopLine>579</TopLine>
|
||||
<CurrentLine>580</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName>
|
||||
@ -1116,7 +1116,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>19</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>147</TopLine>
|
||||
<TopLine>149</TopLine>
|
||||
<CurrentLine>152</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
|
||||
@ -1128,7 +1128,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>fatfs</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -1140,7 +1140,7 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>47</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>50</TopLine>
|
||||
<TopLine>51</TopLine>
|
||||
<CurrentLine>59</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
|
||||
@ -1154,10 +1154,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>12</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>91</TopLine>
|
||||
<CurrentLine>97</CurrentLine>
|
||||
<TopLine>1705</TopLine>
|
||||
<CurrentLine>1713</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ff.c</FilenameWithoutPath>
|
||||
@ -1172,8 +1172,8 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\vendor\fatfs\ccsbcs.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ccsbcs.c</FilenameWithoutPath>
|
||||
|
@ -59,8 +59,8 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_CFG_CONTROLLER0_MODE (TUSB_MODE_HOST)
|
||||
#define TUSB_CFG_CONTROLLER1_MODE (TUSB_MODE_NONE)
|
||||
#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_HOST)
|
||||
#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
@ -83,9 +83,6 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
//#define TUSB_CFG_DEVICE
|
||||
|
||||
//------------- CORE/CONTROLLER -------------//
|
||||
|
||||
//------------- CLASS -------------//
|
||||
//#define TUSB_CFG_DEVICE_CDC
|
||||
|
@ -78,16 +78,16 @@
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/demos</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>doxygen.Doxyfile</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/doxygen.Doxyfile</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>tinyusb</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/tinyusb</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>tinyusb.Doxyfile</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/tinyusb.Doxyfile</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
|
@ -59,8 +59,8 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER CONFIGURATION
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_CFG_CONTROLLER0_MODE (TUSB_MODE_HOST | TUSB_MODE_DEVICE)
|
||||
#define TUSB_CFG_CONTROLLER1_MODE (TUSB_MODE_NONE)
|
||||
#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_HOST | TUSB_MODE_DEVICE)
|
||||
#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_NONE)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// HOST CONFIGURATION
|
||||
@ -85,7 +85,7 @@
|
||||
|
||||
// Test support
|
||||
#define TEST_CONTROLLER_HOST_START_INDEX \
|
||||
( ((CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)) ? 1 : 0)
|
||||
( ((CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)) ? 1 : 0)
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE CONFIGURATION
|
||||
|
@ -43,9 +43,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup Group_ClassDriver Class Driver
|
||||
* \addtogroup ClassDriver Class Driver
|
||||
* @{
|
||||
* \defgroup Group_CDC Communication Device Class
|
||||
* \defgroup ClassDriver_CDC Communication Device Class
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -37,9 +37,9 @@
|
||||
/**************************************************************************/
|
||||
|
||||
/**
|
||||
* \addtogroup Group_ClassDriver Class Driver
|
||||
* \addtogroup ClassDriver Class Driver
|
||||
* @{
|
||||
* \defgroup Group_HID Human Interface Device
|
||||
* \defgroup ClassDriver_HID Human Interface Device (HID)
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
@ -111,9 +111,9 @@ bool tusbh_hid_keyboard_is_mounted(uint8_t dev_addr)
|
||||
return tusbh_device_is_configured(dev_addr) && pipehandle_is_valid(keyboardh_data[dev_addr-1].pipe_hdl);
|
||||
}
|
||||
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void* report)
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void* p_report)
|
||||
{
|
||||
return hidh_interface_get_report(dev_addr, report, &keyboardh_data[dev_addr-1]);
|
||||
return hidh_interface_get_report(dev_addr, p_report, &keyboardh_data[dev_addr-1]);
|
||||
}
|
||||
|
||||
bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr)
|
||||
|
@ -36,12 +36,8 @@
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
/** \ingroup TBD
|
||||
* \defgroup TBD
|
||||
* \brief TBD
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
/** \addtogroup ClassDriver_HID
|
||||
* @{ */
|
||||
|
||||
#ifndef _TUSB_HID_HOST_H_
|
||||
#define _TUSB_HID_HOST_H_
|
||||
@ -54,43 +50,141 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** \defgroup hid_keyboard Keyboard
|
||||
* The interface API includes status checking function, data transferring function and callback functions
|
||||
* @{ */
|
||||
//--------------------------------------------------------------------+
|
||||
// KEYBOARD Application API
|
||||
//--------------------------------------------------------------------+
|
||||
extern uint8_t const hid_keycode_to_ascii_tbl[2][128]; // TODO used weak attr if build failed without KEYBOARD enabled
|
||||
|
||||
/** \brief Check if device supports Keyboard interface or not
|
||||
* \param[in] dev_addr device address
|
||||
* \retval true if device supports Keyboard interface
|
||||
* \retval false if device does not support Keyboard interface or is not mounted
|
||||
*/
|
||||
bool tusbh_hid_keyboard_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/** \brief Check if the interface is currently busy or not
|
||||
* \param[in] dev_addr device address
|
||||
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to device
|
||||
* \retval false if the interface is not busy meaning the stack successfully transferred data from/to device
|
||||
* \note This function is primarily used for polling/waiting result after \ref tusbh_hid_keyboard_get_report.
|
||||
* Alternatively, asynchronous event API can be used
|
||||
*/
|
||||
bool tusbh_hid_keyboard_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void * report) /*ATTR_WARN_UNUSED_RESULT*/;
|
||||
|
||||
/** \brief Perform a get report from Keyboard interface
|
||||
* \param[in] dev_addr device address
|
||||
* \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref TUSB_CFG_ATTR_USBRAM)
|
||||
* \returns \ref tusb_error_t type to indicate success or error condition.
|
||||
* \retval TUSB_ERROR_NONE on success
|
||||
* \retval TUSB_ERROR_INTERFACE_IS_BUSY if the interface is already transferring data with device
|
||||
* \retval TUSB_ERROR_DEVICE_NOT_READY if device is not yet configured (by SET CONFIGURED request)
|
||||
* \retval TUSB_ERROR_INVALID_PARA if inputs parameter are not correct
|
||||
* \note This function is non-blocking and returns immediately. The result of usb transfer will be reported by the interface's callback function
|
||||
*/
|
||||
tusb_error_t tusbh_hid_keyboard_get_report(uint8_t dev_addr, void * p_report) /*ATTR_WARN_UNUSED_RESULT*/;
|
||||
|
||||
//------------- Application Callback -------------//
|
||||
/** \brief Callback function that is invoked when an transferring event occurred
|
||||
* \param[in] dev_addr Address of device
|
||||
* \param[in] event an value from \ref tusb_event_t
|
||||
* \note event can be one of following
|
||||
* - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
|
||||
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
|
||||
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
|
||||
* \note Application should schedule the next report by calling \ref tusbh_hid_keyboard_get_report within this callback
|
||||
*/
|
||||
void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event);
|
||||
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr);
|
||||
void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
|
||||
|
||||
/** \brief Callback function that will be invoked when a device with Keyboard interface is mounted
|
||||
* \param[in] dev_addr Address of newly mounted device
|
||||
* \note This callback should be used by Application to set-up interface-related data
|
||||
*/
|
||||
void tusbh_hid_keyboard_mounted_cb(uint8_t dev_addr);
|
||||
|
||||
/** \brief Callback function that will be invoked when a device with Keyboard interface is unmounted
|
||||
* \param[in] dev_addr Address of newly unmounted device
|
||||
* \note This callback should be used by Application to tear-down interface-related data
|
||||
*/
|
||||
void tusbh_hid_keyboard_unmounted_cb(uint8_t dev_addr);
|
||||
/** @} */
|
||||
|
||||
/** \defgroup hid_mouse Mouse
|
||||
* The interface API includes status checking function, data transferring function and callback functions
|
||||
* @{ */
|
||||
//--------------------------------------------------------------------+
|
||||
// MOUSE Application API
|
||||
//--------------------------------------------------------------------+
|
||||
/** \brief Check if device supports Mouse interface or not
|
||||
* \param[in] dev_addr device address
|
||||
* \retval true if device supports Mouse interface
|
||||
* \retval false if device does not support Mouse interface or is not mounted
|
||||
*/
|
||||
bool tusbh_hid_mouse_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/** \brief Check if the interface is currently busy or not
|
||||
* \param[in] dev_addr device address
|
||||
* \retval true if the interface is busy meaning the stack is still transferring/waiting data from/to device
|
||||
* \retval false if the interface is not busy meaning the stack successfully transferred data from/to device
|
||||
* \note This function is primarily used for polling/waiting result after \ref tusbh_hid_mouse_get_report.
|
||||
* Alternatively, asynchronous event API can be used
|
||||
*/
|
||||
bool tusbh_hid_mouse_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void* report) /*ATTR_WARN_UNUSED_RESULT*/;
|
||||
|
||||
/** \brief Perform a get report from Mouse interface
|
||||
* \param[in] dev_addr device address
|
||||
* \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref TUSB_CFG_ATTR_USBRAM)
|
||||
* \returns \ref tusb_error_t type to indicate success or error condition.
|
||||
* \retval TUSB_ERROR_NONE on success
|
||||
* \retval TUSB_ERROR_INTERFACE_IS_BUSY if the interface is already transferring data with device
|
||||
* \retval TUSB_ERROR_DEVICE_NOT_READY if device is not yet configured (by SET CONFIGURED request)
|
||||
* \retval TUSB_ERROR_INVALID_PARA if inputs parameter are not correct
|
||||
* \note This function is non-blocking and returns immediately. The result of usb transfer will be reported by the interface's callback function
|
||||
*/
|
||||
tusb_error_t tusbh_hid_mouse_get_report(uint8_t dev_addr, void* p_report) /*ATTR_WARN_UNUSED_RESULT*/;
|
||||
|
||||
//------------- Application Callback -------------//
|
||||
/** \brief Callback function that is invoked when an transferring event occurred
|
||||
* \param[in] dev_addr Address of device
|
||||
* \param[in] event an value from \ref tusb_event_t
|
||||
* \note event can be one of following
|
||||
* - TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
|
||||
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
|
||||
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
|
||||
* \note Application should schedule the next report by calling \ref tusbh_hid_mouse_get_report within this callback
|
||||
*/
|
||||
void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event);
|
||||
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr);
|
||||
void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr);
|
||||
|
||||
/** \brief Callback function that will be invoked when a device with Mouse interface is mounted
|
||||
* \param[in] dev_addr Address of newly mounted device
|
||||
* \note This callback should be used by Application to set-up interface-related data
|
||||
*/
|
||||
void tusbh_hid_mouse_mounted_cb(uint8_t dev_addr);
|
||||
|
||||
/** \brief Callback function that will be invoked when a device with Mouse interface is unmounted
|
||||
* \param[in] dev_addr Address of newly unmounted device
|
||||
* \note This callback should be used by Application to tear-down interface-related data
|
||||
*/
|
||||
void tusbh_hid_mouse_unmounted_cb(uint8_t dev_addr);
|
||||
/** @} */
|
||||
|
||||
/** \defgroup hid_generic Generic (not supported yet)
|
||||
* The interface API includes status checking function, data transferring function and callback functions
|
||||
* @{ */
|
||||
//--------------------------------------------------------------------+
|
||||
// GENERIC Application API
|
||||
//--------------------------------------------------------------------+
|
||||
bool tusbh_hid_generic_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_generic_get_report(uint8_t dev_addr, void* report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_generic_set_report(uint8_t dev_addr, void* report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_generic_get_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_hid_generic_set_report(uint8_t dev_addr, void* p_report, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_hid_generic_get_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_hid_generic_set_status(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
//------------- Application Callback -------------//
|
||||
void tusbh_hid_generic_isr(uint8_t dev_addr, tusb_event_t event);
|
||||
/** @} */
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USBH-CLASS DRIVER API
|
||||
|
39
tinyusb/doxygen/configuration.h
Normal file
39
tinyusb/doxygen/configuration.h
Normal file
@ -0,0 +1,39 @@
|
||||
/** \addtogroup group_configuration
|
||||
* @{ */
|
||||
|
||||
/**
|
||||
USB controller in MCU often has limited access to specific RAM section. The Stack will use this macro to place internal variables
|
||||
into the USB RAM section as follows. if your mcu's usb controller has no such limit, define TUSB_CFG_ATTR_USBRAM as empty macro.
|
||||
|
||||
@code
|
||||
uint8_t tinyusb_data[10] TUSB_CFG_ATTR_USBRAM;
|
||||
@endcode
|
||||
*/
|
||||
#define TUSB_CFG_ATTR_USBRAM
|
||||
|
||||
|
||||
/** \defgroup TUSB_CFG_HOST Host
|
||||
* @{ */
|
||||
|
||||
/// Maximum number of device host stack can manage
|
||||
/// - If hub class is not enabled, set this equal to number of controllers in host mode
|
||||
/// - if hub class is enabled, make sure hub is also counted
|
||||
#define TUSB_CFG_HOST_DEVICE_MAX
|
||||
|
||||
/// Buffer size used for getting device configuration descriptor. You may want to increase this from default
|
||||
/// to support lengthy composite device especially with Audio or Video class
|
||||
#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE
|
||||
|
||||
#define TUSB_CFG_HOST_HUB ///< Enable Hub Class
|
||||
#define TUSB_CFG_HOST_HID_KEYBOARD ///< Enable HID Class for Keyboard
|
||||
#define TUSB_CFG_HOST_HID_MOUSE ///< Enable HID Class for Mouse
|
||||
#define TUSB_CFG_HOST_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
|
||||
#define TUSB_CFG_HOST_MSC ///< Enable Mass Storage Class (SCSI subclass only)
|
||||
#define TUSB_CFG_HOST_CDC ///< Enable Virtual Serial (Communication Device Class)
|
||||
#define TUSB_CFG_HOST_CDC_RNDIS ///< Enable Remote Network Device (require TUSB_CFG_HOST_CDC to be enabled)
|
||||
|
||||
/** @} */ // group Host
|
||||
|
||||
|
||||
|
||||
/** @} */
|
@ -1,3 +0,0 @@
|
||||
# What is tinyUSB
|
||||
|
||||

|
@ -57,7 +57,7 @@ enum {
|
||||
tusb_error_t hal_init(void)
|
||||
{
|
||||
//------------- USB0 Clock -------------//
|
||||
#if TUSB_CFG_CONTROLLER0_MODE
|
||||
#if TUSB_CFG_CONTROLLER_0_MODE
|
||||
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE); /* Disable PLL first */
|
||||
ASSERT_INT( CGU_ERROR_SUCCESS, CGU_SetPLL0(), TUSB_ERROR_FAILED); /* the usb core require output clock = 480MHz */
|
||||
CGU_EntityConnect(CGU_CLKSRC_XTAL_OSC, CGU_CLKSRC_PLL0);
|
||||
@ -65,7 +65,7 @@ tusb_error_t hal_init(void)
|
||||
LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
|
||||
|
||||
// reset controller & set role
|
||||
#if TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST
|
||||
#if TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST
|
||||
hcd_controller_reset(0); // TODO where to place prototype
|
||||
LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
|
||||
#else // TODO OTG
|
||||
@ -80,16 +80,16 @@ tusb_error_t hal_init(void)
|
||||
#endif
|
||||
|
||||
//------------- USB1 Clock, only use on-chip FS PHY -------------//
|
||||
#if TUSB_CFG_CONTROLLER1_MODE
|
||||
#if TUSB_CFG_CONTROLLER_1_MODE
|
||||
// TODO confirm whether device mode require P2_5 or not
|
||||
scu_pinmux(0x2, 5, MD_PLN | MD_EZI | MD_ZI, FUNC2); // USB1_VBUS monitor presence, must be high for bus reset occur
|
||||
|
||||
/* connect CLK_USB1 to 60 MHz clock */
|
||||
CGU_EntityConnect(CGU_CLKSRC_PLL1, CGU_BASE_USB1); /* FIXME Run base BASE_USB1_CLK clock from PLL1 (assume PLL1 is 60 MHz, no division required) */
|
||||
//LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
|
||||
LPC_SCU->SFSUSB = (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY
|
||||
LPC_SCU->SFSUSB = (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY
|
||||
|
||||
#if TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST
|
||||
#if TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST
|
||||
hcd_controller_reset(1); // TODO where to place prototype
|
||||
LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
|
||||
#else // TODO OTG
|
||||
@ -106,14 +106,14 @@ tusb_error_t hal_init(void)
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
#if TUSB_CFG_CONTROLLER0_MODE
|
||||
#if TUSB_CFG_CONTROLLER_0_MODE
|
||||
void USB0_IRQHandler(void)
|
||||
{
|
||||
tusb_isr(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_CONTROLLER1_MODE
|
||||
#if TUSB_CFG_CONTROLLER_1_MODE
|
||||
void USB1_IRQHandler(void)
|
||||
{
|
||||
tusb_isr(1);
|
||||
|
@ -61,7 +61,7 @@ STATIC_VAR ehci_data_t ehci_data TUSB_CFG_ATTR_USBRAM;
|
||||
|
||||
#if EHCI_PERIODIC_LIST
|
||||
|
||||
#if (TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
|
||||
ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE] TUSB_CFG_ATTR_USBRAM;
|
||||
|
||||
#ifndef __ICCARM__ // IAR cannot able to determine the alignment with datalignment pragma
|
||||
@ -69,7 +69,7 @@ STATIC_VAR ehci_data_t ehci_data TUSB_CFG_ATTR_USBRAM;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
|
||||
STATIC_VAR ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE] ATTR_ALIGNED(4096) TUSB_CFG_ATTR_USBRAM;
|
||||
|
||||
#ifndef __ICCARM__ // IAR cannot able to determine the alignment with datalignment pragma
|
||||
@ -133,11 +133,11 @@ tusb_error_t hcd_init(void)
|
||||
//------------- Data Structure init -------------//
|
||||
memclr_(&ehci_data, sizeof(ehci_data_t));
|
||||
|
||||
#if (TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
|
||||
ASSERT_STATUS (hcd_controller_init(0));
|
||||
#endif
|
||||
|
||||
#if (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
|
||||
ASSERT_STATUS (hcd_controller_init(1));
|
||||
#endif
|
||||
|
||||
@ -824,12 +824,12 @@ STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid)
|
||||
{
|
||||
switch(hostid)
|
||||
{
|
||||
#if (TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
|
||||
case 0:
|
||||
return period_frame_list0;
|
||||
#endif
|
||||
|
||||
#if (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)
|
||||
#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
|
||||
case 1:
|
||||
return period_frame_list1;
|
||||
#endif
|
||||
@ -841,7 +841,7 @@ STATIC_ INLINE_ ehci_link_t* get_period_frame_list(uint8_t hostid)
|
||||
|
||||
STATIC_ INLINE_ uint8_t hostid_to_data_idx(uint8_t hostid)
|
||||
{
|
||||
#if (CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST)
|
||||
#if (CONTROLLER_HOST_NUMBER == 1) && (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
|
||||
(void) hostid;
|
||||
return 0;
|
||||
#else
|
||||
|
@ -85,7 +85,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// Validation
|
||||
//--------------------------------------------------------------------+
|
||||
#if (CAP_CONTROLLER_NUMBER == 1) && ( defined TUSB_CFG_CONTROLLER1_MODE)
|
||||
#if (CAP_CONTROLLER_NUMBER == 1) && ( defined TUSB_CFG_CONTROLLER_1_MODE)
|
||||
#error current MCU does not have the required number of controllers
|
||||
#endif
|
||||
|
||||
|
@ -58,11 +58,16 @@
|
||||
|
||||
#include "tusb_option.h"
|
||||
|
||||
#define TUSB_OS_NONE 1
|
||||
#define TUSB_OS_FREERTOS 2
|
||||
#define TUSB_OS_CMSIS_RTX 3
|
||||
#define TUSB_OS_UCOS2 4
|
||||
#define TUSB_OS_UCOS3 5
|
||||
/** \ingroup group_configuration
|
||||
* \defgroup TUSB_OS RTOS Integration Selection
|
||||
* \brief TUSB_CFG_OS must be defined to one of these
|
||||
* @{ */
|
||||
#define TUSB_OS_NONE 1 ///< No RTOS is used
|
||||
#define TUSB_OS_FREERTOS 2 ///< FreeRTOS is used
|
||||
#define TUSB_OS_CMSIS_RTX 3 ///< CMSIS RTX is used
|
||||
#define TUSB_OS_UCOS2 4 ///< MicroC OS II is used (not supported yet)
|
||||
#define TUSB_OS_UCOS3 5 ///< MicroC OS III is used (not supported yet)
|
||||
/** @} */
|
||||
|
||||
#ifndef _TEST_
|
||||
|
||||
|
@ -36,34 +36,30 @@
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
/** \file
|
||||
* \brief Configure File
|
||||
*
|
||||
* \note TBD
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup Group_TinyUSB_Configure Configuration tusb_option.h
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _TUSB_TUSB_OPTION_H_
|
||||
#define _TUSB_TUSB_OPTION_H_
|
||||
|
||||
/** \defgroup group_configuration Configuration tusb_config.h
|
||||
* @{ */
|
||||
|
||||
#define TUSB_VERSION_YEAR 00
|
||||
#define TUSB_VERSION_MONTH 00
|
||||
#define TUSB_VERSION_WEEK 0
|
||||
#define TUSB_VERSION_NAME "alpha"
|
||||
#define TUSB_VERSION XSTRING_(TUSB_VERSION_YEAR) "." XSTRING_(TUSB_VERSION_MONTH)
|
||||
|
||||
#define MCU_LPC13UXX 1
|
||||
#define MCU_LPC11UXX 2
|
||||
#define MCU_LPC43XX 3
|
||||
#define MCU_LPC18XX 4
|
||||
#define MCU_LPC175X_6X 5
|
||||
#define MCU_LPC177X_8X 6
|
||||
/** \defgroup MCU_ MCU Selection
|
||||
* \brief TUSB_CFG_MCU must be defined to one of these
|
||||
* @{ */
|
||||
#define MCU_LPC13XX_12ADC 1 ///< NXP LPC13xx 12 bit ADC family with USB on-chip Rom Driver (not supported yet)
|
||||
#define MCU_LPC13XX_10ADC 2 ///< NXP LPC13xx 10 bit ADC family (not supported yet)
|
||||
#define MCU_LPC11UXX 3 ///< NXP LPC11Uxx family (not supported yet)
|
||||
#define MCU_LPC43XX 4 ///< NXP LPC43xx family
|
||||
#define MCU_LPC18XX 5 ///< NXP LPC18xx family (not supported yet)
|
||||
#define MCU_LPC175X_6X 6 ///< NXP LPC175x, LPC176x family (not supported yet)
|
||||
#define MCU_LPC177X_8X 7 ///< NXP LPC177x, LPC178x family (not supported yet)
|
||||
/** @} */
|
||||
|
||||
/// define this symbol will make tinyusb look for external configure file
|
||||
#include "mcu_capacity.h"
|
||||
|
||||
#ifdef TUSB_CFG_CONFIG_FILE
|
||||
@ -75,40 +71,44 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// CONTROLLER
|
||||
//--------------------------------------------------------------------+
|
||||
#define TUSB_MODE_HOST 0x02
|
||||
#define TUSB_MODE_DEVICE 0x01
|
||||
#define TUSB_MODE_NONE 0x00
|
||||
/** \defgroup TUSB_MODE Host/Device Mode Selection
|
||||
* \brief TUSB_CFG_CONTROLLER_N_MODE must be defined with these
|
||||
* @{ */
|
||||
#define TUSB_MODE_HOST 0x02 ///< Host Mode
|
||||
#define TUSB_MODE_DEVICE 0x01 ///< Device Mode
|
||||
#define TUSB_MODE_NONE 0x00 ///< Disabled
|
||||
/** @} */
|
||||
|
||||
#define CONTROLLER_HOST_NUMBER (\
|
||||
((TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \
|
||||
((TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_HOST) ? 1 : 0))
|
||||
((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \
|
||||
((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 1 : 0))
|
||||
|
||||
#define CONTROLLER_DEVICE_NUMBER (\
|
||||
((TUSB_CFG_CONTROLLER0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \
|
||||
((TUSB_CFG_CONTROLLER1_MODE & TUSB_MODE_DEVICE) ? 1 : 0))
|
||||
((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \
|
||||
((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE) ? 1 : 0))
|
||||
|
||||
#define MODE_HOST_SUPPORTED (CONTROLLER_HOST_NUMBER > 0)
|
||||
#define MODE_DEVICE_SUPPORTED (CONTROLLER_DEVICE_NUMBER > 0)
|
||||
|
||||
#if !MODE_HOST_SUPPORTED && !MODE_DEVICE_SUPPORTED
|
||||
#error please configure at least 1 TUSB_CFG_CONTROLLERn_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE
|
||||
#error please configure at least 1 TUSB_CFG_CONTROLLER_N_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// COMMON OPTIONS
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// level 3: ATTR_ALWAYS_INLINE is null, ASSERT has text, Error has its String, STATIC_VAR is NULL
|
||||
// level 2: ATTR_ALWAYS_INLINE is attribute, ASSERT has no text, Error has no strings
|
||||
/// 0: no debug information 3: most debug information provided
|
||||
/**
|
||||
determines the debug level for the stack
|
||||
- Level 3: ATTR_ALWAYS_INLINE is null, ASSERT has text, Error has its String, STATIC_VAR is NULL
|
||||
- Level 2: ATTR_ALWAYS_INLINE is attribute, ASSERT has no text, Error has no strings
|
||||
- Level 1: TBD
|
||||
- Level 0: no debug information is generated
|
||||
*/
|
||||
#ifndef TUSB_CFG_DEBUG
|
||||
#define TUSB_CFG_DEBUG 2
|
||||
#warning TUSB_CFG_DEBUG is not defined, default value is 3
|
||||
#endif
|
||||
|
||||
/// USB RAM Section Placement, MCU's usb controller often has limited access to specific RAM region. This will be used to declare internal variables as follow:
|
||||
/// uint8_t tinyusb_data[10] TUSB_CFG_ATTR_USBRAM;
|
||||
/// if your mcu's usb controller has no such limit, define TUSB_CFG_ATTR_USBRAM as empty macro.
|
||||
#ifndef TUSB_CFG_ATTR_USBRAM
|
||||
#error TUSB_CFG_ATTR_USBRAM is not defined, please help me know how to place data in accessible RAM for usb controller
|
||||
#endif
|
||||
@ -123,6 +123,9 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Maximum number of supported USB's configuration (currently only support only 1)
|
||||
*/
|
||||
#ifndef TUSB_CFG_CONFIGURATION_MAX
|
||||
#define TUSB_CFG_CONFIGURATION_MAX 1
|
||||
#warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
|
||||
@ -154,7 +157,7 @@
|
||||
#endif
|
||||
|
||||
//------------- CLASS -------------//
|
||||
#endif // end TUSB_CFG_HOST
|
||||
#endif // MODE_HOST_SUPPORTED
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// DEVICE OPTIONS
|
||||
@ -168,7 +171,7 @@
|
||||
#define DEVICE_CLASS_HID ( TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + TUSB_CFG_DEVICE_HID_GENERIC )
|
||||
|
||||
|
||||
#endif
|
||||
#endif // MODE_DEVICE_SUPPORTED
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user