hathach 4 년 전
부모
커밋
37cac414f8
5개의 변경된 파일29개의 추가작업 그리고 12개의 파일을 삭제
  1. 12 1
      src/device/dcd.h
  2. 11 1
      src/device/dcd_attr.h
  3. 0 8
      src/device/usbd.c
  4. 2 2
      src/device/usbd.h
  5. 4 0
      src/tusb_option.h

+ 12 - 1
src/device/dcd.h

@@ -30,13 +30,24 @@
 #include "common/tusb_common.h"
 #include "osal/osal.h"
 #include "common/tusb_fifo.h"
-
 #include "dcd_attr.h"
 
 #ifdef __cplusplus
  extern "C" {
 #endif
 
+//--------------------------------------------------------------------+
+// Configuration
+//--------------------------------------------------------------------+
+
+#ifndef CFG_TUD_ENDPPOINT_MAX
+  #define CFG_TUD_ENDPPOINT_MAX   DCD_ATTR_ENDPOINT_MAX
+#endif
+
+//--------------------------------------------------------------------+
+// MACRO CONSTANT TYPEDEF PROTYPES
+//--------------------------------------------------------------------+
+
 typedef enum
 {
   DCD_EVENT_INVALID = 0,

+ 11 - 1
src/device/dcd_attr.h

@@ -33,6 +33,7 @@
 // - ENDPOINT_MAX: max (logical) number of endpoint
 // - ENDPOINT_EXCLUSIVE_NUMBER: endpoint number with different direction IN and OUT aren't allowed,
 //                              e.g EP1 OUT & EP1 IN cannot exist together
+// - PORT_HIGHSPEED: mask to indicate which port support highspeed mode, bit0 for port0 and so on.
 
 //------------- NXP -------------//
 #if   TU_CHECK_MCU(LPC11UXX) || TU_CHECK_MCU(LPC13XX) || TU_CHECK_MCU(LPC15XX)
@@ -48,7 +49,11 @@
 #elif TU_CHECK_MCU(LPC51UXX)
    #define DCD_ATTR_ENDPOINT_MAX   5
 
-#elif TU_CHECK_MCU(LPC54XXX) || TU_CHECK_MCU(LPC55XX)
+#elif TU_CHECK_MCU(LPC54XXX)
+  // TODO USB0 has 5, USB1 has 6
+  #define DCD_ATTR_ENDPOINT_MAX   6
+
+#elif TU_CHECK_MCU(LPC55XX)
   // TODO USB0 has 5, USB1 has 6
   #define DCD_ATTR_ENDPOINT_MAX   6
 
@@ -143,4 +148,9 @@
   #define DCD_ATTR_ENDPOINT_MAX   8
 #endif
 
+// Default to fullspeed if not defined
+//#ifndef PORT_HIGHSPEED
+//  #define DCD_ATTR_PORT_HIGHSPEED 0x00
+//#endif
+
 #endif

+ 0 - 8
src/device/usbd.c

@@ -37,18 +37,10 @@
 // USBD Configuration
 //--------------------------------------------------------------------+
 
-#ifndef CFG_TUD_ENDPOINT0_SIZE
-  #define CFG_TUD_ENDPOINT0_SIZE  64
-#endif
-
 #ifndef CFG_TUD_TASK_QUEUE_SZ
   #define CFG_TUD_TASK_QUEUE_SZ   16
 #endif
 
-#ifndef CFG_TUD_ENDPPOINT_MAX
-  #define CFG_TUD_ENDPPOINT_MAX   DCD_ATTR_ENDPOINT_MAX
-#endif
-
 //--------------------------------------------------------------------+
 // Device Data
 //--------------------------------------------------------------------+

+ 2 - 2
src/device/usbd.h

@@ -27,12 +27,12 @@
 #ifndef _TUSB_USBD_H_
 #define _TUSB_USBD_H_
 
+#include "common/tusb_common.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#include "common/tusb_common.h"
-
 //--------------------------------------------------------------------+
 // Application API
 //--------------------------------------------------------------------+

+ 4 - 0
src/tusb_option.h

@@ -210,6 +210,10 @@
 // DEVICE OPTIONS
 //--------------------------------------------------------------------
 
+#ifndef CFG_TUD_ENDPOINT0_SIZE
+  #define CFG_TUD_ENDPOINT0_SIZE  64
+#endif
+
 #ifndef CFG_TUD_CDC
   #define CFG_TUD_CDC             0
 #endif