summaryrefslogtreecommitdiff
path: root/hid/pico/src/tusb_config.h
blob: a3986ee19dbbfe4cb76e9b31b8131c3ef3341084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* ========================================================================= #
#                                                                            #
#    KVMD - The main PiKVM daemon.                                           #
#                                                                            #
#    Copyright (C) 2018-2024  Maxim Devaev <[email protected]>               #
#                                                                            #
#    This program is free software: you can redistribute it and/or modify    #
#    it under the terms of the GNU General Public License as published by    #
#    the Free Software Foundation, either version 3 of the License, or       #
#    (at your option) any later version.                                     #
#                                                                            #
#    This program is distributed in the hope that it will be useful,         #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of          #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           #
#    GNU General Public License for more details.                            #
#                                                                            #
#    You should have received a copy of the GNU General Public License       #
#    along with this program.  If not, see <https://www.gnu.org/licenses/>.  #
#                                                                            #
# ========================================================================= */


#pragma once


//--------------------------------------------------------------------
// Common config
//--------------------------------------------------------------------

//#define CFG_TUSB_DEBUG 100

#define CFG_TUSB_OS OPT_OS_PICO

// Enable device stack
#define CFG_TUD_ENABLED 1

// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
//#define CFG_TUSB_DEBUG 100

// USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
// Tinyusb use follows macros to declare transferring memory so that they can be put
// into those specific section.
//   - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
//   - CFG_TUSB_MEM_ALIGN   : __attribute__ ((aligned(4)))
#ifndef CFG_TUSB_MEM_SECTION
#	define CFG_TUSB_MEM_SECTION
#endif

#ifndef CFG_TUSB_MEM_ALIGN
#	define CFG_TUSB_MEM_ALIGN __attribute__((aligned(4)))
#endif


//--------------------------------------------------------------------
// Device config
//--------------------------------------------------------------------

#ifndef CFG_TUD_ENDPOINT0_SIZE
#	define CFG_TUD_ENDPOINT0_SIZE 64
#endif

// HID: Keyboard + Mouse
#define CFG_TUD_HID 2

// HID buffer size Should be sufficient to hold ID (if any) + Data
#ifndef CFG_TUD_HID_EP_BUFSIZE
#	define CFG_TUD_HID_EP_BUFSIZE 16
#endif


// CDC for the bridge mode
#define CFG_TUD_CDC             1

// CDC FIFO size of TX and RX
#define CFG_TUD_CDC_RX_BUFSIZE 4096
#define CFG_TUD_CDC_TX_BUFSIZE 4096

// CDC Endpoint transfer buffer size, more is faster
#define CFG_TUD_CDC_EP_BUFSIZE 64