gossamer
0.0.1
a very lightweight app framework for SAMD and SAML chips
Loading...
Searching...
No Matches
tusb_config.h
1
/*
2
* The MIT License (MIT)
3
*
4
* Copyright (c) 2019 Ha Thach (tinyusb.org)
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
* THE SOFTWARE.
23
*
24
*/
25
26
#ifndef _TUSB_CONFIG_H_
27
#define _TUSB_CONFIG_H_
28
29
#include "sam.h"
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
35
#if defined(_SAMD21_)
36
#define CFG_TUSB_MCU OPT_MCU_SAMD21
37
#elif defined(_SAMD11_)
38
#define CFG_TUSB_MCU OPT_MCU_SAMD11
39
#elif defined(_SAML21_)
40
#define CFG_TUSB_MCU OPT_MCU_SAML21
41
#elif defined(_SAML22_)
42
#define CFG_TUSB_MCU OPT_MCU_SAML22
43
#elif defined(_SAMD51_)
44
#define CFG_TUSB_MCU OPT_MCU_SAMD51
45
#endif
46
47
#define BOARD_DEVICE_RHPORT_NUM 0
48
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_
49
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_DEFAULT_SPEED)
50
51
#define CFG_TUSB_OS OPT_OS_NONE
52
53
#ifndef CFG_TUSB_DEBUG
54
#define CFG_TUSB_DEBUG 0
55
#endif
56
57
// Enable Device stack
58
#define CFG_TUD_ENABLED 1
59
60
// Default is max speed that hardware controller could support with on-chip PHY
61
#define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED
62
63
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
64
* Tinyusb use follows macros to declare transferring memory so that they can be put
65
* into those specific section.
66
* e.g
67
* - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
68
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
69
*/
70
#ifndef CFG_TUSB_MEM_SECTION
71
#define CFG_TUSB_MEM_SECTION
72
#endif
73
74
#ifndef CFG_TUSB_MEM_ALIGN
75
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
76
#endif
77
78
//--------------------------------------------------------------------
79
// DEVICE CONFIGURATION
80
//--------------------------------------------------------------------
81
82
#ifndef CFG_TUD_ENDPOINT0_SIZE
83
#define CFG_TUD_ENDPOINT0_SIZE 64
84
#endif
85
86
//------------- CLASS -------------//
87
#ifndef CFG_TUD_CDC
88
#define CFG_TUD_CDC 0
89
#endif
90
91
#ifndef CFG_TUD_MSC
92
#define CFG_TUD_MSC 0
93
#endif
94
95
#ifndef CFG_TUD_HID
96
#define CFG_TUD_HID 0
97
#endif
98
99
#ifndef CFG_TUD_MIDI
100
#define CFG_TUD_MIDI 0
101
#endif
102
103
#ifndef CFG_TUD_VENDOR
104
#define CFG_TUD_VENDOR 0
105
#endif
106
107
// CDC FIFO size of TX and RX
108
#define CFG_TUD_CDC_RX_BUFSIZE (64)
109
#define CFG_TUD_CDC_TX_BUFSIZE (64)
110
111
// CDC Endpoint transfer buffer size, more is faster
112
#define CFG_TUD_CDC_EP_BUFSIZE (64)
113
114
// MIDI FIFO size of TX and RX
115
#define CFG_TUD_MIDI_RX_BUFSIZE (64)
116
#define CFG_TUD_MIDI_TX_BUFSIZE (64)
117
118
// MSC Buffer size of Device Mass storage
119
#define CFG_TUD_MSC_EP_BUFSIZE (512)
120
121
#ifdef __cplusplus
122
}
123
#endif
124
125
#endif
/* _TUSB_CONFIG_H_ */
common
tusb_config.h
Generated by
1.12.0