mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 02:45:05 +00:00
- Create `USB_HOST_TYPE` base driver in TactilityKernel - Refactor esp32_usbhost dts format, and create child devices dynamically - Use PSRAM for task stacks where possible: saving 20 kB from just the task stacks, but roughly 30 kB when nothing is connected. - Allow the user to disable USB host interface in the USB settings app, saving an additionaly 20 kB of IRAM when nothing was connected. - Change listener-based APIs to subscribe and poll/await pattern. This avoids callstacks of apps and services leaking into the USB API This results in big IRAM savings: 30 kB when USB host is on and nothing is connected, and 50 kB total when USB host is disabled. This brings the total free IRAM after boot from roughly 170 kB to 200 kB (host enabled) or 220 kB (host disabled).
35 lines
770 B
C
35 lines
770 B
C
// SPDX-License-Identifier: Apache-2.0
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct Device;
|
|
struct DeviceType;
|
|
|
|
#define USB_MSC_MOUNT_PATH_PREFIX "/usb"
|
|
|
|
struct UsbMscApi {
|
|
bool (*eject)(struct Device* device, const char* mount_path);
|
|
};
|
|
|
|
/**
|
|
* A USB_HOST_MSC_TYPE device exists for each mounted USB drive.
|
|
*/
|
|
extern const struct DeviceType USB_HOST_MSC_TYPE;
|
|
|
|
/**
|
|
* Safely eject a mounted USB drive. The device is removed shortly after.
|
|
* @param device non-null ready USB MSC device
|
|
* @param mount_path Full mount path (e.g. "/usb0").
|
|
* @return true if @a device is the drive mounted at @a mount_path and it was ejected.
|
|
*/
|
|
bool usb_msc_eject(struct Device* device, const char* mount_path);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|