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
This commit is contained in:
hathach
2013-11-01 12:11:26 +07:00
parent c760c69d51
commit 3a54ad4c0d
28 changed files with 821 additions and 243 deletions

View File

@@ -51,6 +51,14 @@
extern "C" {
#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
//--------------------------------------------------------------------+

View File

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

View File

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

View File

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