ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
tusb_config.h
Go to the documentation of this file.
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
33extern "C" {
34#endif
35
36#ifndef CONFIG_TINYUSB_CDC_ENABLED
37# define CONFIG_TINYUSB_CDC_ENABLED 0
38#endif
39
40#ifndef CONFIG_TINYUSB_CDC_COUNT
41# define CONFIG_TINYUSB_CDC_COUNT 0
42#endif
43
44#ifndef CONFIG_TINYUSB_MSC_ENABLED
45# define CONFIG_TINYUSB_MSC_ENABLED 0
46#endif
47
48#ifndef CONFIG_TINYUSB_HID_COUNT
49# define CONFIG_TINYUSB_HID_COUNT 0
50#endif
51
52#ifndef CONFIG_TINYUSB_MIDI_COUNT
53# define CONFIG_TINYUSB_MIDI_COUNT 0
54#endif
55
56#ifndef CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED
57# define CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED 0
58#endif
59
60#ifndef CONFIG_TINYUSB_DEBUG_LEVEL
61# define CONFIG_TINYUSB_DEBUG_LEVEL 0
62#endif
63
64#define CFG_TUSB_RHPORT0_MODE OPT_MODE_DEVICE | OPT_MODE_FULL_SPEED
65#define CFG_TUSB_OS OPT_OS_FREERTOS
66
67/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
68 * Tinyusb use follows macros to declare transferring memory so that they can be put
69 * into those specific section.
70 * e.g
71 * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
72 * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
73 */
74#ifndef CFG_TUSB_MEM_SECTION
75# define CFG_TUSB_MEM_SECTION
76#endif
77
78#ifndef CFG_TUSB_MEM_ALIGN
79# define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
80#endif
81
82#ifndef CFG_TUD_ENDPOINT0_SIZE
83#define CFG_TUD_ENDPOINT0_SIZE 64
84#endif
85
86// Debug Level
87#define CFG_TUSB_DEBUG CONFIG_TINYUSB_DEBUG_LEVEL
88
89// CDC FIFO size of TX and RX
90#define CFG_TUD_CDC_RX_BUFSIZE CONFIG_TINYUSB_CDC_RX_BUFSIZE
91#define CFG_TUD_CDC_TX_BUFSIZE CONFIG_TINYUSB_CDC_TX_BUFSIZE
92
93// MSC Buffer size of Device Mass storage
94#define CFG_TUD_MSC_BUFSIZE CONFIG_TINYUSB_MSC_BUFSIZE
95
96#define CFG_TUD_MIDI_EP_BUFSIZE 64
97#define CFG_TUD_MIDI_EPSIZE CFG_TUD_MIDI_EP_BUFSIZE
98#define CFG_TUD_MIDI_RX_BUFSIZE 64
99#define CFG_TUD_MIDI_TX_BUFSIZE 64
100
101// Enabled device class driver
102#define CFG_TUD_CDC CONFIG_TINYUSB_CDC_COUNT
103#define CFG_TUD_MSC CONFIG_TINYUSB_MSC_ENABLED
104#define CFG_TUD_HID CONFIG_TINYUSB_HID_COUNT
105#define CFG_TUD_MIDI CONFIG_TINYUSB_MIDI_COUNT
106#define CFG_TUD_CUSTOM_CLASS CONFIG_TINYUSB_CUSTOM_CLASS_ENABLED
107
108#ifdef __cplusplus
109}
110#endif