Bläddra i källkod

rename ehci usb_int usb_sts usb/error field
move MCU define to tusb_option.h

hathach 13 år sedan
förälder
incheckning
68ff7365c5
4 ändrade filer med 40 tillägg och 10 borttagningar
  1. 24 4
      tests/test/host/ehci/test_ehci.c
  2. 4 0
      tests/test/support/tusb_config.h
  3. 0 5
      tinyusb/hal/hal.h
  4. 12 1
      tinyusb/tusb_option.h

+ 24 - 4
tests/test/host/ehci/test_ehci.c

@@ -46,6 +46,8 @@ extern ehci_data_t ehci_data;
 extern ehci_link_t period_frame_list0[EHCI_FRAMELIST_SIZE];
 extern ehci_link_t period_frame_list1[EHCI_FRAMELIST_SIZE];
 
+//LPC_USB0_Type lpc_usb0;
+//LPC_USB1_Type lpc_usb1;
 //--------------------------------------------------------------------+
 // Setup/Teardown + helper declare
 //--------------------------------------------------------------------+
@@ -241,8 +243,8 @@ void test_register_usbcmd(void)
 
 void test_register_usbsts(void)
 {
-  TEST_ASSERT_EQUAL( 0  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, int_usb));
-  TEST_ASSERT_EQUAL( 1  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, int_error));
+  TEST_ASSERT_EQUAL( 0  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, usb));
+  TEST_ASSERT_EQUAL( 1  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, usb_error));
   TEST_ASSERT_EQUAL( 2  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, port_change_detect));
   TEST_ASSERT_EQUAL( 3  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, framelist_rollover));
   TEST_ASSERT_EQUAL( 4  , BITFIELD_OFFSET_OF_MEMBER(ehci_registers_t, usb_sts_bit, host_system_error));
@@ -293,9 +295,12 @@ void test_ehci_data(void)
   //
 }
 
-void test_hcd_init(void)
+void test_hcd_init_data(void)
 {
-  hcd_init(0);
+  uint32_t random_data = 0x1234;
+  memcpy(&ehci_data, &random_data, sizeof(random_data));
+
+  hcd_init();
 
   //------------- check memory data -------------//
   ehci_data_t zeroes;
@@ -303,6 +308,21 @@ void test_hcd_init(void)
   TEST_ASSERT_EQUAL_MEMORY(&zeroes, &ehci_data, sizeof(ehci_data_t));
 }
 
+void test_hcd_init(void)
+{
+  hcd_init();
+
+  for(uint32_t i=0; i<TUSB_CFG_HOST_CONTROLLER_NUM; i++)
+  {
+    ehci_registers_t* regs = get_operational_register(i);
+
+    //------------- USB INT Enable-------------//
+//    TEST_ASSERT(regs->usb_int_enable_bit.host_system_error);
+//    TEST_ASSERT(regs->usb_int_enable_bit.usb);
+//    TEST_ASSERT(regs->usb_int_enable_bit.usb_error);
+  }
+}
+
 //--------------------------------------------------------------------+
 // Helper
 //--------------------------------------------------------------------+

+ 4 - 0
tests/test/support/tusb_config.h

@@ -72,6 +72,10 @@
 #define TUSB_CFG_HOST_HID_KEYBOARD               1
 #define TUSB_CFG_HOST_HID_KEYBOARD_ENDPOINT_SIZE 64
 
+#define HOST_HCD_XFER_INTERRUPT
+#define HOST_HCD_XFER_BULK
+#define HOST_HCD_XFER_ISOCHRONOUS
+
 //--------------------------------------------------------------------+
 // DEVICE CONFIGURATION
 //--------------------------------------------------------------------+

+ 0 - 5
tinyusb/hal/hal.h

@@ -54,11 +54,6 @@
 #include "tusb_option.h"
 #include "common/compiler/compiler.h"
 
-#define MCU_LPC13UXX 1
-#define MCU_LPC11UXX 2
-#define MCU_LPC43XX  3
-#define MCU_LPC18XX  4
-
 #if MCU == 0
   #error MCU is not defined or supported
 #elif MCU == MCU_LPC11UXX

+ 12 - 1
tinyusb/tusb_option.h

@@ -89,10 +89,17 @@
   #warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
 #endif
 
+// TODO  may move to other places
+#define MCU_LPC13UXX 1
+#define MCU_LPC11UXX 2
+#define MCU_LPC43XX  3
+#define MCU_LPC18XX  4
+
 //--------------------------------------------------------------------+
 // HOST OPTIONS
 //--------------------------------------------------------------------+
 #ifdef TUSB_CFG_HOST
+  //------------- Controller -------------//
   #ifndef TUSB_CFG_HOST_CONTROLLER_NUM
     #define TUSB_CFG_HOST_CONTROLLER_NUM 1
     #warning TUSB_CFG_HOST_CONTROLLER_NUM is not defined, default value is 1
@@ -107,6 +114,8 @@
     #warning TUSB_CFG_HOST_DEVICE_MAX is not defined, default value is 1
   #endif
 
+  //------------- HID CLASS -------------//
+  #define HOST_CLASS_HID   ( TUSB_CFG_HOST_HID_KEYBOARD )
   #if TUSB_CFG_HOST_HID_KEYBOARD
     #if !defined(TUSB_CFG_HOST_HID_KEYBOARD_ENDPOINT_SIZE)
       #define TUSB_CFG_HOST_HID_KEYBOARD_ENDPOINT_SIZE 64
@@ -116,6 +125,8 @@
     #if !defined(TUSB_CFG_HOST_HID_KEYBOARD_NO_INSTANCES_PER_DEVICE)
       #define TUSB_CFG_HOST_HID_KEYBOARD_NO_INSTANCES_PER_DEVICE 1
     #endif
+
+    #define HOST_HCD_XFER_INTERRUPT
   #endif // end TUSB_CFG_HOST_HID_KEYBOARD
 
   #ifndef TUSB_CFG_HOST_ENUM_BUFFER_SIZE
@@ -123,7 +134,7 @@
     #warning TUSB_CFG_HOST_ENUM_BUFFER_SIZE is not defined, default value is 256
   #endif
 
-  #define HOST_CLASS_HID   ( TUSB_CFG_HOST_HID_KEYBOARD )
+  //------------- CLASS -------------//
 #endif // end TUSB_CFG_HOST
 
 //--------------------------------------------------------------------+