summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhihong Chen <[email protected]>2026-08-19 12:55:23 +0800
committersakumisu <[email protected]>2026-08-19 13:52:13 +0800
commitcfb8d3bcdb4b1c4e5e153111e0502ec354512377 (patch)
tree7e4c38deb59cdde89af2085725a8831754600f27
parent89a1610636845a77deec3c3e70c565f20ddb3341 (diff)
[update] platform: zephyr: add MSC application lifecycle hooks
- Add weak usbh_msc_app_run() and usbh_msc_app_stop() callbacks to the Zephyr MSC disk adapter. - Invoke the application start callback after registering the disk and the stop callback before unregistering it, allowing samples to mount and unmount filesystems without modifying the CherryUSB class driver. Signed-off-by: Zhihong Chen <[email protected]>
-rw-r--r--platform/zephyr/usbh_msc_disk.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/platform/zephyr/usbh_msc_disk.c b/platform/zephyr/usbh_msc_disk.c
index 6890f985..0223a9ee 100644
--- a/platform/zephyr/usbh_msc_disk.c
+++ b/platform/zephyr/usbh_msc_disk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2025, sakumisu
+ * Copyright (c) 2025-2026 sakumisu
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -131,12 +131,26 @@ static struct disk_info usbh_msc_disk = {
.ops = &msc_disk_ops,
};
+__WEAK void usbh_msc_app_run(struct usbh_msc *msc_class)
+{
+ (void)msc_class;
+}
+
+__WEAK void usbh_msc_app_stop(struct usbh_msc *msc_class)
+{
+ (void)msc_class;
+}
+
void usbh_msc_run(struct usbh_msc *msc_class)
{
disk_access_register(&usbh_msc_disk);
+
+ usbh_msc_app_run(msc_class);
}
void usbh_msc_stop(struct usbh_msc *msc_class)
{
+ usbh_msc_app_stop(msc_class);
+
disk_access_unregister(&usbh_msc_disk);
-} \ No newline at end of file
+}