forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 6
USB host MSC implementation at PoC stage according to SoW Block 4 (REQ-VND-USB-006) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vgololobov
wants to merge
5
commits into
renesas:support_renesas_ra_uhc
Choose a base branch
from
Embedd-it:renesas_usbh_msc_poc
base: support_renesas_ra_uhc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f3ec01a
Common USB host stack fixes
vgololobov 105d1be
USB host Mass Storage Class (MSC) implementation at PoC stage
vgololobov beb7d4b
tests: usbh: msc:
vgololobov af1c81f
tests: usbh: msc: MSC improvements
vgololobov b9e6659
tests: usbh: msc: Extended msc test suite with error paths
mattiam-del File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # SPDX-FileCopyrightText: Copyright Nordic Semiconductor ASA | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| if(CONFIG_USBD_VIDEO_CLASS OR CONFIG_USBH_VIDEO_CLASS) | ||
| if(CONFIG_USBD_VIDEO_CLASS OR CONFIG_USBH_VIDEO_CLASS OR CONFIG_USBD_MSC_CLASS OR CONFIG_USBH_MSC_CLASS) | ||
| zephyr_include_directories(.) | ||
| zephyr_sources(uvc.c) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: Copyright 2026 Renesas, Embedd | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /** | ||
| * @file | ||
| * @brief USB Mass Storage Class private header | ||
| * | ||
| * Header follows below documentation: | ||
| * - USB Device Class Definition for Mass Storage Class Devices (Revision 1.4) | ||
| * - SCSI Primary Commands 7 | ||
| * - SCSI Block Commands 7 | ||
| */ | ||
|
|
||
| #ifndef ZEPHYR_SUBSYS_USB_COMMON_MSC_H | ||
| #define ZEPHYR_SUBSYS_USB_COMMON_MSC_H | ||
|
|
||
| /* Subclass and Protocol codes */ | ||
| #define SCSI_TRANSPARENT_COMMAND_SET 0x06 | ||
| #define BULK_ONLY_TRANSPORT 0x50 | ||
|
|
||
| /* Control requests */ | ||
| #define GET_MAX_LUN 0xFE | ||
| #define BULK_ONLY_MASS_STORAGE_RESET 0xFF | ||
|
|
||
| /* Command wrapper */ | ||
| #define CBW_SIGNATURE 0x43425355u | ||
| #define CSW_SIGNATURE 0x53425355u | ||
|
|
||
| #define CBW_FLAGS_DIRECTION_IN 0x80 | ||
| #define CBW_FLAGS_RESERVED_MASK 0x3F | ||
|
|
||
| /* Used to determine if a device is ready to transfer data */ | ||
| #define SCSI_COMMAND_TEST_UNIT_READY 0x00u | ||
| /* Requests that the device server transfer sense data to the application client */ | ||
| #define SCSI_COMMAND_REQUEST_SENSE 0x03u | ||
| /* Requests that the device server transfer mode data */ | ||
| #define SCSI_COMMAND_MODE_SENSE_6 0x1Au | ||
| /* Requests that the device server transfer capacity and medium format information */ | ||
| #define SCSI_COMMAND_READ_CAPACITY_10 0x25u | ||
| /* Requests that the device server read the specified logical blocks */ | ||
| #define SCSI_COMMAND_READ_10 0x28u | ||
| /* Requests that the device server write the specified logical blocks */ | ||
| #define SCSI_COMMAND_WRITE_10 0x2Au | ||
| /* Requests that the device server ensure that the specified logical blocks have their most recent | ||
| data values recorded in non-volatile cache and/or on the medium */ | ||
| #define SCSI_COMMAND_SYNCHRONIZE_CACHE_10 0x35u | ||
| /* Requests that the device server transfer mode data */ | ||
| #define SCSI_COMMAND_MODE_SENSE_10 0x5Au | ||
|
|
||
| #endif /* ZEPHYR_SUBSYS_USB_COMMON_MSC_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| rsource "Kconfig.uvc" | ||
| rsource "Kconfig.msc" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # SPDX-FileCopyrightText: Copyright 2026 Renesas, Embedd | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config USBH_MSC_CLASS | ||
| bool "USB host Mass Storage Class support [EXPERIMENTAL]" | ||
| select EXPERIMENTAL | ||
|
Comment on lines
+4
to
+6
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing |
||
| help | ||
| USB Mass Storage Class (MSC) implementation. | ||
|
|
||
| if USBH_MSC_CLASS | ||
|
|
||
| config USBH_MSC_INSTANCES_COUNT | ||
| int "Number of HOST MSC instances" | ||
| default 4 | ||
| help | ||
| Number of instances of this USB class | ||
|
|
||
| config USBH_MSC_TEST_UNIT_READY_ATTEMPTS | ||
| int "Number of attempts for unit ready command" | ||
| default 5 | ||
| help | ||
| Before an MSC device can be used it must be tested for readyness. It may respond | ||
| negatively, and this is the amount of attempts the test is repeated for before failing. | ||
|
|
||
| config USBH_MSC_RECOVERY_ATTEMPTS | ||
| int "Number of recovery attempts in case of error" | ||
| default 5 | ||
| help | ||
| A SCSI transaction may fail due to USB protocol issues (hardware disturbances, device | ||
| refuses to comply); in this case a reset is required. This is the number of times the host | ||
| driver attempts to reset communication and retry the transaction before failing. | ||
|
|
||
| config USBH_MSC_MAX_SUPPORTED_LUN | ||
| int "Maximum number of logical units supported by the driver" | ||
| default 4 | ||
| help | ||
| An MSC device may expose more than one drive in its interface. They are advertised as LUN | ||
| (Logical UNits) when the device is first connected and each one should result in a | ||
| different mount point. This configuration parameter specifies how many the driver can | ||
| handle for each device. | ||
|
|
||
| config USBH_MSC_IGNORE_SYNC | ||
| bool "Do not attempt to sync data from the device's caches" | ||
| default y | ||
| help | ||
| A lot of cheap MSC devices don't support the SYNCHRONIZE CACHE command; this option skips | ||
| it. | ||
|
|
||
| module = USBH_MSC | ||
| module-str = usbh msc | ||
| default-count = 1 | ||
| source "subsys/logging/Kconfig.template.log_config" | ||
| source "subsys/usb/common/Kconfig.template.instances_count" | ||
|
|
||
| endif # USBH_MSC_CLASS | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why the MSC class build includes
uvc.c?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MSC drivers doesn't strictly need
uvc.c, just the directory inclusion to accesssubsus/usb/commonand includemsc.h. I'll update the file reflect this.