summaryrefslogtreecommitdiff
path: root/bsp/at32/libraries/rt_drivers/config
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2023-02-25 13:52:37 -0500
committerGitHub <[email protected]>2023-02-25 13:52:37 -0500
commit1acef4277b02e5084310ecd7028656ae535178f5 (patch)
tree03b6b6f0b3df75a1cef301e1e7b2b3d234213390 /bsp/at32/libraries/rt_drivers/config
parent759192f5f5af23ae360818483d35974ef5b91c78 (diff)
parente63e33a3c64327aef3556fa811df0a8ec1e0e7ee (diff)
Merge pull request #6981 from RT-Thread/masterserialX-dev
sync from master
Diffstat (limited to 'bsp/at32/libraries/rt_drivers/config')
-rw-r--r--bsp/at32/libraries/rt_drivers/config/f403a_407/usb_config.h69
-rw-r--r--bsp/at32/libraries/rt_drivers/config/f413/usb_config.h69
-rw-r--r--bsp/at32/libraries/rt_drivers/config/f415/usb_config.h95
-rw-r--r--bsp/at32/libraries/rt_drivers/config/f425/usb_config.h95
-rw-r--r--bsp/at32/libraries/rt_drivers/config/f435_437/usb_config.h135
5 files changed, 463 insertions, 0 deletions
diff --git a/bsp/at32/libraries/rt_drivers/config/f403a_407/usb_config.h b/bsp/at32/libraries/rt_drivers/config/f403a_407/usb_config.h
new file mode 100644
index 0000000000..6c7e8fcabc
--- /dev/null
+++ b/bsp/at32/libraries/rt_drivers/config/f403a_407/usb_config.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-28 leo first version
+ */
+
+#ifndef __USB_CONFIG_H__
+#define __USB_CONFIG_H__
+
+#include <rtthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* usb irqhandler */
+#define USB_IRQHandler USBFS_L_CAN1_RX0_IRQHandler
+
+/**
+ * @brief usb endpoint number
+ */
+#define USB_EPT_MAX_NUM 8
+
+/**
+ * @brief auto malloc usb endpoint buffer
+ */
+#define USB_EPT_AUTO_MALLOC_BUFFER
+
+#ifndef USB_EPT_AUTO_MALLOC_BUFFER
+#define EPT0_TX_ADDR 0x40
+#define EPT0_RX_ADDR 0x80
+#define EPT1_TX_ADDR 0xC0
+#define EPT1_RX_ADDR 0x100
+#define EPT2_TX_ADDR 0x140
+#define EPT2_RX_ADDR 0x180
+#define EPT3_TX_ADDR 0x00
+#define EPT3_RX_ADDR 0x00
+#define EPT4_TX_ADDR 0x00
+#define EPT4_RX_ADDR 0x00
+#define EPT5_TX_ADDR 0x00
+#define EPT5_RX_ADDR 0x00
+#define EPT6_TX_ADDR 0x00
+#define EPT6_RX_ADDR 0x00
+#define EPT7_TX_ADDR 0x00
+#define EPT7_RX_ADDR 0x00
+#endif
+
+/**
+ * @brief usb low power wakeup handler enable
+ */
+#define USB_LOW_POWER_WAKUP
+
+#if defined(BSP_USING_USBD)
+#define USBD_CONFIG \
+ { \
+ .name = "usbd", \
+ .irqn = USBFS_L_CAN1_RX0_IRQn, \
+ }
+#endif /* BSP_USING_USBD */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/bsp/at32/libraries/rt_drivers/config/f413/usb_config.h b/bsp/at32/libraries/rt_drivers/config/f413/usb_config.h
new file mode 100644
index 0000000000..6c7e8fcabc
--- /dev/null
+++ b/bsp/at32/libraries/rt_drivers/config/f413/usb_config.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-28 leo first version
+ */
+
+#ifndef __USB_CONFIG_H__
+#define __USB_CONFIG_H__
+
+#include <rtthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* usb irqhandler */
+#define USB_IRQHandler USBFS_L_CAN1_RX0_IRQHandler
+
+/**
+ * @brief usb endpoint number
+ */
+#define USB_EPT_MAX_NUM 8
+
+/**
+ * @brief auto malloc usb endpoint buffer
+ */
+#define USB_EPT_AUTO_MALLOC_BUFFER
+
+#ifndef USB_EPT_AUTO_MALLOC_BUFFER
+#define EPT0_TX_ADDR 0x40
+#define EPT0_RX_ADDR 0x80
+#define EPT1_TX_ADDR 0xC0
+#define EPT1_RX_ADDR 0x100
+#define EPT2_TX_ADDR 0x140
+#define EPT2_RX_ADDR 0x180
+#define EPT3_TX_ADDR 0x00
+#define EPT3_RX_ADDR 0x00
+#define EPT4_TX_ADDR 0x00
+#define EPT4_RX_ADDR 0x00
+#define EPT5_TX_ADDR 0x00
+#define EPT5_RX_ADDR 0x00
+#define EPT6_TX_ADDR 0x00
+#define EPT6_RX_ADDR 0x00
+#define EPT7_TX_ADDR 0x00
+#define EPT7_RX_ADDR 0x00
+#endif
+
+/**
+ * @brief usb low power wakeup handler enable
+ */
+#define USB_LOW_POWER_WAKUP
+
+#if defined(BSP_USING_USBD)
+#define USBD_CONFIG \
+ { \
+ .name = "usbd", \
+ .irqn = USBFS_L_CAN1_RX0_IRQn, \
+ }
+#endif /* BSP_USING_USBD */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/bsp/at32/libraries/rt_drivers/config/f415/usb_config.h b/bsp/at32/libraries/rt_drivers/config/f415/usb_config.h
new file mode 100644
index 0000000000..8fedb30599
--- /dev/null
+++ b/bsp/at32/libraries/rt_drivers/config/f415/usb_config.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-28 leo first version
+ */
+
+#ifndef __USB_CONFIG_H__
+#define __USB_CONFIG_H__
+
+#include <rtthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined BSP_USING_DEVICE_USBFS1
+#define USE_OTG_DEVICE_MODE
+#endif
+
+#if defined BSP_USING_HOST_USBFS1
+#define USE_OTG_HOST_MODE
+#endif
+
+/* usbfs irqhandler */
+#define OTGFS1_IRQHandler OTGFS1_IRQHandler
+
+/**
+ * @brief usb device mode config
+ */
+#define USB_EPT_MAX_NUM 4
+
+/* otg1 device fifo */
+#define USBD_RX_SIZE 128
+#define USBD_EP0_TX_SIZE 24
+#define USBD_EP1_TX_SIZE 20
+#define USBD_EP2_TX_SIZE 20
+#define USBD_EP3_TX_SIZE 20
+#define USBD_EP4_TX_SIZE 20
+#define USBD_EP5_TX_SIZE 20
+#define USBD_EP6_TX_SIZE 20
+#define USBD_EP7_TX_SIZE 20
+
+/**
+ * @brief usb host mode config
+ */
+#define USB_HOST_CHANNEL_NUM 8
+
+/* otg1 host fifo */
+#define USBH_RX_FIFO_SIZE 128
+#define USBH_NP_TX_FIFO_SIZE 96
+#define USBH_P_TX_FIFO_SIZE 96
+
+/**
+ * @brief usb sof output enable
+ */
+// #define USB_SOF_OUTPUT_ENABLE
+
+/**
+ * @brief usb vbus ignore, not use vbus pin
+ */
+#define USB_VBUS_IGNORE
+
+/**
+ * @brief usb low power wakeup handler enable
+ */
+// #define USB_LOW_POWER_WAKUP
+
+#if defined(BSP_USING_HOST_USBFS1)
+#undef BSP_USING_DEVICE_USBFS1
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbh", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_HOST_USBFS1 */
+
+#if defined(BSP_USING_DEVICE_USBFS1)
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbd", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_DEVICE_USBFS1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/bsp/at32/libraries/rt_drivers/config/f425/usb_config.h b/bsp/at32/libraries/rt_drivers/config/f425/usb_config.h
new file mode 100644
index 0000000000..90ea5ae9c0
--- /dev/null
+++ b/bsp/at32/libraries/rt_drivers/config/f425/usb_config.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-28 leo first version
+ */
+
+#ifndef __USB_CONFIG_H__
+#define __USB_CONFIG_H__
+
+#include <rtthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined BSP_USING_DEVICE_USBFS1
+#define USE_OTG_DEVICE_MODE
+#endif
+
+#if defined BSP_USING_HOST_USBFS1
+#define USE_OTG_HOST_MODE
+#endif
+
+/* usbfs irqhandler */
+#define OTGFS1_IRQHandler OTGFS1_IRQHandler
+
+/**
+ * @brief usb device mode config
+ */
+#define USB_EPT_MAX_NUM 8
+
+/* otg1 device fifo */
+#define USBD_RX_SIZE 128
+#define USBD_EP0_TX_SIZE 24
+#define USBD_EP1_TX_SIZE 20
+#define USBD_EP2_TX_SIZE 20
+#define USBD_EP3_TX_SIZE 20
+#define USBD_EP4_TX_SIZE 20
+#define USBD_EP5_TX_SIZE 20
+#define USBD_EP6_TX_SIZE 20
+#define USBD_EP7_TX_SIZE 20
+
+/**
+ * @brief usb host mode config
+ */
+#define USB_HOST_CHANNEL_NUM 16
+
+/* otg1 host fifo */
+#define USBH_RX_FIFO_SIZE 128
+#define USBH_NP_TX_FIFO_SIZE 96
+#define USBH_P_TX_FIFO_SIZE 96
+
+/**
+ * @brief usb sof output enable
+ */
+// #define USB_SOF_OUTPUT_ENABLE
+
+/**
+ * @brief usb vbus ignore, not use vbus pin
+ */
+#define USB_VBUS_IGNORE
+
+/**
+ * @brief usb low power wakeup handler enable
+ */
+// #define USB_LOW_POWER_WAKUP
+
+#if defined(BSP_USING_HOST_USBFS1)
+#undef BSP_USING_DEVICE_USBFS1
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbh", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_HOST_USBFS1 */
+
+#if defined(BSP_USING_DEVICE_USBFS1)
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbd", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_DEVICE_USBFS1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/bsp/at32/libraries/rt_drivers/config/f435_437/usb_config.h b/bsp/at32/libraries/rt_drivers/config/f435_437/usb_config.h
new file mode 100644
index 0000000000..93d69f33d9
--- /dev/null
+++ b/bsp/at32/libraries/rt_drivers/config/f435_437/usb_config.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2023-02-28 leo first version
+ */
+
+#ifndef __USB_CONFIG_H__
+#define __USB_CONFIG_H__
+
+#include <rtthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined BSP_USING_DEVICE_USBFS1 || defined BSP_USING_DEVICE_USBFS2
+#define USE_OTG_DEVICE_MODE
+#endif
+
+#if defined BSP_USING_HOST_USBFS1 || defined BSP_USING_HOST_USBFS2
+#define USE_OTG_HOST_MODE
+#endif
+
+/* usbfs irqhandler */
+#define OTGFS1_IRQHandler OTGFS1_IRQHandler
+#define OTGFS2_IRQHandler OTGFS2_IRQHandler
+
+/**
+ * @brief usb device mode config
+ */
+#define USB_EPT_MAX_NUM 8
+
+/* otg1 device fifo */
+#define USBD_RX_SIZE 128
+#define USBD_EP0_TX_SIZE 24
+#define USBD_EP1_TX_SIZE 20
+#define USBD_EP2_TX_SIZE 20
+#define USBD_EP3_TX_SIZE 20
+#define USBD_EP4_TX_SIZE 20
+#define USBD_EP5_TX_SIZE 20
+#define USBD_EP6_TX_SIZE 20
+#define USBD_EP7_TX_SIZE 20
+
+/* otg2 device fifo */
+#define USBD2_RX_SIZE 128
+#define USBD2_EP0_TX_SIZE 24
+#define USBD2_EP1_TX_SIZE 20
+#define USBD2_EP2_TX_SIZE 20
+#define USBD2_EP3_TX_SIZE 20
+#define USBD2_EP4_TX_SIZE 20
+#define USBD2_EP5_TX_SIZE 20
+#define USBD2_EP6_TX_SIZE 20
+#define USBD2_EP7_TX_SIZE 20
+
+/**
+ * @brief usb host mode config
+ */
+#define USB_HOST_CHANNEL_NUM 16
+
+/* otg1 host fifo */
+#define USBH_RX_FIFO_SIZE 128
+#define USBH_NP_TX_FIFO_SIZE 96
+#define USBH_P_TX_FIFO_SIZE 96
+
+/* otg2 host fifo */
+#define USBH2_RX_FIFO_SIZE 128
+#define USBH2_NP_TX_FIFO_SIZE 96
+#define USBH2_P_TX_FIFO_SIZE 96
+
+/**
+ * @brief usb sof output enable
+ */
+// #define USB_SOF_OUTPUT_ENABLE
+
+/**
+ * @brief usb vbus ignore, not use vbus pin
+ */
+#define USB_VBUS_IGNORE
+
+/**
+ * @brief usb low power wakeup handler enable
+ */
+// #define USB_LOW_POWER_WAKUP
+
+#if defined(BSP_USING_HOST_USBFS1)
+#undef BSP_USING_HOST_USBFS2
+#undef BSP_USING_DEVICE_USBFS1
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbh1", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_HOST_USBFS1 */
+
+#if defined(BSP_USING_DEVICE_USBFS1)
+#undef BSP_USING_DEVICE_USBFS2
+#define USBFS1_CONFIG \
+ { \
+ .name = "usbd", \
+ .id = USB_OTG1_ID, \
+ .irqn = OTGFS1_IRQn, \
+ }
+#endif /* BSP_USING_DEVICE_USBFS1 */
+
+#if defined(BSP_USING_HOST_USBFS2)
+#undef BSP_USING_HOST_USBFS1
+#undef BSP_USING_DEVICE_USBFS2
+#define USBFS2_CONFIG \
+ { \
+ .name = "usbh2", \
+ .id = USB_OTG2_ID, \
+ .irqn = OTGFS2_IRQn, \
+ }
+#endif /* BSP_USING_HOST_USBFS2 */
+
+#if defined(BSP_USING_DEVICE_USBFS2)
+#undef BSP_USING_DEVICE_USBFS1
+#define USBFS2_CONFIG \
+ { \
+ .name = "usbd", \
+ .id = USB_OTG2_ID, \
+ .irqn = OTGFS2_IRQn, \
+ }
+#endif /* BSP_USING_DEVICE_USBFS2 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif