summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-08-16 14:16:45 +0800
committersakumisu <[email protected]>2024-08-16 14:16:45 +0800
commit143a5ce3fd31156606c10221730b6fe2a977ee89 (patch)
treeaa0b13dd0ddcbb9a53023b75cd2e5ed4b276c184
parentb171b28a75df1ddc52d166bad6835a43eecd8811 (diff)
refactor: move CHERRYUSB_VERSION and CHERRYUSB_VERSION_STR into usb_version.h
-rw-r--r--cherryusb_config_template.h3
-rw-r--r--common/usb_version.h21
-rw-r--r--core/usbd_core.h1
-rw-r--r--core/usbh_core.h1
-rw-r--r--osal/idf/usb_config.h3
-rw-r--r--port/pusb2/freertos/usb_config.h3
-rw-r--r--port/pusb2/rt-thread/usb_config.h3
-rw-r--r--port/pusb2/standalone/usb_config.h3
-rwxr-xr-xport/xhci/phytium/freertos/usb_config.h3
-rw-r--r--port/xhci/phytium/rt-thread/usb_config.h3
10 files changed, 23 insertions, 21 deletions
diff --git a/cherryusb_config_template.h b/cherryusb_config_template.h
index 013b85b8..4f0517bc 100644
--- a/cherryusb_config_template.h
+++ b/cherryusb_config_template.h
@@ -6,9 +6,6 @@
#ifndef CHERRYUSB_CONFIG_H
#define CHERRYUSB_CONFIG_H
-#define CHERRYUSB_VERSION 0x010301
-#define CHERRYUSB_VERSION_STR "v1.3.1"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
diff --git a/common/usb_version.h b/common/usb_version.h
new file mode 100644
index 00000000..3bdf7306
--- /dev/null
+++ b/common/usb_version.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2024, sakumisu
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef USB_VERSION_H
+#define USB_VERSION_H
+
+#ifdef CHERRYUSB_VERSION
+#warning "Please do not define CHERRYUSB_VERSION in usb_config.h"
+#undef CHERRYUSB_VERSION
+#endif
+#ifdef CHERRYUSB_VERSION_STR
+#warning "Please do not define CHERRYUSB_VERSION_STR in usb_config.h"
+#undef CHERRYUSB_VERSION_STR
+#endif
+
+#define CHERRYUSB_VERSION 0x010301
+#define CHERRYUSB_VERSION_STR "v1.3.1"
+
+#endif \ No newline at end of file
diff --git a/core/usbd_core.h b/core/usbd_core.h
index 5b88494d..ab7be7f1 100644
--- a/core/usbd_core.h
+++ b/core/usbd_core.h
@@ -23,6 +23,7 @@ extern "C" {
#include "usb_log.h"
#include "usb_dc.h"
#include "usb_memcpy.h"
+#include "usb_version.h"
enum usbd_event_type {
/* USB DCD IRQ */
diff --git a/core/usbh_core.h b/core/usbh_core.h
index c2e98eaf..6674fcb4 100644
--- a/core/usbh_core.h
+++ b/core/usbh_core.h
@@ -21,6 +21,7 @@
#include "usb_osal.h"
#include "usbh_hub.h"
#include "usb_memcpy.h"
+#include "usb_version.h"
#ifdef __cplusplus
extern "C" {
diff --git a/osal/idf/usb_config.h b/osal/idf/usb_config.h
index d761a924..a3d79456 100644
--- a/osal/idf/usb_config.h
+++ b/osal/idf/usb_config.h
@@ -6,9 +6,6 @@
#pragma once
-#define CHERRYUSB_VERSION 0x010301
-#define CHERRYUSB_VERSION_STR "v1.3.1"
-
#include "sdkconfig.h"
#include "esp_rom_sys.h"
diff --git a/port/pusb2/freertos/usb_config.h b/port/pusb2/freertos/usb_config.h
index f8eade1a..760759f8 100644
--- a/port/pusb2/freertos/usb_config.h
+++ b/port/pusb2/freertos/usb_config.h
@@ -15,9 +15,6 @@
#include "FreeRTOS.h"
#include "task.h"
-#define CHERRYUSB_VERSION 0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
diff --git a/port/pusb2/rt-thread/usb_config.h b/port/pusb2/rt-thread/usb_config.h
index 57eeff98..2a42c478 100644
--- a/port/pusb2/rt-thread/usb_config.h
+++ b/port/pusb2/rt-thread/usb_config.h
@@ -13,9 +13,6 @@
#include "rtconfig.h"
-#define CHERRYUSB_VERSION 0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__)
diff --git a/port/pusb2/standalone/usb_config.h b/port/pusb2/standalone/usb_config.h
index 9665b0eb..e4fbc4e7 100644
--- a/port/pusb2/standalone/usb_config.h
+++ b/port/pusb2/standalone/usb_config.h
@@ -13,9 +13,6 @@
#include "sdkconfig.h"
-#define CHERRYUSB_VERSION 0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
diff --git a/port/xhci/phytium/freertos/usb_config.h b/port/xhci/phytium/freertos/usb_config.h
index addb09e7..60a9ed18 100755
--- a/port/xhci/phytium/freertos/usb_config.h
+++ b/port/xhci/phytium/freertos/usb_config.h
@@ -16,9 +16,6 @@
#include "FreeRTOS.h"
#include "task.h"
-#define CHERRYUSB_VERSION 0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
diff --git a/port/xhci/phytium/rt-thread/usb_config.h b/port/xhci/phytium/rt-thread/usb_config.h
index 553b3ba0..460d1241 100644
--- a/port/xhci/phytium/rt-thread/usb_config.h
+++ b/port/xhci/phytium/rt-thread/usb_config.h
@@ -13,9 +13,6 @@
#include "rtthread.h"
-#define CHERRYUSB_VERSION 0x010400
-#define CHERRYUSB_VERSION_STR "v1.4.0"
-
/* ================ USB common Configuration ================ */
#define CONFIG_USB_PRINTF(...) rt_kprintf(__VA_ARGS__)