From 49efd06029f27869084010b7b7c7bd2114fefd73 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 15 May 2019 22:29:16 +0700 Subject: [PATCH] update tinyusb --- .../tinyusb/src/class/audio/audio.h | 2 +- .../tinyusb/src/class/cdc/cdc.h | 2 +- .../tinyusb/src/class/cdc/cdc_device.c | 6 +- .../tinyusb/src/class/cdc/cdc_device.h | 2 +- .../tinyusb/src/class/custom/custom_device.c | 2 +- .../tinyusb/src/class/custom/custom_device.h | 2 +- .../tinyusb/src/class/hid/hid.h | 2 +- .../tinyusb/src/class/hid/hid_device.c | 2 +- .../tinyusb/src/class/hid/hid_device.h | 2 +- .../tinyusb/src/class/midi/midi.h | 2 +- .../tinyusb/src/class/midi/midi_device.c | 2 +- .../tinyusb/src/class/midi/midi_device.h | 2 +- .../tinyusb/src/class/msc/msc.h | 2 +- .../tinyusb/src/class/msc/msc_device.c | 19 +-- .../tinyusb/src/class/msc/msc_device.h | 2 +- .../src/common/compiler/tusb_compiler_gcc.h | 74 --------- .../src/common/compiler/tusb_compiler_iar.h | 58 ------- .../tinyusb/src/common/tusb_common.h | 143 +++++++----------- .../tinyusb/src/common/tusb_compiler.h | 44 ++++-- .../tinyusb/src/common/tusb_error.h | 2 +- .../tinyusb/src/common/tusb_fifo.c | 2 +- .../tinyusb/src/common/tusb_fifo.h | 2 +- .../tinyusb/src/common/tusb_timeout.h | 2 +- .../tinyusb/src/common/tusb_types.h | 2 +- .../tinyusb/src/common/tusb_verify.h | 5 +- .../tinyusb/src/device/dcd.h | 2 +- .../tinyusb/src/device/usbd.c | 8 +- .../tinyusb/src/device/usbd.h | 4 +- .../tinyusb/src/device/usbd_control.c | 2 +- .../tinyusb/src/device/usbd_pvt.h | 2 +- .../tinyusb/src/osal/osal.h | 2 +- .../tinyusb/src/osal/osal_freertos.h | 2 +- .../tinyusb/src/osal/osal_mynewt.h | 2 +- .../tinyusb/src/osal/osal_none.h | 2 +- .../src/portable/nordic/nrf5x/dcd_nrf5x.c | 10 +- .../src/portable/nordic/nrf5x/hal_nrf5x.c | 2 +- .../Adafruit_TinyUSB_Core/tinyusb/src/tusb.c | 2 +- .../Adafruit_TinyUSB_Core/tinyusb/src/tusb.h | 16 +- .../tinyusb/src/tusb_option.h | 11 +- 39 files changed, 139 insertions(+), 313 deletions(-) delete mode 100644 cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_gcc.h delete mode 100644 cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_iar.h diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/audio/audio.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/audio/audio.h index 8ef9389a..c655e79e 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/audio/audio.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/audio/audio.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc.h index a764f15d..200f6eaa 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.c index 7a0380e6..81ce2e43 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -99,7 +99,7 @@ static void _prep_out_transaction (uint8_t itf) bool tud_cdc_n_connected(uint8_t itf) { // DTR (bit 0) active is considered as connected - return tud_ready() && TU_BIT_TEST(_cdcd_itf[itf].line_state, 0); + return tud_ready() && tu_bit_test(_cdcd_itf[itf].line_state, 0); } uint8_t tud_cdc_n_get_line_state (uint8_t itf) @@ -358,7 +358,7 @@ bool cdcd_control_request(uint8_t rhport, tusb_control_request_t const * request usbd_control_status(rhport, request); // Invoke callback - if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, TU_BIT_TEST(request->wValue, 0), TU_BIT_TEST(request->wValue, 1)); + if ( tud_cdc_line_state_cb) tud_cdc_line_state_cb(itf, tu_bit_test(request->wValue, 0), tu_bit_test(request->wValue, 1)); break; default: return false; // stall unsupported request diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.h index 18d6f842..44fd9215 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/cdc/cdc_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.c index abc8934d..7e0ed6da 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.h index 895d5c14..bc5e1d86 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/custom/custom_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h index 7c702f4d..902c01ef 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.c index 1c971a60..9089ac6b 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.h index 4065a0f6..aa1f2b83 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/hid/hid_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi.h index 0c26c188..ee318f78 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.c index 5ba111a2..e834e063 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.h index a4351404..84f4c57b 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/midi/midi_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc.h index bdf906b4..95fac659 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.c index c486d5e0..2fd3d44a 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -80,7 +80,8 @@ static inline uint32_t rdwr10_get_lba(uint8_t const command[]) uint32_t lba; memcpy(&lba, &p_rdwr10->lba, 4); - return __be2n(lba); + // lba is in Big Endian format + return tu_ntohl(lba); } static inline uint16_t rdwr10_get_blockcount(uint8_t const command[]) @@ -92,7 +93,7 @@ static inline uint16_t rdwr10_get_blockcount(uint8_t const command[]) uint16_t block_count; memcpy(&block_count, &p_rdwr10->block_count, 2); - return __be2n_16(block_count); + return tu_ntohs(block_count); } //--------------------------------------------------------------------+ @@ -238,8 +239,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff { scsi_read_capacity10_resp_t read_capa10; - read_capa10.last_lba = ENDIAN_BE(block_count-1); - read_capa10.block_size = ENDIAN_BE(block_size); + read_capa10.last_lba = tu_htonl(block_count-1); + read_capa10.block_size = tu_htonl(block_size); resplen = sizeof(read_capa10); memcpy(buffer, &read_capa10, resplen); @@ -272,8 +273,8 @@ int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_t* buff if ( _mscd_itf.sense_key == 0 ) tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x04, 0x00); }else { - read_fmt_capa.block_num = ENDIAN_BE(block_count); - read_fmt_capa.block_size_u16 = ENDIAN_BE16(block_size); + read_fmt_capa.block_num = tu_htonl(block_count); + read_fmt_capa.block_size_u16 = tu_htons(block_size); resplen = sizeof(read_fmt_capa); memcpy(buffer, &read_fmt_capa, resplen); @@ -390,7 +391,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t // For other SCSI commands // 1. OUT : queue transfer (invoke app callback after done) // 2. IN & Zero: Process if is built-in, else Invoke app callback. Skip DATA if zero length - if ( (p_cbw->total_bytes > 0 ) && !TU_BIT_TEST(p_cbw->dir, 7) ) + if ( (p_cbw->total_bytes > 0 ) && !tu_bit_test(p_cbw->dir, 7) ) { // queue transfer TU_ASSERT( dcd_edpt_xfer(rhport, p_msc->ep_out, _mscd_buf, p_msc->total_len) ); @@ -439,7 +440,7 @@ bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t case MSC_STAGE_DATA: // OUT transfer, invoke callback if needed - if ( !TU_BIT_TEST(p_cbw->dir, 7) ) + if ( !tu_bit_test(p_cbw->dir, 7) ) { if ( SCSI_CMD_WRITE_10 != p_cbw->command[0] ) { diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.h index ad438749..b2cd7e89 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/class/msc/msc_device.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_gcc.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_gcc.h deleted file mode 100644 index 6eab1e78..00000000 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_gcc.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018, hathach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -/** \ingroup Group_Compiler - * \defgroup Group_GCC GNU GCC - * @{ */ - -#ifndef _TUSB_COMPILER_GCC_H_ -#define _TUSB_COMPILER_GCC_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -#define ALIGN_OF(x) __alignof__(x) - -// Specifies a minimum alignment for the variable or structure field, measured in bytes -#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) - -// Place variable in a specific section -#define ATTR_SECTION(sec_name) __attribute__ (( section(#sec_name) )) - -// Packed struct/variable into smallest possible size -#define ATTR_PACKED __attribute__ ((packed)) -#define ATTR_PREPACKED - -// The deprecated attribute results in a warning if the function is used. -#define ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) - -// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. -#define ATTR_WEAK __attribute__ ((weak)) - -// Function/Variable is meant to be possibly unused (thus no warning) -#define ATTR_UNUSED __attribute__ ((unused)) - -// TODO mcu specific -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define __n2be(x) __builtin_bswap32(x) ///< built-in function to convert 32-bit from native to Big Endian -#define __be2n(x) __n2be(x) ///< built-in function to convert 32-bit from Big Endian to native - -#define __n2be_16(u16) __builtin_bswap16(u16) -#define __be2n_16(u16) __n2be_16(u16) -#endif - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_COMPILER_GCC_H_ */ - -/// @} diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_iar.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_iar.h deleted file mode 100644 index 326a4003..00000000 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/compiler/tusb_compiler_iar.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018, hathach (tinyusb.org) - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * This file is part of the TinyUSB stack. - */ - -#ifndef _TUSB_COMPILER_IAR_H_ -#define _TUSB_COMPILER_IAR_H_ - -#ifdef __cplusplus - extern "C" { -#endif - -#define ALIGN_OF(x) __ALIGNOF__(x) -#define ATTR_ALIGNED(bytes) _Pragma(XSTRING_(data_alignment=##bytes)) -//#define ATTR_SECTION(section) _Pragma((#section)) -#define ATTR_PREPACKED __packed -#define ATTR_PACKED -#define ATTR_DEPRECATED(mess) -#define ATTR_WEAK __weak -#define ATTR_UNUSED - -// built-in function to convert 32-bit Big-Endian to Little-Endian -//#if __LITTLE_ENDIAN__ -#define __be2n __REV -#define __n2be __be2n - -#define __n2be_16(u16) ((uint16_t) __REV16(u16)) -#define __be2n_16(u16) __n2be_16(u16) - -#error "IAR won't work due to '__packed' placement before struct" - -#ifdef __cplusplus - } -#endif - -#endif /* _TUSB_COMPILER_IAR_H_ */ - diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_common.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_common.h index e687b898..4b74bcfc 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_common.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_common.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -38,65 +38,27 @@ //--------------------------------------------------------------------+ // Macros Helper //--------------------------------------------------------------------+ -#define TU_ARRAY_SZIE(_arr) ( sizeof(_arr) / sizeof(_arr[0]) ) -#define TU_MIN(_x, _y) ( (_x) < (_y) ) ? (_x) : (_y) ) -#define TU_MAX(_x, _y) ( (_x) > (_y) ) ? (_x) : (_y) ) +#define TU_ARRAY_SZIE(_arr) ( sizeof(_arr) / sizeof(_arr[0]) ) +#define TU_MIN(_x, _y) ( (_x) < (_y) ) ? (_x) : (_y) ) +#define TU_MAX(_x, _y) ( (_x) > (_y) ) ? (_x) : (_y) ) -#define U16_HIGH_U8(u16) ((uint8_t) (((u16) >> 8) & 0x00ff)) -#define U16_LOW_U8(u16) ((uint8_t) ((u16) & 0x00ff)) -#define U16_TO_U8S_BE(u16) U16_HIGH_U8(u16), U16_LOW_U8(u16) -#define U16_TO_U8S_LE(u16) U16_LOW_U8(u16), U16_HIGH_U8(u16) +#define TU_U16_HIGH(u16) ((uint8_t) (((u16) >> 8) & 0x00ff)) +#define TU_U16_LOW(u16) ((uint8_t) ((u16) & 0x00ff)) +#define U16_TO_U8S_BE(u16) TU_U16_HIGH(u16), TU_U16_LOW(u16) +#define U16_TO_U8S_LE(u16) TU_U16_LOW(u16), TU_U16_HIGH(u16) -#define U32_B1_U8(u32) ((uint8_t) (((u32) >> 24) & 0x000000ff)) // MSB -#define U32_B2_U8(u32) ((uint8_t) (((u32) >> 16) & 0x000000ff)) -#define U32_B3_U8(u32) ((uint8_t) (((u32) >> 8) & 0x000000ff)) -#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB +#define U32_B1_U8(u32) ((uint8_t) (((u32) >> 24) & 0x000000ff)) // MSB +#define U32_B2_U8(u32) ((uint8_t) (((u32) >> 16) & 0x000000ff)) +#define U32_B3_U8(u32) ((uint8_t) (((u32) >> 8) & 0x000000ff)) +#define U32_B4_U8(u32) ((uint8_t) ((u32) & 0x000000ff)) // LSB -#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32) -#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32) +#define U32_TO_U8S_BE(u32) U32_B1_U8(u32), U32_B2_U8(u32), U32_B3_U8(u32), U32_B4_U8(u32) +#define U32_TO_U8S_LE(u32) U32_B4_U8(u32), U32_B3_U8(u32), U32_B2_U8(u32), U32_B1_U8(u32) -//------------- Bit -------------// -#define TU_BIT(n) (1U << (n)) ///< n-th Bit -#define TU_BIT_SET(x, n) ( (x) | TU_BIT(n) ) ///< set n-th bit of x to 1 -#define TU_BIT_CLEAR(x, n) ( (x) & (~TU_BIT(n)) ) ///< clear n-th bit of x -#define TU_BIT_TEST(x, n) ( ((x) & TU_BIT(n)) ? true : false ) ///< check if n-th bit of x is 1 - -//------------- Endian Conversion -------------// -#define ENDIAN_BE(u32) \ - (uint32_t) ( (((u32) & 0xFF) << 24) | (((u32) & 0xFF00) << 8) | (((u32) >> 8) & 0xFF00) | (((u32) >> 24) & 0xFF) ) - -#define ENDIAN_BE16(le16) ((uint16_t) ((U16_LOW_U8(le16) << 8) | U16_HIGH_U8(le16)) ) - -//------------- Binary constant -------------// -#if defined(__GNUC__) && !defined(__CC_ARM) - -#define TU_BIN8(x) ((uint8_t) (0b##x)) -#define TU_BIN16(b1, b2) ((uint16_t) (0b##b1##b2)) -#define TU_BIN32(b1, b2, b3, b4) ((uint32_t) (0b##b1##b2##b3##b4)) - -#else - -// internal macro of B8, B16, B32 -#define _B8__(x) (((x&0x0000000FUL)?1:0) \ - +((x&0x000000F0UL)?2:0) \ - +((x&0x00000F00UL)?4:0) \ - +((x&0x0000F000UL)?8:0) \ - +((x&0x000F0000UL)?16:0) \ - +((x&0x00F00000UL)?32:0) \ - +((x&0x0F000000UL)?64:0) \ - +((x&0xF0000000UL)?128:0)) - -#define TU_BIN8(d) ((uint8_t) _B8__(0x##d##UL)) -#define TU_BIN16(dmsb,dlsb) (((uint16_t)TU_BIN8(dmsb)<<8) + TU_BIN8(dlsb)) -#define TU_BIN32(dmsb,db2,db3,dlsb) \ - (((uint32_t)TU_BIN8(dmsb)<<24) \ - + ((uint32_t)TU_BIN8(db2)<<16) \ - + ((uint32_t)TU_BIN8(db3)<<8) \ - + TU_BIN8(dlsb)) -#endif +#define TU_BIT(n) (1U << (n)) // for declaration of reserved field, make use of _TU_COUNTER_ -#define TU_RESERVED XSTRING_CONCAT_(reserved, _TU_COUNTER_) +#define TU_RESERVED XSTRING_CONCAT_(reserved, _TU_COUNTER_) //--------------------------------------------------------------------+ // INCLUDES @@ -113,54 +75,28 @@ #include "tusb_option.h" #include "tusb_compiler.h" #include "tusb_verify.h" -#include "tusb_error.h" +#include "tusb_error.h" // TODO remove #include "tusb_timeout.h" #include "tusb_types.h" //--------------------------------------------------------------------+ // INLINE FUNCTION //--------------------------------------------------------------------+ -#ifndef __n2be_16 // TODO clean up -#define __n2be_16(u16) ((uint16_t) ((U16_LOW_U8(u16) << 8) | U16_HIGH_U8(u16)) ) -#define __be2n_16(u16) __n2be_16(u16) -#endif - #define tu_memclr(buffer, size) memset((buffer), 0, (size)) #define tu_varclr(_var) tu_memclr(_var, sizeof(*(_var))) -static inline bool tu_mem_test_zero (void const* buffer, uint32_t size) -{ - uint8_t const* p_mem = (uint8_t const*) buffer; - for(uint32_t i=0; i> 8)) & 0x00ff); -} - -static inline uint8_t tu_u16_low(uint16_t u16) -{ - return (uint8_t) (u16 & 0x00ff); -} - -static inline uint16_t tu_u16_le2be(uint16_t u16) -{ - return ((uint16_t)(tu_u16_low(u16) << 8)) | tu_u16_high(u16); -} +static inline uint8_t tu_u16_high(uint16_t u16) { return (uint8_t) (((uint16_t) (u16 >> 8)) & 0x00ff); } +static inline uint8_t tu_u16_low (uint16_t u16) { return (uint8_t) (u16 & 0x00ff); } // Min static inline uint8_t tu_min8 (uint8_t x, uint8_t y ) { return (x < y) ? x : y; } @@ -175,9 +111,7 @@ static inline uint32_t tu_max32 (uint32_t x, uint32_t y) { return (x > y) ? x : // Align static inline uint32_t tu_align32 (uint32_t value) { return (value & 0xFFFFFFE0UL); } static inline uint32_t tu_align16 (uint32_t value) { return (value & 0xFFFFFFF0UL); } -static inline uint32_t tu_align_n (uint32_t alignment, uint32_t value) { return value & ((uint32_t) ~(alignment-1)); } static inline uint32_t tu_align4k (uint32_t value) { return (value & 0xFFFFF000UL); } - static inline uint32_t tu_offset4k(uint32_t value) { return (value & 0xFFFUL); } //------------- Mathematics -------------// @@ -190,7 +124,7 @@ static inline bool tu_within(uint32_t lower, uint32_t value, uint32_t upper) } // log2 of a value is its MSB's position -// TODO use clz +// TODO use clz TODO remove static inline uint8_t tu_log2(uint32_t value) { uint8_t result = 0; @@ -203,9 +137,9 @@ static inline uint8_t tu_log2(uint32_t value) } // Bit -static inline uint32_t tu_bit_set(uint32_t value, uint8_t n) { return value | TU_BIT(n); } +static inline uint32_t tu_bit_set (uint32_t value, uint8_t n) { return value | TU_BIT(n); } static inline uint32_t tu_bit_clear(uint32_t value, uint8_t n) { return value & (~TU_BIT(n)); } -static inline bool tu_bit_test(uint32_t value, uint8_t n) { return (value & TU_BIT(n)) ? true : false; } +static inline bool tu_bit_test (uint32_t value, uint8_t n) { return (value & TU_BIT(n)) ? true : false; } /*------------------------------------------------------------------*/ /* Count number of arguments of __VA_ARGS__ @@ -237,6 +171,35 @@ static inline bool tu_bit_test(uint32_t value, uint8_t n) { return (value & TU_B 9,8,7,6,5,4,3,2,1,0 #endif +// To be removed +//------------- Binary constant -------------// +#if defined(__GNUC__) && !defined(__CC_ARM) + +#define TU_BIN8(x) ((uint8_t) (0b##x)) +#define TU_BIN16(b1, b2) ((uint16_t) (0b##b1##b2)) +#define TU_BIN32(b1, b2, b3, b4) ((uint32_t) (0b##b1##b2##b3##b4)) + +#else + +// internal macro of B8, B16, B32 +#define _B8__(x) (((x&0x0000000FUL)?1:0) \ + +((x&0x000000F0UL)?2:0) \ + +((x&0x00000F00UL)?4:0) \ + +((x&0x0000F000UL)?8:0) \ + +((x&0x000F0000UL)?16:0) \ + +((x&0x00F00000UL)?32:0) \ + +((x&0x0F000000UL)?64:0) \ + +((x&0xF0000000UL)?128:0)) + +#define TU_BIN8(d) ((uint8_t) _B8__(0x##d##UL)) +#define TU_BIN16(dmsb,dlsb) (((uint16_t)TU_BIN8(dmsb)<<8) + TU_BIN8(dlsb)) +#define TU_BIN32(dmsb,db2,db3,dlsb) \ + (((uint32_t)TU_BIN8(dmsb)<<24) \ + + ((uint32_t)TU_BIN8(db2)<<16) \ + + ((uint32_t)TU_BIN8(db3)<<8) \ + + TU_BIN8(dlsb)) +#endif + #ifdef __cplusplus } #endif diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_compiler.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_compiler.h index 613db4d3..0978d1c0 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_compiler.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_compiler.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,27 +43,41 @@ #define _TU_COUNTER_ __LINE__ #endif -//--------------------------------------------------------------------+ -// Compile-time Assert (use TU_VERIFY_STATIC to avoid name conflict) -//--------------------------------------------------------------------+ +// Compile-time Assert #if __STDC_VERSION__ >= 201112L #define TU_VERIFY_STATIC _Static_assert #else #define TU_VERIFY_STATIC(const_expr, _mess) enum { XSTRING_CONCAT_(_verify_static_, _TU_COUNTER_) = 1/(!!(const_expr)) } #endif -// allow debugger to watch any module-wide variables anywhere -#if CFG_TUSB_DEBUG -#define STATIC_VAR -#else -#define STATIC_VAR static -#endif - - +//--------------------------------------------------------------------+ +// Compiler porting with Attribute and Endian +//--------------------------------------------------------------------+ #if defined(__GNUC__) - #include "compiler/tusb_compiler_gcc.h" -#elif defined __ICCARM__ - #include "compiler/tusb_compiler_iar.h" + #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) + #define ATTR_SECTION(sec_name) __attribute__ ((section(#sec_name))) + #define ATTR_PACKED __attribute__ ((packed)) + #define ATTR_PREPACKED + #define ATTR_WEAK __attribute__ ((weak)) + #define ATTR_DEPRECATED(mess) __attribute__ ((deprecated(mess))) // warn if function with this attribute is used + #define ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused + + // Endian conversion use well-known host to network (big endian) naming + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #define tu_htonl(u32) __builtin_bswap32(u32) + #define tu_ntohl(u32) __builtin_bswap32(u32) + + #define tu_htons(u16) __builtin_bswap16(u16) + #define tu_ntohs(u16) __builtin_bswap16(u16) + #else + #define tu_htonl(u32) (u32) + #define tu_ntohl(u32) (u32) + + #define tu_htons(u16) (u16) + #define tu_ntohs(u16) (u16) + #endif +#else + #error "Compiler attribute porting are required" #endif #endif /* _TUSB_COMPILER_H_ */ diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_error.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_error.h index 8dbfb0a5..e6313f7a 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_error.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_error.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.c index cdaa4ca7..e2ed51cd 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.h index b6fd3a70..1b64f1db 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_fifo.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_timeout.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_timeout.h index 83a4dac6..558742ff 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_timeout.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_timeout.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_types.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_types.h index 82b5a65c..78653384 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_types.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_types.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_verify.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_verify.h index 21c5122e..8252d0f6 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_verify.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/common/tusb_verify.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -46,11 +46,10 @@ extern "C" { #endif - //--------------------------------------------------------------------+ // TU_VERIFY Helper //--------------------------------------------------------------------+ -#if CFG_TUSB_DEBUG >= 1 +#if CFG_TUSB_DEBUG #include #define _MESS_ERR(_err) printf("%s: %d: failed, error = %s\n", __func__, __LINE__, tusb_strerr[_err]) #define _MESS_FAILED() printf("%s: %d: failed\n", __func__, __LINE__) diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/dcd.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/dcd.h index 18678f15..35164ac6 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/dcd.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/dcd.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.c index 6e3a1e1c..56d89538 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -382,7 +382,7 @@ static bool process_control_request(uint8_t rhport, tusb_control_request_t const break; case TUSB_REQ_GET_DESCRIPTOR: - TU_ASSERT( process_get_descriptor(rhport, p_request) ); + TU_VERIFY( process_get_descriptor(rhport, p_request) ); break; case TUSB_REQ_SET_FEATURE: @@ -739,7 +739,7 @@ void usbd_edpt_stall(uint8_t rhport, uint8_t ep_addr) uint8_t const dir = tu_edpt_dir(ep_addr); dcd_edpt_stall(rhport, ep_addr); - _usbd_dev.ep_stall_mask[dir] = tu_bit_set(_usbd_dev.ep_stall_mask[dir], epnum); + _usbd_dev.ep_stall_mask[dir] = (uint8_t) tu_bit_set(_usbd_dev.ep_stall_mask[dir], epnum); } void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) @@ -748,7 +748,7 @@ void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) uint8_t const dir = tu_edpt_dir(ep_addr); dcd_edpt_clear_stall(rhport, ep_addr); - _usbd_dev.ep_stall_mask[dir] = tu_bit_clear(_usbd_dev.ep_stall_mask[dir], epnum); + _usbd_dev.ep_stall_mask[dir] = (uint8_t) tu_bit_clear(_usbd_dev.ep_stall_mask[dir], epnum); } bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr) diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h index 2e34b25a..46143a21 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -94,7 +94,7 @@ ATTR_WEAK void tud_resume_cb(void); #define TUD_CONFIG_DESC_LEN (9) -// Inteface count, string index, total length, attribute, power in mA +// Interface count, string index, total length, attribute, power in mA #define TUD_CONFIG_DESCRIPTOR(_itfcount, _stridx, _total_len, _attribute, _power_ma) \ 9, TUSB_DESC_CONFIGURATION, U16_TO_U8S_LE(_total_len), _itfcount, 1, _stridx, TU_BIT(7) | _attribute, (_power_ma)/2 diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_control.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_control.c index 0b878fbc..1b5ee9f9 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_control.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_control.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_pvt.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_pvt.h index 61f92612..f64b083c 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_pvt.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd_pvt.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal.h index 7304fdbd..ea655d4f 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_freertos.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_freertos.h index 20f00b2b..a3c23d80 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_freertos.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_freertos.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_mynewt.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_mynewt.h index 94b588e6..cb6caa8c 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_mynewt.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_mynewt.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_none.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_none.h index 02106417..7780345d 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_none.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/osal/osal_none.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c index aacba2eb..556bef6c 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -375,7 +375,7 @@ void USBD_IRQHandler(void) for(uint8_t i=0; iEPOUT[epnum].AMOUNT; @@ -517,7 +517,7 @@ void USBD_IRQHandler(void) // CBI In: Endpoint -> Host (transaction complete) for(uint8_t epnum=0; epnum<8; epnum++) { - if ( TU_BIT_TEST(data_status, epnum ) || ( epnum == 0 && is_control_in) ) + if ( tu_bit_test(data_status, epnum ) || ( epnum == 0 && is_control_in) ) { xfer_td_t* xfer = get_td(epnum, TUSB_DIR_IN); @@ -538,7 +538,7 @@ void USBD_IRQHandler(void) // CBI OUT: Host -> Endpoint for(uint8_t epnum=0; epnum<8; epnum++) { - if ( TU_BIT_TEST(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) ) + if ( tu_bit_test(data_status, 16+epnum ) || ( epnum == 0 && is_control_out) ) { xfer_td_t* xfer = get_td(epnum, TUSB_DIR_OUT); diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c index 6d71c05c..f7f1eef6 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.c b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.c index 825aa988..0f8eedd5 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.c +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.c @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.h index 6c7fcff9..e7d850af 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -101,20 +101,6 @@ bool tusb_inited(void); // TODO // bool tusb_teardown(void); - -// backward compatible only. TODO remove later -ATTR_DEPRECATED("Please use either tud_task() or tuh_task()") -static inline void tusb_task(void) -{ - #if TUSB_OPT_HOST_ENABLED - tuh_task(); - #endif - - #if TUSB_OPT_DEVICE_ENABLED - tud_task(); - #endif -} - /** @} */ #ifdef __cplusplus diff --git a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb_option.h b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb_option.h index 4ade46a7..d165f3dd 100644 --- a/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb_option.h +++ b/cores/nRF5/Adafruit_TinyUSB_Core/tinyusb/src/tusb_option.h @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2018, hathach (tinyusb.org) + * Copyright (c) 2019 Ha Thach (tinyusb.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -119,13 +119,8 @@ //--------------------------------------------------------------------+ // COMMON OPTIONS //--------------------------------------------------------------------+ -/** - determines the debug level for the stack - - Level 3: TBD - - Level 2: TBD - - Level 1: Print out if Assert failed. STATIC_VAR is NULL --> accessible when debugging - - Level 0: no debug information is generated -*/ + +// Debug enable to print out error message #ifndef CFG_TUSB_DEBUG #define CFG_TUSB_DEBUG 0 #endif