summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2019-04-11 00:20:54 +0700
committerhathach <[email protected]>2019-04-11 00:22:18 +0700
commit61021831935cb6e93979cecfdd414a8d6a2219fe (patch)
tree7ecf7c32172f8e593412bb0a8084e7f02fa62f39 /src
parent64bed848d07b8de37cc94c9b64be3e92fa12739d (diff)
clean up
Diffstat (limited to 'src')
-rw-r--r--src/class/msc/msc_device.h7
-rw-r--r--src/common/compiler/tusb_compiler_gcc.h23
-rw-r--r--src/common/compiler/tusb_compiler_iar.h6
-rw-r--r--src/common/tusb_common.h1
-rw-r--r--src/common/tusb_types.h36
-rw-r--r--src/device/usbd_auto_desc.c5
6 files changed, 31 insertions, 47 deletions
diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h
index 74be7e06d..1d223991b 100644
--- a/src/class/msc/msc_device.h
+++ b/src/class/msc/msc_device.h
@@ -31,6 +31,9 @@
#include "device/usbd.h"
#include "msc.h"
+#ifdef __cplusplus
+ extern "C" {
+#endif
//--------------------------------------------------------------------+
// Class Driver Configuration
@@ -59,10 +62,6 @@ TU_VERIFY_STATIC(CFG_TUD_MSC_BUFSIZE < UINT16_MAX, "Size is not correct");
#error CFG_TUD_MSC_PRODUCT_REV 4-byte string must be defined
#endif
-#ifdef __cplusplus
- extern "C" {
-#endif
-
/** \addtogroup ClassDriver_MSC
* @{
* \defgroup MSC_Device Device
diff --git a/src/common/compiler/tusb_compiler_gcc.h b/src/common/compiler/tusb_compiler_gcc.h
index a3b84116f..bb2d0b56b 100644
--- a/src/common/compiler/tusb_compiler_gcc.h
+++ b/src/common/compiler/tusb_compiler_gcc.h
@@ -35,34 +35,25 @@
extern "C" {
#endif
-#define ALIGN_OF(x) __alignof__(x)
+#define ALIGN_OF(x) __alignof__(x)
-/// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
+// 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
+// Place variable in a specific section
#define ATTR_SECTION(sec_name) __attribute__ (( section(#sec_name) ))
-/// The packed attribute specifies that a variable or structure field should have
-/// the smallest possible alignment—one byte for a variable, and one bit for a field.
+// Packed struct/variable into smallest possible size
#define ATTR_PACKED __attribute__ ((packed))
#define ATTR_PREPACKED
-/// This attribute inlines the function even if no optimization level is specified
-#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
-
-/// The deprecated attribute results in a warning if the function is used anywhere in the source file.
-/// This is useful when identifying functions that are expected to be removed in a future version of a program.
+// 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.
-/// This is primarily useful in defining library functions that can be overridden in user code
+// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global.
#define ATTR_WEAK __attribute__ ((weak))
-/// Warn if a caller of the function with this attribute does not use its return value.
-#define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
-
-/// Function is meant to be possibly unused. GCC does not produce a warning for this function.
+// Function/Variable is meant to be possibly unused (thus no warning)
#define ATTR_UNUSED __attribute__ ((unused))
// TODO mcu specific
diff --git a/src/common/compiler/tusb_compiler_iar.h b/src/common/compiler/tusb_compiler_iar.h
index 29bec875f..326a40031 100644
--- a/src/common/compiler/tusb_compiler_iar.h
+++ b/src/common/compiler/tusb_compiler_iar.h
@@ -36,12 +36,8 @@
//#define ATTR_SECTION(section) _Pragma((#section))
#define ATTR_PREPACKED __packed
#define ATTR_PACKED
-
-#define ATTR_ALWAYS_INLINE
#define ATTR_DEPRECATED(mess)
#define ATTR_WEAK __weak
-
-#define ATTR_WARN_UNUSED_RESULT
#define ATTR_UNUSED
// built-in function to convert 32-bit Big-Endian to Little-Endian
@@ -52,6 +48,8 @@
#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
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h
index c877f0137..0b5a37922 100644
--- a/src/common/tusb_common.h
+++ b/src/common/tusb_common.h
@@ -113,7 +113,6 @@
#include "tusb_option.h"
#include "tusb_compiler.h"
#include "tusb_verify.h"
-//#include "binary.h"
#include "tusb_error.h"
#include "tusb_timeout.h"
#include "tusb_types.h"
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index 3a4ddb4c3..7d57a7950 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -127,25 +127,23 @@ typedef enum
typedef enum
{
- TUSB_CLASS_UNSPECIFIED = 0 , ///< 0
- TUSB_CLASS_AUDIO = 1 , ///< 1
- TUSB_CLASS_CDC = 2 , ///< 2
- TUSB_CLASS_HID = 3 , ///< 3
- TUSB_CLASS_RESERVED_4 = 4 , ///< 4
- TUSB_CLASS_PHYSICAL = 5 , ///< 5
- TUSB_CLASS_IMAGE = 6 , ///< 6
- TUSB_CLASS_PRINTER = 7 , ///< 7
- TUSB_CLASS_MSC = 8 , ///< 8
- TUSB_CLASS_HUB = 9 , ///< 9
- TUSB_CLASS_CDC_DATA = 10 , ///< 10
- TUSB_CLASS_SMART_CARD = 11 , ///< 11
- TUSB_CLASS_RESERVED_12 = 12 , ///< 12
- TUSB_CLASS_CONTENT_SECURITY = 13 , ///< 13
- TUSB_CLASS_VIDEO = 14 , ///< 14
- TUSB_CLASS_PERSONAL_HEALTHCARE = 15 , ///< 15
- TUSB_CLASS_AUDIO_VIDEO = 16 , ///< 16
-
- TUSB_CLASS_MAPPED_INDEX_START = 17 , // TODO Map DIAGNOSTIC, WIRELESS_CONTROLLER, MISC, VENDOR_SPECIFIC to this to minimize the array
+ TUSB_CLASS_UNSPECIFIED = 0 ,
+ TUSB_CLASS_AUDIO = 1 ,
+ TUSB_CLASS_CDC = 2 ,
+ TUSB_CLASS_HID = 3 ,
+ TUSB_CLASS_RESERVED_4 = 4 ,
+ TUSB_CLASS_PHYSICAL = 5 ,
+ TUSB_CLASS_IMAGE = 6 ,
+ TUSB_CLASS_PRINTER = 7 ,
+ TUSB_CLASS_MSC = 8 ,
+ TUSB_CLASS_HUB = 9 ,
+ TUSB_CLASS_CDC_DATA = 10 ,
+ TUSB_CLASS_SMART_CARD = 11 ,
+ TUSB_CLASS_RESERVED_12 = 12 ,
+ TUSB_CLASS_CONTENT_SECURITY = 13 ,
+ TUSB_CLASS_VIDEO = 14 ,
+ TUSB_CLASS_PERSONAL_HEALTHCARE = 15 ,
+ TUSB_CLASS_AUDIO_VIDEO = 16 ,
TUSB_CLASS_DIAGNOSTIC = 0xDC ,
TUSB_CLASS_WIRELESS_CONTROLLER = 0xE0 ,
diff --git a/src/device/usbd_auto_desc.c b/src/device/usbd_auto_desc.c
index e418cd23c..4b683e354 100644
--- a/src/device/usbd_auto_desc.c
+++ b/src/device/usbd_auto_desc.c
@@ -43,7 +43,6 @@
#endif
#ifndef CFG_TUD_DESC_PID
-
/* A combination of interfaces must have a unique product id, since PC will save device driver after the first plug.
* Same VID/PID with different interface e.g MSC (first), then CDC (later) will possibly cause system error on PC.
*
@@ -484,7 +483,7 @@ desc_auto_cfg_t const _desc_auto_config_struct =
.bEndpointAddress = EP_MSC_OUT,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = { .size = EP_MSC_SIZE},
- .bInterval = 1
+ .bInterval = 0
},
.ep_in =
@@ -494,7 +493,7 @@ desc_auto_cfg_t const _desc_auto_config_struct =
.bEndpointAddress = EP_MSC_IN,
.bmAttributes = { .xfer = TUSB_XFER_BULK },
.wMaxPacketSize = { .size = EP_MSC_SIZE},
- .bInterval = 1
+ .bInterval = 0
}
},
#endif // msc