10 Commits

Author SHA1 Message Date
sakumisu
18fc474696 docs: freeze version to v1.5.3.99
Signed-off-by: sakumisu <1203593632@qq.com>
2026-01-22 21:33:51 +08:00
MDLZCOOL
fd49804470 fix(musb): fix musb_pipe_alloc missing bus parameter, and fix host checks in irq
Includes:

- add `struct usbh_bus *bus` parameter to `musb_pipe_alloc`
- correct call in `usbh_submit_urb`
- correct host checks in irq
2026-01-22 21:16:27 +08:00
SunJ
af556f4f03 refactor(osal): replace NuttX internal APIs with POSIX APIs
Replace nxsched_self() and nxsched_set_priority() with
standard POSIX sched_getparam() and sched_setparam() in
usb_osal_thread_schedule_other().

This improves portability and follows POSIX standards for
thread priority management.

Change-Id: I2e637268f77e200fbdee3e7713cba1b115976696
Signed-off-by: SunJ <jsun@bouffalolab.com>
2026-01-22 21:16:27 +08:00
sakumisu
901adfe19b update(platform): remove net class weak api, check CONFIG_USBHOST_PLATFORM_* macro is defined or not in usbh_lwip.c
Signed-off-by: sakumisu <1203593632@qq.com>
2026-01-14 14:40:30 +08:00
sakumisu
6e2434a83c fix(port/dwc2/usb_hc_dwc2): restart split transfer with dwc2_xxx_urb_init, do not use dwc2_chan_reenable api
Signed-off-by: sakumisu <1203593632@qq.com>
2026-01-14 14:40:18 +08:00
HakumenJean
dba6022bc9 Update T113S3 glue 2026-01-14 14:39:47 +08:00
Alvin
f9fbf881ba fix(bluetooth): Correct HCI packet type from SCO to ISO in USB host. 2026-01-14 14:38:52 +08:00
sakumisu
de844391bd fix(demo): fix cdc ecm string check
Signed-off-by: sakumisu <1203593632@qq.com>
2026-01-14 14:38:44 +08:00
sakumisu
5ffe9cbe7f fix(port/dwc2/usb_hc_dwc2): fix incorrect HFIR_RELOAD_CTRL setting
Signed-off-by: sakumisu <1203593632@qq.com>
2025-12-26 22:00:39 +08:00
sakumisu
047c872e99 fix: fix winusb string and audio macro
Signed-off-by: sakumisu <1203593632@qq.com>
2025-12-26 12:44:03 +08:00
18 changed files with 196 additions and 154 deletions

View File

@@ -474,7 +474,7 @@ if PKG_USING_CHERRYUSB
config PKG_USING_CHERRYUSB_LATEST_VERSION
bool "latest"
config PKG_USING_CHERRYUSB_V010502
config PKG_USING_CHERRYUSB_V010503
bool "v1.5.3"
config PKG_USING_CHERRYUSB_V010502
bool "v1.5.2"

View File

@@ -1,5 +1,5 @@
VERSION_MAJOR = 1
VERSION_MINOR = 5
PATCHLEVEL = 3
VERSION_TWEAK = 0
VERSION_TWEAK = 99
EXTRAVERSION = 0

View File

@@ -306,16 +306,6 @@ int usbh_cdc_ecm_eth_output(uint32_t buflen)
return usbh_submit_urb(&g_cdc_ecm_class.bulkout_urb);
}
__WEAK void usbh_cdc_ecm_run(struct usbh_cdc_ecm *cdc_ecm_class)
{
(void)cdc_ecm_class;
}
__WEAK void usbh_cdc_ecm_stop(struct usbh_cdc_ecm *cdc_ecm_class)
{
(void)cdc_ecm_class;
}
const struct usbh_class_driver cdc_ecm_class_driver = {
.driver_name = "cdc_ecm",
.connect = usbh_cdc_ecm_connect,

View File

@@ -386,16 +386,6 @@ int usbh_cdc_ncm_eth_output(uint32_t buflen)
return usbh_submit_urb(&g_cdc_ncm_class.bulkout_urb);
}
__WEAK void usbh_cdc_ncm_run(struct usbh_cdc_ncm *cdc_ncm_class)
{
(void)cdc_ncm_class;
}
__WEAK void usbh_cdc_ncm_stop(struct usbh_cdc_ncm *cdc_ncm_class)
{
(void)cdc_ncm_class;
}
const struct usbh_class_driver cdc_ncm_class_driver = {
.driver_name = "cdc_ncm",
.connect = usbh_cdc_ncm_connect,

View File

@@ -795,16 +795,6 @@ int usbh_asix_eth_output(uint32_t buflen)
return usbh_submit_urb(&g_asix_class.bulkout_urb);
}
__WEAK void usbh_asix_run(struct usbh_asix *asix_class)
{
(void)asix_class;
}
__WEAK void usbh_asix_stop(struct usbh_asix *asix_class)
{
(void)asix_class;
}
static const uint16_t asix_id_table[][2] = {
{ 0x0B95, 0x772B },
{ 0x0B95, 0x7720 },

View File

@@ -2251,16 +2251,6 @@ int usbh_rtl8152_eth_output(uint32_t buflen)
return usbh_submit_urb(&g_rtl8152_class.bulkout_urb);
}
__WEAK void usbh_rtl8152_run(struct usbh_rtl8152 *rtl8152_class)
{
(void)rtl8152_class;
}
__WEAK void usbh_rtl8152_stop(struct usbh_rtl8152 *rtl8152_class)
{
(void)rtl8152_class;
}
static const uint16_t rtl_id_table[][2] = {
{ 0x0BDA, 0x8152 },
{ 0, 0 },

View File

@@ -578,16 +578,6 @@ int usbh_rndis_eth_output(uint32_t buflen)
return usbh_submit_urb(&g_rndis_class.bulkout_urb);
}
__WEAK void usbh_rndis_run(struct usbh_rndis *rndis_class)
{
(void)rndis_class;
}
__WEAK void usbh_rndis_stop(struct usbh_rndis *rndis_class)
{
(void)rndis_class;
}
static const struct usbh_class_driver rndis_class_driver = {
.driver_name = "rndis",
.connect = usbh_rndis_connect,

View File

@@ -16,6 +16,6 @@
#endif
#define CHERRYUSB_VERSION 0x010503
#define CHERRYUSB_VERSION_STR "v1.5.3"
#define CHERRYUSB_VERSION_STR "v1.5.3.99"
#endif

View File

@@ -123,12 +123,12 @@
AUDIO_AS_FEEDBACK_DESCRIPTOR_LEN(1))
#endif
#define AUDIO_AC_SIZ (AUDIO_SIZEOF_AC_HEADER_DESC(2) + \
AUDIO_SIZEOF_AC_INPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_FEATURE_UNIT_DESC(2, 1) + \
AUDIO_SIZEOF_AC_OUTPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_INPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_FEATURE_UNIT_DESC(2, 1) + \
#define AUDIO_AC_SIZ (AUDIO_SIZEOF_AC_HEADER_DESC(2) + \
AUDIO_SIZEOF_AC_INPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_FEATURE_UNIT_DESC(IN_CHANNEL_NUM, 1) + \
AUDIO_SIZEOF_AC_OUTPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_INPUT_TERMINAL_DESC + \
AUDIO_SIZEOF_AC_FEATURE_UNIT_DESC(OUT_CHANNEL_NUM, 1) + \
AUDIO_SIZEOF_AC_OUTPUT_TERMINAL_DESC)
#ifdef CONFIG_USBDEV_ADVANCE_DESC

View File

@@ -83,7 +83,7 @@ static const uint8_t *device_quality_descriptor_callback(uint8_t speed)
static const char *string_descriptor_callback(uint8_t speed, uint8_t index)
{
if (index > 3) {
if (index > 4) {
return NULL;
}
return string_descriptors[index];

View File

@@ -65,14 +65,23 @@ void usb_osal_thread_delete(usb_osal_thread_t thread)
void usb_osal_thread_schedule_other(void)
{
struct tcb_s *tcb = nxsched_self();
const int old_priority = tcb->sched_priority;
struct sched_param param;
int old_priority;
nxsched_set_priority(tcb, SCHED_PRIORITY_MIN);
/* Get current priority (pid=0 means current task) */
assert(sched_getparam(0, &param) == 0);
old_priority = param.sched_priority;
/* Set to minimum priority to yield CPU to other tasks */
param.sched_priority = SCHED_PRIORITY_MIN;
assert(sched_setparam(0, &param) == 0);
/* Yield CPU to other tasks */
sched_yield();
nxsched_set_priority(tcb, old_priority);
/* Restore original priority */
param.sched_priority = old_priority;
assert(sched_setparam(0, &param) == 0);
}
usb_osal_sem_t usb_osal_sem_create(uint32_t initial_count)

View File

@@ -30,6 +30,14 @@
#error TCPIP_THREAD_STACKSIZE must be >= 1024
#endif
#if !defined(CONFIG_USBHOST_PLATFORM_CDC_ECM) && \
!defined(CONFIG_USBHOST_PLATFORM_CDC_RNDIS) && \
!defined(CONFIG_USBHOST_PLATFORM_CDC_NCM) && \
!defined(CONFIG_USBHOST_PLATFORM_ASIX) && \
!defined(CONFIG_USBHOST_PLATFORM_RTL8152)
#error "Please enable at least one USB Ethernet platform in usb_config.h or Kconfig"
#endif
// #define CONFIG_USBHOST_PLATFORM_CDC_ECM
// #define CONFIG_USBHOST_PLATFORM_CDC_RNDIS
// #define CONFIG_USBHOST_PLATFORM_CDC_NCM

View File

@@ -48,6 +48,14 @@
#error RT_LWIP_TCPTHREAD_STACKSIZE must be >= 2048
#endif
#if !defined(CONFIG_USBHOST_PLATFORM_CDC_ECM) && \
!defined(CONFIG_USBHOST_PLATFORM_CDC_RNDIS) && \
!defined(CONFIG_USBHOST_PLATFORM_CDC_NCM) && \
!defined(CONFIG_USBHOST_PLATFORM_ASIX) && \
!defined(CONFIG_USBHOST_PLATFORM_RTL8152)
#error "Please enable at least one USB Ethernet platform in usb_config.h or Kconfig"
#endif
// #define CONFIG_USBHOST_PLATFORM_CDC_ECM
// #define CONFIG_USBHOST_PLATFORM_CDC_RNDIS
// #define CONFIG_USBHOST_PLATFORM_CDC_NCM

View File

@@ -339,22 +339,6 @@ static inline void dwc2_chan_enable_csplit(struct usbh_bus *bus, uint8_t ch_num,
}
}
static inline void dwc2_chan_reenable(struct usbh_bus *bus, uint8_t ch_num)
{
__IO uint32_t tmpreg;
uint8_t is_oddframe;
is_oddframe = (((uint32_t)USB_OTG_HOST->HFNUM & 0x01U) != 0U) ? 0U : 1U;
USB_OTG_HC(ch_num)->HCCHAR &= ~USB_OTG_HCCHAR_ODDFRM;
USB_OTG_HC(ch_num)->HCCHAR |= (uint32_t)is_oddframe << 29;
/* Set host channel enable */
tmpreg = USB_OTG_HC(ch_num)->HCCHAR;
tmpreg &= ~USB_OTG_HCCHAR_CHDIS;
tmpreg |= USB_OTG_HCCHAR_CHENA;
USB_OTG_HC(ch_num)->HCCHAR = tmpreg;
}
static void dwc2_halt(struct usbh_bus *bus, uint8_t ch_num)
{
volatile uint32_t ChannelEna = (USB_OTG_HC(ch_num)->HCCHAR & USB_OTG_HCCHAR_CHENA) >> 31;
@@ -751,7 +735,7 @@ int usb_hc_init(struct usbh_bus *bus)
}
if (g_dwc2_hcd[bus->hcd.hcd_id].hw_params.snpsid > 0x4F54292AU) {
USB_OTG_HOST->HCFG |= USB_OTG_HFIR_RELOAD_CTRL;
USB_OTG_HOST->HFIR |= USB_OTG_HFIR_RELOAD_CTRL;
}
/* Clear all pending HC Interrupts */
@@ -1215,12 +1199,15 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
/* restart ssplit transfer */
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
chan->do_csplit = 0;
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
chan->do_csplit = 0;
dwc2_chan_enable_csplit(bus, ch_num, false);
dwc2_chan_reenable(bus, ch_num);
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_INTERRUPT:
chan->do_csplit = 0;
dwc2_chan_enable_csplit(bus, ch_num, false);
urb->errorcode = -USB_ERR_NAK;
dwc2_urb_waitup(urb);
@@ -1235,17 +1222,39 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
}
} else if (chan_intstatus & USB_OTG_HCINT_ACK) {
if (chan->do_ssplit) {
/* start ssplit transfer */
/* start csplit transfer */
chan->do_csplit = 1;
chan->ssplit_frame = dwc2_get_full_frame_num(bus);
dwc2_chan_enable_csplit(bus, ch_num, true);
dwc2_chan_reenable(bus, ch_num);
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
case USB_ENDPOINT_TYPE_INTERRUPT:
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
default:
break;
}
}
} else if (chan_intstatus & USB_OTG_HCINT_NYET) {
if (chan->do_ssplit) {
/* restart csplit transfer */
dwc2_chan_enable_csplit(bus, ch_num, true);
dwc2_chan_reenable(bus, ch_num);
chan->do_csplit = 1;
chan->ssplit_frame = dwc2_get_full_frame_num(bus);
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
case USB_ENDPOINT_TYPE_INTERRUPT:
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
default:
break;
}
} else {
urb->errorcode = -USB_ERR_NAK;
dwc2_urb_waitup(urb);
@@ -1352,12 +1361,15 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
/* restart ssplit transfer */
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
chan->do_csplit = 0;
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
chan->do_csplit = 0;
dwc2_chan_enable_csplit(bus, ch_num, false);
dwc2_chan_reenable(bus, ch_num);
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_INTERRUPT:
chan->do_csplit = 0;
dwc2_chan_enable_csplit(bus, ch_num, false);
urb->errorcode = -USB_ERR_NAK;
dwc2_urb_waitup(urb);
@@ -1372,17 +1384,39 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
}
} else if (chan_intstatus & USB_OTG_HCINT_ACK) {
if (chan->do_ssplit) {
/* start ssplit transfer */
/* start csplit transfer */
chan->do_csplit = 1;
chan->ssplit_frame = dwc2_get_full_frame_num(bus);
dwc2_chan_enable_csplit(bus, ch_num, true);
dwc2_chan_reenable(bus, ch_num);
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
case USB_ENDPOINT_TYPE_INTERRUPT:
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
default:
break;
}
}
} else if (chan_intstatus & USB_OTG_HCINT_NYET) {
if (chan->do_ssplit) {
/* restart csplit transfer */
dwc2_chan_enable_csplit(bus, ch_num, true);
dwc2_chan_reenable(bus, ch_num);
chan->do_csplit = 1;
chan->ssplit_frame = dwc2_get_full_frame_num(bus);
switch (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes)) {
case USB_ENDPOINT_TYPE_CONTROL:
dwc2_control_urb_init(bus, ch_num, urb, urb->setup, urb->transfer_buffer + urb->actual_length - 8, urb->transfer_buffer_length);
break;
case USB_ENDPOINT_TYPE_BULK:
case USB_ENDPOINT_TYPE_INTERRUPT:
dwc2_bulk_intr_urb_init(bus, ch_num, urb, urb->transfer_buffer + urb->actual_length, urb->transfer_buffer_length);
break;
default:
break;
}
} else {
urb->errorcode = -USB_ERR_NAK;
dwc2_urb_waitup(urb);

View File

@@ -1,18 +1,27 @@
/*
* Copyright (c) 2025, YC113
* Copyright (c) 2026, HakumenJean
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2026-01-06 HakumenJean first version
*/
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include "usbh_core.h"
#include "usb_hc_ehci.h"
#ifdef CONFIG_USB_EHCI_WITH_OHCI
#include "usb_hc_ohci.h"
#endif
#include "hal_clk.h"
#include "hal_reset.h"
#include "interrupt.h"
#include "drv_reg_base.h"
#include "drv_clock.h"
#if CONFIG_USBHOST_MAX_BUS != 2
#error "t113 has 2 usb host controller"
@@ -34,6 +43,13 @@
#error "t113 usb ehci no iso register"
#endif
#define USB0_OTG_BASE_ADDR (0x04100000U)
#define USB0_PHY_BASE_ADDR (0x04100400U)
#define USB0_EHCI_BASE_ADDR (0x04101000U)
#define USB1_EHCI_BASE_ADDR (0x04200000U)
#define USB1_PHY_BASE_ADDR (0x04200800U)
void usb_select_phyTohci(void)
{
*(volatile rt_uint32_t *)(USB0_OTG_BASE_ADDR + 0x420) &= ~(1 << 0);
@@ -41,55 +57,52 @@ void usb_select_phyTohci(void)
void usb_gate_open(rt_uint8_t busid)
{
rt_uint32_t addr;
addr = (rt_uint32_t)&CCU->usb0_clk + busid * 4;
if(busid == 0) {
if (busid == 0) {
/* otg gate open*/
CCU->usb_bgr |= 1 << 8;
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_BUS_OTG));
/* otg bus reset */
CCU->usb_bgr &= ~(1 << 24);
sdelay(10);
CCU->usb_bgr |= (1 << 24);
sdelay(10);
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_BUS_OTG));
/* ehci gate open */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_BUS_EHCI0));
/* ehci bus reset */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_BUS_EHCI0));
/* ohci gate open */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_BUS_OHCI0));
/* ohci bus reset */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_BUS_OHCI0));
/* clock enable */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_USB_OHCI0));
/* reset phy */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_USB_PHY0));
/* otg phy select */
usb_select_phyTohci();
} else {
/* ehci gate open */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_BUS_EHCI1));
/* ehci bus reset */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_BUS_EHCI1));
/* ohci gate open */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_BUS_OHCI1));
/* ohci bus reset */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_BUS_OHCI1));
/* clock enable */
hal_clock_enable(hal_clock_get(HAL_SUNXI_CCU, CLK_USB_OHCI1));
/* reset phy */
hal_reset_control_reset(hal_reset_control_get(HAL_SUNXI_RESET, RST_USB_PHY1));
}
/* ehci gate open */
CCU->usb_bgr |= (1 << 4) << busid;
/* ehci bus reset */
CCU->usb_bgr &= ~((1 << 20) << busid);
sdelay(10);
CCU->usb_bgr |= (1 << 20) << busid;
sdelay(10);
/* ohci gate open */
CCU->usb_bgr |= 1 << busid;
/* ohci bus reset */
CCU->usb_bgr &= ~((1 << 16) << busid);
sdelay(10);
CCU->usb_bgr |= (1 << 16) << busid;
sdelay(10);
sdelay(10);
/* clock enable */
*(volatile rt_uint32_t *)addr &= ~(3 << 24);
*(volatile rt_uint32_t *)addr |= (1 << 31) | (1 << 24);
/* reset phy */
*(volatile rt_uint32_t *)addr &= ~(1 << 30);
sdelay(10);
*(volatile rt_uint32_t *)addr |= 1 << 30;
sdelay(10);
/* otg phy select */
if(busid == 0) usb_select_phyTohci();
USB_LOG_DBG("usb%d gate : %X, clock : %X\n", busid, CCU->usb_bgr, *(volatile rt_uint32_t *)addr);
}
void usb_clean_siddp(struct usbh_bus *bus)
@@ -109,10 +122,10 @@ void usb_hci_set_passby(struct usbh_bus *bus)
void t113_ehci_isr(int vector, void *arg)
{
rt_interrupt_enter();
struct usbh_bus *bus = (struct usbh_bus *)arg;
rt_interrupt_enter();
USB_LOG_DBG("t113_ehci_isr");
extern void USBH_IRQHandler(uint8_t busid);
@@ -125,10 +138,10 @@ void t113_ehci_isr(int vector, void *arg)
void t113_ohci_isr(int vector, void *arg)
{
rt_interrupt_enter();
struct usbh_bus *bus = (struct usbh_bus *)arg;
rt_interrupt_enter();
USB_LOG_DBG("t113_ohci_isr");
extern void OHCI_IRQHandler(uint8_t busid);
@@ -149,8 +162,9 @@ void usb_hc_low_level_init(struct usbh_bus *bus)
usb_hci_set_passby(bus);
/* register EHCI interrupt callback */
vector = T113_IRQ_USB0_EHCI + (bus->busid > 0 ? 3 : 0);
vector = SUNXI_IRQ_USB0_EHCI + (bus->busid > 0 ? 3 : 0);
rt_hw_interrupt_install(vector, t113_ehci_isr, bus, RT_NULL);
rt_hw_interrupt_set_priority(vector, 11 << 4);
rt_hw_interrupt_umask(vector);
/* register OHCI interrupt callback */
@@ -196,8 +210,26 @@ int __usbh_init(void)
#ifdef PKG_CHERRYUSB_HOST
#include <rtthread.h>
#include <rthw.h>
#include <rtdevice.h>
INIT_ENV_EXPORT(__usbh_init);
#ifdef CONFIG_USB_DCACHE_ENABLE
void usb_dcache_clean(uintptr_t addr, size_t size)
{
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, (void *)addr, size);
}
void usb_dcache_invalidate(uintptr_t addr, size_t size)
{
rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE, (void *)addr, size);
}
void usb_dcache_flush(uintptr_t addr, size_t size)
{
rt_hw_cpu_dcache_ops(RT_HW_CACHE_FLUSH, (void *)addr, size);
}
#endif
#endif

View File

@@ -17,7 +17,7 @@
#undef USB_POWER_RESUME
#ifndef CONFIG_USB_MUSB_SIFLI
#error must define CONFIG_USB_MUSB_SIFLI when use sunxi chips
#error must define CONFIG_USB_MUSB_SIFLI when use sifli chips
#endif
#include "bf0_hal.h"

View File

@@ -524,7 +524,7 @@ static uint8_t usbh_get_port_speed(struct usbh_bus *bus, const uint8_t port)
return speed;
}
static int musb_pipe_alloc(void)
static int musb_pipe_alloc(struct usbh_bus *bus)
{
int chidx;
uintptr_t flags;
@@ -769,7 +769,7 @@ int usbh_submit_urb(struct usbh_urb *urb)
if (USB_GET_ENDPOINT_TYPE(urb->ep->bmAttributes) == USB_ENDPOINT_TYPE_CONTROL) {
chidx = 0;
} else {
chidx = musb_pipe_alloc();
chidx = musb_pipe_alloc(bus);
if (chidx == -1) {
return -USB_ERR_NOMEM;
}
@@ -1023,9 +1023,11 @@ void USBH_IRQHandler(uint8_t busid)
bus = &g_usbhost_bus[busid];
#if 0
if (!(HWREGB(USB_BASE + MUSB_DEVCTL_OFFSET) & USB_DEVCTL_HOST)) {
return;
}
#endif
is = HWREGB(USB_BASE + MUSB_IS_OFFSET);
txis = HWREGH(USB_BASE + MUSB_TXIS_OFFSET);

View File

@@ -217,10 +217,9 @@ static int usbh_hci_host_rcv_pkt(uint8_t *data, uint32_t len)
buf = usbh_bt_acl_recv(data, remaining);
break;
case USB_BLUETOOTH_HCI_SCO:
case USB_BLUETOOTH_HCI_ISO:
buf = usbh_bt_iso_recv(data, remaining);
break;
default:
USB_LOG_ERR("Unknown HCI type %u\r\n", pkt_indicator);
return -1;