diff --git a/doxygen/configuration.txt b/doxygen/configuration.txt
index c84eea76e..8f5887718 100644
--- a/doxygen/configuration.txt
+++ b/doxygen/configuration.txt
@@ -7,46 +7,46 @@
/// \brief tell the stack which mode (host/device/otg) the usb controller0 will be operated on. Possible value is
/// from \ref group_mode. Note the hardware usb controller must support the selected mode.
-#define TUSB_CFG_CONTROLLER_0_MODE
+#define CFG_TUSB_CONTROLLER_0_MODE
/** 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.
+ into the USB RAM section as follows. if your mcu's usb controller has no such limit, define CFG_TUSB_ATTR_USBRAM as empty macro.
@code
- TUSB_CFG_ATTR_USBRAM uint8_t usb_xfer_buffer[10];
+ CFG_TUSB_ATTR_USBRAM uint8_t usb_xfer_buffer[10];
@endcode
*/
-#define TUSB_CFG_ATTR_USBRAM
+#define CFG_TUSB_ATTR_USBRAM
-#define TUSB_CFG_MCU ///< Select one of the supported MCU, the value must be from \ref group_mcu
-#define TUSB_CFG_OS ///< Select one of the supported RTOS, the value must be from \ref group_supported_os.
-#define TUSB_CFG_OS_TASK_PRIO ///< If \ref TUSB_CFG_OS is configured to use a real RTOS (other than TUSB_OS_NONE). This determines the priority of the usb stack task.
-#define TUSB_CFG_TICKS_HZ ///< The rate ticks in hert. This is used in conjunction with \ref tusb_tick_get to calculate timing.
+#define CFG_TUSB_MCU ///< Select one of the supported MCU, the value must be from \ref group_mcu
+#define CFG_TUSB_OS ///< Select one of the supported RTOS, the value must be from \ref group_supported_os.
+#define CFG_TUSB_OS_TASK_PRIO ///< If \ref CFG_TUSB_OS is configured to use a real RTOS (other than TUSB_OS_NONE). This determines the priority of the usb stack task.
+#define CFG_TUSB_TICKS_HZ ///< The rate ticks in hert. This is used in conjunction with \ref tusb_tick_get to calculate timing.
//--------------------------------------------------------------------+
// HOST CONFIGURATION
//--------------------------------------------------------------------+
-/** \defgroup TUSB_CFG_HOST Host Options
+/** \defgroup CFG_TUSB_HOST Host Options
* @{ */
/** \brief Maximum number of device host stack can manage
* \n If hub class is not enabled, set this equal to number of controllers in host mode
* \n If hub class is enabled, make sure hub is also counted */
-#define TUSB_CFG_HOST_DEVICE_MAX
+#define CFG_TUSB_HOST_DEVICE_MAX
/// \brief Buffer size used for getting device configuration descriptor. You may want to increase this from default (256)
/// to support lengthy composite device especially with Audio or Video class
-#define TUSB_CFG_HOST_ENUM_BUFFER_SIZE
+#define CFG_TUSB_HOST_ENUM_BUFFER_SIZE
/** \defgroup config_host_class Class Driver
* \brief For each Class Driver a value of 1 means enable, value of 0 mean disable
* @{ */
-#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 CFG_TUSB_HOST_HUB ///< Enable Hub Class
+#define CFG_TUSB_HOST_HID_KEYBOARD ///< Enable HID Class for Keyboard
+#define CFG_TUSB_HOST_HID_MOUSE ///< Enable HID Class for Mouse
+#define CFG_TUSB_HOST_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
+#define CFG_TUSB_HOST_MSC ///< Enable Mass Storage Class (SCSI subclass only)
+#define CFG_TUSB_HOST_CDC ///< Enable Virtual Serial (Communication Device Class)
/** @} */
/** @} */ // group Host
@@ -54,10 +54,10 @@
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
-/** \defgroup TUSB_CFG_DEVICE Device Options
+/** \defgroup CFG_TUSB_DEVICE Device Options
* @{ */
-#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE ///< Max packet size of Cotnrol Endpoint, default is 64
+#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_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
/// Device Descriptor, Configuration Descriptor, String Descriptors, HID Report Descriptors etc ...
@@ -66,11 +66,11 @@ tusbd_descriptor_pointer_t tusbd_descriptor_pointers;
/** \defgroup config_device_class Class Driver
* \brief For each Class Driver a value of 1 means enable, value of 0 mean disable
* @{ */
-#define TUSB_CFG_DEVICE_HID_KEYBOARD ///< Enable HID Class for Keyboard
-#define TUSB_CFG_DEVICE_HID_MOUSE ///< Enable HID Class for Mouse
-#define TUSB_CFG_DEVICE_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
-#define TUSB_CFG_DEVICE_MSC ///< Enable Mass Storage Class (SCSI subclass only)
-#define TUSB_CFG_DEVICE_CDC ///< Enable Virtual Serial (Communication Device Class)
+#define CFG_TUSB_DEVICE_HID_KEYBOARD ///< Enable HID Class for Keyboard
+#define CFG_TUSB_DEVICE_HID_MOUSE ///< Enable HID Class for Mouse
+#define CFG_TUSB_DEVICE_HID_GENERIC ///< Enable HID Class for Generic (not supported yet)
+#define CFG_TUSB_DEVICE_MSC ///< Enable Mass Storage Class (SCSI subclass only)
+#define CFG_TUSB_DEVICE_CDC ///< Enable Virtual Serial (Communication Device Class)
/** @} */
/** @} */ // group Device
diff --git a/doxygen/getting_started.md b/doxygen/getting_started.md
index d58634845..79bc8f01f 100644
--- a/doxygen/getting_started.md
+++ b/doxygen/getting_started.md
@@ -35,7 +35,7 @@ It is relatively simple to incorporate tinyusb to your (existing) project
1. Copy core folder **tinyusb** to your project. Let's say it is *your_project/tinyusb*
2. Add all the .c in the core folder to your project settings (uvproj, ewp, makefile)
3. Add *your_project/tinysb* to your include path. Also make sure your current include path also contains the configuration file tusb_config.h. Or you could simply put the tusb_config.h into the tinyusb folder as well.
-4. Make sure all required macros are all defined properly in tusb_config.h (configure file in demo application is sufficient, but you need to add a few more such as TUSB_CFG_MCU, TUSB_CFG_OS, TUSB_CFG_OS_TASK_PRIO since they are passed by IDE/compiler to maintain a unique configure for all demo projects).
+4. Make sure all required macros are all defined properly in tusb_config.h (configure file in demo application is sufficient, but you need to add a few more such as CFG_TUSB_MCU, CFG_TUSB_OS, CFG_TUSB_OS_TASK_PRIO since they are passed by IDE/compiler to maintain a unique configure for all demo projects).
5. If you use the device stack, make sure you have created/modified usb descriptors for your own need. Ultimately you need to fill out required pointers in tusbd_descriptor_pointers for that stack to work.
6. Add tusb_init() call to your reset initialization code.
7. Implement all enabled classes's callbacks.
diff --git a/doxygen/started_demo.md b/doxygen/started_demo.md
index 287c55731..7e82596f5 100644
--- a/doxygen/started_demo.md
+++ b/doxygen/started_demo.md
@@ -34,7 +34,7 @@ void led_blinking_task( void * p_task_para )
static uint32_t led_on_mask = 0;
// FreeRTOS API's vTaskDelay is used in place of osal_task_delay. Note it takes input parameter in tick
- vTaskDelay( (led_blink_interval_ms * TUSB_CFG_TICKS_HZ) / 1000);
+ vTaskDelay( (led_blink_interval_ms * CFG_TUSB_TICKS_HZ) / 1000);
board_leds(led_on_mask, 1 - led_on_mask);
led_on_mask = 1 - led_on_mask; // toggle
diff --git a/examples/device/device_virtual_com/segger/device_virtual_com.emProject b/examples/device/device_virtual_com/segger/device_virtual_com.emProject
index c52698a89..63927ff9d 100644
--- a/examples/device/device_virtual_com/segger/device_virtual_com.emProject
+++ b/examples/device/device_virtual_com/segger/device_virtual_com.emProject
@@ -201,7 +201,7 @@
+ c_preprocessor_definitions="BOARD=BOARD_EA4357;CFG_TUSB_MCU=MCU_LPC43XX" />
-
+
diff --git a/examples/device/nrf52840/src/main.c b/examples/device/nrf52840/src/main.c
index 203cd3f18..bb26f3a4e 100644
--- a/examples/device/nrf52840/src/main.c
+++ b/examples/device/nrf52840/src/main.c
@@ -144,9 +144,9 @@ void print_greeting(void)
printf("--------------------------------------------------------------------\n\n");
printf("This DEVICE demo is configured to support:");
- printf(" - RTOS = %s\n", rtos_name[TUSB_CFG_OS]);
- if (TUSB_CFG_DEVICE_HID_MOUSE ) puts(" - HID Mouse");
- if (TUSB_CFG_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard");
- if (TUSB_CFG_DEVICE_MSC ) puts(" - Mass Storage");
- if (TUSB_CFG_DEVICE_CDC ) puts(" - Communication Device Class");
+ printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
+ if (CFG_TUSB_DEVICE_HID_MOUSE ) puts(" - HID Mouse");
+ if (CFG_TUSB_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard");
+ if (CFG_TUSB_DEVICE_MSC ) puts(" - Mass Storage");
+ if (CFG_TUSB_DEVICE_CDC ) puts(" - Communication Device Class");
}
diff --git a/examples/device/nrf52840/src/msc_device_app.c b/examples/device/nrf52840/src/msc_device_app.c
index 401a32d1d..6609257e2 100644
--- a/examples/device/nrf52840/src/msc_device_app.c
+++ b/examples/device/nrf52840/src/msc_device_app.c
@@ -38,7 +38,7 @@
#include "msc_device_app.h"
-#if TUSB_CFG_DEVICE_MSC
+#if CFG_TUSB_DEVICE_MSC
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
diff --git a/examples/device/nrf52840/src/msc_device_app.h b/examples/device/nrf52840/src/msc_device_app.h
index cd087b8a3..185ceb260 100644
--- a/examples/device/nrf52840/src/msc_device_app.h
+++ b/examples/device/nrf52840/src/msc_device_app.h
@@ -50,7 +50,7 @@
extern "C" {
#endif
-#if TUSB_CFG_DEVICE_MSC
+#if CFG_TUSB_DEVICE_MSC
enum
{
@@ -63,7 +63,7 @@ enum
If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb"
-#if TUSB_CFG_MCU==MCU_LPC11UXX || TUSB_CFG_MCU==MCU_LPC13UXX
+#if CFG_TUSB_MCU==MCU_LPC11UXX || CFG_TUSB_MCU==MCU_LPC13UXX
#define MSCD_APP_ROMDISK
#else // defaults is ram disk
#define MSCD_APP_RAMDISK
diff --git a/examples/device/nrf52840/src/msc_device_ramdisk.c b/examples/device/nrf52840/src/msc_device_ramdisk.c
index fefbfdf79..b19b37252 100644
--- a/examples/device/nrf52840/src/msc_device_ramdisk.c
+++ b/examples/device/nrf52840/src/msc_device_ramdisk.c
@@ -38,7 +38,7 @@
#include "msc_device_app.h"
-#if TUSB_CFG_DEVICE_MSC && defined (MSCD_APP_RAMDISK)
+#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_RAMDISK)
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
@@ -47,7 +47,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT
+CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT
uint8_t msc_device_ramdisk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
{
//------------- Boot Sector -------------//
diff --git a/examples/device/nrf52840/src/tusb_config.h b/examples/device/nrf52840/src/tusb_config.h
index e517376c3..54ec51cce 100644
--- a/examples/device/nrf52840/src/tusb_config.h
+++ b/examples/device/nrf52840/src/tusb_config.h
@@ -46,41 +46,41 @@
//--------------------------------------------------------------------+
// CONTROLLER CONFIGURATION
//--------------------------------------------------------------------+
-//#define TUSB_CFG_MCU will be passed from IDE/command line for easy board/mcu switching
+//#define CFG_TUSB_MCU will be passed from IDE/command line for easy board/mcu switching
-#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
-//#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
+#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
+//#define CFG_TUSB_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
+#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
//------------- CLASS -------------//
-#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
-#define TUSB_CFG_DEVICE_HID_MOUSE 0
-#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
-#define TUSB_CFG_DEVICE_MSC 1
-#define TUSB_CFG_DEVICE_CDC 1
+#define CFG_TUSB_DEVICE_HID_KEYBOARD 0
+#define CFG_TUSB_DEVICE_HID_MOUSE 0
+#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
+#define CFG_TUSB_DEVICE_MSC 1
+#define CFG_TUSB_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_DEBUG 2
+#define CFG_TUSB_DEBUG 2
-#define TUSB_CFG_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
-//#define TUSB_CFG_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
-#define TUSB_CFG_TICKS_HZ 1000
+#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
+//#define CFG_TUSB_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
+#define CFG_TUSB_TICKS_HZ 1000
-//#define TUSB_CFG_OS TUSB_OS_NONE
+//#define CFG_TUSB_OS TUSB_OS_NONE
//--------------------------------------------------------------------+
// USB RAM PLACEMENT
//--------------------------------------------------------------------+
-#define TUSB_CFG_ATTR_USBRAM
+#define CFG_TUSB_ATTR_USBRAM
// LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
-#if TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX
+#if CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(64)
#elif defined NRF52840_XXAA
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(4)
diff --git a/examples/device/nrf52840/src/tusb_descriptors.c b/examples/device/nrf52840/src/tusb_descriptors.c
index a36786961..99a47618a 100644
--- a/examples/device/nrf52840/src/tusb_descriptors.c
+++ b/examples/device/nrf52840/src/tusb_descriptors.c
@@ -53,7 +53,7 @@ tusb_desc_device_t const desc_device =
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
- .bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
+ .bMaxPacketSize0 = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE,
.idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID,
diff --git a/examples/device/nrf52840/src/tusb_descriptors.h b/examples/device/nrf52840/src/tusb_descriptors.h
index cf291e25e..b8d07357e 100644
--- a/examples/device/nrf52840/src/tusb_descriptors.h
+++ b/examples/device/nrf52840/src/tusb_descriptors.h
@@ -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.
// Auto ProductID layout's Bitmap: (MSB) MassStorage | Generic | Mouse | Key | CDC (LSB)
#ifndef CFG_PRODUCTID
- #define PRODUCTID_BITMAP(interface, n) ( (TUSB_CFG_DEVICE_##interface) << (n) )
+ #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) )
#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(MSC, 4) ) )
diff --git a/examples/obsolete/device/device_freertos/.cproject b/examples/obsolete/device/device_freertos/.cproject
index e3c134ea3..9a17de18e 100644
--- a/examples/obsolete/device/device_freertos/.cproject
+++ b/examples/obsolete/device/device_freertos/.cproject
@@ -32,9 +32,9 @@
-
-
-
+
+
+
@@ -129,10 +129,10 @@
-
+
-
-
+
+
@@ -226,10 +226,10 @@
-
-
+
+
-
+
@@ -330,10 +330,10 @@
-
+
-
-
+
+
@@ -428,10 +428,10 @@
-
+
-
-
+
+
@@ -527,10 +527,10 @@
-
+
-
-
+
+
diff --git a/examples/obsolete/device/device_os_none/.cproject b/examples/obsolete/device/device_os_none/.cproject
index b09c3d9cd..a8cd67cf2 100644
--- a/examples/obsolete/device/device_os_none/.cproject
+++ b/examples/obsolete/device/device_os_none/.cproject
@@ -32,8 +32,8 @@
-
-
+
+
@@ -125,9 +125,9 @@
-
+
-
+
@@ -218,10 +218,10 @@
-
+
-
+
@@ -323,8 +323,8 @@
-
-
+
+
@@ -418,10 +418,10 @@
-
+
-
+
@@ -515,9 +515,9 @@
-
+
-
+
diff --git a/examples/obsolete/device/src/app_os_prio.h b/examples/obsolete/device/src/app_os_prio.h
index 5d932a41e..e75b942ce 100644
--- a/examples/obsolete/device/src/app_os_prio.h
+++ b/examples/obsolete/device/src/app_os_prio.h
@@ -46,16 +46,16 @@
#include "tusb.h"
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
#define LOWER_PRIO(x) 0 // does not matter
-#elif TUSB_CFG_OS == TUSB_OS_FREERTOS
+#elif CFG_TUSB_OS == TUSB_OS_FREERTOS
#define LOWER_PRIO(x) ((x)-1) // freeRTOS lower number --> lower priority
#else
#error Priority is not configured for this RTOS
#endif
enum {
- STANDARD_APP_TASK_PRIO = LOWER_PRIO(TUSB_CFG_OS_TASK_PRIO), // Application Task is lower than usb system task
+ STANDARD_APP_TASK_PRIO = LOWER_PRIO(CFG_TUSB_OS_TASK_PRIO), // Application Task is lower than usb system task
LED_BLINKING_APP_TASK_PRIO = LOWER_PRIO(STANDARD_APP_TASK_PRIO), // Blinking task is lower than normal task
KEYBOARD_APP_TASK_PRIO = STANDARD_APP_TASK_PRIO,
diff --git a/examples/obsolete/device/src/cdc_device_app.c b/examples/obsolete/device/src/cdc_device_app.c
index 7f448de05..d72e6bcd9 100644
--- a/examples/obsolete/device/src/cdc_device_app.c
+++ b/examples/obsolete/device/src/cdc_device_app.c
@@ -38,7 +38,7 @@
#include "cdc_device_app.h"
-#if TUSB_CFG_DEVICE_CDC
+#if CFG_TUSB_DEVICE_CDC
#include "common/tusb_fifo.h" // TODO refractor
#include "app_os_prio.h"
diff --git a/examples/obsolete/device/src/cdc_device_app.h b/examples/obsolete/device/src/cdc_device_app.h
index a2cd70eb7..45f02baef 100644
--- a/examples/obsolete/device/src/cdc_device_app.h
+++ b/examples/obsolete/device/src/cdc_device_app.h
@@ -53,7 +53,7 @@
extern "C" {
#endif
-#if TUSB_CFG_DEVICE_CDC
+#if CFG_TUSB_DEVICE_CDC
void cdc_serial_app_init(void);
void cdc_serial_app_task(void* param);
diff --git a/examples/obsolete/device/src/keyboard_device_app.c b/examples/obsolete/device/src/keyboard_device_app.c
index 64087053a..a4ae81a46 100644
--- a/examples/obsolete/device/src/keyboard_device_app.c
+++ b/examples/obsolete/device/src/keyboard_device_app.c
@@ -38,7 +38,7 @@
#include "keyboard_device_app.h"
-#if TUSB_CFG_DEVICE_HID_KEYBOARD
+#if CFG_TUSB_DEVICE_HID_KEYBOARD
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
@@ -51,7 +51,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM hid_keyboard_report_t keyboard_report;
+CFG_TUSB_ATTR_USBRAM hid_keyboard_report_t keyboard_report;
//--------------------------------------------------------------------+
// tinyusb callbacks
diff --git a/examples/obsolete/device/src/keyboard_device_app.h b/examples/obsolete/device/src/keyboard_device_app.h
index 4d069ae39..1d2a8b39e 100644
--- a/examples/obsolete/device/src/keyboard_device_app.h
+++ b/examples/obsolete/device/src/keyboard_device_app.h
@@ -53,7 +53,7 @@
extern "C" {
#endif
-#if TUSB_CFG_DEVICE_HID_KEYBOARD
+#if CFG_TUSB_DEVICE_HID_KEYBOARD
void keyboard_app_init(void);
void keyboard_app_task(void* param);
diff --git a/examples/obsolete/device/src/main.c b/examples/obsolete/device/src/main.c
index 0cd9eb3bc..802883ce4 100644
--- a/examples/obsolete/device/src/main.c
+++ b/examples/obsolete/device/src/main.c
@@ -64,7 +64,7 @@ void led_blinking_init(void);
void led_blinking_task(void* param);
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
// like a real RTOS, this function is a main loop invoking each task in application and never return
void os_none_start_scheduler(void)
{
@@ -97,9 +97,9 @@ int main(void)
cdc_serial_app_init();
//------------- start OS scheduler (never return) -------------//
-#if TUSB_CFG_OS == TUSB_OS_FREERTOS
+#if CFG_TUSB_OS == TUSB_OS_FREERTOS
vTaskStartScheduler();
-#elif TUSB_CFG_OS == TUSB_OS_NONE
+#elif CFG_TUSB_OS == TUSB_OS_NONE
os_none_start_scheduler();
#else
#error need to start RTOS schduler
@@ -193,9 +193,9 @@ void print_greeting(void)
);
puts("This DEVICE demo is configured to support:");
- printf(" - RTOS = %s\n", rtos_name[TUSB_CFG_OS]);
- if (TUSB_CFG_DEVICE_HID_MOUSE ) puts(" - HID Mouse");
- if (TUSB_CFG_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard");
- if (TUSB_CFG_DEVICE_MSC ) puts(" - Mass Storage");
- if (TUSB_CFG_DEVICE_CDC ) puts(" - Communication Device Class");
+ printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
+ if (CFG_TUSB_DEVICE_HID_MOUSE ) puts(" - HID Mouse");
+ if (CFG_TUSB_DEVICE_HID_KEYBOARD ) puts(" - HID Keyboard");
+ if (CFG_TUSB_DEVICE_MSC ) puts(" - Mass Storage");
+ if (CFG_TUSB_DEVICE_CDC ) puts(" - Communication Device Class");
}
diff --git a/examples/obsolete/device/src/mouse_device_app.c b/examples/obsolete/device/src/mouse_device_app.c
index b04ef7133..3cc2e0d68 100644
--- a/examples/obsolete/device/src/mouse_device_app.c
+++ b/examples/obsolete/device/src/mouse_device_app.c
@@ -38,7 +38,7 @@
#include "mouse_device_app.h"
-#if TUSB_CFG_DEVICE_HID_MOUSE
+#if CFG_TUSB_DEVICE_HID_MOUSE
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
@@ -51,7 +51,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM hid_mouse_report_t mouse_report;
+CFG_TUSB_ATTR_USBRAM hid_mouse_report_t mouse_report;
//--------------------------------------------------------------------+
// tinyusb callbacks
diff --git a/examples/obsolete/device/src/mouse_device_app.h b/examples/obsolete/device/src/mouse_device_app.h
index f39f8e30f..48bfb3315 100644
--- a/examples/obsolete/device/src/mouse_device_app.h
+++ b/examples/obsolete/device/src/mouse_device_app.h
@@ -53,7 +53,7 @@
extern "C" {
#endif
-#if TUSB_CFG_DEVICE_HID_MOUSE
+#if CFG_TUSB_DEVICE_HID_MOUSE
void mouse_app_init(void);
void mouse_app_task(void * param);
diff --git a/examples/obsolete/device/src/msc_device_app.c b/examples/obsolete/device/src/msc_device_app.c
index 5650d8b71..df78ccd6e 100644
--- a/examples/obsolete/device/src/msc_device_app.c
+++ b/examples/obsolete/device/src/msc_device_app.c
@@ -38,7 +38,7 @@
#include "msc_device_app.h"
-#if TUSB_CFG_DEVICE_MSC
+#if CFG_TUSB_DEVICE_MSC
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
diff --git a/examples/obsolete/device/src/msc_device_app.h b/examples/obsolete/device/src/msc_device_app.h
index cd087b8a3..185ceb260 100644
--- a/examples/obsolete/device/src/msc_device_app.h
+++ b/examples/obsolete/device/src/msc_device_app.h
@@ -50,7 +50,7 @@
extern "C" {
#endif
-#if TUSB_CFG_DEVICE_MSC
+#if CFG_TUSB_DEVICE_MSC
enum
{
@@ -63,7 +63,7 @@ enum
If you find any bugs or get any questions, feel free to file an\r\n\
issue at github.com/hathach/tinyusb"
-#if TUSB_CFG_MCU==MCU_LPC11UXX || TUSB_CFG_MCU==MCU_LPC13UXX
+#if CFG_TUSB_MCU==MCU_LPC11UXX || CFG_TUSB_MCU==MCU_LPC13UXX
#define MSCD_APP_ROMDISK
#else // defaults is ram disk
#define MSCD_APP_RAMDISK
diff --git a/examples/obsolete/device/src/msc_device_ramdisk.c b/examples/obsolete/device/src/msc_device_ramdisk.c
index 294e0b792..e2a7a110f 100644
--- a/examples/obsolete/device/src/msc_device_ramdisk.c
+++ b/examples/obsolete/device/src/msc_device_ramdisk.c
@@ -38,7 +38,7 @@
#include "msc_device_app.h"
-#if TUSB_CFG_DEVICE_MSC && defined (MSCD_APP_RAMDISK)
+#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_RAMDISK)
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
@@ -47,7 +47,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM
+CFG_TUSB_ATTR_USBRAM
uint8_t msc_device_ramdisk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
{
//------------- Boot Sector -------------//
diff --git a/examples/obsolete/device/src/msc_device_romdisk.c b/examples/obsolete/device/src/msc_device_romdisk.c
index 16c8fe518..9f80c8001 100644
--- a/examples/obsolete/device/src/msc_device_romdisk.c
+++ b/examples/obsolete/device/src/msc_device_romdisk.c
@@ -38,7 +38,7 @@
#include "msc_device_app.h"
-#if TUSB_CFG_DEVICE_MSC && defined (MSCD_APP_ROMDISK)
+#if CFG_TUSB_DEVICE_MSC && defined (MSCD_APP_ROMDISK)
//--------------------------------------------------------------------+
// INCLUDE
@@ -91,7 +91,7 @@ const uint8_t msc_device_app_rommdisk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
[3] = README_CONTENTS
};
-TUSB_CFG_ATTR_USBRAM
+CFG_TUSB_ATTR_USBRAM
static uint8_t sector_buffer[DISK_BLOCK_SIZE];
//--------------------------------------------------------------------+
diff --git a/examples/obsolete/device/src/tusb_config.h b/examples/obsolete/device/src/tusb_config.h
index f33fb46ba..6a841d28c 100644
--- a/examples/obsolete/device/src/tusb_config.h
+++ b/examples/obsolete/device/src/tusb_config.h
@@ -46,62 +46,62 @@
//--------------------------------------------------------------------+
// CONTROLLER CONFIGURATION
//--------------------------------------------------------------------+
-//#define TUSB_CFG_MCU will be passed from IDE/command line for easy board/mcu switching
+//#define CFG_TUSB_MCU will be passed from IDE/command line for easy board/mcu switching
-#define TUSB_CFG_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
-//#define TUSB_CFG_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
+#define CFG_TUSB_CONTROLLER_0_MODE (TUSB_MODE_DEVICE)
+//#define CFG_TUSB_CONTROLLER_1_MODE (TUSB_MODE_DEVICE)
//--------------------------------------------------------------------+
// DEVICE CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64
+#define CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE 64
//------------- CLASS -------------//
-#define TUSB_CFG_DEVICE_HID_KEYBOARD 1
-#define TUSB_CFG_DEVICE_HID_MOUSE 1
-#define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet
-#define TUSB_CFG_DEVICE_MSC 1
-#define TUSB_CFG_DEVICE_CDC 1
+#define CFG_TUSB_DEVICE_HID_KEYBOARD 1
+#define CFG_TUSB_DEVICE_HID_MOUSE 1
+#define CFG_TUSB_DEVICE_HID_GENERIC 0 // not supported yet
+#define CFG_TUSB_DEVICE_MSC 1
+#define CFG_TUSB_DEVICE_CDC 1
//--------------------------------------------------------------------+
// COMMON CONFIGURATION
//--------------------------------------------------------------------+
-#define TUSB_CFG_DEBUG 2
+#define CFG_TUSB_DEBUG 2
-//#define TUSB_CFG_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
-//#define TUSB_CFG_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
+//#define CFG_TUSB_OS TUSB_OS_NONE // be passed from IDE/command line for easy project switching
+//#define CFG_TUSB_OS_TASK_PRIO 0 // be passed from IDE/command line for easy project switching
//--------------------------------------------------------------------+
// USB RAM PLACEMENT
//--------------------------------------------------------------------+
#ifdef __CODE_RED // compiled with lpcxpresso
- #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
- #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(.data.$RAM2) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
- #elif TUSB_CFG_MCU == MCU_LPC175X_6X
- #define TUSB_CFG_ATTR_USBRAM // LPC17xx USB DMA can access all
- #elif (TUSB_CFG_MCU == MCU_LPC43XX)
- #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(.data.$RAM3)
+ #if (CFG_TUSB_MCU == MCU_LPC11UXX) || (CFG_TUSB_MCU == MCU_LPC13UXX)
+ #define CFG_TUSB_ATTR_USBRAM ATTR_SECTION(.data.$RAM2) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
+ #elif CFG_TUSB_MCU == MCU_LPC175X_6X
+ #define CFG_TUSB_ATTR_USBRAM // LPC17xx USB DMA can access all
+ #elif (CFG_TUSB_MCU == MCU_LPC43XX)
+ #define CFG_TUSB_ATTR_USBRAM ATTR_SECTION(.data.$RAM3)
#endif
#elif defined __CC_ARM // Compiled with Keil armcc, USBRAM_SECTION is defined in scatter files
- #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
- #define TUSB_CFG_ATTR_USBRAM ATTR_SECTION(USBRAM_SECTION) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
- #elif (TUSB_CFG_MCU == MCU_LPC175X_6X)
- #define TUSB_CFG_ATTR_USBRAM // LPC17xx USB DMA can access all address
- #elif (TUSB_CFG_MCU == MCU_LPC43XX)
- #define TUSB_CFG_ATTR_USBRAM // Use keil tool configure to have AHB SRAM as default memory
+ #if (CFG_TUSB_MCU == MCU_LPC11UXX) || (CFG_TUSB_MCU == MCU_LPC13UXX)
+ #define CFG_TUSB_ATTR_USBRAM ATTR_SECTION(USBRAM_SECTION) ATTR_ALIGNED(64) // lp11u & lp13u requires data to be 64 byte aligned
+ #elif (CFG_TUSB_MCU == MCU_LPC175X_6X)
+ #define CFG_TUSB_ATTR_USBRAM // LPC17xx USB DMA can access all address
+ #elif (CFG_TUSB_MCU == MCU_LPC43XX)
+ #define CFG_TUSB_ATTR_USBRAM // Use keil tool configure to have AHB SRAM as default memory
#endif
#elif defined __ICCARM__ // compiled with IAR
- #if (TUSB_CFG_MCU == MCU_LPC11UXX) || (TUSB_CFG_MCU == MCU_LPC13UXX)
- #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\"USB_PACKET_MEMORY\"") ATTR_ALIGNED(64)
- #elif (TUSB_CFG_MCU == MCU_LPC175X_6X)
- #define TUSB_CFG_ATTR_USBRAM
- #elif (TUSB_CFG_MCU == MCU_LPC43XX)
- #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
+ #if (CFG_TUSB_MCU == MCU_LPC11UXX) || (CFG_TUSB_MCU == MCU_LPC13UXX)
+ #define CFG_TUSB_ATTR_USBRAM _Pragma("location=\"USB_PACKET_MEMORY\"") ATTR_ALIGNED(64)
+ #elif (CFG_TUSB_MCU == MCU_LPC175X_6X)
+ #define CFG_TUSB_ATTR_USBRAM
+ #elif (CFG_TUSB_MCU == MCU_LPC43XX)
+ #define CFG_TUSB_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
#endif
#else
@@ -111,7 +111,7 @@
#endif
// LPC11uxx and LPC13uxx requires each buffer has to be 64-byte alignment
-#if TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX
+#if CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(64)
#elif defined NRF52840_XXAA
#define ATTR_USB_MIN_ALIGNMENT ATTR_ALIGNED(4)
diff --git a/examples/obsolete/device/src/tusb_descriptors.c b/examples/obsolete/device/src/tusb_descriptors.c
index bd279dc93..ca71d60e3 100644
--- a/examples/obsolete/device/src/tusb_descriptors.c
+++ b/examples/obsolete/device/src/tusb_descriptors.c
@@ -41,7 +41,7 @@
//--------------------------------------------------------------------+
// Keyboard Report Descriptor
//--------------------------------------------------------------------+
-#if TUSB_CFG_DEVICE_HID_KEYBOARD
+#if CFG_TUSB_DEVICE_HID_KEYBOARD
uint8_t const desc_keyboard_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_KEYBOARD ),
@@ -87,7 +87,7 @@ uint8_t const desc_keyboard_report[] = {
//--------------------------------------------------------------------+
// Mouse Report Descriptor
//--------------------------------------------------------------------+
-#if TUSB_CFG_DEVICE_HID_MOUSE
+#if CFG_TUSB_DEVICE_HID_MOUSE
uint8_t const desc_mouse_report[] = {
HID_USAGE_PAGE ( HID_USAGE_PAGE_DESKTOP ),
HID_USAGE ( HID_USAGE_DESKTOP_MOUSE ),
@@ -140,7 +140,7 @@ tusb_desc_device_t const desc_device =
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
- #if TUSB_CFG_DEVICE_CDC
+ #if CFG_TUSB_DEVICE_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)
.bDeviceClass = TUSB_CLASS_MISC,
@@ -152,7 +152,7 @@ tusb_desc_device_t const desc_device =
.bDeviceProtocol = 0x00,
#endif
- .bMaxPacketSize0 = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE,
+ .bMaxPacketSize0 = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE,
.idVendor = CFG_VENDORID,
.idProduct = CFG_PRODUCTID,
@@ -184,7 +184,7 @@ app_descriptor_configuration_t const desc_configuration =
.bMaxPower = TUSB_DESC_CONFIG_POWER_MA(500)
},
- #if TUSB_CFG_DEVICE_CDC
+ #if CFG_TUSB_DEVICE_CDC
// IAD points to CDC Interfaces
.cdc_iad =
{
@@ -296,7 +296,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif
//------------- HID Keyboard -------------//
- #if TUSB_CFG_DEVICE_HID_KEYBOARD
+ #if CFG_TUSB_DEVICE_HID_KEYBOARD
.keyboard_interface =
{
.bLength = sizeof(tusb_desc_interface_t),
@@ -333,7 +333,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif
//------------- HID Mouse -------------//
- #if TUSB_CFG_DEVICE_HID_MOUSE
+ #if CFG_TUSB_DEVICE_HID_MOUSE
.mouse_interface =
{
.bLength = sizeof(tusb_desc_interface_t),
@@ -370,7 +370,7 @@ app_descriptor_configuration_t const desc_configuration =
#endif
//------------- Mass Storage -------------//
- #if TUSB_CFG_DEVICE_MSC
+ #if CFG_TUSB_DEVICE_MSC
.msc_interface =
{
.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_string_arr = (uint8_t const **) string_descriptor_arr,
- #if TUSB_CFG_DEVICE_HID_KEYBOARD
+ #if CFG_TUSB_DEVICE_HID_KEYBOARD
.p_hid_keyboard_report = (uint8_t const *) desc_keyboard_report,
#endif
- #if TUSB_CFG_DEVICE_HID_MOUSE
+ #if CFG_TUSB_DEVICE_HID_MOUSE
.p_hid_mouse_report = (uint8_t const *) desc_mouse_report,
#endif
};
diff --git a/examples/obsolete/device/src/tusb_descriptors.h b/examples/obsolete/device/src/tusb_descriptors.h
index 0ef98e695..274ad00e2 100644
--- a/examples/obsolete/device/src/tusb_descriptors.h
+++ b/examples/obsolete/device/src/tusb_descriptors.h
@@ -50,22 +50,22 @@
// 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)
#ifndef CFG_PRODUCTID
- #define PRODUCTID_BITMAP(interface, n) ( (TUSB_CFG_DEVICE_##interface) << (n) )
+ #define PRODUCTID_BITMAP(interface, n) ( (CFG_TUSB_DEVICE_##interface) << (n) )
#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(MSC, 4) ) )
#endif
#define ITF_NUM_CDC 0
-#define INTERFACE_NO_HID_KEYBOARD (ITF_NUM_CDC + 2*(TUSB_CFG_DEVICE_CDC ? 1 : 0) )
-#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_KEYBOARD )
-#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + TUSB_CFG_DEVICE_HID_MOUSE )
-#define ITF_NUM_MSC (INTERFACE_NO_HID_GENERIC + TUSB_CFG_DEVICE_HID_GENERIC )
+#define INTERFACE_NO_HID_KEYBOARD (ITF_NUM_CDC + 2*(CFG_TUSB_DEVICE_CDC ? 1 : 0) )
+#define INTERFACE_NO_HID_MOUSE (INTERFACE_NO_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_KEYBOARD )
+#define INTERFACE_NO_HID_GENERIC (INTERFACE_NO_HID_MOUSE + CFG_TUSB_DEVICE_HID_MOUSE )
+#define ITF_NUM_MSC (INTERFACE_NO_HID_GENERIC + CFG_TUSB_DEVICE_HID_GENERIC )
-#define ITF_TOTAL (2*TUSB_CFG_DEVICE_CDC + TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + \
- TUSB_CFG_DEVICE_HID_GENERIC + TUSB_CFG_DEVICE_MSC)
+#define ITF_TOTAL (2*CFG_TUSB_DEVICE_CDC + CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + \
+ CFG_TUSB_DEVICE_HID_GENERIC + CFG_TUSB_DEVICE_MSC)
-#if (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX) && (ITF_TOTAL > 4)
+#if (CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX) && (ITF_TOTAL > 4)
#error These MCUs do not have enough number of endpoints for the current configuration
#endif
@@ -75,7 +75,7 @@
#define EDPT_IN(x) (0x80 | (x))
#define EDPT_OUT(x) (x)
-#if TUSB_CFG_MCU == MCU_LPC175X_6X // MCUs's endpoint number has a fixed type
+#if CFG_TUSB_MCU == MCU_LPC175X_6X // MCUs's endpoint number has a fixed type
//------------- CDC -------------//
#define CDC_EDPT_NOTIF EDPT_IN (1)
@@ -125,7 +125,7 @@
#endif
-#define MSC_EDPT_PACKETSIZE (TUSB_CFG_MCU == MCU_LPC43XX ? 512 : 64)
+#define MSC_EDPT_PACKETSIZE (CFG_TUSB_MCU == MCU_LPC43XX ? 512 : 64)
//--------------------------------------------------------------------+
// CONFIGURATION DESCRIPTOR
@@ -135,7 +135,7 @@ typedef struct ATTR_PACKED
tusb_desc_configuration_t configuration;
//------------- CDC -------------//
-#if TUSB_CFG_DEVICE_CDC
+#if CFG_TUSB_DEVICE_CDC
tusb_desc_interface_assoc_t cdc_iad;
//CDC Control Interface
@@ -153,21 +153,21 @@ typedef struct ATTR_PACKED
#endif
//------------- HID Keyboard -------------//
-#if TUSB_CFG_DEVICE_HID_KEYBOARD
+#if CFG_TUSB_DEVICE_HID_KEYBOARD
tusb_desc_interface_t keyboard_interface;
tusb_hid_descriptor_hid_t keyboard_hid;
tusb_desc_endpoint_t keyboard_endpoint;
#endif
//------------- HID Mouse -------------//
-#if TUSB_CFG_DEVICE_HID_MOUSE
+#if CFG_TUSB_DEVICE_HID_MOUSE
tusb_desc_interface_t mouse_interface;
tusb_hid_descriptor_hid_t mouse_hid;
tusb_desc_endpoint_t mouse_endpoint;
#endif
//------------- Mass Storage -------------//
-#if TUSB_CFG_DEVICE_MSC
+#if CFG_TUSB_DEVICE_MSC
tusb_desc_interface_t msc_interface;
tusb_desc_endpoint_t msc_endpoint_in;
tusb_desc_endpoint_t msc_endpoint_out;
diff --git a/examples/obsolete/host/host_freertos/.cproject b/examples/obsolete/host/host_freertos/.cproject
index fe0ec307f..fc0a70c7b 100644
--- a/examples/obsolete/host/host_freertos/.cproject
+++ b/examples/obsolete/host/host_freertos/.cproject
@@ -35,10 +35,10 @@
-
+
-
-
+
+
@@ -134,10 +134,10 @@
-
+
-
-
+
+
@@ -231,9 +231,9 @@
-
+
-
+
@@ -305,10 +305,10 @@
-
+
-
-
+
+
@@ -422,10 +422,10 @@
-
+
-
-
+
+
diff --git a/examples/obsolete/host/host_os_none/.cproject b/examples/obsolete/host/host_os_none/.cproject
index 3852d5d35..f282a4abe 100644
--- a/examples/obsolete/host/host_os_none/.cproject
+++ b/examples/obsolete/host/host_os_none/.cproject
@@ -34,9 +34,9 @@
-
+
-
+
@@ -128,9 +128,9 @@
-
+
-
+
@@ -223,9 +223,9 @@
-
+
-
+
@@ -315,9 +315,9 @@
-
+
-
+
diff --git a/examples/obsolete/host/src/app_os_prio.h b/examples/obsolete/host/src/app_os_prio.h
index 99be2de0c..5eacd4c1e 100644
--- a/examples/obsolete/host/src/app_os_prio.h
+++ b/examples/obsolete/host/src/app_os_prio.h
@@ -53,18 +53,18 @@
#include "tusb.h"
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
#define LOWER_PRIO(x) 0 // does not matter
-#elif TUSB_CFG_OS == TUSB_OS_FREERTOS
+#elif CFG_TUSB_OS == TUSB_OS_FREERTOS
#define LOWER_PRIO(x) ((x)-1) // freeRTOS lower number --> lower priority
-#elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX
+#elif CFG_TUSB_OS == TUSB_OS_CMSIS_RTX
#define LOWER_PRIO(x) ((x)-1) // CMSIS-RTOS lower number --> lower priority
#else
#error Priority is not configured for this RTOS
#endif
enum {
- STANDARD_APP_TASK_PRIO = LOWER_PRIO(TUSB_CFG_OS_TASK_PRIO), // Application Task is lower than usb system task
+ STANDARD_APP_TASK_PRIO = LOWER_PRIO(CFG_TUSB_OS_TASK_PRIO), // Application Task is lower than usb system task
LED_BLINKING_APP_TASK_PRIO = LOWER_PRIO(STANDARD_APP_TASK_PRIO), // Blinking task is lower than normal task
KEYBOARD_APP_TASK_PRIO = STANDARD_APP_TASK_PRIO,
diff --git a/examples/obsolete/host/src/cdc_serial_host_app.c b/examples/obsolete/host/src/cdc_serial_host_app.c
index 1ab3f409b..0782d0518 100644
--- a/examples/obsolete/host/src/cdc_serial_host_app.c
+++ b/examples/obsolete/host/src/cdc_serial_host_app.c
@@ -39,7 +39,7 @@
#include "cdc_serial_host_app.h"
#include "app_os_prio.h"
-#if TUSB_CFG_HOST_CDC
+#if CFG_TUSB_HOST_CDC
#define QUEUE_SERIAL_DEPTH 100
@@ -49,8 +49,8 @@
static osal_semaphore_t sem_hdl;
enum { SERIAL_BUFFER_SIZE = 64 };
-TUSB_CFG_ATTR_USBRAM static uint8_t serial_in_buffer[SERIAL_BUFFER_SIZE];
-TUSB_CFG_ATTR_USBRAM static uint8_t serial_out_buffer[SERIAL_BUFFER_SIZE];
+CFG_TUSB_ATTR_USBRAM static uint8_t serial_in_buffer[SERIAL_BUFFER_SIZE];
+CFG_TUSB_ATTR_USBRAM static uint8_t serial_out_buffer[SERIAL_BUFFER_SIZE];
static uint8_t received_bytes; // set by transfer complete callback
@@ -126,7 +126,7 @@ void cdc_serial_host_app_task( void* param )
OSAL_TASK_BEGIN
//------------- send characters got from uart terminal to the first CDC device -------------//
- for(uint8_t dev_addr=1; dev_addr <= TUSB_CFG_HOST_DEVICE_MAX; dev_addr++)
+ for(uint8_t dev_addr=1; dev_addr <= CFG_TUSB_HOST_DEVICE_MAX; dev_addr++)
{
if ( tuh_cdc_serial_is_mounted(dev_addr) )
{
@@ -152,7 +152,7 @@ void cdc_serial_host_app_task( void* param )
{
for(uint8_t i=0; i change to other drive
- for(uint8_t i=0; i move to AHB ram
- #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".sram\"")
- #elif (TUSB_CFG_MCU == MCU_LPC43XX)
- #define TUSB_CFG_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
+ #define CFG_TUSB_ATTR_USBRAM _Pragma("location=\".sram\"")
+ #elif (CFG_TUSB_MCU == MCU_LPC43XX)
+ #define CFG_TUSB_ATTR_USBRAM _Pragma("location=\".ahb_sram1\"")
#endif
#else
diff --git a/examples/readme.md b/examples/readme.md
index 6e87b4f45..407638da7 100644
--- a/examples/readme.md
+++ b/examples/readme.md
@@ -55,7 +55,7 @@ IAR is just as easy as Keil
## Configure demo
-Application demo is written to have the code excluded if its required option is not enabled in [tusb_config.h](). Some of combination may exceed the 32KB limit of IAR/Keil so you may want to re-configure to disable some class support, decrease TUSB_CFG_DEBUG or increase the compiler optimization level.
+Application demo is written to have the code excluded if its required option is not enabled in [tusb_config.h](). Some of combination may exceed the 32KB limit of IAR/Keil so you may want to re-configure to disable some class support, decrease CFG_TUSB_DEBUG or increase the compiler optimization level.
In addition, there are some configuration you can change such as
diff --git a/hw/bsp/ea4357/board_ea4357.c b/hw/bsp/ea4357/board_ea4357.c
index 549eb70f7..fdb8adb8b 100644
--- a/hw/bsp/ea4357/board_ea4357.c
+++ b/hw/bsp/ea4357/board_ea4357.c
@@ -68,7 +68,7 @@ enum {
/*------------------------------------------------------------------*/
/* TUSB HAL MILLISECOND
*------------------------------------------------------------------*/
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
volatile uint32_t system_ticks = 0;
@@ -91,7 +91,7 @@ void board_init(void)
{
CGU_Init();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
@@ -99,7 +99,7 @@ void board_init(void)
// USB0 Power: EA4357 channel B U20 GPIO26 active low (base board), P2_3 on LPC4357
scu_pinmux(0x02, 3, MD_PUP | MD_EZI, FUNC7); // USB0 VBus Power
- #if TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE
+ #if CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_DEVICE
scu_pinmux(0x09, 5, GPIO_PDN, FUNC4); // P9_5 (GPIO5[18]) (GPIO28 on oem base) as USB connect, active low.
GPIO_SetDir(5, BIT_(18), 1);
#endif
diff --git a/hw/bsp/keil/board_mcb4300.c b/hw/bsp/keil/board_mcb4300.c
index b9a3f4144..55d0dc6ba 100644
--- a/hw/bsp/keil/board_mcb4300.c
+++ b/hw/bsp/keil/board_mcb4300.c
@@ -74,7 +74,7 @@ void board_init(void)
{
CGU_Init();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/lpcxpresso/board_lpclink2.c b/hw/bsp/lpcxpresso/board_lpclink2.c
index 5f6f18cb6..f5dc00e00 100644
--- a/hw/bsp/lpcxpresso/board_lpclink2.c
+++ b/hw/bsp/lpcxpresso/board_lpclink2.c
@@ -56,7 +56,7 @@ void board_init(void)
{
CGU_Init();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c
index 79df45a36..a93ee21e0 100644
--- a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c
+++ b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.c
@@ -67,7 +67,7 @@ void board_init(void)
{
SystemInit();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
index 5796c2341..ba21a287e 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.c
@@ -58,7 +58,7 @@ void board_init(void)
{
SystemInit();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
index c0a870d7e..2730e1768 100644
--- a/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
+++ b/hw/bsp/lpcxpresso1347/board_lpcxpresso1347.c
@@ -68,7 +68,7 @@ void board_init(void)
{
SystemInit();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
index 7aceb87f4..ba465e224 100644
--- a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
+++ b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
@@ -67,7 +67,7 @@ void board_init(void)
{
SystemInit();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
#endif
diff --git a/hw/bsp/ngx/board_ngx4330.c b/hw/bsp/ngx/board_ngx4330.c
index 63c72756e..41c0beddc 100644
--- a/hw/bsp/ngx/board_ngx4330.c
+++ b/hw/bsp/ngx/board_ngx4330.c
@@ -70,7 +70,7 @@ void board_init(void)
{
CGU_Init();
-#if TUSB_CFG_OS == TUSB_OS_NONE // TODO may move to main.c
+#if CFG_TUSB_OS == TUSB_OS_NONE // TODO may move to main.c
SysTick_Config( CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)/BOARD_TICKS_HZ ); /* 1 ms Timer */
#endif
diff --git a/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c b/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c
index e8b204639..f7998d5af 100644
--- a/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c
+++ b/hw/mcu/nxp/lpc11uxx/hal_mcu/hal_lpc11uxx.c
@@ -39,7 +39,7 @@
#include "common/tusb_common.h"
#include "hal.h"
-#if TUSB_CFG_MCU == MCU_LPC11UXX
+#if CFG_TUSB_MCU == MCU_LPC11UXX
void tusb_hal_int_enable(uint8_t rhport)
{
diff --git a/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c b/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c
index 89136da97..265729aa9 100644
--- a/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c
+++ b/hw/mcu/nxp/lpc13uxx/hal_mcu/hal_lpc13uxx.c
@@ -39,7 +39,7 @@
#include "common/tusb_common.h"
#include "hal.h"
-#if TUSB_CFG_MCU == MCU_LPC13UXX
+#if CFG_TUSB_MCU == MCU_LPC13UXX
void tusb_hal_int_enable(uint8_t rhport)
{
diff --git a/readme.markdown b/readme.markdown
index 0715adfd4..47eaa419b 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -45,7 +45,7 @@ In addition to running without an RTOS, tinyusb is an OS-awared stack that can r
### RTOS ###
-Currently the following OS are supported with tinyusb out of the box with a simple change of TUSB_CFG_OS macro.
+Currently the following OS are supported with tinyusb out of the box with a simple change of CFG_TUSB_OS macro.
- **None OS**
- **FreeRTOS**
diff --git a/tests/.cproject b/tests/.cproject
index 8e5a14e6f..9aae91f8c 100644
--- a/tests/.cproject
+++ b/tests/.cproject
@@ -33,7 +33,7 @@
-
+
diff --git a/tests/lpc175x_6x/project.yml b/tests/lpc175x_6x/project.yml
index f878423fe..10cf23cf3 100644
--- a/tests/lpc175x_6x/project.yml
+++ b/tests/lpc175x_6x/project.yml
@@ -42,7 +42,7 @@
# 1) remove the trailing [] from the :common: section
# 2) add entries to the :common: section (e.g. :test: has TEST defined)
:commmon: &common_defines
- - TUSB_CFG_MCU=MCU_LPC175X_6X -std=gnu99
+ - CFG_TUSB_MCU=MCU_LPC175X_6X -std=gnu99
# - -mx32
- CORE_M4
- __CODE_RED
diff --git a/tests/lpc175x_6x/test/test_usbd.c b/tests/lpc175x_6x/test/test_usbd.c
index 69ba8c151..6ace0085b 100644
--- a/tests/lpc175x_6x/test/test_usbd.c
+++ b/tests/lpc175x_6x/test/test_usbd.c
@@ -128,26 +128,26 @@ void test_usbd_string_descriptor(void)
//------------- manufacturer string descriptor -------------//
- uint32_t const manufacturer_len = sizeof(TUSB_CFG_DEVICE_STRING_MANUFACTURER) - 1;
+ uint32_t const manufacturer_len = sizeof(CFG_TUSB_DEVICE_STRING_MANUFACTURER) - 1;
TEST_ASSERT_EQUAL(manufacturer_len*2 + 2, app_tusb_desc_strings.manufacturer.bLength);
for(uint32_t i=0; ibRequest);
TEST_ASSERT_EQUAL(TUSB_DESC_TYPE_CONFIGURATION, p_request->wValue >> 8);
- TEST_ASSERT_EQUAL(TUSB_CFG_HOST_ENUM_BUFFER_SIZE, p_request->wLength);
+ TEST_ASSERT_EQUAL(CFG_TUSB_HOST_ENUM_BUFFER_SIZE, p_request->wLength);
memcpy(data, &desc_configuration, p_request->wLength);
break;
diff --git a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
index cede93fd2..7b99b013a 100644
--- a/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
+++ b/tests/lpc18xx_43xx/test/host/usbh/test_usbh.c
@@ -56,7 +56,7 @@
uint8_t dev_addr;
void setUp(void)
{
- dev_addr = RANDOM(TUSB_CFG_HOST_DEVICE_MAX)+1;
+ dev_addr = RANDOM(CFG_TUSB_HOST_DEVICE_MAX)+1;
}
void tearDown(void)
@@ -70,7 +70,7 @@ void test_usbh_status_get_fail(void)
{
usbh_devices[dev_addr].state = 0;
- TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_INVALID_PARAMETER, tusbh_device_get_state(TUSB_CFG_HOST_DEVICE_MAX+1) );
+ TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_INVALID_PARAMETER, tusbh_device_get_state(CFG_TUSB_HOST_DEVICE_MAX+1) );
TEST_ASSERT_EQUAL( TUSB_DEVICE_STATE_UNPLUG, tusbh_device_get_state(dev_addr) );
}
@@ -134,7 +134,7 @@ void test_usbh_init_ok(void)
//------------- code under test -------------//
TEST_ASSERT_EQUAL(TUSB_ERROR_NONE, usbh_init());
- for (uint8_t i=0; ibInterfaceSubClass )
{
- #if TUSB_CFG_HOST_HID_KEYBOARD
+ #if CFG_TUSB_HOST_HID_KEYBOARD
if ( HID_PROTOCOL_KEYBOARD == p_interface_desc->bInterfaceProtocol)
{
STASK_ASSERT_ERR ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &keyboardh_data[dev_addr-1]) );
@@ -230,7 +230,7 @@ tusb_error_t hidh_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_
} else
#endif
- #if TUSB_CFG_HOST_HID_MOUSE
+ #if CFG_TUSB_HOST_HID_MOUSE
if ( HID_PROTOCOL_MOUSE == p_interface_desc->bInterfaceProtocol)
{
STASK_ASSERT_ERR ( hidh_interface_open(dev_addr, p_interface_desc->bInterfaceNumber, p_endpoint_desc, &mouseh_data[dev_addr-1]) );
@@ -255,7 +255,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
{
(void) xferred_bytes; // TODO may need to use this para later
-#if TUSB_CFG_HOST_HID_KEYBOARD
+#if CFG_TUSB_HOST_HID_KEYBOARD
if ( pipehandle_is_equal(pipe_hdl, keyboardh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
tuh_hid_keyboard_isr(pipe_hdl.dev_addr, event);
@@ -263,7 +263,7 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
}
#endif
-#if TUSB_CFG_HOST_HID_MOUSE
+#if CFG_TUSB_HOST_HID_MOUSE
if ( pipehandle_is_equal(pipe_hdl, mouseh_data[pipe_hdl.dev_addr-1].pipe_hdl) )
{
tuh_hid_mouse_isr(pipe_hdl.dev_addr, event);
@@ -271,14 +271,14 @@ void hidh_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes
}
#endif
-#if TUSB_CFG_HOST_HID_GENERIC
+#if CFG_TUSB_HOST_HID_GENERIC
#endif
}
void hidh_close(uint8_t dev_addr)
{
-#if TUSB_CFG_HOST_HID_KEYBOARD
+#if CFG_TUSB_HOST_HID_KEYBOARD
if ( pipehandle_is_valid( keyboardh_data[dev_addr-1].pipe_hdl ) )
{
hidh_interface_close(&keyboardh_data[dev_addr-1]);
@@ -286,7 +286,7 @@ void hidh_close(uint8_t dev_addr)
}
#endif
-#if TUSB_CFG_HOST_HID_MOUSE
+#if CFG_TUSB_HOST_HID_MOUSE
if( pipehandle_is_valid( mouseh_data[dev_addr-1].pipe_hdl ) )
{
hidh_interface_close(&mouseh_data[dev_addr-1]);
@@ -294,7 +294,7 @@ void hidh_close(uint8_t dev_addr)
}
#endif
-#if TUSB_CFG_HOST_HID_GENERIC
+#if CFG_TUSB_HOST_HID_GENERIC
hidh_generic_close(dev_addr);
#endif
}
diff --git a/tinyusb/class/hid/hid_host.h b/tinyusb/class/hid/hid_host.h
index c52f4b6de..b93bcdccb 100644
--- a/tinyusb/class/hid/hid_host.h
+++ b/tinyusb/class/hid/hid_host.h
@@ -80,7 +80,7 @@ bool tuh_hid_keyboard_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNU
/** \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)
+ * \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref CFG_TUSB_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
@@ -145,7 +145,7 @@ bool tuh_hid_mouse_is_busy(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED
/** \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)
+ * \param[in,out] p_report address that is used to store data from device. Must be accessible by usb controller (see \ref CFG_TUSB_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
diff --git a/tinyusb/class/msc/msc_device.c b/tinyusb/class/msc/msc_device.c
index 3e9008a90..0d7fa4f71 100644
--- a/tinyusb/class/msc/msc_device.c
+++ b/tinyusb/class/msc/msc_device.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if (MODE_DEVICE_SUPPORTED && TUSB_CFG_DEVICE_MSC)
+#if (MODE_DEVICE_SUPPORTED && CFG_TUSB_DEVICE_MSC)
#define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+
@@ -64,7 +64,7 @@ typedef struct {
uint8_t scsi_data[64];
ATTR_USB_MIN_ALIGNMENT msc_cbw_t cbw;
-#if defined (__ICCARM__) && (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX)
+#if defined (__ICCARM__) && (CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX)
uint8_t padding1[64-sizeof(msc_cbw_t)]; // IAR cannot align struct's member
#endif
@@ -79,7 +79,7 @@ typedef struct {
uint16_t xferred_len; // numbered of bytes transferred so far in the Data Stage
}mscd_interface_t;
-TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT STATIC_VAR mscd_interface_t mscd_data;
+CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT STATIC_VAR mscd_interface_t mscd_data;
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
diff --git a/tinyusb/class/msc/msc_device.h b/tinyusb/class/msc/msc_device.h
index 8176e7ea6..1d7b11aec 100644
--- a/tinyusb/class/msc/msc_device.h
+++ b/tinyusb/class/msc/msc_device.h
@@ -64,7 +64,7 @@
* \param[in] rhport USB Controller ID
* \param[in] lun Targeted Logical Unit
* \param[out] pp_buffer Pointer to buffer which application need to update with the response data's address.
- * Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
+ * Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM)
* \param[in] lba Starting Logical Block Address to be read
* \param[in] block_count Number of requested block
* \retval non-zero Actual number of block that application processed, must be less than or equal to \a \b block_count.
@@ -82,7 +82,7 @@ uint16_t tud_msc_read10_cb (uint8_t rhport, uint8_t lun, void** pp_buffer, uint3
* \param[in] rhport USB Controller ID
* \param[in] lun Targeted Logical Unit
* \param[out] pp_buffer Pointer to buffer which application need to update with the address to hold data from host
- * Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
+ * Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM)
* \param[in] lba Starting Logical Block Address to be write
* \param[in] block_count Number of requested block
* \retval non-zero Actual number of block that application can receive and must be less than or equal to \a \b block_count.
diff --git a/tinyusb/class/msc/msc_host.c b/tinyusb/class/msc/msc_host.c
index c0b643076..dcdfa4d53 100644
--- a/tinyusb/class/msc/msc_host.c
+++ b/tinyusb/class/msc/msc_host.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if MODE_HOST_SUPPORTED & TUSB_CFG_HOST_MSC
+#if MODE_HOST_SUPPORTED & CFG_TUSB_HOST_MSC
#define _TINY_USB_SOURCE_FILE_
@@ -51,13 +51,13 @@
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM STATIC_VAR msch_interface_t msch_data[TUSB_CFG_HOST_DEVICE_MAX];
+CFG_TUSB_ATTR_USBRAM STATIC_VAR msch_interface_t msch_data[CFG_TUSB_HOST_DEVICE_MAX];
//------------- Initalization Data -------------//
static osal_semaphore_t msch_sem_hdl;
// buffer used to read scsi information when mounted, largest response data currently is inquiry
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) STATIC_VAR uint8_t msch_buffer[sizeof(scsi_inquiry_data_t)];
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) STATIC_VAR uint8_t msch_buffer[sizeof(scsi_inquiry_data_t)];
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
@@ -288,7 +288,7 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe
//--------------------------------------------------------------------+
void msch_init(void)
{
- memclr_(msch_data, sizeof(msch_interface_t)*TUSB_CFG_HOST_DEVICE_MAX);
+ memclr_(msch_data, sizeof(msch_interface_t)*CFG_TUSB_HOST_DEVICE_MAX);
msch_sem_hdl = osal_semaphore_create(1, 0);
}
diff --git a/tinyusb/class/msc/msc_host.h b/tinyusb/class/msc/msc_host.h
index 049db97ce..dce275fc8 100644
--- a/tinyusb/class/msc/msc_host.h
+++ b/tinyusb/class/msc/msc_host.h
@@ -104,7 +104,7 @@ tusb_error_t tuh_msc_get_capacity(uint8_t dev_addr, uint32_t* p_last_lba, uint32
/** \brief Perform SCSI READ 10 command to read data from MassStorage device
* \param[in] dev_addr device address
* \param[in] lun Targeted Logical Unit
- * \param[out] p_buffer Buffer used to store data read from device. Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
+ * \param[out] p_buffer Buffer used to store data read from device. Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM)
* \param[in] lba Starting Logical Block Address to be read
* \param[in] block_count Number of Block to be read
* \retval TUSB_ERROR_NONE on success
@@ -118,7 +118,7 @@ tusb_error_t tuh_msc_read10 (uint8_t dev_addr, uint8_t lun, void * p_buffer, uin
/** \brief Perform SCSI WRITE 10 command to write data to MassStorage device
* \param[in] dev_addr device address
* \param[in] lun Targeted Logical Unit
- * \param[in] p_buffer Buffer containing data. Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
+ * \param[in] p_buffer Buffer containing data. Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM)
* \param[in] lba Starting Logical Block Address to be written
* \param[in] block_count Number of Block to be written
* \retval TUSB_ERROR_NONE on success
@@ -132,7 +132,7 @@ tusb_error_t tuh_msc_write10(uint8_t dev_addr, uint8_t lun, void const * p_buffe
/** \brief Perform SCSI REQUEST SENSE command, used to retrieve sense data from MassStorage device
* \param[in] dev_addr device address
* \param[in] lun Targeted Logical Unit
- * \param[in] p_data Buffer to store response's data from device. Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM)
+ * \param[in] p_data Buffer to store response's data from device. Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM)
* \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)
diff --git a/tinyusb/common/tusb_compiler.h b/tinyusb/common/tusb_compiler.h
index 8c0e75029..369c3121a 100644
--- a/tinyusb/common/tusb_compiler.h
+++ b/tinyusb/common/tusb_compiler.h
@@ -65,7 +65,7 @@
#endif
// allow debugger to watch any module-wide variables anywhere
-#if TUSB_CFG_DEBUG
+#if CFG_TUSB_DEBUG
#define STATIC_VAR
#else
#define STATIC_VAR static
diff --git a/tinyusb/common/tusb_error.h b/tinyusb/common/tusb_error.h
index 96684ef5f..339f6ced1 100644
--- a/tinyusb/common/tusb_error.h
+++ b/tinyusb/common/tusb_error.h
@@ -100,8 +100,8 @@ typedef enum
TUSB_ERROR_COUNT
}tusb_error_t;
-#if TUSB_CFG_DEBUG
-/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
+#if CFG_TUSB_DEBUG
+/// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG > 0
extern char const* const tusb_strerr[TUSB_ERROR_COUNT];
#endif
diff --git a/tinyusb/common/tusb_fifo.h b/tinyusb/common/tusb_fifo.h
index 8054f315c..217781c9c 100644
--- a/tinyusb/common/tusb_fifo.h
+++ b/tinyusb/common/tusb_fifo.h
@@ -57,7 +57,7 @@
#include "osal/osal.h"
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
// Since all fifo read/write is done in thread mode, there should be
// no conflict except for osal queue which will be address seperatedly.
// Therefore there may be no need for mutex with internal use of fifo
diff --git a/tinyusb/common/tusb_verify.h b/tinyusb/common/tusb_verify.h
index 516a30a75..4a9ac2d36 100644
--- a/tinyusb/common/tusb_verify.h
+++ b/tinyusb/common/tusb_verify.h
@@ -60,7 +60,7 @@
//--------------------------------------------------------------------+
// VERIFY Helper
//--------------------------------------------------------------------+
-#if TUSB_CFG_DEBUG >= 1
+#if CFG_TUSB_DEBUG >= 1
#define _MESS_ERR(_err) printf("%s: %d: failed, error = %s\n", __PRETTY_FUNCTION__, __LINE__, tusb_strerr[_err])
#define _MESS_FAILED() printf("%s: %d: failed\n", __PRETTY_FUNCTION__, __LINE__)
#else
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index d18cb258a..23bf971d3 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -76,7 +76,7 @@ typedef struct {
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
-TUSB_CFG_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT uint8_t usbd_enum_buffer[TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE];
+CFG_TUSB_ATTR_USBRAM ATTR_USB_MIN_ALIGNMENT uint8_t usbd_enum_buffer[CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE];
static usbd_class_driver_t const usbd_class_drivers[] =
{
@@ -93,7 +93,7 @@ static usbd_class_driver_t const usbd_class_drivers[] =
},
#endif
- #if TUSB_CFG_DEVICE_MSC
+ #if CFG_TUSB_DEVICE_MSC
[TUSB_CLASS_MSC] =
{
.init = mscd_init,
@@ -106,7 +106,7 @@ static usbd_class_driver_t const usbd_class_drivers[] =
},
#endif
- #if TUSB_CFG_DEVICE_CDC
+ #if CFG_TUSB_DEVICE_CDC
[TUSB_CLASS_CDC] =
{
.init = cdcd_init,
@@ -184,8 +184,8 @@ VERIFY_STATIC(sizeof(usbd_task_event_t) <= 12, "size is not correct");
#define TUC_DEVICE_STACKSIZE 150
#endif
-#ifndef TUSB_CFG_OS_TASK_PRIO
-#define TUSB_CFG_OS_TASK_PRIO 0
+#ifndef CFG_TUSB_OS_TASK_PRIO
+#define CFG_TUSB_OS_TASK_PRIO 0
#endif
@@ -200,11 +200,11 @@ static tusb_error_t usbd_main_st(void);
tusb_error_t usbd_init (void)
{
- #if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
+ #if (CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
dcd_init(0);
#endif
- #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
+ #if (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
dcd_init(1);
#endif
@@ -215,7 +215,7 @@ tusb_error_t usbd_init (void)
_usbd_ctrl_sem = osal_semaphore_create(1, 0);
VERIFY(_usbd_q, TUSB_ERROR_OSAL_SEMAPHORE_FAILED);
- osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, TUSB_CFG_OS_TASK_PRIO);
+ osal_task_create(usbd_task, "usbd", TUC_DEVICE_STACKSIZE, NULL, CFG_TUSB_OS_TASK_PRIO);
//------------- Descriptor Check -------------//
TU_ASSERT(tusbd_descriptor_pointers.p_device != NULL && tusbd_descriptor_pointers.p_configuration != NULL, TUSB_ERROR_DESCRIPTOR_CORRUPTED);
@@ -489,7 +489,7 @@ static uint16_t get_descriptor(uint8_t rhport, tusb_control_request_t const * co
// up to Host's length
len = min16_of(p_request->wLength, len );
- TU_ASSERT( len <= TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE, 0);
+ TU_ASSERT( len <= CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE, 0);
memcpy(usbd_enum_buffer, desc_data, len);
(*pp_buffer) = usbd_enum_buffer;
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h
index a2559d880..3f8fc1be9 100644
--- a/tinyusb/device/usbd.h
+++ b/tinyusb/device/usbd.h
@@ -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_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 TUSB_CFG_DEVICE_HID_KEYBOARD is enabled
- uint8_t const * p_hid_mouse_report; ///< pointer to HID report descriptor of Mouse interface. Only needed if TUSB_CFG_DEVICE_HID_MOUSE is enabled
+ 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_mouse_report; ///< pointer to HID report descriptor of Mouse interface. Only needed if CFG_TUSB_DEVICE_HID_MOUSE is enabled
}tusbd_descriptor_pointer_t;
// define by application
diff --git a/tinyusb/host/ehci/ehci.c b/tinyusb/host/ehci/ehci.c
index 0686748f4..f1b2c7f92 100644
--- a/tinyusb/host/ehci/ehci.c
+++ b/tinyusb/host/ehci/ehci.c
@@ -38,7 +38,7 @@
#include "common/tusb_common.h"
-#if MODE_HOST_SUPPORTED && (TUSB_CFG_MCU == MCU_LPC43XX || TUSB_CFG_MCU == MCU_LPC18XX)
+#if MODE_HOST_SUPPORTED && (CFG_TUSB_MCU == MCU_LPC43XX || CFG_TUSB_MCU == MCU_LPC18XX)
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
@@ -57,20 +57,20 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM STATIC_VAR ehci_data_t ehci_data;
+CFG_TUSB_ATTR_USBRAM STATIC_VAR ehci_data_t ehci_data;
#if EHCI_PERIODIC_LIST
- #if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
- TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE];
+ #if (CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_HOST)
+ CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE];
#ifndef __ICCARM__ // IAR cannot able to determine the alignment with datalignment pragma
VERIFY_STATIC( ALIGN_OF(period_frame_list0) == 4096, "Period Framelist must be 4k alginment"); // validation
#endif
#endif
- #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
- TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE];
+ #if (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST)
+ CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4096) STATIC_VAR ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE];
#ifndef __ICCARM__ // IAR cannot able to determine the alignment with datalignment pragma
VERIFY_STATIC( ALIGN_OF(period_frame_list1) == 4096, "Period Framelist must be 4k alginment"); // validation
@@ -133,11 +133,11 @@ tusb_error_t hcd_init(void)
//------------- Data Structure init -------------//
memclr_(&ehci_data, sizeof(ehci_data_t));
- #if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
+ #if (CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_HOST)
ASSERT_ERR (hcd_controller_init(0));
#endif
- #if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
+ #if (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST)
ASSERT_ERR (hcd_controller_init(1));
#endif
@@ -511,7 +511,7 @@ static void async_advance_isr(ehci_qhd_t * const async_head)
usbh_devices[0].state = TUSB_DEVICE_STATE_UNPLUG;
}
- for(uint8_t relative_dev_addr=0; relative_dev_addr < TUSB_CFG_HOST_DEVICE_MAX; relative_dev_addr++)
+ for(uint8_t relative_dev_addr=0; relative_dev_addr < CFG_TUSB_HOST_DEVICE_MAX; relative_dev_addr++)
{
// check if control endpoint is removing
ehci_qhd_t *p_control_qhd = &ehci_data.device[relative_dev_addr].control.qhd;
@@ -592,7 +592,7 @@ static void async_list_xfer_complete_isr(ehci_qhd_t * const async_head)
}
p_qhd = qhd_next(p_qhd);
max_loop++;
- }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX); // async list traversal, stop if loop around
+ }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*CFG_TUSB_HOST_DEVICE_MAX); // async list traversal, stop if loop around
// TODO abstract max loop guard for async
}
@@ -606,7 +606,7 @@ static void period_list_xfer_complete_isr(uint8_t hostid, uint8_t interval_ms)
// TODO abstract max loop guard for period
while( !next_item.terminate &&
!(interval_ms > 1 && period_1ms_addr == align32(next_item.address)) &&
- max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*TUSB_CFG_HOST_DEVICE_MAX)
+ max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*CFG_TUSB_HOST_DEVICE_MAX)
{
switch ( next_item.type )
{
@@ -691,7 +691,7 @@ static void xfer_error_isr(uint8_t hostid)
qhd_xfer_error_isr( p_qhd );
p_qhd = qhd_next(p_qhd);
max_loop++;
- }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX); // async list traversal, stop if loop around
+ }while(p_qhd != async_head && max_loop < HCD_MAX_ENDPOINT*CFG_TUSB_HOST_DEVICE_MAX); // async list traversal, stop if loop around
#if EHCI_PERIODIC_LIST
//------------- TODO refractor period list -------------//
@@ -704,7 +704,7 @@ static void xfer_error_isr(uint8_t hostid)
// TODO abstract max loop guard for period
while( !next_item.terminate &&
!(interval_ms > 1 && period_1ms_addr == align32(next_item.address)) &&
- period_max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*TUSB_CFG_HOST_DEVICE_MAX)
+ period_max_loop < (HCD_MAX_ENDPOINT + EHCI_MAX_ITD + EHCI_MAX_SITD)*CFG_TUSB_HOST_DEVICE_MAX)
{
switch ( next_item.type )
{
@@ -794,12 +794,12 @@ static inline ehci_link_t* get_period_frame_list(uint8_t hostid)
{
switch(hostid)
{
-#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST)
+#if (CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_HOST)
case 0:
return period_frame_list0;
#endif
-#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST)
+#if (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST)
case 1:
return period_frame_list1;
#endif
@@ -811,7 +811,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_CONTROLLER_1_MODE & TUSB_MODE_HOST)
+ #if (CONTROLLER_HOST_NUMBER == 1) && (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST)
(void) hostid;
return 0;
#else
diff --git a/tinyusb/host/ehci/ehci.h b/tinyusb/host/ehci/ehci.h
index 5b1cc7987..250023ee5 100644
--- a/tinyusb/host/ehci/ehci.h
+++ b/tinyusb/host/ehci/ehci.h
@@ -471,7 +471,7 @@ typedef struct {
ehci_qtd_t qtd[HCD_MAX_XFER] ATTR_ALIGNED(32) ; ///< Queue Element Transfer Pool
// ehci_itd_t itd[EHCI_MAX_ITD] ; ///< Iso Transfer Pool
// ehci_sitd_t sitd[EHCI_MAX_SITD] ; ///< Split (FS) Isochronous Transfer Pool
- }device[TUSB_CFG_HOST_DEVICE_MAX];
+ }device[CFG_TUSB_HOST_DEVICE_MAX];
}ehci_data_t;
#ifdef __cplusplus
diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h
index a7f412cbf..b9f6a1ff7 100644
--- a/tinyusb/host/hcd.h
+++ b/tinyusb/host/hcd.h
@@ -52,8 +52,8 @@
#if MODE_HOST_SUPPORTED
// Max number of endpoints per device
enum {
- HCD_MAX_ENDPOINT = TUSB_CFG_HOST_HUB + TUSB_CFG_HOST_HID_KEYBOARD + TUSB_CFG_HOST_HID_MOUSE + TUSB_CFG_HOST_HID_GENERIC +
- TUSB_CFG_HOST_MSC*2 + TUSB_CFG_HOST_CDC*3,
+ HCD_MAX_ENDPOINT = CFG_TUSB_HOST_HUB + CFG_TUSB_HOST_HID_KEYBOARD + CFG_TUSB_HOST_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC +
+ CFG_TUSB_HOST_MSC*2 + CFG_TUSB_HOST_CDC*3,
HCD_MAX_XFER = HCD_MAX_ENDPOINT*2,
};
diff --git a/tinyusb/host/hub.c b/tinyusb/host/hub.c
index 9b4f03634..063cef61a 100644
--- a/tinyusb/host/hub.c
+++ b/tinyusb/host/hub.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if (MODE_HOST_SUPPORTED && TUSB_CFG_HOST_HUB)
+#if (MODE_HOST_SUPPORTED && CFG_TUSB_HOST_HUB)
#define _TINY_USB_SOURCE_FILE_
@@ -58,8 +58,8 @@ typedef struct {
uint8_t status_change; // data from status change interrupt endpoint
}usbh_hub_t;
-TUSB_CFG_ATTR_USBRAM STATIC_VAR usbh_hub_t hub_data[TUSB_CFG_HOST_DEVICE_MAX];
-ATTR_ALIGNED(4) TUSB_CFG_ATTR_USBRAM STATIC_VAR uint8_t hub_enum_buffer[sizeof(descriptor_hub_desc_t)];
+CFG_TUSB_ATTR_USBRAM STATIC_VAR usbh_hub_t hub_data[CFG_TUSB_HOST_DEVICE_MAX];
+ATTR_ALIGNED(4) CFG_TUSB_ATTR_USBRAM STATIC_VAR uint8_t hub_enum_buffer[sizeof(descriptor_hub_desc_t)];
//OSAL_SEM_DEF(hub_enum_semaphore);
//static osal_semaphore_handle_t hub_enum_sem_hdl;
@@ -152,7 +152,7 @@ tusb_speed_t hub_port_get_speed(void)
//--------------------------------------------------------------------+
void hub_init(void)
{
- memclr_(hub_data, TUSB_CFG_HOST_DEVICE_MAX*sizeof(usbh_hub_t));
+ memclr_(hub_data, CFG_TUSB_HOST_DEVICE_MAX*sizeof(usbh_hub_t));
// hub_enum_sem_hdl = osal_semaphore_create( OSAL_SEM_REF(hub_enum_semaphore) );
}
diff --git a/tinyusb/host/ohci/ohci.c b/tinyusb/host/ohci/ohci.c
index 435d2d8ff..2d1b70666 100644
--- a/tinyusb/host/ohci/ohci.c
+++ b/tinyusb/host/ohci/ohci.c
@@ -38,7 +38,7 @@
#include
-#if MODE_HOST_SUPPORTED && (TUSB_CFG_MCU == MCU_LPC175X_6X)
+#if MODE_HOST_SUPPORTED && (CFG_TUSB_MCU == MCU_LPC175X_6X)
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
@@ -143,7 +143,7 @@ enum {
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(256) STATIC_VAR ohci_data_t ohci_data;
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(256) STATIC_VAR ohci_data_t ohci_data;
static ohci_ed_t * const p_ed_head[] =
{
@@ -384,7 +384,7 @@ static inline ohci_ed_t * ed_find_free(uint8_t dev_addr)
static ohci_ed_t * ed_list_find_previous(ohci_ed_t const * p_head, ohci_ed_t const * p_ed)
{
- uint32_t max_loop = HCD_MAX_ENDPOINT*TUSB_CFG_HOST_DEVICE_MAX;
+ uint32_t max_loop = HCD_MAX_ENDPOINT*CFG_TUSB_HOST_DEVICE_MAX;
ohci_ed_t const * p_prev = p_head;
@@ -608,7 +608,7 @@ static inline uint32_t gtd_xfer_byte_left(uint32_t buffer_end, uint32_t current_
static void done_queue_isr(uint8_t hostid)
{
- uint8_t max_loop = (TUSB_CFG_HOST_DEVICE_MAX+1)*(HCD_MAX_XFER+OHCI_MAX_ITD);
+ uint8_t max_loop = (CFG_TUSB_HOST_DEVICE_MAX+1)*(HCD_MAX_XFER+OHCI_MAX_ITD);
// done head is written in reversed order of completion --> need to reverse the done queue first
ohci_td_item_t* td_head = list_reverse ( (ohci_td_item_t*) align16(ohci_data.hcca.done_head) );
diff --git a/tinyusb/host/ohci/ohci.h b/tinyusb/host/ohci/ohci.h
index 96ee6f90c..f49d85261 100644
--- a/tinyusb/host/ohci/ohci.h
+++ b/tinyusb/host/ohci/ohci.h
@@ -191,13 +191,13 @@ typedef struct ATTR_ALIGNED(256) {
struct {
ohci_ed_t ed;
ohci_gtd_t gtd[3]; // setup, data, status
- }control[TUSB_CFG_HOST_DEVICE_MAX+1];
+ }control[CFG_TUSB_HOST_DEVICE_MAX+1];
struct {
// ochi_itd_t itd[OHCI_MAX_ITD]; // itd requires alignment of 32
ohci_ed_t ed[HCD_MAX_ENDPOINT];
ohci_gtd_t gtd[HCD_MAX_XFER];
- }device[TUSB_CFG_HOST_DEVICE_MAX];
+ }device[CFG_TUSB_HOST_DEVICE_MAX];
} ohci_data_t;
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index bb7300596..6e94ccd4e 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -42,8 +42,8 @@
#define _TINY_USB_SOURCE_FILE_
-#ifndef TUSB_CFG_OS_TASK_PRIO
-#define TUSB_CFG_OS_TASK_PRIO 0
+#ifndef CFG_TUSB_OS_TASK_PRIO
+#define CFG_TUSB_OS_TASK_PRIO 0
#endif
//--------------------------------------------------------------------+
@@ -67,7 +67,7 @@ static host_class_driver_t const usbh_class_drivers[] =
},
#endif
- #if TUSB_CFG_HOST_CDC
+ #if CFG_TUSB_HOST_CDC
[TUSB_CLASS_CDC] = {
.init = cdch_init,
.open_subtask = cdch_open_subtask,
@@ -76,7 +76,7 @@ static host_class_driver_t const usbh_class_drivers[] =
},
#endif
- #if TUSB_CFG_HOST_MSC
+ #if CFG_TUSB_HOST_MSC
[TUSB_CLASS_MSC] = {
.init = msch_init,
.open_subtask = msch_open_subtask,
@@ -85,7 +85,7 @@ static host_class_driver_t const usbh_class_drivers[] =
},
#endif
- #if TUSB_CFG_HOST_HUB
+ #if CFG_TUSB_HOST_HUB
[TUSB_CLASS_HUB] = {
.init = hub_init,
.open_subtask = hub_open_subtask,
@@ -94,7 +94,7 @@ static host_class_driver_t const usbh_class_drivers[] =
},
#endif
- #if TUSB_CFG_HOST_CUSTOM_CLASS
+ #if CFG_TUSB_HOST_CUSTOM_CLASS
[TUSB_CLASS_MAPPED_INDEX_END-1] = {
.init = cush_init,
.open_subtask = cush_open_subtask,
@@ -109,13 +109,13 @@ enum { USBH_CLASS_DRIVER_COUNT = sizeof(usbh_class_drivers) / sizeof(host_class_
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-TUSB_CFG_ATTR_USBRAM usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including zero-address
+CFG_TUSB_ATTR_USBRAM usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including zero-address
//------------- Enumeration Task Data -------------/
enum { ENUM_QUEUE_DEPTH = 16 };
STATIC_VAR osal_queue_t enum_queue_hdl;
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) STATIC_VAR uint8_t enum_data_buffer[TUSB_CFG_HOST_ENUM_BUFFER_SIZE];
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) STATIC_VAR uint8_t enum_data_buffer[CFG_TUSB_HOST_ENUM_BUFFER_SIZE];
//------------- Reporter Task Data -------------//
@@ -128,7 +128,7 @@ static inline uint8_t get_configure_number_for_device(tusb_desc_device_t* dev_de
//--------------------------------------------------------------------+
tusb_device_state_t tuh_device_get_state (uint8_t const dev_addr)
{
- TU_ASSERT( dev_addr <= TUSB_CFG_HOST_DEVICE_MAX, TUSB_DEVICE_STATE_INVALID_PARAMETER);
+ TU_ASSERT( dev_addr <= CFG_TUSB_HOST_DEVICE_MAX, TUSB_DEVICE_STATE_INVALID_PARAMETER);
return (tusb_device_state_t) usbh_devices[dev_addr].state;
}
@@ -142,7 +142,7 @@ uint32_t tuh_device_get_mounted_class_flag(uint8_t dev_addr)
//--------------------------------------------------------------------+
tusb_error_t usbh_init(void)
{
- memclr_(usbh_devices, sizeof(usbh_device_info_t)*(TUSB_CFG_HOST_DEVICE_MAX+1));
+ memclr_(usbh_devices, sizeof(usbh_device_info_t)*(CFG_TUSB_HOST_DEVICE_MAX+1));
ASSERT_ERR( hcd_init() );
@@ -150,10 +150,10 @@ tusb_error_t usbh_init(void)
enum_queue_hdl = osal_queue_create( ENUM_QUEUE_DEPTH, sizeof(uint32_t) );
TU_ASSERT(enum_queue_hdl, TUSB_ERROR_OSAL_QUEUE_FAILED);
- osal_task_create(usbh_enumeration_task, "usbh", 200, NULL, TUSB_CFG_OS_TASK_PRIO);
+ osal_task_create(usbh_enumeration_task, "usbh", 200, NULL, CFG_TUSB_OS_TASK_PRIO);
//------------- Semaphore, Mutex for Control Pipe -------------//
- for(uint8_t i=0; i= ((tusb_desc_configuration_t*)enum_data_buffer)->wTotalLength,
+ STASK_ASSERT_HDLR( CFG_TUSB_HOST_ENUM_BUFFER_SIZE >= ((tusb_desc_configuration_t*)enum_data_buffer)->wTotalLength,
tuh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG, NULL) );
//------------- Get full configuration descriptor -------------//
STASK_INVOKE(
usbh_control_xfer_subtask( new_addr, bm_request_type(TUSB_DIR_IN, TUSB_REQ_TYPE_STANDARD, TUSB_REQ_RCPT_DEVICE),
TUSB_REQ_GET_DESCRIPTOR, (TUSB_DESC_CONFIGURATION << 8) | (configure_selected - 1), 0,
- TUSB_CFG_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ),
+ CFG_TUSB_HOST_ENUM_BUFFER_SIZE, enum_data_buffer ),
error
);
STASK_ASSERT_ERR(error);
@@ -618,7 +618,7 @@ tusb_error_t enumeration_body_subtask(void)
static inline uint8_t get_new_address(void)
{
uint8_t addr;
- for (addr=1; addr <= TUSB_CFG_HOST_DEVICE_MAX; addr++)
+ for (addr=1; addr <= CFG_TUSB_HOST_DEVICE_MAX; addr++)
{
if (usbh_devices[addr].state == TUSB_DEVICE_STATE_UNPLUG)
break;
diff --git a/tinyusb/host/usbh_hcd.h b/tinyusb/host/usbh_hcd.h
index ac967332e..1c2c4ad0b 100644
--- a/tinyusb/host/usbh_hcd.h
+++ b/tinyusb/host/usbh_hcd.h
@@ -96,7 +96,7 @@ typedef struct {
} control;
} usbh_device_info_t;
-extern usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1]; // including zero-address
+extern usbh_device_info_t usbh_devices[CFG_TUSB_HOST_DEVICE_MAX+1]; // including zero-address
//--------------------------------------------------------------------+
// callback from HCD ISR
diff --git a/tinyusb/osal/osal.c b/tinyusb/osal/osal.c
index 68bafa3ea..6bf799d59 100644
--- a/tinyusb/osal/osal.c
+++ b/tinyusb/osal/osal.c
@@ -43,7 +43,7 @@
//--------------------------------------------------------------------+
// TICK API
//--------------------------------------------------------------------+
-#if TUSB_CFG_OS == TUSB_OS_FREERTOS
+#if CFG_TUSB_OS == TUSB_OS_FREERTOS
uint32_t tusb_hal_millis(void)
{
diff --git a/tinyusb/osal/osal.h b/tinyusb/osal/osal.h
index cd165aa3e..f87423d18 100644
--- a/tinyusb/osal/osal.h
+++ b/tinyusb/osal/osal.h
@@ -47,7 +47,7 @@
* @{ */
/** \defgroup group_supported_os Supported RTOS
- * \brief \ref TUSB_CFG_OS must be defined to one of these
+ * \brief \ref CFG_TUSB_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
@@ -64,14 +64,14 @@ enum
};
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
#include "osal_none.h"
#else
- #if TUSB_CFG_OS == TUSB_OS_FREERTOS
+ #if CFG_TUSB_OS == TUSB_OS_FREERTOS
#include "osal_freeRTOS.h"
#else
- #error TUSB_CFG_OS is not defined or OS is not supported yet
+ #error CFG_TUSB_OS is not defined or OS is not supported yet
#endif
#define OSAL_TASK_BEGIN while(1) {
diff --git a/tinyusb/portable/nordic/nrf5x/dcd_nrf5x.c b/tinyusb/portable/nordic/nrf5x/dcd_nrf5x.c
index 082fc40e3..852b67eef 100644
--- a/tinyusb/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/tinyusb/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -528,6 +528,7 @@ void USBD_IRQHandler(void)
// SOF interrupt
if ( int_status & USBD_INTEN_SOF_Msk )
{
+#if 0
// FIXME Errata 104 The EPDATA event might not be generated, and the related update of EPDATASTATUS does not occur.
// There is no way for software to tell if a xfer is complete or not.
// Walkaround: we will asssume an non-control IN transfer is always complete after 10 frames
@@ -559,6 +560,7 @@ void USBD_IRQHandler(void)
}
}
}
+#endif
dcd_bus_event(0, USBD_BUS_EVENT_SOF);
}
diff --git a/tinyusb/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c b/tinyusb/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c
index 140438ce0..4fecda490 100644
--- a/tinyusb/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c
+++ b/tinyusb/portable/nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if MODE_DEVICE_SUPPORTED && (TUSB_CFG_MCU == MCU_LPC11UXX || TUSB_CFG_MCU == MCU_LPC13UXX)
+#if MODE_DEVICE_SUPPORTED && (CFG_TUSB_MCU == MCU_LPC11UXX || CFG_TUSB_MCU == MCU_LPC13UXX)
#define _TINY_USB_SOURCE_FILE_
@@ -63,7 +63,7 @@
#define DCD_11U_13U_QHD_COUNT 10
enum {
- DCD_11U_13U_MAX_BYTE_PER_TD = (TUSB_CFG_MCU == MCU_LPC11UXX ? 64 : 1023)
+ DCD_11U_13U_MAX_BYTE_PER_TD = (CFG_TUSB_MCU == MCU_LPC11UXX ? 64 : 1023)
};
#ifdef __CC_ARM
@@ -142,11 +142,11 @@ typedef struct {
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
-// TUSB_CFG_ATTR_USBRAM must have ATTR_ALIGNED(64) for lpc11u & lpc13u
+// CFG_TUSB_ATTR_USBRAM must have ATTR_ALIGNED(64) for lpc11u & lpc13u
#ifdef __ICCARM__
-ATTR_ALIGNED(256) TUSB_CFG_ATTR_USBRAM // for IAR the first ATTR_ALIGNED takes effect
+ATTR_ALIGNED(256) CFG_TUSB_ATTR_USBRAM // for IAR the first ATTR_ALIGNED takes effect
#else
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(256) // GCC & Keil the last ATTR_ALIGNED takes effect
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(256) // GCC & Keil the last ATTR_ALIGNED takes effect
#endif
STATIC_VAR dcd_11u_13u_data_t dcd_data;
diff --git a/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c b/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
index 619aa6b21..73645631e 100644
--- a/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
+++ b/tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if MODE_DEVICE_SUPPORTED && (TUSB_CFG_MCU == MCU_LPC175X_6X)
+#if MODE_DEVICE_SUPPORTED && (CFG_TUSB_MCU == MCU_LPC175X_6X)
#define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+
@@ -68,7 +68,7 @@ typedef struct {
}dcd_data_t;
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(128) STATIC_VAR dcd_data_t dcd_data;
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(128) STATIC_VAR dcd_data_t dcd_data;
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
@@ -128,8 +128,8 @@ bool dcd_init(uint8_t rhport)
//------------- user manual 11.13 usb device controller initialization -------------// LPC_USB->USBEpInd = 0;
// step 6 : set up control endpoint
- edpt_set_max_packet_size(0, TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE);
- edpt_set_max_packet_size(1, TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE);
+ edpt_set_max_packet_size(0, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
+ edpt_set_max_packet_size(1, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
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)
{
- uint16_t const packet_len = min16_of(length, TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE);
+ uint16_t const packet_len = min16_of(length, CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE);
if (ep_id)
{
diff --git a/tinyusb/portable/nxp/lpc17xx/hal_lpc175x_6x.c b/tinyusb/portable/nxp/lpc17xx/hal_lpc175x_6x.c
index ab609dd4f..4ed5c544c 100644
--- a/tinyusb/portable/nxp/lpc17xx/hal_lpc175x_6x.c
+++ b/tinyusb/portable/nxp/lpc17xx/hal_lpc175x_6x.c
@@ -37,7 +37,7 @@
/**************************************************************************/
#include "common/tusb_common.h"
-#if TUSB_CFG_MCU == MCU_LPC175X_6X
+#if CFG_TUSB_MCU == MCU_LPC175X_6X
#include "hal_usb.h"
diff --git a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
index 7fffd99f1..df572761a 100644
--- a/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
+++ b/tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c
@@ -38,7 +38,7 @@
#include "tusb_option.h"
-#if MODE_DEVICE_SUPPORTED && TUSB_CFG_MCU == MCU_LPC43XX
+#if MODE_DEVICE_SUPPORTED && CFG_TUSB_MCU == MCU_LPC43XX
//--------------------------------------------------------------------+
// INCLUDE
@@ -70,12 +70,12 @@ typedef struct {
extern ATTR_WEAK dcd_data_t dcd_data0;
extern ATTR_WEAK dcd_data_t dcd_data1;
-#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data0;
+#if (CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data0;
#endif
-#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
-TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data1;
+#if (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
+CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(2048) STATIC_VAR dcd_data_t dcd_data1;
#endif
static LPC_USB0_Type * const LPC_USB[2] = { LPC_USB0, ((LPC_USB0_Type*) LPC_USB1_BASE) };
@@ -138,7 +138,7 @@ static void bus_reset(uint8_t rhport)
//------------- 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].max_package_size = p_dcd->qhd[1].max_package_size = TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE;
+ p_dcd->qhd[0].max_package_size = p_dcd->qhd[1].max_package_size = CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE;
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
diff --git a/tinyusb/portable/nxp/lpc43xx_lpc18xx/hal_lpc43xx.c b/tinyusb/portable/nxp/lpc43xx_lpc18xx/hal_lpc43xx.c
index 31481b742..34ebb9260 100644
--- a/tinyusb/portable/nxp/lpc43xx_lpc18xx/hal_lpc43xx.c
+++ b/tinyusb/portable/nxp/lpc43xx_lpc18xx/hal_lpc43xx.c
@@ -38,7 +38,7 @@
#include "tusb.h"
-#if TUSB_CFG_MCU == MCU_LPC43XX
+#if CFG_TUSB_MCU == MCU_LPC43XX
#include "LPC43xx.h"
#include "lpc43xx_cgu.h"
@@ -84,7 +84,7 @@ bool tusb_hal_init(void)
LPC_CREG->CREG0 &= ~(1<<5); /* Turn on the phy */
//------------- USB0 -------------//
-#if TUSB_CFG_CONTROLLER_0_MODE
+#if CFG_TUSB_CONTROLLER_0_MODE
CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE); /* Disable PLL first */
VERIFY( CGU_ERROR_SUCCESS == CGU_SetPLL0()); /* the usb core require output clock = 480MHz */
CGU_EntityConnect(CGU_CLKSRC_XTAL_OSC, CGU_CLKSRC_PLL0);
@@ -93,29 +93,29 @@ bool tusb_hal_init(void)
// reset controller & set role
hal_controller_reset(0);
- #if TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST
+ #if CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_HOST
LPC_USB0->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
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)*/;
- #if TUSB_CFG_DEVICE_FULLSPEED // TODO for easy testing
+ #if CFG_TUSB_DEVICE_FULLSPEED // TODO for easy testing
LPC_USB0->PORTSC1_D |= (1<<24); // force full speed
#endif
#endif
#endif
//------------- USB1 -------------//
-#if TUSB_CFG_CONTROLLER_1_MODE
+#if CFG_TUSB_CONTROLLER_1_MODE
// Host require to config P2_5, 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_SCU->SFSUSB = (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY
+ LPC_SCU->SFSUSB = (CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 0x16 : 0x12; // enable USB1 with on-chip FS PHY
hal_controller_reset(1);
- #if TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST
+ #if CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST
LPC_USB1->USBMODE_H = LPC43XX_USBMODE_HOST | (LPC43XX_USBMODE_VBUS_HIGH << 5);
#else // TODO OTG
LPC_USB1->USBMODE_D = LPC43XX_USBMODE_DEVICE;
@@ -129,7 +129,7 @@ bool tusb_hal_init(void)
void hal_dcd_isr(uint8_t rhport);
-#if TUSB_CFG_CONTROLLER_0_MODE
+#if CFG_TUSB_CONTROLLER_0_MODE
void USB0_IRQHandler(void)
{
#if MODE_HOST_SUPPORTED
@@ -142,7 +142,7 @@ void USB0_IRQHandler(void)
}
#endif
-#if TUSB_CFG_CONTROLLER_1_MODE
+#if CFG_TUSB_CONTROLLER_1_MODE
void USB1_IRQHandler(void)
{
#if MODE_HOST_SUPPORTED
diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c
index 2bbba8471..c9d71b1c1 100644
--- a/tinyusb/tusb.c
+++ b/tinyusb/tusb.c
@@ -56,7 +56,7 @@ tusb_error_t tusb_init(void)
return TUSB_ERROR_NONE;
}
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
void tusb_task(void)
{
#if MODE_HOST_SUPPORTED
@@ -73,7 +73,7 @@ void tusb_task(void)
/*------------------------------------------------------------------*/
/* Debug
*------------------------------------------------------------------*/
-#if TUSB_CFG_DEBUG
+#if CFG_TUSB_DEBUG
char const* const tusb_strerr[TUSB_ERROR_COUNT] =
{
diff --git a/tinyusb/tusb.h b/tinyusb/tusb.h
index 795431cff..9a1fd0c4c 100644
--- a/tinyusb/tusb.h
+++ b/tinyusb/tusb.h
@@ -58,15 +58,15 @@
#include "class/hid/hid_host.h"
#endif
- #if TUSB_CFG_HOST_MSC
+ #if CFG_TUSB_HOST_MSC
#include "class/msc/msc_host.h"
#endif
- #if TUSB_CFG_HOST_CDC
+ #if CFG_TUSB_HOST_CDC
#include "class/cdc/cdc_host.h"
#endif
- #if TUSB_CFG_HOST_CUSTOM_CLASS
+ #if CFG_TUSB_HOST_CUSTOM_CLASS
#include "class/custom_class.h"
#endif
@@ -80,11 +80,11 @@
#include "class/hid/hid_device.h"
#endif
- #if TUSB_CFG_DEVICE_CDC
+ #if CFG_TUSB_DEVICE_CDC
#include "class/cdc/cdc_device.h"
#endif
- #if TUSB_CFG_DEVICE_MSC
+ #if CFG_TUSB_DEVICE_MSC
#include "class/msc/msc_device.h"
#endif
#endif
@@ -102,9 +102,9 @@
*/
tusb_error_t tusb_init(void);
-#if TUSB_CFG_OS == TUSB_OS_NONE
+#if CFG_TUSB_OS == TUSB_OS_NONE
/** \brief Run all tinyusb's internal tasks (e.g host task, device task).
- * \note This function is only required when using no RTOS (\ref TUSB_CFG_OS == TUSB_OS_NONE). All the stack functions
+ * \note This function is only required when using no RTOS (\ref CFG_TUSB_OS == TUSB_OS_NONE). All the stack functions
* & callback are invoked within this function, so it should be called periodically within the mainloop
*
@code
diff --git a/tinyusb/tusb_hal.h b/tinyusb/tusb_hal.h
index 84871f7b7..b8e30851f 100644
--- a/tinyusb/tusb_hal.h
+++ b/tinyusb/tusb_hal.h
@@ -82,11 +82,11 @@ uint32_t tusb_hal_millis(void);
// Enable all ports' interrupt
static inline void tusb_hal_int_enable_all(void)
{
-#ifdef TUSB_CFG_CONTROLLER_0_MODE
+#ifdef CFG_TUSB_CONTROLLER_0_MODE
tusb_hal_int_enable(0);
#endif
-#ifdef TUSB_CFG_CONTROLLER_0_MODE
+#ifdef CFG_TUSB_CONTROLLER_0_MODE
tusb_hal_int_enable(1);
#endif
}
@@ -94,11 +94,11 @@ static inline void tusb_hal_int_enable_all(void)
// Disable all ports' interrupt
static inline void tusb_hal_int_disable_all(void)
{
-#ifdef TUSB_CFG_CONTROLLER_0_MODE
+#ifdef CFG_TUSB_CONTROLLER_0_MODE
tusb_hal_int_disable(0);
#endif
-#ifdef TUSB_CFG_CONTROLLER_0_MODE
+#ifdef CFG_TUSB_CONTROLLER_0_MODE
tusb_hal_int_disable(1);
#endif
}
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index d17487ba8..a1ce5a273 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -47,7 +47,7 @@
// TODO remove, use vendor specific flag
/** \defgroup group_mcu Supported MCU
- * \ref TUSB_CFG_MCU must be defined to one of these
+ * \ref CFG_TUSB_MCU must be defined to one of these
* @{ */
#define MCU_LPC11UXX 1 ///< NXP LPC11Uxx family
#define MCU_LPC13XX 2 ///< NXP LPC13xx (not supported yet)
@@ -59,11 +59,11 @@
/** @} */
// Allow to use command line to change the config name/location
-#ifndef TUSB_CFG_CONFIG_FILE
- #define TUSB_CFG_CONFIG_FILE "tusb_config.h"
+#ifndef CFG_TUSB_CONFIG_FILE
+ #define CFG_TUSB_CONFIG_FILE "tusb_config.h"
#endif
-#include TUSB_CFG_CONFIG_FILE
+#include CFG_TUSB_CONFIG_FILE
/** \addtogroup group_configuration
* @{ */
@@ -72,34 +72,34 @@
// CONTROLLER
//--------------------------------------------------------------------+
/** \defgroup group_mode Controller Mode Selection
- * \brief TUSB_CFG_CONTROLLER_N_MODE must be defined with these
+ * \brief CFG_TUSB_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
/** @} */
-#ifndef TUSB_CFG_CONTROLLER_0_MODE
- #define TUSB_CFG_CONTROLLER_0_MODE TUSB_MODE_NONE
+#ifndef CFG_TUSB_CONTROLLER_0_MODE
+ #define CFG_TUSB_CONTROLLER_0_MODE TUSB_MODE_NONE
#endif
-#ifndef TUSB_CFG_CONTROLLER_1_MODE
- #define TUSB_CFG_CONTROLLER_1_MODE TUSB_MODE_NONE
+#ifndef CFG_TUSB_CONTROLLER_1_MODE
+ #define CFG_TUSB_CONTROLLER_1_MODE TUSB_MODE_NONE
#endif
#define CONTROLLER_HOST_NUMBER (\
- ((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \
- ((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 1 : 0))
+ ((CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \
+ ((CFG_TUSB_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 1 : 0))
#define CONTROLLER_DEVICE_NUMBER (\
- ((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \
- ((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE) ? 1 : 0))
+ ((CFG_TUSB_CONTROLLER_0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \
+ ((CFG_TUSB_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_CONTROLLER_N_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE
+ #error please configure at least 1 CFG_TUSB_CONTROLLER_N_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE
#endif
//--------------------------------------------------------------------+
@@ -112,26 +112,26 @@
- Level 1: Print out if Assert failed. STATIC_VAR is NULL --> accessible when debugging
- Level 0: no debug information is generated
*/
-#ifndef TUSB_CFG_DEBUG
- #define TUSB_CFG_DEBUG 0
- #warning TUSB_CFG_DEBUG is not defined, default value is 0
+#ifndef CFG_TUSB_DEBUG
+ #define CFG_TUSB_DEBUG 0
+ #warning CFG_TUSB_DEBUG is not defined, default value is 0
#endif
-#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
+#ifndef CFG_TUSB_ATTR_USBRAM
+ #error CFG_TUSB_ATTR_USBRAM is not defined, please help me know how to place data in accessible RAM for usb controller
#endif
-#ifndef TUSB_CFG_OS
-#define TUSB_CFG_OS TUSB_OS_NONE
+#ifndef CFG_TUSB_OS
+#define CFG_TUSB_OS TUSB_OS_NONE
#endif
-#if (TUSB_CFG_OS != TUSB_OS_NONE) && !defined (TUSB_CFG_OS_TASK_PRIO)
- #error TUSB_CFG_OS_TASK_PRIO need to be defined (hint: use the highest if possible)
+#if (CFG_TUSB_OS != TUSB_OS_NONE) && !defined (CFG_TUSB_OS_TASK_PRIO)
+ #error CFG_TUSB_OS_TASK_PRIO need to be defined (hint: use the highest if possible)
#endif
-//#ifndef TUSB_CFG_CONFIGURATION_MAX
-// #define TUSB_CFG_CONFIGURATION_MAX 1
-// #warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
+//#ifndef CFG_TUSB_CONFIGURATION_MAX
+// #define CFG_TUSB_CONFIGURATION_MAX 1
+// #warning CFG_TUSB_CONFIGURATION_MAX is not defined, default value is 1
//#endif
#ifndef tu_malloc
@@ -147,24 +147,24 @@
// HOST OPTIONS
//--------------------------------------------------------------------+
#if MODE_HOST_SUPPORTED
- #ifndef TUSB_CFG_HOST_DEVICE_MAX
- #define TUSB_CFG_HOST_DEVICE_MAX 1
- #warning TUSB_CFG_HOST_DEVICE_MAX is not defined, default value is 1
+ #ifndef CFG_TUSB_HOST_DEVICE_MAX
+ #define CFG_TUSB_HOST_DEVICE_MAX 1
+ #warning CFG_TUSB_HOST_DEVICE_MAX is not defined, default value is 1
#endif
//------------- HUB CLASS -------------//
- #if TUSB_CFG_HOST_HUB && (TUSB_CFG_HOST_DEVICE_MAX == 1)
- #error there is no benefit enable hub with max device is 1. Please disable hub or increase TUSB_CFG_HOST_DEVICE_MAX
+ #if CFG_TUSB_HOST_HUB && (CFG_TUSB_HOST_DEVICE_MAX == 1)
+ #error there is no benefit enable hub with max device is 1. Please disable hub or increase CFG_TUSB_HOST_DEVICE_MAX
#endif
//------------- HID CLASS -------------//
- #define HOST_CLASS_HID ( TUSB_CFG_HOST_HID_KEYBOARD + TUSB_CFG_HOST_HID_MOUSE + TUSB_CFG_HOST_HID_GENERIC )
+ #define HOST_CLASS_HID ( CFG_TUSB_HOST_HID_KEYBOARD + CFG_TUSB_HOST_HID_MOUSE + CFG_TUSB_HOST_HID_GENERIC )
// #if HOST_CLASS_HID
// #define HOST_HCD_XFER_INTERRUPT
// #endif
- #ifndef TUSB_CFG_HOST_ENUM_BUFFER_SIZE
- #define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256
+ #ifndef CFG_TUSB_HOST_ENUM_BUFFER_SIZE
+ #define CFG_TUSB_HOST_ENUM_BUFFER_SIZE 256
#endif
//------------- CLASS -------------//
@@ -175,14 +175,14 @@
//--------------------------------------------------------------------+
#if MODE_DEVICE_SUPPORTED
- #define DEVICE_CLASS_HID ( TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + TUSB_CFG_DEVICE_HID_GENERIC )
+ #define DEVICE_CLASS_HID ( CFG_TUSB_DEVICE_HID_KEYBOARD + CFG_TUSB_DEVICE_HID_MOUSE + CFG_TUSB_DEVICE_HID_GENERIC )
- #if TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE > 64
+ #if CFG_TUSB_DEVICE_CONTROL_ENDOINT_SIZE > 64
#error Control Endpoint Max Package Size cannot larger than 64
#endif
- #ifndef TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE
- #define TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE 256
+ #ifndef CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE
+ #define CFG_TUSB_DEVICE_ENUM_BUFFER_SIZE 256
#endif
#endif // MODE_DEVICE_SUPPORTED
diff --git a/vendor/fatfs/ccsbcs.c b/vendor/fatfs/ccsbcs.c
index 51c858b58..5cf0dd503 100644
--- a/vendor/fatfs/ccsbcs.c
+++ b/vendor/fatfs/ccsbcs.c
@@ -27,7 +27,7 @@
#include "ff.h"
-#if TUSB_CFG_HOST_MSC
+#if CFG_TUSB_HOST_MSC
#if _CODE_PAGE == 437
#define _TBLDEF 1
@@ -540,4 +540,4 @@ WCHAR ff_wtoupper ( /* Upper converted character */
return tbl_lower[i] ? tbl_upper[i] : chr;
}
-#endif // TUSB_CFG_HOST_MSC
+#endif // CFG_TUSB_HOST_MSC
diff --git a/vendor/fatfs/diskio.c b/vendor/fatfs/diskio.c
index 130f6860d..ecaccec3e 100644
--- a/vendor/fatfs/diskio.c
+++ b/vendor/fatfs/diskio.c
@@ -38,7 +38,7 @@
#include "tusb.h"
-#if TUSB_CFG_HOST_MSC
+#if CFG_TUSB_HOST_MSC
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
@@ -48,7 +48,7 @@
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
// TODO change it to portable init
-static DSTATUS disk_state[TUSB_CFG_HOST_DEVICE_MAX];
+static DSTATUS disk_state[CFG_TUSB_HOST_DEVICE_MAX];
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
@@ -63,7 +63,7 @@ static DRESULT wait_for_io_complete(uint8_t usb_addr)
while ( tuh_msc_is_busy(usb_addr) )
{
// TODO should have timeout here
- #if TUSB_CFG_OS != TUSB_OS_NONE
+ #if CFG_TUSB_OS != TUSB_OS_NONE
osal_task_delay(10);
#endif
}
@@ -73,7 +73,7 @@ static DRESULT wait_for_io_complete(uint8_t usb_addr)
void diskio_init(void)
{
- memset(disk_state, STA_NOINIT, TUSB_CFG_HOST_DEVICE_MAX);
+ memset(disk_state, STA_NOINIT, CFG_TUSB_HOST_DEVICE_MAX);
}
//pdrv Specifies the physical drive number.
@@ -204,4 +204,4 @@ DWORD get_fattime (void)
return timestamp.value;
}
-#endif // TUSB_CFG_HOST_MSC
+#endif // CFG_TUSB_HOST_MSC
diff --git a/vendor/fatfs/diskio.h b/vendor/fatfs/diskio.h
index ca97e3403..99743538a 100644
--- a/vendor/fatfs/diskio.h
+++ b/vendor/fatfs/diskio.h
@@ -83,7 +83,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
static inline bool disk_is_ready(BYTE pdrv);
static inline bool disk_is_ready(BYTE pdrv)
{
- return (pdrv < TUSB_CFG_HOST_DEVICE_MAX) &&
+ return (pdrv < CFG_TUSB_HOST_DEVICE_MAX) &&
( (disk_status(pdrv) & (STA_NOINIT | STA_NODISK)) == 0 );
}
diff --git a/vendor/fatfs/ff.c b/vendor/fatfs/ff.c
index ee2b6c0f7..897965332 100644
--- a/vendor/fatfs/ff.c
+++ b/vendor/fatfs/ff.c
@@ -99,7 +99,7 @@
#include "ff.h" /* FatFs configurations and declarations */
#include "diskio.h" /* Declarations of low level disk I/O functions */
-#if TUSB_CFG_HOST_MSC
+#if CFG_TUSB_HOST_MSC
/*--------------------------------------------------------------------------
Module Private Definitions
@@ -4327,4 +4327,4 @@ int f_printf (
#endif /* !_FS_READONLY */
#endif /* _USE_STRFUNC */
-#endif // TUSB_CFG_HOST_MSC
+#endif // CFG_TUSB_HOST_MSC
diff --git a/vendor/fatfs/ffconf.h b/vendor/fatfs/ffconf.h
index 75c5c15af..bc132d2c3 100644
--- a/vendor/fatfs/ffconf.h
+++ b/vendor/fatfs/ffconf.h
@@ -128,7 +128,7 @@
/ Physical Drive Configurations
/----------------------------------------------------------------------------*/
-#define _VOLUMES TUSB_CFG_HOST_DEVICE_MAX
+#define _VOLUMES CFG_TUSB_HOST_DEVICE_MAX
/* Number of volumes (logical drives) to be used. */
diff --git a/vendor/freertos/FreeRTOSConfig.h b/vendor/freertos/FreeRTOSConfig.h
index fa1707f99..53ce7551a 100644
--- a/vendor/freertos/FreeRTOSConfig.h
+++ b/vendor/freertos/FreeRTOSConfig.h
@@ -4,7 +4,7 @@
//--------------------------------------------------------------------+
// See http://www.freertos.org/a00110.html.
//--------------------------------------------------------------------+
-#if TUSB_CFG_MCU == MCU_LPC43XX
+#if CFG_TUSB_MCU == MCU_LPC43XX
// TODO remove
#include "lpc43xx_cgu.h"
#define configCPU_CLOCK_HZ CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE)