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#endif
44
45#define BOARD_DEVICE_RHPORT_NUM 0
46#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_
47#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | OPT_MODE_DEFAULT_SPEED)
48
49#define CFG_TUSB_OS OPT_OS_NONE
50
51#ifndef CFG_TUSB_DEBUG
52#define CFG_TUSB_DEBUG 0
53#endif
54
55// Enable Device stack
56#define CFG_TUD_ENABLED 1
57
58// Default is max speed that hardware controller could support with on-chip PHY
59#define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED
60
61/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
62 * Tinyusb use follows macros to declare transferring memory so that they can be put
63 * into those specific section.
64 * e.g
65 * - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
66 * - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
67 */
68#ifndef CFG_TUSB_MEM_SECTION
69#define CFG_TUSB_MEM_SECTION
70#endif
71
72#ifndef CFG_TUSB_MEM_ALIGN
73#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
74#endif
75
76//--------------------------------------------------------------------
77// DEVICE CONFIGURATION
78//--------------------------------------------------------------------
79
80#ifndef CFG_TUD_ENDPOINT0_SIZE
81#define CFG_TUD_ENDPOINT0_SIZE 64
82#endif
83
84//------------- CLASS -------------//
85#ifndef CFG_TUD_CDC
86#define CFG_TUD_CDC 0
87#endif
88
89#ifndef CFG_TUD_MSC
90#define CFG_TUD_MSC 0
91#endif
92
93#ifndef CFG_TUD_HID
94#define CFG_TUD_HID 0
95#endif
96
97#ifndef CFG_TUD_MIDI
98#define CFG_TUD_MIDI 0
99#endif
100
101#ifndef CFG_TUD_VENDOR
102#define CFG_TUD_VENDOR 0
103#endif
104
105// CDC FIFO size of TX and RX
106#define CFG_TUD_CDC_RX_BUFSIZE (64)
107#define CFG_TUD_CDC_TX_BUFSIZE (64)
108
109// CDC Endpoint transfer buffer size, more is faster
110#define CFG_TUD_CDC_EP_BUFSIZE (64)
111
112// MIDI FIFO size of TX and RX
113#define CFG_TUD_MIDI_RX_BUFSIZE (64)
114#define CFG_TUD_MIDI_TX_BUFSIZE (64)
115
116// MSC Buffer size of Device Mass storage
117#define CFG_TUD_MSC_EP_BUFSIZE (512)
118
119#ifdef __cplusplus
120 }
121#endif
122
123#endif /* _TUSB_CONFIG_H_ */