From 3c2467196070eeedd4171e183db04fb815677246 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 10 Apr 2018 14:31:11 +0700 Subject: mass rename TUSB_CFG to CFG_TUSB --- tinyusb/class/cdc/cdc_device.c | 8 +-- tinyusb/class/cdc/cdc_host.c | 6 +- tinyusb/class/cdc/cdc_host.h | 10 +-- tinyusb/class/cdc/cdc_rndis_host.c | 14 ++-- tinyusb/class/custom_class_host.c | 6 +- tinyusb/class/hid/hid_device.c | 10 +-- tinyusb/class/hid/hid_device.h | 8 +-- tinyusb/class/hid/hid_host.c | 40 ++++++------ tinyusb/class/hid/hid_host.h | 4 +- tinyusb/class/msc/msc_device.c | 6 +- tinyusb/class/msc/msc_device.h | 4 +- tinyusb/class/msc/msc_host.c | 8 +-- tinyusb/class/msc/msc_host.h | 6 +- tinyusb/common/tusb_compiler.h | 2 +- tinyusb/common/tusb_error.h | 4 +- tinyusb/common/tusb_fifo.h | 2 +- tinyusb/common/tusb_verify.h | 2 +- tinyusb/device/usbd.c | 18 ++--- tinyusb/device/usbd.h | 4 +- tinyusb/host/ehci/ehci.c | 32 ++++----- tinyusb/host/ehci/ehci.h | 2 +- tinyusb/host/hcd.h | 4 +- tinyusb/host/hub.c | 8 +-- tinyusb/host/ohci/ohci.c | 8 +-- tinyusb/host/ohci/ohci.h | 4 +- tinyusb/host/usbh.c | 38 +++++------ tinyusb/host/usbh_hcd.h | 2 +- tinyusb/osal/osal.c | 2 +- tinyusb/osal/osal.h | 8 +-- tinyusb/portable/nordic/nrf5x/dcd_nrf5x.c | 2 + .../nxp/lpc11xx_lpc13xx/dcd_lpc_11uxx_13uxx.c | 10 +-- tinyusb/portable/nxp/lpc17xx/dcd_lpc175x_6x.c | 10 +-- tinyusb/portable/nxp/lpc17xx/hal_lpc175x_6x.c | 2 +- tinyusb/portable/nxp/lpc43xx_lpc18xx/dcd_lpc43xx.c | 12 ++-- tinyusb/portable/nxp/lpc43xx_lpc18xx/hal_lpc43xx.c | 18 ++--- tinyusb/tusb.c | 4 +- tinyusb/tusb.h | 14 ++-- tinyusb/tusb_hal.h | 8 +-- tinyusb/tusb_option.h | 76 +++++++++++----------- 39 files changed, 214 insertions(+), 212 deletions(-) (limited to 'tinyusb') diff --git a/tinyusb/class/cdc/cdc_device.c b/tinyusb/class/cdc/cdc_device.c index 3dde8a4a9..5ca4c7d31 100644 --- a/tinyusb/class/cdc/cdc_device.c +++ b/tinyusb/class/cdc/cdc_device.c @@ -38,7 +38,7 @@ #include "tusb_option.h" -#if (MODE_DEVICE_SUPPORTED && TUSB_CFG_DEVICE_CDC) +#if (MODE_DEVICE_SUPPORTED && CFG_TUSB_DEVICE_CDC) #define _TINY_USB_SOURCE_FILE_ //--------------------------------------------------------------------+ @@ -51,7 +51,7 @@ //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ -TUSB_CFG_ATTR_USBRAM STATIC_VAR cdc_line_coding_t cdcd_line_coding[CONTROLLER_DEVICE_NUMBER]; +CFG_TUSB_ATTR_USBRAM STATIC_VAR cdc_line_coding_t cdcd_line_coding[CONTROLLER_DEVICE_NUMBER]; typedef struct { uint8_t interface_number; @@ -66,8 +66,8 @@ typedef struct { }cdcd_data_t; // TODO multiple rhport -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_rx_buf[64]; -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_tx_buf[64]; +CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_rx_buf[64]; +CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) uint8_t _tmp_tx_buf[64]; #define CFG_TUD_CDC_BUFSIZE 128 diff --git a/tinyusb/class/cdc/cdc_host.c b/tinyusb/class/cdc/cdc_host.c index 56f36aedb..bd5b5e32c 100644 --- a/tinyusb/class/cdc/cdc_host.c +++ b/tinyusb/class/cdc/cdc_host.c @@ -38,7 +38,7 @@ #include "tusb_option.h" -#if (MODE_HOST_SUPPORTED && TUSB_CFG_HOST_CDC) +#if (MODE_HOST_SUPPORTED && CFG_TUSB_HOST_CDC) #define _TINY_USB_SOURCE_FILE_ @@ -55,7 +55,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -STATIC_VAR cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static +STATIC_VAR cdch_data_t cdch_data[CFG_TUSB_HOST_DEVICE_MAX]; // TODO to be static static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) { @@ -139,7 +139,7 @@ tusb_error_t tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, //--------------------------------------------------------------------+ void cdch_init(void) { - memclr_(cdch_data, sizeof(cdch_data_t)*TUSB_CFG_HOST_DEVICE_MAX); + memclr_(cdch_data, sizeof(cdch_data_t)*CFG_TUSB_HOST_DEVICE_MAX); } tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) diff --git a/tinyusb/class/cdc/cdc_host.h b/tinyusb/class/cdc/cdc_host.h index f720cb438..77f1e5a78 100644 --- a/tinyusb/class/cdc/cdc_host.h +++ b/tinyusb/class/cdc/cdc_host.h @@ -77,27 +77,27 @@ bool tuh_cdc_is_busy(uint8_t dev_addr, cdc_pipeid_t pipeid) ATTR_PURE ATTR_WARN /** \brief Perform USB OUT transfer to device * \param[in] dev_addr device address - * \param[in] p_data Buffer containing data. Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM) + * \param[in] p_data Buffer containing data. Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM) * \param[in] length Number of bytes to be transferred via USB bus * \retval TUSB_ERROR_NONE on success * \retval TUSB_ERROR_INTERFACE_IS_BUSY if the interface is already transferring data with device * \retval TUSB_ERROR_DEVICE_NOT_READY if device is not yet configured (by SET CONFIGURED request) * \retval TUSB_ERROR_INVALID_PARA if input parameters are not correct * \note This function is non-blocking and returns immediately. The result of USB transfer will be reported by the - * interface's callback function. \a p_data must be declared with \ref TUSB_CFG_ATTR_USBRAM. + * interface's callback function. \a p_data must be declared with \ref CFG_TUSB_ATTR_USBRAM. */ tusb_error_t tuh_cdc_send(uint8_t dev_addr, void const * p_data, uint32_t length, bool is_notify); /** \brief Perform USB IN transfer to get data from device * \param[in] dev_addr device address - * \param[in] p_buffer Buffer containing received data. Must be accessible by USB controller (see \ref TUSB_CFG_ATTR_USBRAM) + * \param[in] p_buffer Buffer containing received data. Must be accessible by USB controller (see \ref CFG_TUSB_ATTR_USBRAM) * \param[in] length Number of bytes to be transferred via USB bus * \retval TUSB_ERROR_NONE on success * \retval TUSB_ERROR_INTERFACE_IS_BUSY if the interface is already transferring data with device * \retval TUSB_ERROR_DEVICE_NOT_READY if device is not yet configured (by SET CONFIGURED request) * \retval TUSB_ERROR_INVALID_PARA if input parameters are not correct * \note This function is non-blocking and returns immediately. The result of USB transfer will be reported by the - * interface's callback function. \a p_data must be declared with \ref TUSB_CFG_ATTR_USBRAM. + * interface's callback function. \a p_data must be declared with \ref CFG_TUSB_ATTR_USBRAM. */ tusb_error_t tuh_cdc_receive(uint8_t dev_addr, void * p_buffer, uint32_t length, bool is_notify); @@ -147,7 +147,7 @@ typedef struct { } cdch_data_t; -extern cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO consider to move to cdch internal header file +extern cdch_data_t cdch_data[CFG_TUSB_HOST_DEVICE_MAX]; // TODO consider to move to cdch internal header file void cdch_init(void); tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_desc_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT; diff --git a/tinyusb/class/cdc/cdc_rndis_host.c b/tinyusb/class/cdc/cdc_rndis_host.c index 7026a3871..62361feb4 100644 --- a/tinyusb/class/cdc/cdc_rndis_host.c +++ b/tinyusb/class/cdc/cdc_rndis_host.c @@ -38,7 +38,7 @@ #include "tusb_option.h" -#if (MODE_HOST_SUPPORTED && TUSB_CFG_HOST_CDC && TUSB_CFG_HOST_CDC_RNDIS) +#if (MODE_HOST_SUPPORTED && CFG_TUSB_HOST_CDC && CFG_TUSB_HOST_CDC_RNDIS) #define _TINY_USB_SOURCE_FILE_ @@ -54,10 +54,10 @@ //--------------------------------------------------------------------+ #define RNDIS_MSG_PAYLOAD_MAX (1024*4) -TUSB_CFG_ATTR_USBRAM static uint8_t msg_notification[TUSB_CFG_HOST_DEVICE_MAX][8]; -TUSB_CFG_ATTR_USBRAM ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX]; +CFG_TUSB_ATTR_USBRAM static uint8_t msg_notification[CFG_TUSB_HOST_DEVICE_MAX][8]; +CFG_TUSB_ATTR_USBRAM ATTR_ALIGNED(4) static uint8_t msg_payload[RNDIS_MSG_PAYLOAD_MAX]; -STATIC_VAR rndish_data_t rndish_data[TUSB_CFG_HOST_DEVICE_MAX]; +STATIC_VAR rndish_data_t rndish_data[CFG_TUSB_HOST_DEVICE_MAX]; // TODO Microsoft requires message length for any get command must be at least 4096 bytes @@ -102,7 +102,7 @@ static tusb_error_t rndis_body_subtask(void) OSAL_SUBTASK_BEGIN - for (relative_addr = 0; relative_addr < TUSB_CFG_HOST_DEVICE_MAX; relative_addr++) + for (relative_addr = 0; relative_addr < CFG_TUSB_HOST_DEVICE_MAX; relative_addr++) { } @@ -117,12 +117,12 @@ static tusb_error_t rndis_body_subtask(void) //--------------------------------------------------------------------+ void rndish_init(void) { - memclr_(rndish_data, sizeof(rndish_data_t)*TUSB_CFG_HOST_DEVICE_MAX); + memclr_(rndish_data, sizeof(rndish_data_t)*CFG_TUSB_HOST_DEVICE_MAX); //------------- Task creation -------------// //------------- semaphore creation for notificaiton pipe -------------// - 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 -- cgit v1.3.1