summaryrefslogtreecommitdiff
path: root/tinyusb/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-11-01 12:11:26 +0700
committerhathach <[email protected]>2013-11-01 12:11:26 +0700
commit3a54ad4c0d4e31bf9a13cebb771ccc9e9f4f6449 (patch)
treea47a948c51dd729c57593ab572c157665f4e3fd3 /tinyusb/common
parentc760c69d51e44c98f9a15feb3f93bee599026332 (diff)
implement msc device class
usbd auto stall control for not supported return from class control request usbd implement xfer isr callback mechanism DCD - implement dcd multiple qtd support - dcd dcd_pipe_stall - implement dcd_pipe_queue_xfer - xfer_complete_isr - flush control endpoint if received new setup while previous transfer is not complete change msc_cmd_block_wrapper_t flags field to dir force full speed for easy testing NOTEs: somehow unable to get endpoint IN interrupt with ioc
Diffstat (limited to 'tinyusb/common')
-rw-r--r--tinyusb/common/common.h9
-rw-r--r--tinyusb/common/errors.h5
-rw-r--r--tinyusb/common/std_request.h8
-rw-r--r--tinyusb/common/tusb_types.h12
4 files changed, 26 insertions, 8 deletions
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index ef8f8c7c2..a5416f3f9 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -52,6 +52,14 @@
#endif
//--------------------------------------------------------------------+
+// MACROS
+//--------------------------------------------------------------------+
+#define STRING_(x) #x // stringify without expand
+#define XSTRING_(x) STRING_(x) // expand then stringify
+#define STRING_CONCAT_(a, b) a##b // concat without expand
+#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) // expand then concat
+
+//--------------------------------------------------------------------+
// INCLUDES
//--------------------------------------------------------------------+
@@ -75,6 +83,7 @@
#include "std_descriptors.h"
#include "std_request.h"
+
//--------------------------------------------------------------------+
// MACROS
//--------------------------------------------------------------------+
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index f5ce6a343..3a2296230 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -86,11 +86,14 @@
ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_SUBCLASS )\
ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_PROTOCOL )\
ENTRY(TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED )\
- ENTRY(TUSB_ERROR_MSCH_UNSUPPORTED_PROTOCOL )\
+ ENTRY(TUSB_ERROR_MSC_UNSUPPORTED_PROTOCOL )\
ENTRY(TUSB_ERROR_MSCH_UNKNOWN_SCSI_COMMAND )\
ENTRY(TUSB_ERROR_MSCH_DEVICE_NOT_MOUNTED )\
ENTRY(TUSB_ERROR_HUB_FEATURE_NOT_SUPPORTED )\
+ ENTRY(TUSB_ERROR_DESCRIPTOR_CORRUPTED )\
ENTRY(TUSB_ERROR_DCD_FAILED )\
+ ENTRY(TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT )\
+ ENTRY(TUSB_ERROR_DCD_NOT_ENOUGH_QTD )\
ENTRY(TUSB_ERROR_NOT_SUPPORTED_YET )\
ENTRY(TUSB_ERROR_FAILED )\
diff --git a/tinyusb/common/std_request.h b/tinyusb/common/std_request.h
index 2b618ce7b..240587691 100644
--- a/tinyusb/common/std_request.h
+++ b/tinyusb/common/std_request.h
@@ -36,12 +36,6 @@
*/
/**************************************************************************/
-/** \file
- * \brief TBD
- *
- * \note TBD
- */
-
/** \ingroup TBD
* \defgroup TBD
* \brief TBD
@@ -72,7 +66,7 @@ typedef ATTR_PACKED_STRUCT(struct){
uint16_t wLength;
} tusb_control_request_t;
-//STATIC_ASSERT(sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
+STATIC_ASSERT( sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
// TODO move to somewhere suitable
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient) ATTR_CONST ATTR_ALWAYS_INLINE;
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h
index d5708d77f..75ae576a9 100644
--- a/tinyusb/common/tusb_types.h
+++ b/tinyusb/common/tusb_types.h
@@ -210,6 +210,18 @@ enum {
DESCRIPTOR_OFFSET_TYPE = 1
};
+static inline uint8_t std_class_code_to_index(uint8_t std_class_code) ATTR_CONST ATTR_ALWAYS_INLINE;
+static inline uint8_t std_class_code_to_index(uint8_t std_class_code)
+{
+ return (std_class_code <= TUSB_CLASS_AUDIO_VIDEO ) ? std_class_code :
+ (std_class_code == TUSB_CLASS_DIAGNOSTIC ) ? TUSB_CLASS_MAPPED_INDEX_START :
+ (std_class_code == TUSB_CLASS_WIRELESS_CONTROLLER ) ? TUSB_CLASS_MAPPED_INDEX_START + 1 :
+ (std_class_code == TUSB_CLASS_MISC ) ? TUSB_CLASS_MAPPED_INDEX_START + 2 :
+ (std_class_code == TUSB_CLASS_APPLICATION_SPECIFIC ) ? TUSB_CLASS_MAPPED_INDEX_START + 3 :
+ (std_class_code == TUSB_CLASS_VENDOR_SPECIFIC ) ? TUSB_CLASS_MAPPED_INDEX_START + 4 : 0;
+}
+
+
#ifdef __cplusplus
}
#endif