summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2025-01-15 17:10:44 +0800
committersakumisu <[email protected]>2025-01-15 17:11:27 +0800
commit99e2e6bfd45cb763bc0ddde002ea0537e5d795e4 (patch)
tree9ea851a6af7f362c778d620eadc06ddedc1367c1 /common
parent64394bf246ece73201b7e76092a26d36fa793fb3 (diff)
feat(core/otg): add otg framework
Signed-off-by: sakumisu <[email protected]>
Diffstat (limited to 'common')
-rw-r--r--common/usb_otg.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/common/usb_otg.h b/common/usb_otg.h
new file mode 100644
index 00000000..6adf5451
--- /dev/null
+++ b/common/usb_otg.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025, sakumisu
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef USB_OTG_H
+#define USB_OTG_H
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief usb otg controller hardware or gpio id simulator init.
+ *
+ * @return On success will return 0, and others indicate fail.
+ */
+int usb_otg_init(uint8_t busid);
+/**
+ * @brief usb otg controller hardware or gpio id simulator deinit.
+ *
+ * @return On success will return 0, and others indicate fail.
+ */
+int usb_otg_deinit(uint8_t busid);
+/**
+ * @brief get current role mode.
+ *
+ * @return return USBOTG_MODE_HOST or USBOTG_MODE_DEVICE.
+ */
+uint8_t usbotg_get_current_mode(uint8_t busid);
+
+/* called by user */
+void USBOTG_IRQHandler(uint8_t busid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* USB_OTG_H */ \ No newline at end of file