rename CFG_TUSB_DEVICE_* to CFG_TUD_*

This commit is contained in:
hathach
2018-04-12 13:23:52 +07:00
parent 3d31f92106
commit 4b660175be
40 changed files with 113 additions and 113 deletions

View File

@@ -56,7 +56,7 @@
/** \defgroup CFG_TUSB_DEVICE Device Options /** \defgroup CFG_TUSB_DEVICE Device Options
* @{ */ * @{ */
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE ///< Max packet size of Cotnrol Endpoint, default is 64 #define CFG_TUD_ENDOINT0_SIZE ///< Max packet size of Cotnrol Endpoint, default is 64
/// Application MUST define this variable and initialize its pointers's member to all required USB descriptors including /// Application MUST define this variable and initialize its pointers's member to all required USB descriptors including
/// Device Descriptor, Configuration Descriptor, String Descriptors, HID Report Descriptors etc ... /// Device Descriptor, Configuration Descriptor, String Descriptors, HID Report Descriptors etc ...
@@ -65,11 +65,11 @@ tusbd_descriptor_pointer_t tusbd_descriptor_pointers;
/** \defgroup config_device_class Class Driver /** \defgroup config_device_class Class Driver
* \brief For each Class Driver a value of 1 means enable, value of 0 mean disable * \brief For each Class Driver a value of 1 means enable, value of 0 mean disable
* @{ */ * @{ */
#define CFG_TUSB_DEVICE_HID_KEYBOARD ///< Enable HID Class for Keyboard #define CFG_TUD_HID_KEYBOARD ///< Enable HID Class for Keyboard
#define CFG_TUSB_DEVICE_HID_MOUSE ///< Enable HID Class for Mouse #define CFG_TUD_HID_MOUSE ///< Enable HID Class for Mouse
#define CFG_TUSB_DEVICE_HID_GENERIC ///< Enable HID Class for Generic (not supported yet) #define CFG_TUD_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
#define CFG_TUSB_DEVICE_MSC ///< Enable Mass Storage Class (SCSI subclass only) #define CFG_TUD_MSC ///< Enable Mass Storage Class (SCSI subclass only)
#define CFG_TUSB_DEVICE_CDC ///< Enable Virtual Serial (Communication Device Class) #define CFG_TUD_CDC ///< Enable Virtual Serial (Communication Device Class)
/** @} */ /** @} */
/** @} */ // group Device /** @} */ // group Device

View File

@@ -147,8 +147,8 @@ void print_greeting(void)
puts("This DEVICE demo is configured to support:"); puts("This DEVICE demo is configured to support:");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]); printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
if (CFG_TUSB_DEVICE_HID_MOUSE ) puts(" - HID Mouse"); if (CFG_TUD_HID_MOUSE ) puts(" - HID Mouse");
if (CFG_TUSB_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard"); if (CFG_TUD_HID_KEYBOARD ) puts(" - HID Keyboard");
if (CFG_TUSB_DEVICE_MSC ) puts(" - Mass Storage"); if (CFG_TUD_MSC ) puts(" - Mass Storage");
if (CFG_TUSB_DEVICE_CDC ) puts(" - Communication Device Class"); if (CFG_TUD_CDC ) puts(" - Communication Device Class");
} }

View File

@@ -54,14 +54,14 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0 #define CFG_TUD_HID_KEYBOARD 0
#define CFG_TUSB_DEVICE_HID_MOUSE 0 #define CFG_TUD_HID_MOUSE 0
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet #define CFG_TUD_HID_GENERIC 0 // not supported yet
#define CFG_TUSB_DEVICE_MSC 0 #define CFG_TUD_MSC 0
#define CFG_TUSB_DEVICE_CDC 1 #define CFG_TUD_CDC 1
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON CONFIGURATION // COMMON CONFIGURATION

View File

@@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device =
.bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD, .bDeviceProtocol = MISC_PROTOCOL_IAD,
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE, .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE,
.idVendor = CFG_VENDORID, .idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID, .idProduct = CFG_PRODUCTID,

View File

@@ -50,7 +50,7 @@
// each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug. // each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug.
// Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB) // Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB)
#ifndef CFG_PRODUCTID #ifndef CFG_PRODUCTID
#define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) ) #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUD_##interface) << (n) )
#define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \ #define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \ PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \
PRODUCTID_BITMAP(MSC, 4) ) ) PRODUCTID_BITMAP(MSC, 4) ) )

View File

@@ -145,8 +145,8 @@ void print_greeting(void)
printf("This DEVICE demo is configured to support:"); printf("This DEVICE demo is configured to support:");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]); printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
if (CFG_TUSB_DEVICE_HID_MOUSE ) puts(" - HID Mouse"); if (CFG_TUD_HID_MOUSE ) puts(" - HID Mouse");
if (CFG_TUSB_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard"); if (CFG_TUD_HID_KEYBOARD ) puts(" - HID Keyboard");
if (CFG_TUSB_DEVICE_MSC ) puts(" - Mass Storage"); if (CFG_TUD_MSC ) puts(" - Mass Storage");
if (CFG_TUSB_DEVICE_CDC ) puts(" - Communication Device Class"); if (CFG_TUD_CDC ) puts(" - Communication Device Class");
} }

View File

@@ -38,7 +38,7 @@
#include "msc_device_app.h" #include "msc_device_app.h"
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -50,7 +50,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
enum enum
{ {

View File

@@ -38,7 +38,7 @@
#include "msc_device_app.h" #include "msc_device_app.h"
#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_RAMDISK) #if CFG_TUD_MSC && defined (MSCD_APP_RAMDISK)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF // MACRO CONSTANT TYPEDEF

View File

@@ -54,14 +54,14 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUSB_DEVICE_HID_KEYBOARD 0 #define CFG_TUD_HID_KEYBOARD 0
#define CFG_TUSB_DEVICE_HID_MOUSE 0 #define CFG_TUD_HID_MOUSE 0
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet #define CFG_TUD_HID_GENERIC 0 // not supported yet
#define CFG_TUSB_DEVICE_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUSB_DEVICE_CDC 1 #define CFG_TUD_CDC 1
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON CONFIGURATION // COMMON CONFIGURATION

View File

@@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device =
.bDeviceSubClass = MISC_SUBCLASS_COMMON, .bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD, .bDeviceProtocol = MISC_PROTOCOL_IAD,
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE, .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE,
.idVendor = CFG_VENDORID, .idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID, .idProduct = CFG_PRODUCTID,

View File

@@ -50,7 +50,7 @@
// each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug. // each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug.
// Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB) // Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB)
#ifndef CFG_PRODUCTID #ifndef CFG_PRODUCTID
#define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) ) #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUD_##interface) << (n) )
#define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \ #define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \ PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \
PRODUCTID_BITMAP(MSC, 4) ) ) PRODUCTID_BITMAP(MSC, 4) ) )

View File

@@ -38,7 +38,7 @@
#include "cdc_device_app.h" #include "cdc_device_app.h"
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
#include "common/tusb_fifo.h" // TODO refractor #include "common/tusb_fifo.h" // TODO refractor
#include "app_os_prio.h" #include "app_os_prio.h"

View File

@@ -53,7 +53,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
void cdc_serial_app_init(void); void cdc_serial_app_init(void);
void cdc_serial_app_task(void* param); void cdc_serial_app_task(void* param);

View File

@@ -38,7 +38,7 @@
#include "keyboard_device_app.h" #include "keyboard_device_app.h"
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -53,7 +53,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
void keyboard_app_init(void); void keyboard_app_init(void);
void keyboard_app_task(void* param); void keyboard_app_task(void* param);

View File

@@ -194,8 +194,8 @@ void print_greeting(void)
puts("This DEVICE demo is configured to support:"); puts("This DEVICE demo is configured to support:");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]); printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
if (CFG_TUSB_DEVICE_HID_MOUSE ) puts(" - HID Mouse"); if (CFG_TUD_HID_MOUSE ) puts(" - HID Mouse");
if (CFG_TUSB_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard"); if (CFG_TUD_HID_KEYBOARD ) puts(" - HID Keyboard");
if (CFG_TUSB_DEVICE_MSC ) puts(" - Mass Storage"); if (CFG_TUD_MSC ) puts(" - Mass Storage");
if (CFG_TUSB_DEVICE_CDC ) puts(" - Communication Device Class"); if (CFG_TUD_CDC ) puts(" - Communication Device Class");
} }

View File

@@ -38,7 +38,7 @@
#include "mouse_device_app.h" #include "mouse_device_app.h"
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -53,7 +53,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
void mouse_app_init(void); void mouse_app_init(void);
void mouse_app_task(void * param); void mouse_app_task(void * param);

View File

@@ -38,7 +38,7 @@
#include "msc_device_app.h" #include "msc_device_app.h"
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -50,7 +50,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
enum enum
{ {

View File

@@ -38,7 +38,7 @@
#include "msc_device_app.h" #include "msc_device_app.h"
#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_RAMDISK) #if CFG_TUD_MSC && defined (MSCD_APP_RAMDISK)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF // MACRO CONSTANT TYPEDEF

View File

@@ -38,7 +38,7 @@
#include "msc_device_app.h" #include "msc_device_app.h"
#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_ROMDISK) #if CFG_TUD_MSC && defined (MSCD_APP_ROMDISK)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// INCLUDE // INCLUDE

View File

@@ -54,14 +54,14 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1 #define CFG_TUD_HID_KEYBOARD 1
#define CFG_TUSB_DEVICE_HID_MOUSE 1 #define CFG_TUD_HID_MOUSE 1
#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet #define CFG_TUD_HID_GENERIC 0 // not supported yet
#define CFG_TUSB_DEVICE_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUSB_DEVICE_CDC 1 #define CFG_TUD_CDC 1
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON CONFIGURATION // COMMON CONFIGURATION

View File

@@ -41,7 +41,7 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Keyboard Report Descriptor // Keyboard Report Descriptor
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
uint8_t const desc_keyboard_report[] = { uint8_t const desc_keyboard_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ), HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ), HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
@@ -87,7 +87,7 @@ uint8_t const desc_keyboard_report[] = {
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Mouse Report Descriptor // Mouse Report Descriptor
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
uint8_t const desc_mouse_report[] = { uint8_t const desc_mouse_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ), HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ), HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
@@ -140,7 +140,7 @@ tusb_desc_device_t const desc_device =
.bLength = sizeof(tusb_desc_device_t), .bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE, .bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200, .bcdUSB = 0x0200,
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
// Use Interface Association Descriptor (IAD) for CDC // Use Interface Association Descriptor (IAD) for CDC
// As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1) // As required by USB Specs IAD's subclass must be common class (2) and protocol must be IAD (1)
.bDeviceClass = TUSB_CLASS_MISC, .bDeviceClass = TUSB_CLASS_MISC,
@@ -152,7 +152,7 @@ tusb_desc_device_t const desc_device =
.bDeviceProtocol = 0x00, .bDeviceProtocol = 0x00,
#endif #endif
.bMaxPacketSize0 = CFG_TUSB_DEVICE_ENDOINT0_SIZE, .bMaxPacketSize0 = CFG_TUD_ENDOINT0_SIZE,
.idVendor = CFG_VENDORID, .idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID, .idProduct = CFG_PRODUCTID,
@@ -184,7 +184,7 @@ app_descriptor_configuration_t const desc_configuration =
.bMaxPower = TUSB_DESC_CONFIG_POWER_MA(500) .bMaxPower = TUSB_DESC_CONFIG_POWER_MA(500)
}, },
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
// IAD points to CDC Interfaces // IAD points to CDC Interfaces
.cdc_iad = .cdc_iad =
{ {
@@ -296,7 +296,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif #endif
//------------- HID Keyboard -------------// //------------- HID Keyboard -------------//
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
.keyboard_interface = .keyboard_interface =
{ {
.bLength = sizeof(tusb_desc_interface_t), .bLength = sizeof(tusb_desc_interface_t),
@@ -333,7 +333,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif #endif
//------------- HID Mouse -------------// //------------- HID Mouse -------------//
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
.mouse_interface = .mouse_interface =
{ {
.bLength = sizeof(tusb_desc_interface_t), .bLength = sizeof(tusb_desc_interface_t),
@@ -370,7 +370,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif #endif
//------------- Mass Storage -------------// //------------- Mass Storage -------------//
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
.msc_interface = .msc_interface =
{ {
.bLength = sizeof(tusb_desc_interface_t), .bLength = sizeof(tusb_desc_interface_t),
@@ -465,11 +465,11 @@ tusbd_descriptor_pointer_t tusbd_descriptor_pointers =
.p_configuration = (uint8_t const * ) &desc_configuration, .p_configuration = (uint8_t const * ) &desc_configuration,
.p_string_arr = (uint8_t const **) string_descriptor_arr, .p_string_arr = (uint8_t const **) string_descriptor_arr,
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
.p_hid_keyboard_report = (uint8_t const *) desc_keyboard_report, .p_hid_keyboard_report = (uint8_t const *) desc_keyboard_report,
#endif #endif
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
.p_hid_mouse_report = (uint8_t const *) desc_mouse_report, .p_hid_mouse_report = (uint8_t const *) desc_mouse_report,
#endif #endif
}; };

View File

@@ -50,20 +50,20 @@
// each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug. // each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug.
// Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB) // Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB)
#ifndef CFG_PRODUCTID #ifndef CFG_PRODUCTID
#define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) ) #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUD_##interface) << (n) )
#define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \ #define CFG_PRODUCTID (0x4000 | ( PRODUCTID_BITMAP(CDC, 0) | PRODUCTID_BITMAP(HID_KEYBOARD, 1) | \
PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \ PRODUCTID_BITMAP(HID_MOUSE, 2) | PRODUCTID_BITMAP(HID_GENERIC, 3) | \
PRODUCTID_BITMAP(MSC, 4) ) ) PRODUCTID_BITMAP(MSC, 4) ) )
#endif #endif
#define ITF_NUM_CDC 0 #define ITF_NUM_CDC 0
#define INTERFACE_NO_HID_KEYBOARD (ITF_NUM_CDC + 2*(CFG_TUSB_DEVICE_CDC ? 1 : 0) ) #define INTERFACE_NO_HID_KEYBOARD (ITF_NUM_CDC + 2*(CFG_TUD_CDC ? 1 : 0) )
#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_KEYBOARD ) #define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + CFG_TUD_HID_KEYBOARD )
#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + CFG_TUSB_DEVICE_HID_MOUSE ) #define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + CFG_TUD_HID_MOUSE )
#define ITF_NUM_MSC (INTERFACE_NO_HID_GENERIC + CFG_TUSB_DEVICE_HID_GENERIC ) #define ITF_NUM_MSC (INTERFACE_NO_HID_GENERIC + CFG_TUD_HID_GENERIC )
#define ITF_TOTAL (2*CFG_TUSB_DEVICE_CDC + CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + \ #define ITF_TOTAL (2*CFG_TUD_CDC + CFG_TUD_HID_KEYBOARD + CFG_TUD_HID_MOUSE + \
CFG_TUSB_DEVICE_HID_GENERIC + CFG_TUSB_DEVICE_MSC) CFG_TUD_HID_GENERIC + CFG_TUD_MSC)
#if (CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX) && (ITF_TOTAL > 4) #if (CFG_TUSB_MCU == OPT_MCU_LPC11UXX || CFG_TUSB_MCU == OPT_MCU_LPC13UXX) && (ITF_TOTAL > 4)
#error These MCUs do not have enough number of endpoints for the current configuration #error These MCUs do not have enough number of endpoints for the current configuration
@@ -135,7 +135,7 @@ typedef struct ATTR_PACKED
tusb_desc_configuration_t configuration; tusb_desc_configuration_t configuration;
//------------- CDC -------------// //------------- CDC -------------//
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
tusb_desc_interface_assoc_t cdc_iad; tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface //CDC Control Interface
@@ -153,21 +153,21 @@ typedef struct ATTR_PACKED
#endif #endif
//------------- HID Keyboard -------------// //------------- HID Keyboard -------------//
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
tusb_desc_interface_t keyboard_interface; tusb_desc_interface_t keyboard_interface;
tusb_hid_descriptor_hid_t keyboard_hid; tusb_hid_descriptor_hid_t keyboard_hid;
tusb_desc_endpoint_t keyboard_endpoint; tusb_desc_endpoint_t keyboard_endpoint;
#endif #endif
//------------- HID Mouse -------------// //------------- HID Mouse -------------//
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
tusb_desc_interface_t mouse_interface; tusb_desc_interface_t mouse_interface;
tusb_hid_descriptor_hid_t mouse_hid; tusb_hid_descriptor_hid_t mouse_hid;
tusb_desc_endpoint_t mouse_endpoint; tusb_desc_endpoint_t mouse_endpoint;
#endif #endif
//------------- Mass Storage -------------// //------------- Mass Storage -------------//
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
tusb_desc_interface_t msc_interface; tusb_desc_interface_t msc_interface;
tusb_desc_endpoint_t msc_endpoint_in; tusb_desc_endpoint_t msc_endpoint_in;
tusb_desc_endpoint_t msc_endpoint_out; tusb_desc_endpoint_t msc_endpoint_out;

View File

@@ -64,7 +64,7 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#if defined(_WIN32) #if defined(_WIN32)
/* Do not include nrf specific files when building for PC host */ /* Do not include nrf specific files when building for PC host */
#elif defined(__unix) //#elif defined(__unix)
/* Do not include nrf specific files when building for PC host */ /* Do not include nrf specific files when building for PC host */
#elif defined(__APPLE__) #elif defined(__APPLE__)
/* Do not include nrf specific files when building for PC host */ /* Do not include nrf specific files when building for PC host */

View File

@@ -128,26 +128,26 @@ void test_usbd_string_descriptor(void)
//------------- manufacturer string descriptor -------------// //------------- manufacturer string descriptor -------------//
uint32_t const manufacturer_len = sizeof(CFG_TUSB_DEVICE_STRING_MANUFACTURER) - 1; uint32_t const manufacturer_len = sizeof(CFG_TUD_STRING_MANUFACTURER) - 1;
TEST_ASSERT_EQUAL(manufacturer_len*2 + 2, app_tusb_desc_strings.manufacturer.bLength); TEST_ASSERT_EQUAL(manufacturer_len*2 + 2, app_tusb_desc_strings.manufacturer.bLength);
for(uint32_t i=0; i<manufacturer_len; i++) for(uint32_t i=0; i<manufacturer_len; i++)
{ {
TEST_ASSERT_EQUAL(CFG_TUSB_DEVICE_STRING_MANUFACTURER[i], app_tusb_desc_strings.manufacturer.unicode_string[i]); TEST_ASSERT_EQUAL(CFG_TUD_STRING_MANUFACTURER[i], app_tusb_desc_strings.manufacturer.unicode_string[i]);
} }
//------------- product string descriptor -------------// //------------- product string descriptor -------------//
uint32_t const product_len = sizeof(CFG_TUSB_DEVICE_STRING_PRODUCT) - 1; uint32_t const product_len = sizeof(CFG_TUD_STRING_PRODUCT) - 1;
TEST_ASSERT_EQUAL(product_len*2 + 2, app_tusb_desc_strings.product.bLength); TEST_ASSERT_EQUAL(product_len*2 + 2, app_tusb_desc_strings.product.bLength);
for(uint32_t i=0; i < product_len; i++) for(uint32_t i=0; i < product_len; i++)
{ {
TEST_ASSERT_EQUAL(CFG_TUSB_DEVICE_STRING_PRODUCT[i], app_tusb_desc_strings.product.unicode_string[i]); TEST_ASSERT_EQUAL(CFG_TUD_STRING_PRODUCT[i], app_tusb_desc_strings.product.unicode_string[i]);
} }
//------------- serial string descriptor -------------// //------------- serial string descriptor -------------//
uint32_t const serial_len = sizeof(CFG_TUSB_DEVICE_STRING_SERIAL) - 1; uint32_t const serial_len = sizeof(CFG_TUD_STRING_SERIAL) - 1;
TEST_ASSERT_EQUAL(serial_len*2 + 2, app_tusb_desc_strings.serial.bLength); TEST_ASSERT_EQUAL(serial_len*2 + 2, app_tusb_desc_strings.serial.bLength);
for(uint32_t i=0; i<serial_len; i++) for(uint32_t i=0; i<serial_len; i++)
{ {
TEST_ASSERT_EQUAL(CFG_TUSB_DEVICE_STRING_SERIAL[i], app_tusb_desc_strings.serial.unicode_string[i]); TEST_ASSERT_EQUAL(CFG_TUD_STRING_SERIAL[i], app_tusb_desc_strings.serial.unicode_string[i]);
} }
} }

View File

@@ -69,7 +69,7 @@ typedef struct
tusb_desc_interface_assoc_t CDC_IAD; tusb_desc_interface_assoc_t CDC_IAD;
#endif #endif
#if 0 //&& CFG_TUSB_DEVICE_CDC #if 0 //&& CFG_TUD_CDC
//CDC - Serial //CDC - Serial
//CDC Control Interface //CDC Control Interface
tusb_desc_interface_t CDC_CCI_Interface; tusb_desc_interface_t CDC_CCI_Interface;

View File

@@ -70,14 +70,14 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------// //------------- CLASS -------------//
#define CFG_TUSB_DEVICE_HID_KEYBOARD 1 #define CFG_TUD_HID_KEYBOARD 1
#define CFG_TUSB_DEVICE_HID_MOUSE 1 #define CFG_TUD_HID_MOUSE 1
#define CFG_TUSB_DEVICE_HID_GENERIC 0 #define CFG_TUD_HID_GENERIC 0
#define CFG_TUSB_DEVICE_MSC 1 #define CFG_TUD_MSC 1
#define CFG_TUSB_DEVICE_CDC 1 #define CFG_TUD_CDC 1
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -38,7 +38,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (MODE_DEVICE_SUPPORTED && CFG_TUSB_DEVICE_CDC) #if (MODE_DEVICE_SUPPORTED && CFG_TUD_CDC)
#define _TINY_USB_SOURCE_FILE_ #define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -78,7 +78,7 @@ static hidd_class_driver_t const hidd_class_driver[HIDD_NUMBER_OF_SUBCLASS] =
{ {
// [HID_PROTOCOL_NONE] = for HID Generic // [HID_PROTOCOL_NONE] = for HID Generic
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
[HID_PROTOCOL_KEYBOARD] = [HID_PROTOCOL_KEYBOARD] =
{ {
.p_interface = &keyboardd_data, .p_interface = &keyboardd_data,
@@ -88,7 +88,7 @@ static hidd_class_driver_t const hidd_class_driver[HIDD_NUMBER_OF_SUBCLASS] =
}, },
#endif #endif
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
[HID_PROTOCOL_MOUSE] = [HID_PROTOCOL_MOUSE] =
{ {
.p_interface = &moused_data, .p_interface = &moused_data,
@@ -105,7 +105,7 @@ CFG_TUSB_ATTR_USBRAM STATIC_VAR uint8_t m_hid_buffer[ HIDD_BUFFER_SIZE ];
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// KEYBOARD APPLICATION API // KEYBOARD APPLICATION API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if CFG_TUSB_DEVICE_HID_KEYBOARD #if CFG_TUD_HID_KEYBOARD
STATIC_VAR hidd_interface_t keyboardd_data; STATIC_VAR hidd_interface_t keyboardd_data;
bool tud_hid_keyboard_busy(uint8_t rhport) bool tud_hid_keyboard_busy(uint8_t rhport)
@@ -128,7 +128,7 @@ tusb_error_t tud_hid_keyboard_send(uint8_t rhport, hid_keyboard_report_t const *
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// MOUSE APPLICATION API // MOUSE APPLICATION API
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if CFG_TUSB_DEVICE_HID_MOUSE #if CFG_TUD_HID_MOUSE
STATIC_VAR hidd_interface_t moused_data; STATIC_VAR hidd_interface_t moused_data;
bool tud_hid_mouse_is_busy(uint8_t rhport) bool tud_hid_mouse_is_busy(uint8_t rhport)

View File

@@ -38,7 +38,7 @@
#include "tusb_option.h" #include "tusb_option.h"
#if (MODE_DEVICE_SUPPORTED && CFG_TUSB_DEVICE_MSC) #if (MODE_DEVICE_SUPPORTED && CFG_TUD_MSC)
#define _TINY_USB_SOURCE_FILE_ #define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+

View File

@@ -76,7 +76,7 @@ typedef struct {
// MACRO CONSTANT TYPEDEF // MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER]; usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t usbd_enum_buffer[CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE]; CFG_TUSB_ATTR_USBRAM CFG_TUSB_MEM_ALIGN uint8_t usbd_enum_buffer[CFG_TUD_ENUM_BUFFER_SIZE];
static usbd_class_driver_t const usbd_class_drivers[] = static usbd_class_driver_t const usbd_class_drivers[] =
{ {
@@ -93,7 +93,7 @@ static usbd_class_driver_t const usbd_class_drivers[] =
}, },
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
[TUSB_CLASS_MSC] = [TUSB_CLASS_MSC] =
{ {
.init = mscd_init, .init = mscd_init,
@@ -106,7 +106,7 @@ static usbd_class_driver_t const usbd_class_drivers[] =
}, },
#endif #endif
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
[TUSB_CLASS_CDC] = [TUSB_CLASS_CDC] =
{ {
.init = cdcd_init, .init = cdcd_init,
@@ -489,7 +489,7 @@ static uint16_t get_descriptor(uint8_t rhport, tusb_control_request_t const * co
// up to Host's length // up to Host's length
len = min16_of(p_request->wLength, len ); len = min16_of(p_request->wLength, len );
TU_ASSERT( len <= CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE, 0); TU_ASSERT( len <= CFG_TUD_ENUM_BUFFER_SIZE, 0);
memcpy(usbd_enum_buffer, desc_data, len); memcpy(usbd_enum_buffer, desc_data, len);
(*pp_buffer) = usbd_enum_buffer; (*pp_buffer) = usbd_enum_buffer;

View File

@@ -63,8 +63,8 @@ typedef struct {
uint8_t const * p_configuration; ///< pointer to the whole configuration descriptor, starting by \ref tusb_desc_configuration_t uint8_t const * p_configuration; ///< pointer to the whole configuration descriptor, starting by \ref tusb_desc_configuration_t
uint8_t const** p_string_arr; ///< a array of pointers to string descriptors uint8_t const** p_string_arr; ///< a array of pointers to string descriptors
uint8_t const * p_hid_keyboard_report; ///< pointer to HID report descriptor of Keybaord interface. Only needed if CFG_TUSB_DEVICE_HID_KEYBOARD is enabled uint8_t const * p_hid_keyboard_report; ///< pointer to HID report descriptor of Keybaord interface. Only needed if CFG_TUD_HID_KEYBOARD is enabled
uint8_t const * p_hid_mouse_report; ///< pointer to HID report descriptor of Mouse interface. Only needed if CFG_TUSB_DEVICE_HID_MOUSE is enabled uint8_t const * p_hid_mouse_report; ///< pointer to HID report descriptor of Mouse interface. Only needed if CFG_TUD_HID_MOUSE is enabled
}tusbd_descriptor_pointer_t; }tusbd_descriptor_pointer_t;
// define by application // define by application

View File

@@ -128,8 +128,8 @@ bool dcd_init(uint8_t rhport)
//------------- user manual 11.13 usb device controller initialization -------------// LPC_USB->USBEpInd = 0; //------------- user manual 11.13 usb device controller initialization -------------// LPC_USB->USBEpInd = 0;
// step 6 : set up control endpoint // step 6 : set up control endpoint
edpt_set_max_packet_size(0, CFG_TUSB_DEVICE_ENDOINT0_SIZE); edpt_set_max_packet_size(0, CFG_TUD_ENDOINT0_SIZE);
edpt_set_max_packet_size(1, CFG_TUSB_DEVICE_ENDOINT0_SIZE); edpt_set_max_packet_size(1, CFG_TUD_ENDOINT0_SIZE);
bus_reset(); bus_reset();
@@ -312,7 +312,7 @@ static inline uint16_t length_byte2dword(uint16_t length_in_bytes)
static tusb_error_t pipe_control_xfer(uint8_t ep_id, uint8_t* p_buffer, uint16_t length) static tusb_error_t pipe_control_xfer(uint8_t ep_id, uint8_t* p_buffer, uint16_t length)
{ {
uint16_t const packet_len = min16_of(length, CFG_TUSB_DEVICE_ENDOINT0_SIZE); uint16_t const packet_len = min16_of(length, CFG_TUD_ENDOINT0_SIZE);
if (ep_id) if (ep_id)
{ {

View File

@@ -138,7 +138,7 @@ static void bus_reset(uint8_t rhport)
//------------- Set up Control Endpoints (0 OUT, 1 IN) -------------// //------------- Set up Control Endpoints (0 OUT, 1 IN) -------------//
p_dcd->qhd[0].zero_length_termination = p_dcd->qhd[1].zero_length_termination = 1; p_dcd->qhd[0].zero_length_termination = p_dcd->qhd[1].zero_length_termination = 1;
p_dcd->qhd[0].max_package_size = p_dcd->qhd[1].max_package_size = CFG_TUSB_DEVICE_ENDOINT0_SIZE; p_dcd->qhd[0].max_package_size = p_dcd->qhd[1].max_package_size = CFG_TUD_ENDOINT0_SIZE;
p_dcd->qhd[0].qtd_overlay.next = p_dcd->qhd[1].qtd_overlay.next = QTD_NEXT_INVALID; p_dcd->qhd[0].qtd_overlay.next = p_dcd->qhd[1].qtd_overlay.next = QTD_NEXT_INVALID;
p_dcd->qhd[0].int_on_setup = 1; // OUT only p_dcd->qhd[0].int_on_setup = 1; // OUT only

View File

@@ -98,7 +98,7 @@ bool tusb_hal_init(void)
#else // TODO OTG #else // TODO OTG
LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE; LPC_USB0->USBMODE_D = LPC43XX_USBMODE_DEVICE;
LPC_USB0->OTGSC = (1<<3) | (1<<0) /*| (1<<16)| (1<<24)| (1<<25)| (1<<26)| (1<<27)| (1<<28)| (1<<29)| (1<<30)*/; LPC_USB0->OTGSC = (1<<3) | (1<<0) /*| (1<<16)| (1<<24)| (1<<25)| (1<<26)| (1<<27)| (1<<28)| (1<<29)| (1<<30)*/;
#if CFG_TUSB_DEVICE_FULLSPEED // TODO for easy testing #if CFG_TUD_FULLSPEED // TODO for easy testing
LPC_USB0->PORTSC1_D |= (1<<24); // force full speed LPC_USB0->PORTSC1_D |= (1<<24); // force full speed
#endif #endif
#endif #endif

View File

@@ -80,11 +80,11 @@
#include "class/hid/hid_device.h" #include "class/hid/hid_device.h"
#endif #endif
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
#include "class/cdc/cdc_device.h" #include "class/cdc/cdc_device.h"
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
#include "class/msc/msc_device.h" #include "class/msc/msc_device.h"
#endif #endif
#endif #endif

View File

@@ -157,19 +157,19 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#if MODE_DEVICE_SUPPORTED #if MODE_DEVICE_SUPPORTED
#define DEVICE_CLASS_HID ( CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + CFG_TUSB_DEVICE_HID_GENERIC ) #define DEVICE_CLASS_HID ( CFG_TUD_HID_KEYBOARD + CFG_TUD_HID_MOUSE + CFG_TUD_HID_GENERIC )
#ifndef CFG_TUSB_DEVICE_ENDOINT0_SIZE #ifndef CFG_TUD_ENDOINT0_SIZE
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
#endif #endif
#if CFG_TUSB_DEVICE_ENDOINT0_SIZE > 64 #if CFG_TUD_ENDOINT0_SIZE > 64
#error Control Endpoint Max Package Size cannot larger than 64 #error Control Endpoint Max Package Size cannot larger than 64
#endif #endif
#ifndef CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE #ifndef CFG_TUD_ENUM_BUFFER_SIZE
#define CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE 256 #define CFG_TUD_ENUM_BUFFER_SIZE 256
#endif #endif
#endif // MODE_DEVICE_SUPPORTED #endif // MODE_DEVICE_SUPPORTED