From 1dd2cd43dda857de3f4272074c595e663ef09b22 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 24 Feb 2021 13:10:47 +0700 Subject: [PATCH] add hcd_ehci.h as interface for ehci port --- src/host/usbh.c | 2 +- src/portable/ehci/ehci.c | 5 +- src/portable/ehci/hcd_ehci.h | 53 +++++++++++++++++++ .../nxp/transdimension/hcd_transdimension.c | 4 +- 4 files changed, 56 insertions(+), 8 deletions(-) create mode 100644 src/portable/ehci/hcd_ehci.h diff --git a/src/host/usbh.c b/src/host/usbh.c index a4ee4cb5..3761f279 100644 --- a/src/host/usbh.c +++ b/src/host/usbh.c @@ -656,7 +656,7 @@ static bool enum_new_device(hcd_event_t* event) //------------- connected/disconnected directly with roothub -------------// if (dev0->hub_addr == 0) { - // wait until device is stable + // wait until device is stable TODO non blocking osal_task_delay(RESET_DELAY); // device unplugged while delaying diff --git a/src/portable/ehci/ehci.c b/src/portable/ehci/ehci.c index e2327fdc..484e4960 100644 --- a/src/portable/ehci/ehci.c +++ b/src/portable/ehci/ehci.c @@ -37,6 +37,7 @@ #include "host/hcd.h" #include "host/usbh_hcd.h" +#include "hcd_ehci.h" #include "ehci.h" //--------------------------------------------------------------------+ @@ -49,10 +50,6 @@ // Periodic frame list must be 4K alignment CFG_TUSB_MEM_SECTION TU_ATTR_ALIGNED(4096) static ehci_data_t ehci_data; -// EHCI portable -uint32_t hcd_ehci_register_addr(uint8_t rhport); -bool hcd_ehci_init (uint8_t rhport); // TODO move later - //--------------------------------------------------------------------+ // PROTOTYPE //--------------------------------------------------------------------+ diff --git a/src/portable/ehci/hcd_ehci.h b/src/portable/ehci/hcd_ehci.h new file mode 100644 index 00000000..480d11ed --- /dev/null +++ b/src/portable/ehci/hcd_ehci.h @@ -0,0 +1,53 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2021, Ha Thach (tinyusb.org) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * This file is part of the TinyUSB stack. + */ + +#ifndef _TUSB_HCD_EHCI_H_ +#define _TUSB_HCD_EHCI_H_ + +#ifdef __cplusplus + extern "C" { +#endif + + +//--------------------------------------------------------------------+ +// API Implemented by HCD +//--------------------------------------------------------------------+ + +// Get operational address i.e EHCI Command register +uint32_t hcd_ehci_register_addr(uint8_t rhport); + +//--------------------------------------------------------------------+ +// API Implemented by EHCI +//--------------------------------------------------------------------+ + +// Initialize EHCI driver +extern bool hcd_ehci_init (uint8_t rhport); + +#ifdef __cplusplus + } +#endif + +#endif diff --git a/src/portable/nxp/transdimension/hcd_transdimension.c b/src/portable/nxp/transdimension/hcd_transdimension.c index e6b7afe8..db447ef2 100644 --- a/src/portable/nxp/transdimension/hcd_transdimension.c +++ b/src/portable/nxp/transdimension/hcd_transdimension.c @@ -43,6 +43,7 @@ #include "common/tusb_common.h" #include "common_transdimension.h" +#include "portable/ehci/hcd_ehci.h" //--------------------------------------------------------------------+ // MACRO CONSTANT TYPEDEF @@ -75,9 +76,6 @@ typedef struct }; #endif -// TODO better prototype later -extern bool hcd_ehci_init (uint8_t rhport); // from ehci.c - //--------------------------------------------------------------------+ // Controller API //--------------------------------------------------------------------+