1 /* 2 * The MIT License (MIT) 3 * 4 * Copyright (c) 2019 Ha Thach (tinyusb.org), 5 * Additions Copyright (c) 2020, Espressif Systems (Shanghai) PTE LTD 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal 9 * in the Software without restriction, including without limitation the rights 10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 * copies of the Software, and to permit persons to whom the Software is 12 * furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 * THE SOFTWARE. 24 * 25 */ 26 27 #pragma once 28 29 #include "tusb_option.h" 30 #include "sdkconfig.h" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #ifndef CONFIG_TINYUSB_CDC_ENABLED 37 # define CONFIG_TINYUSB_CDC_ENABLED 0 38 #endif 39 40 #ifndef CONFIG_TINYUSB_MSC_ENABLED 41 # define CONFIG_TINYUSB_MSC_ENABLED 0 42 #endif 43 44 #ifndef CONFIG_TINYUSB_HID_ENABLED 45 # define CONFIG_TINYUSB_HID_ENABLED 0 46 #endif 47 48 #ifndef CONFIG_TINYUSB_MIDI_ENABLED 49 # define CONFIG_TINYUSB_MIDI_ENABLED 0 50 #endif 51 52 #ifndef CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 53 # define CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 0 54 #endif 55 56 #define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE | OPT_MODE_FULL_SPEED 57 #define CFG_TUSB_OS OPT_OS_FREERTOS 58 59 /* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment. 60 * Tinyusb use follows macros to declare transferring memory so that they can be put 61 * into those specific section. 62 * e.g 63 * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") )) 64 * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4))) 65 */ 66 #ifndef CFG_TUSB_MEM_SECTION 67 # define CFG_TUSB_MEM_SECTION 68 #endif 69 70 #ifndef CFG_TUSB_MEM_ALIGN 71 # define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4) 72 #endif 73 74 #ifndef CFG_TUD_ENDPOINT0_SIZE 75 #define CFG_TUD_ENDPOINT0_SIZE 64 76 #endif 77 78 // CDC FIFO size of TX and RX 79 #define CFG_TUD_CDC_RX_BUFSIZE CONFIG_TINYUSB_CDC_RX_BUFSIZE 80 #define CFG_TUD_CDC_TX_BUFSIZE CONFIG_TINYUSB_CDC_TX_BUFSIZE 81 82 // MSC Buffer size of Device Mass storage 83 #define CFG_TUD_MSC_BUFSIZE CONFIG_TINYUSB_MSC_BUFSIZE 84 85 // HID buffer size Should be sufficient to hold ID (if any) + Data 86 #define CFG_TUD_HID_BUFSIZE CONFIG_TINYUSB_HID_BUFSIZE 87 88 // Enabled device class driver 89 #define CFG_TUD_CDC CONFIG_TINYUSB_CDC_ENABLED 90 #define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED 91 #define CFG_TUD_HID CONFIG_TINYUSB_HID_ENABLED 92 #define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_ENABLED 93 #define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 94 95 #ifdef __cplusplus 96 } 97 #endif 98