update tinyusb config

This commit is contained in:
hathach 2018-04-12 18:11:45 +07:00
parent 58c86bae1d
commit a360bcc0b4
7 changed files with 32 additions and 23 deletions

@ -1 +1 @@
Subproject commit a74b2d34e5467d913d86abf3331eab2ccd2def92 Subproject commit a24615bffcba2272af9d0d75bdefb6a8a6180e89

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

@ -49,7 +49,7 @@
extern "C" { extern "C" {
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
enum enum
{ {
@ -62,7 +62,7 @@ enum
If you find any bugs or get any questions, feel free to file an\r\n\ If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb" issue at github.com/hathach/tinyusb"
#if CFG_TUSB_MCU==MCU_LPC11UXX || CFG_TUSB_MCU==MCU_LPC13UXX #if CFG_TUSB_MCU==OPT_MCU_LPC11UXX || CFG_TUSB_MCU==OPT_MCU_LPC13UXX
#define MSCD_APP_ROMDISK #define MSCD_APP_ROMDISK
#else // defaults is ram disk #else // defaults is ram disk
#define MSCD_APP_RAMDISK #define MSCD_APP_RAMDISK

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

@ -46,29 +46,30 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// COMMON CONFIGURATION // COMMON CONFIGURATION
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE) #define CFG_TUSB_MCU OPT_MCU_NRF5X
#define CFG_TUSB_CONTROLLER_0_MODE (OPT_MODE_DEVICE)
#define CFG_TUSB_DEBUG 2 #define CFG_TUSB_DEBUG 2
#define CFG_TUSB_OS TUSB_OS_NONE #define CFG_TUSB_OS OPT_OS_NONE
//#define CFG_TUSB_OS_TASK_PRIO 0 //#define CFG_TUSB_OS_TASK_PRIO 0
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// DEVICE CONFIGURATION // DEVICE CONFIGURATION
// Note: TUD Stand for Tiny Usb Device
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
#define CFG_TUSB_DEVICE_ENDOINT0_SIZE 64 #define CFG_TUD_ENDOINT0_SIZE 64
//------------- CLASS -------------// //------------- Class enabled -------------//
#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
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* CLASS /* CLASS DRIVER
* TUD Stand for Tiny Usb Device
*------------------------------------------------------------------*/ *------------------------------------------------------------------*/
// FIFO size of CDC TX and RX // FIFO size of CDC TX and RX
@ -84,6 +85,14 @@
#define CFG_TUSB_ATTR_USBRAM #define CFG_TUSB_ATTR_USBRAM
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4) #define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4)
#define BREAKPOINT_IGNORE_COUNT(n) \
do {\
static uint8_t ignore_count = 0;\
ignore_count++;\
if ( ignore_count > n ) verify_breakpoint();\
}while(0)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

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,
@ -85,7 +85,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 = .cdc =
{ {
@ -199,7 +199,7 @@ app_descriptor_configuration_t const desc_configuration =
}, },
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
.msc = .msc =
{ {
.interface = .interface =

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) ) )
@ -60,7 +60,7 @@
#define ITF_NUM_MSC 2 #define ITF_NUM_MSC 2
// total number of interfaces // total number of interfaces
#define ITF_TOTAL (CFG_TUSB_DEVICE_CDC*2 + CFG_TUSB_DEVICE_MSC) #define ITF_TOTAL (CFG_TUD_CDC*2 + CFG_TUD_MSC)
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Endpoints Address & Max Packet Size // Endpoints Address & Max Packet Size
@ -87,7 +87,7 @@ typedef struct ATTR_PACKED
{ {
tusb_desc_configuration_t configuration; tusb_desc_configuration_t configuration;
#if CFG_TUSB_DEVICE_CDC #if CFG_TUD_CDC
struct ATTR_PACKED struct ATTR_PACKED
{ {
tusb_desc_interface_assoc_t iad; tusb_desc_interface_assoc_t iad;
@ -107,7 +107,7 @@ typedef struct ATTR_PACKED
}cdc; }cdc;
#endif #endif
#if CFG_TUSB_DEVICE_MSC #if CFG_TUD_MSC
struct ATTR_PACKED struct ATTR_PACKED
{ {
tusb_desc_interface_t interface; tusb_desc_interface_t interface;