usb0 host on mcb1800 work with fullspeed mode.

use usbh_edpt_open() to correctly map ep2drv[]
This commit is contained in:
hathach
2020-05-19 00:55:43 +07:00
parent 905a80d1b2
commit 58cedf4c06
18 changed files with 115 additions and 66 deletions

View File

@@ -15,8 +15,9 @@ SRC_C += \
src/host/usbh.c \
src/host/hub.c \
src/host/ehci/ehci.c \
src/class/cdc/cdc_host.c \
src/host/ehci/ehci.c \
src/class/cdc/cdc_host.c \
src/class/msc/msc_host.c \
src/portable/nxp/lpc18_43/hcd_lpc18_43.c
include ../../rules.mk

View File

@@ -124,6 +124,10 @@
</folder>
</folder>
</folder>
<configuration
Name="MCB1800"
arm_target_interface_type="JTAG"
speed="12000" />
</project>
<configuration
Name="MCB1800"

View File

@@ -75,7 +75,7 @@ CFG_TUSB_MEM_SECTION static char serial_in_buffer[64] = { 0 };
void tuh_mount_cb(uint8_t dev_addr)
{
// application set-up
printf("\na CDC device (address %d) is mounted\n", dev_addr);
printf("\na device with address %d is mounted\n", dev_addr);
tuh_cdc_receive(dev_addr, serial_in_buffer, sizeof(serial_in_buffer), true); // schedule first transfer
}
@@ -83,7 +83,7 @@ void tuh_mount_cb(uint8_t dev_addr)
void tuh_umount_cb(uint8_t dev_addr)
{
// application tear-down
printf("\na CDC device (address %d) is unmounted \n", dev_addr);
printf("\na device with address %d is unmounted \n", dev_addr);
}
// invoked ISR context
@@ -195,8 +195,15 @@ void print_greeting(void)
printf("This Host demo is configured to support:\r\n");
printf(" - RTOS = %s\n", rtos_name[CFG_TUSB_OS]);
// if (CFG_TUH_CDC ) puts(" - Communication Device Class");
// if (CFG_TUH_MSC ) puts(" - Mass Storage");
#if CFG_TUH_CDC
printf(" - Communication Device Class\r\n");
#endif
#if CFG_TUH_MSC
printf(" - Mass Storage\r\n");
#endif
// if (CFG_TUH_HID_KEYBOARD ) puts(" - HID Keyboard");
// if (CFG_TUH_HID_MOUSE ) puts(" - HID Mouse");
}

View File

@@ -35,23 +35,24 @@
//------------- IMPLEMENTATION -------------//
void tuh_msc_mounted_cb(uint8_t dev_addr)
{
puts("\na MassStorage device is mounted");
printf("a MassStorage device is mounted\r\n");
// //------------- Disk Information -------------//
// // SCSI VendorID[8] & ProductID[16] from Inquiry Command
// uint8_t const* p_vendor = tuh_msc_get_vendor_name(dev_addr);
// uint8_t const* p_product = tuh_msc_get_product_name(dev_addr);
//
// for(uint8_t i=0; i<8; i++) putchar(p_vendor[i]);
//
// putchar(' ');
// for(uint8_t i=0; i<16; i++) putchar(p_product[i]);
// putchar('\n');
//
// uint32_t last_lba, block_size;
// tuh_msc_get_capacity(dev_addr, &last_lba, &block_size);
// printf("Disk Size: %d MB\n", (last_lba+1)/ ((1024*1024)/block_size) );
// printf("LBA 0-0x%X Block Size: %d\n", last_lba, block_size);
//------------- Disk Information -------------//
// SCSI VendorID[8] & ProductID[16] from Inquiry Command
uint8_t const* p_vendor = tuh_msc_get_vendor_name(dev_addr);
uint8_t const* p_product = tuh_msc_get_product_name(dev_addr);
for(uint8_t i=0; i<8; i++) putchar(p_vendor[i]);
putchar(' ');
for(uint8_t i=0; i<16; i++) putchar(p_product[i]);
putchar('\n');
uint32_t last_lba = 0;
uint32_t block_size = 0;
tuh_msc_get_capacity(dev_addr, &last_lba, &block_size);
printf("Disk Size: %ld MB\r\n", (last_lba+1)/ ((1024*1024)/block_size) );
printf("LBA 0-0x%lX Block Size: %ld\r\n", last_lba, block_size);
//
// //------------- file system (only 1 LUN support) -------------//
// uint8_t phy_disk = dev_addr-1;
@@ -81,7 +82,8 @@ void tuh_msc_mounted_cb(uint8_t dev_addr)
void tuh_msc_unmounted_cb(uint8_t dev_addr)
{
puts("\na MassStorage device is unmounted");
(void) dev_addr;
printf("a MassStorage device is unmounted\r\n");
// uint8_t phy_disk = dev_addr-1;
//

View File

@@ -40,9 +40,9 @@
#endif
#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED)
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_HOST | OPT_MODE_HIGH_SPEED)
#else
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
#define CFG_TUSB_RHPORT0_MODE OPT_MODE_HOST
#endif
#define CFG_TUSB_OS OPT_OS_NONE
@@ -74,7 +74,7 @@
#define CFG_TUH_HID_KEYBOARD 0
#define CFG_TUH_HID_MOUSE 0
#define CFG_TUSB_HOST_HID_GENERIC 0 // (not yet supported)
#define CFG_TUH_MSC 0
#define CFG_TUH_MSC 1
#define CFG_TUH_VENDOR 0
#define CFG_TUSB_HOST_DEVICE_MAX (CFG_TUH_HUB ? 5 : 1) // normal hub has 4 ports