Skip to content

Update cherryusb to v1.6.1#11362

Open
sakumisu wants to merge 2 commits intoRT-Thread:masterfrom
sakumisu:master
Open

Update cherryusb to v1.6.1#11362
sakumisu wants to merge 2 commits intoRT-Thread:masterfrom
sakumisu:master

Conversation

@sakumisu
Copy link
Copy Markdown
Contributor

@sakumisu sakumisu commented May 6, 2026

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread!

为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。
To ensure your code complies with RT-Thread's coding style, please run the code formatting workflow by following the steps below (If the formatting of CI fails to run).


🛠 操作步骤 | Steps

  1. 前往 Actions 页面 | Go to the Actions page
    点击进入工作流 → | Click to open workflow →

  2. 点击 Run workflow | Click Run workflow

  • 设置需排除的文件/目录(目录请以"/"结尾)
    Set files/directories to exclude (directories should end with "/")
  • 将目标分支设置为 \ Set the target branch to:master
  • 设置PR number为 \ Set the PR number to:11362
  1. 等待工作流完成 | Wait for the workflow to complete
    格式化后的代码将自动推送至你的分支。
    The formatted code will be automatically pushed to your branch.

完成后,提交将自动更新至 master 分支,关联的 Pull Request 也会同步更新。
Once completed, commits will be pushed to the master branch automatically, and the related Pull Request will be updated.

如有问题欢迎联系我们,再次感谢您的贡献!💐
If you have any questions, feel free to reach out. Thanks again for your contribution!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

📌 Code Review Assignment

🏷️ Tag: bsp_mcxn

Reviewers: hywing

Changed Files (Click to expand)
  • bsp/nxp/mcx/mcxn/frdm-mcxn947/board/cherryusb_port.c
  • bsp/nxp/mcx/mcxn/frdm-mcxn947/board/usb_config.h

🏷️ Tag: components

Reviewers: Maihuanyi

Changed Files (Click to expand)
  • components/drivers/usb/cherryusb/Kconfig
  • components/drivers/usb/cherryusb/README.md
  • components/drivers/usb/cherryusb/README_zh.md
  • components/drivers/usb/cherryusb/SConscript
  • components/drivers/usb/cherryusb/VERSION
  • components/drivers/usb/cherryusb/cherryusb.cmake
  • components/drivers/usb/cherryusb/cherryusb_config_template.h
  • components/drivers/usb/cherryusb/class/adb/usbd_adb.c
  • components/drivers/usb/cherryusb/class/audio/usb_audio.h
  • components/drivers/usb/cherryusb/class/audio/usbd_audio.c
  • components/drivers/usb/cherryusb/class/audio/usbh_audio.c
  • components/drivers/usb/cherryusb/class/cdc/usb_cdc.h
  • components/drivers/usb/cherryusb/class/cdc/usbd_cdc_acm.c
  • components/drivers/usb/cherryusb/class/cdc/usbd_cdc_ecm.c
  • components/drivers/usb/cherryusb/class/dfu/usb_dfu.h
  • components/drivers/usb/cherryusb/class/dfu/usbd_dfu.c
  • components/drivers/usb/cherryusb/class/dfu/usbd_dfu.h
  • components/drivers/usb/cherryusb/class/gamepad/usbd_gamepad.c
  • components/drivers/usb/cherryusb/class/hid/usbd_hid.c
  • components/drivers/usb/cherryusb/class/hid/usbh_hid.c
  • components/drivers/usb/cherryusb/class/hid/usbh_hid.h
  • components/drivers/usb/cherryusb/class/hub/usbh_hub.c
  • components/drivers/usb/cherryusb/class/msc/usbd_msc.c

📊 Current Review Status (Last Updated: 2026-05-06 14:14 CST)

  • Maihuanyi Pending Review
  • hywing Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

sakumisu added 2 commits May 6, 2026 14:13
Signed-off-by: sakumisu <1203593632@qq.com>
Signed-off-by: sakumisu <1203593632@qq.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the in-tree CherryUSB stack to v1.6.1, adding new class drivers/templates and refactoring parts of the RT-Thread integration and host/device core.

本次 PR 将仓库内置的 CherryUSB 协议栈升级到 v1.6.1,并新增部分 class driver / demo,同时调整了 RT-Thread 集成与 host/device 核心逻辑。

Changes / 变更点:

  • Version bump to v1.6.1 (VERSION / usb_version.h / idf_component.yml) and README refresh.
    版本升级到 v1.6.1,并更新 README/资源占用说明等内容。
  • Add vendor display device class + template and add xbox vendor paths/host driver hooks.
    新增厂商 display 设备类与模板,并加入 xbox vendor 类相关构建入口。
  • Host/device core + ports improvements (DWC2/MUSB/HPM, HID parser refactor, etc.).
    host/device 核心与部分端口代码优化(DWC2/MUSB/HPM、HID 解析重构等)。

PR process notes / PR 流程备注:

  • PR title does not follow RT-Thread prefix convention (e.g. [usb] ...).
    PR 标题未遵循 RT-Thread 前缀规范(例如 [usb] ...)。
  • PR description template is still unfilled (the [...] placeholder remains).
    PR 描述模板未填写完成(仍保留 [...] 占位内容)。

Reviewed changes

Copilot reviewed 95 out of 98 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
bsp/bouffalo_lab/bl61x/board/cherryusb_port.c Update usbh_initialize signature usage
bsp/bouffalo_lab/bl61x/board/usb_config.h Rename serial class macro + RX size default
bsp/hpmicro/hpm6750evk/board/cherryusb_port.c Remove old CherryUSB port (deleted)
bsp/hpmicro/hpm6750evk2/board/cherryusb_port.c Update usbh_initialize signature usage
bsp/hpmicro/hpm6750evk2/board/usb_config.h Rename serial class macro + RX size default
bsp/nxp/mcx/mcxn/frdm-mcxn947/board/cherryusb_port.c Update usbh_initialize signature usage
bsp/nxp/mcx/mcxn/frdm-mcxn947/board/usb_config.h Rename serial class macro + RX size default
components/drivers/usb/cherryusb/Kconfig Add new options; rename host test symbols
components/drivers/usb/cherryusb/README.md Update English README contents/resources
components/drivers/usb/cherryusb/README_zh.md Update Chinese README contents/resources
components/drivers/usb/cherryusb/SConscript Add display/xbox; refactor RT-Thread platform source lists
components/drivers/usb/cherryusb/VERSION Bump patch level to 1
components/drivers/usb/cherryusb/cherryusb.cmake Add display/xbox CMake hooks; remove cherryRB/cherryMP hooks
components/drivers/usb/cherryusb/cherryusb_config_template.h Add commented XBOX class count
components/drivers/usb/cherryusb/class/adb/usbd_adb.c Tighten checks using asserts
components/drivers/usb/cherryusb/class/audio/usb_audio.h Adjust feature unit sizing + descriptor length formatting
components/drivers/usb/cherryusb/class/audio/usbd_audio.c Fix fixed-length field copies and reduce logging
components/drivers/usb/cherryusb/class/audio/usbh_audio.c Fix altsetting selection logic + add bounds asserts
components/drivers/usb/cherryusb/class/cdc/usb_cdc.h Fix ECM/NCM descriptor lengths and add altsetting0 interface
components/drivers/usb/cherryusb/class/cdc/usbd_cdc_acm.c Use fixed 7-byte line coding copy
components/drivers/usb/cherryusb/class/cdc/usbd_cdc_ecm.c Reduce unhandled request logging
components/drivers/usb/cherryusb/class/dfu/usb_dfu.h DFU protocol/constants + descriptor macro changes
components/drivers/usb/cherryusb/class/dfu/usbd_dfu.h Update DFU header API surface
components/drivers/usb/cherryusb/class/gamepad/usbd_gamepad.c Fix memset/memcpy sizing to struct types
components/drivers/usb/cherryusb/class/hid/usbd_hid.c Reduce unhandled request logging
components/drivers/usb/cherryusb/class/hid/usbh_hid.c Replace old report parser with new item-based parser
components/drivers/usb/cherryusb/class/hid/usbh_hid.h New HID report item data structures/APIs
components/drivers/usb/cherryusb/class/hub/usbh_hub.c Replace bus mutex with hub sem; deinit/thread exit changes
components/drivers/usb/cherryusb/class/msc/usbd_msc.c Minor MSC behavior + comment formatting + inquiry length tweak
components/drivers/usb/cherryusb/class/serial/usbh_ch34x.c Fix debug tag typo
components/drivers/usb/cherryusb/class/serial/usbh_ftdi.c Formatting-only change
components/drivers/usb/cherryusb/class/serial/usbh_serial.c Switch to common usb_ringbuffer
components/drivers/usb/cherryusb/class/serial/usbh_serial.h Remove local ringbuf type; use usb_ringbuffer_t
components/drivers/usb/cherryusb/class/vendor/display/usbd_display.c New display class implementation
components/drivers/usb/cherryusb/class/vendor/display/usbd_display.h New display class public API
components/drivers/usb/cherryusb/class/video/usbd_video.c Reduce unhandled request logging
components/drivers/usb/cherryusb/class/video/usbh_video.c Fix device search flow + add bounds asserts
components/drivers/usb/cherryusb/class/video/usbh_video.h Make max frames/formats configurable
components/drivers/usb/cherryusb/class/wireless/usbd_rndis.c Reduce noisy logging
components/drivers/usb/cherryusb/common/usb_mempool.h New mempool utility based on ringbuffer + sem
components/drivers/usb/cherryusb/common/usb_osal.h Add usb_osal_sem_create_counting API
components/drivers/usb/cherryusb/common/usb_ringbuffer.h New generic ringbuffer implementation
components/drivers/usb/cherryusb/common/usb_version.h Bump version macros to v1.6.1
components/drivers/usb/cherryusb/core/usbd_core.c Reorder init/deinit event notifications
components/drivers/usb/cherryusb/core/usbd_core.h Include ringbuffer/mempool headers
components/drivers/usb/cherryusb/core/usbh_core.c Fix config parse pointer advance; mutex handling tweaks; connected check
components/drivers/usb/cherryusb/core/usbh_core.h Include ringbuffer/mempool headers; replace bus mutex member
components/drivers/usb/cherryusb/core/usbotg_core.c Update usbh_initialize call signature
components/drivers/usb/cherryusb/demo/adb/usbd_adb_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/audio_v1_mic_multichan_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/audio_v1_mic_speaker_multichan_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/audio_v2_mic_multichan_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/audio_v2_mic_speaker_multichan_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/audio_v2_speaker_multichan_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/bootuf2/msc_bootuf2_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_acm_hid_msc_template.c Fix string descriptor bounds check; HID report cleanup
components/drivers/usb/cherryusb/demo/cdc_acm_mavlink_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_acm_msc_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_acm_multi_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_acm_rttchardev_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_acm_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/cdc_ecm_template.c Fix string descriptor bounds check; fix dhclient typo
components/drivers/usb/cherryusb/demo/cdc_rndis_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/dfu_st_cubemx_main.c Remove ST CubeMX sample (deleted)
components/drivers/usb/cherryusb/demo/dfu_template.c Update DFU demo descriptors + new DFU hook functions
components/drivers/usb/cherryusb/demo/display/README.md New display demo README
components/drivers/usb/cherryusb/demo/display/usbdisplay_template.c New USB display demo template
components/drivers/usb/cherryusb/demo/gamepad_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/hid_custom_inout_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/hid_keyboard_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/hid_mouse_template.c Fix string descriptor bounds check; formatting cleanup
components/drivers/usb/cherryusb/demo/hid_remote_wakeup_template.c Fix string descriptor bounds check; HID report cleanup
components/drivers/usb/cherryusb/demo/midi_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/msc_ram_template.c Update blkdev gating + new blkdev init hook
components/drivers/usb/cherryusb/demo/video_audiov1_hid_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/video_static_h264_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/video_static_mjpeg_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/video_static_yuyv_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/webusb_hid_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/winusb1.0_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/winusb2.0_cdc_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/demo/winusb2.0_template.c Fix string descriptor bounds check
components/drivers/usb/cherryusb/idf_component.yml Bump IDF component version to 1.6.1
components/drivers/usb/cherryusb/osal/usb_osal_rtthread.c Add counting semaphore API stub
components/drivers/usb/cherryusb/port/chipidea/usb_dc_chipidea.c Fix out_ep indexing for cache invalidate
components/drivers/usb/cherryusb/port/dwc2/usb_dc_dwc2.c Fix PHYIF16 handling; improve deinit interrupt cleanup
components/drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c Comment style tweak
components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c Critical-section around channel interrupt mask/enable
components/drivers/usb/cherryusb/port/hpmicro/usb_dc_hpm.c SDK version guard; setup packet handling fix; error codes
components/drivers/usb/cherryusb/port/musb/README.md Add TM4Cx to TI list
components/drivers/usb/cherryusb/port/musb/usb_hc_musb.c Stall flag handling adjustments
components/drivers/usb/cherryusb/platform/rtthread/usb_check.c Remove old RT-Thread host checks (deleted)
components/drivers/usb/cherryusb/platform/rtthread/usb_msh.c Remove old host MSH commands (deleted)
components/drivers/usb/cherryusb/platform/rtthread/usbd_adb_shell.c Remove old RT-Thread ADB shell port (deleted)
components/drivers/usb/cherryusb/platform/rtthread/usbd_serial.c Remove old RT-Thread CDC ACM chardev (deleted)
components/drivers/usb/cherryusb/platform/rtthread/usbh_dfs.c Remove old RT-Thread MSC/DFS glue (deleted)
components/drivers/usb/cherryusb/platform/rtthread/usbh_lwip.c Remove old RT-Thread LWIP glue (deleted)
Comments suppressed due to low confidence (2)

components/drivers/usb/cherryusb/Kconfig:510

  • [bug/错误]: Kconfig renamed host demo symbols but code still checks old macros

English: The Kconfig options were renamed to RT_TEST_USBH_*, but existing demo code (e.g., components/drivers/usb/cherryusb/demo/usb_host.c) still uses #ifdef CONFIG_TEST_USBH_*. This mismatch will prevent these demos from being enabled/compiled via menuconfig. Please either keep the old CONFIG_TEST_USBH_* symbols, or update the demo sources (and any documentation) to use the new RT_TEST_USBH_* names.
中文:Kconfig 中将 host demo 选项改为 RT_TEST_USBH_*,但现有示例代码(如 components/drivers/usb/cherryusb/demo/usb_host.c)仍通过 #ifdef CONFIG_TEST_USBH_* 控制编译。该不一致会导致在 menuconfig 中无法正确启用/编译这些 demo。请保留旧的 CONFIG_TEST_USBH_* 符号,或同步修改 demo 源码(及文档)使用新的 RT_TEST_USBH_* 名称。

        menu "Select USB host template, please select class driver first"
            config RT_TEST_USBH_SERIAL
                bool
                prompt "demo for test seial, cannot enable this demo, you can use rt-thread device api to test"
                default n
                depends on CONFIG_USBHOST_SERIAL
            config RT_TEST_USBH_HID
                int
                prompt "demo for test hid"
                default 0
                depends on RT_CHERRYUSB_HOST_HID
            config RT_TEST_USBH_MSC
                bool
                prompt "demo for test msc, cannot enable this demo, you can use rt-thread dfs api to test"
                default n
                depends on RT_CHERRYUSB_HOST_MSC
            config RT_TEST_USBH_NET
                bool
                prompt "demo for test net, cannot enable this demo, you can use lwip api to test"
                default n
                depends on RT_CHERRYUSB_HOST_CDC_ECM || RT_CHERRYUSB_HOST_CDC_RNDIS || RT_CHERRYUSB_HOST_CDC_NCM || RT_CHERRYUSB_HOST_ASIX || RT_CHERRYUSB_HOST_RTL8152

components/drivers/usb/cherryusb/class/hub/usbh_hub.c:749

  • [bug/错误]: Resource leak on hub init failure paths

English: In usbh_hub_initialize(), if creating hub_sem fails, the previously created hub_mq is not deleted. If thread creation fails, neither hub_mq nor hub_sem is cleaned up. This can leak IPC objects and make subsequent init attempts fail. Please add proper cleanup on each failure path.
中文:在 usbh_hub_initialize() 中,如果创建 hub_sem 失败,之前创建的 hub_mq 没有释放;如果创建线程失败,则 hub_mqhub_sem 都不会清理。这会泄漏 IPC 对象并可能导致后续初始化失败。请在各个失败分支补充相应的资源回收逻辑。

    bus->hub_mq = usb_osal_mq_create(7);
    if (bus->hub_mq == NULL) {
        USB_LOG_ERR("Failed to create hub mq\r\n");
        return -1;
    }

    bus->hub_sem = usb_osal_sem_create(0);
    if (bus->hub_sem == NULL) {
        USB_LOG_ERR("Failed to create hub sem\r\n");
        return -1;
    }

    snprintf(thread_name, 32, "usbh_hub%u", bus->busid);
    bus->hub_thread = usb_osal_thread_create(thread_name, CONFIG_USBHOST_PSC_STACKSIZE, CONFIG_USBHOST_PSC_PRIO, usbh_hub_thread, bus);
    if (bus->hub_thread == NULL) {
        USB_LOG_ERR("Failed to create hub thread\r\n");
        return -1;
    }

Comment on lines 143 to 146
if GetDepend(['RT_CHERRYUSB_DEVICE_ADB']):
src += Glob('class/adb/usbd_adb.c')
src += Glob('platform/rtthread/usbd_adb_shell.c')

Comment on lines +352 to +353
src += Glob('platform/rtthread/rt_usb_msh.c')
src += Glob('platform/rtthread/rt_usb_check.c')
src += Glob('platform/rtthread/usbd_serial.c')
src += Glob('platform/rtthread/rt_usbd_serial.c')

if GetDepend(['PKG_CHERRYUSB_DEVICE_MSC_BLKDEV']):
Comment on lines 145 to +153
void msc_ram_init(uint8_t busid, uintptr_t reg_base)
{
#if defined(RT_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV) || defined(PKG_CHERRYUSB_DEVICE_TEMPLATE_MSC_BLKDEV)
rt_err_t res;

blk_dev = rt_device_find(CONFIG_USBDEV_MSC_BLOCK_DEV_NAME);
RT_ASSERT(blk_dev);

res = rt_device_open(blk_dev, RT_DEVICE_OFLAG_RDWR);
RT_ASSERT(res == RT_EOK);
#endif
usbd_desc_register(busid, &msc_ram_descriptor);

#if defined(RT_CHERRYUSB_DEVICE_MSC_BLKDEV) || defined(PKG_CHERRYUSB_DEVICE_MSC_BLKDEV)
extern void usbd_msc_blkdev_init(uint8_t busid, uint8_t in_ep, uint8_t out_ep);
usbd_msc_blkdev_init(busid, MSC_IN_EP, MSC_OUT_EP);
#else
usbd_add_interface(busid, usbd_msc_init_intf(busid, &intf0, MSC_OUT_EP, MSC_IN_EP));
#endif
Comment on lines 107 to 116
/**\brief Payload packet to response in DFU_GETSTATUS request */
struct dfu_info {
uint8_t bStatus; /**<\brief An indication of the status resulting from the
struct dfu_status {
uint8_t bStatus; /**<\brief An indication of the status resulting from the
* execution of the most recent request.*/
uint8_t bPollTimeout; /**<\brief Minimum time (LSB) in ms, that the host should wait
uint32_t bwPollTimeout; /**<\brief Minimum time in ms, that the host should wait
* before sending a subsequent DFU_GETSTATUS request.*/
uint16_t wPollTimeout; /**<\brief Minimum time (MSB) in ms, that the host should wait
* before sending a subsequent DFU_GETSTATUS request.*/
uint8_t bState; /**<\brief An indication of the state that the device is going
uint8_t bState; /**<\brief An indication of the state that the device is going
* to enter immediately following transmission of this response.*/
uint8_t iString; /**<\brief Index of the status string descriptor.*/
uint8_t iString; /**<\brief Index of the status string descriptor.*/
};
Comment on lines +131 to +142
static inline void usb_mempool_reset(struct usb_mempool *pool)
{
uintptr_t *item;

usb_ringbuffer_reset(&pool->in);
usb_ringbuffer_reset(&pool->out);

for (uint32_t i = 0; i < pool->block_count; i++) {
item = (uintptr_t *)((uint8_t *)pool->block + i * pool->block_size);
usb_mempool_free(pool, item);
}
}
Comment on lines +65 to +68
usb_osal_sem_t usb_osal_sem_create_counting(uint32_t max_count)
{
return usb_osal_sem_create(0);
}
Comment on lines 51 to 55
static USB_NOCACHE_RAM_SECTION ATTR_ALIGN(USB_SOC_DCD_DATA_RAM_ADDRESS_ALIGNMENT)
uint8_t _dcd_data[CONFIG_USBDEV_MAX_BUS][HPM_ALIGN_UP(sizeof(dcd_data_t), USB_SOC_DCD_DATA_RAM_ADDRESS_ALIGNMENT)];
static USB_NOCACHE_RAM_SECTION usb_device_handle_t usb_device_handle[CONFIG_USBDEV_MAX_BUS];
static uint8_t _setup_data[8];

@@ -39,7 +39,7 @@ static int cdc_acm_class_interface_request_handler(uint8_t busid, struct usb_set
/* 4 - Space */
/* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */
/*******************************************************************************/
Comment on lines 31 to 38
switch (control_selector) {
case AUDIO_EP_CONTROL_SAMPLING_FEQ:
switch (setup->bRequest) {
case AUDIO_REQUEST_SET_CUR:
memcpy((uint8_t *)&sampling_freq, *data, *len);
memcpy((uint8_t *)&sampling_freq, *data, 3);
USB_LOG_DBG("Set ep:0x%02x %d Hz\r\n", ep, (int)sampling_freq);
usbd_audio_set_sampling_freq(busid, ep, sampling_freq);
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants