Contiki-NG
Toggle main menu visibility
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
#ifdef __cplusplus
30
extern
"C"
{
31
#endif
32
33
//--------------------------------------------------------------------
34
// COMMON CONFIGURATION
35
//--------------------------------------------------------------------
36
37
// defined by board.mk
38
#ifndef CFG_TUSB_MCU
39
#error CFG_TUSB_MCU must be defined
40
#endif
41
42
// RHPort number used for device can be defined by board.mk, default to port 0
43
#ifndef BOARD_DEVICE_RHPORT_NUM
44
#define BOARD_DEVICE_RHPORT_NUM 0
45
#endif
46
47
// RHPort max operational speed can defined by board.mk
48
// Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
49
#ifndef BOARD_DEVICE_RHPORT_SPEED
50
#if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
51
CFG_TUSB_MCU == OPT_MCU_NUC505 || CFG_TUSB_MCU == OPT_MCU_CXD56)
52
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_HIGH_SPEED
53
#else
54
#define BOARD_DEVICE_RHPORT_SPEED OPT_MODE_FULL_SPEED
55
#endif
56
#endif
57
58
// Device mode with rhport and speed defined by board.mk
59
#if BOARD_DEVICE_RHPORT_NUM == 0
60
#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
61
#elif BOARD_DEVICE_RHPORT_NUM == 1
62
#define CFG_TUSB_RHPORT1_MODE (OPT_MODE_DEVICE | BOARD_DEVICE_RHPORT_SPEED)
63
#else
64
#error "Incorrect RHPort configuration"
65
#endif
66
67
// This example doesn't use an RTOS
68
#ifndef CFG_TUSB_OS
69
#define CFG_TUSB_OS OPT_OS_NONE
70
#endif
71
72
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
73
// #define CFG_TUSB_DEBUG 0
74
75
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
76
* Tinyusb use follows macros to declare transferring memory so that they can be put
77
* into those specific section.
78
* e.g
79
* - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
80
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
81
*/
82
#ifndef CFG_TUSB_MEM_SECTION
83
#define CFG_TUSB_MEM_SECTION
84
#endif
85
86
#ifndef CFG_TUSB_MEM_ALIGN
87
#define CFG_TUSB_MEM_ALIGN __attribute__ ((aligned(4)))
88
#endif
89
90
//--------------------------------------------------------------------
91
// DEVICE CONFIGURATION
92
//--------------------------------------------------------------------
93
94
#ifndef CFG_TUD_ENDPOINT0_SIZE
95
#define CFG_TUD_ENDPOINT0_SIZE 64
96
#endif
97
98
//------------- CLASS -------------//
99
#define CFG_TUD_CDC 1
100
#define CFG_TUD_MSC 0
101
#define CFG_TUD_HID 0
102
#define CFG_TUD_MIDI 0
103
#define CFG_TUD_VENDOR 0
104
#define CFG_TUD_DFU_RUNTIME 1
105
106
// CDC FIFO size of TX and RX
107
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
108
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
109
110
// CDC Endpoint transfer buffer size, more is faster
111
#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
112
113
// MSC Buffer size of Device Mass storage
114
#define CFG_TUD_MSC_EP_BUFSIZE 512
115
116
#ifdef __cplusplus
117
}
118
#endif
119
120
#endif
/* _TUSB_CONFIG_H_ */
arch
cpu
nrf
usb
tusb_config.h
Generated on
for Contiki-NG by
1.17.0