This commit is contained in:
hathach 2019-04-11 00:20:54 +07:00
parent 64bed848d0
commit 6102183193
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
6 changed files with 31 additions and 47 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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 ,

View File

@ -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