1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2024-04-12 shelton first version 9 */ 10 11 #ifndef __USB_CONFIG_H__ 12 #define __USB_CONFIG_H__ 13 14 #include <rtthread.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #if defined BSP_USING_DEVICE_USBOTG1 21 #define USE_OTG_DEVICE_MODE 22 #endif 23 24 #if defined BSP_USING_HOST_USBOTG1 25 #define USE_OTG_HOST_MODE 26 #endif 27 28 /* usb irqhandler */ 29 #define OTGFS1_IRQHandler OTGFS1_IRQHandler 30 31 /** 32 * @brief usb device mode config 33 */ 34 #define USB_EPT_MAX_NUM 8 35 36 /* otg1 device fifo */ 37 #define USBD_RX_SIZE 128 38 #define USBD_EP0_TX_SIZE 24 39 #define USBD_EP1_TX_SIZE 20 40 #define USBD_EP2_TX_SIZE 20 41 #define USBD_EP3_TX_SIZE 20 42 #define USBD_EP4_TX_SIZE 20 43 #define USBD_EP5_TX_SIZE 20 44 #define USBD_EP6_TX_SIZE 20 45 #define USBD_EP7_TX_SIZE 20 46 47 /** 48 * @brief usb host mode config 49 */ 50 #define USB_HOST_CHANNEL_NUM 16 51 52 /* otg1 host fifo */ 53 #define USBH_RX_FIFO_SIZE 128 54 #define USBH_NP_TX_FIFO_SIZE 96 55 #define USBH_P_TX_FIFO_SIZE 96 56 57 /** 58 * @brief usb sof output enable 59 */ 60 // #define USB_SOF_OUTPUT_ENABLE 61 62 /** 63 * @brief usb vbus ignore, not use vbus pin 64 */ 65 #define USB_VBUS_IGNORE 66 67 /** 68 * @brief usb low power wakeup handler enable 69 */ 70 // #define USB_LOW_POWER_WAKUP 71 72 #if defined(BSP_USING_HOST_USBOTG1) 73 #undef BSP_USING_DEVICE_USBOTG1 74 #define USBOTG1_CONFIG \ 75 { \ 76 .name = "usbh", \ 77 .id = USB_OTG1_ID, \ 78 .dev_spd = USB_FULL_SPEED_CORE_ID, \ 79 .irqn = OTGFS1_IRQn, \ 80 } 81 #endif /* BSP_USING_HOST_USBOTG1 */ 82 83 #if defined(BSP_USING_DEVICE_USBOTG1) 84 #define USBOTG1_CONFIG \ 85 { \ 86 .name = "usbd", \ 87 .id = USB_OTG1_ID, \ 88 .dev_spd = USB_FULL_SPEED_CORE_ID, \ 89 .irqn = OTGFS1_IRQn, \ 90 } 91 #endif /* BSP_USING_DEVICE_USBOTG1 */ 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #endif 98