tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
tusb_option.h
Go to the documentation of this file.
1 /**************************************************************************/
37 /**************************************************************************/
38 
39 #ifndef _TUSB_TUSB_OPTION_H_
40 #define _TUSB_TUSB_OPTION_H_
41 
42 #define TUSB_VERSION_YEAR 00
43 #define TUSB_VERSION_MONTH 00
44 #define TUSB_VERSION_WEEK 0
45 #define TUSB_VERSION_NAME "alpha"
46 #define TUSB_VERSION XSTRING_(TUSB_VERSION_YEAR) "." XSTRING_(TUSB_VERSION_MONTH)
47 
51 #define MCU_LPC11UXX 1
52 #define MCU_LPC13XX 2
53 #define MCU_LPC13UXX 3
54 #define MCU_LPC175X_6X 4
55 #define MCU_LPC177X_8X 5
56 #define MCU_LPC18XX 6
57 #define MCU_LPC43XX 7
58 
60 #include "mcu_capacity.h"
61 
62 #ifndef TUSB_CFG_CONFIG_FILE
63  #define TUSB_CFG_CONFIG_FILE "tusb_config.h"
64 #endif
65 
66 #include TUSB_CFG_CONFIG_FILE
67 
71 //--------------------------------------------------------------------+
72 // CONTROLLER
73 //--------------------------------------------------------------------+
77 #define TUSB_MODE_HOST 0x02
78 #define TUSB_MODE_DEVICE 0x01
79 #define TUSB_MODE_NONE 0x00
80 
82 #ifndef TUSB_CFG_CONTROLLER_0_MODE
83  #define TUSB_CFG_CONTROLLER_0_MODE TUSB_MODE_NONE
84 #endif
85 
86 #ifndef TUSB_CFG_CONTROLLER_1_MODE
87  #define TUSB_CFG_CONTROLLER_1_MODE TUSB_MODE_NONE
88 #endif
89 
90 #define CONTROLLER_HOST_NUMBER (\
91  ((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_HOST) ? 1 : 0) + \
92  ((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_HOST) ? 1 : 0))
93 
94 #define CONTROLLER_DEVICE_NUMBER (\
95  ((TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE) ? 1 : 0) + \
96  ((TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE) ? 1 : 0))
97 
98 #define MODE_HOST_SUPPORTED (CONTROLLER_HOST_NUMBER > 0)
99 #define MODE_DEVICE_SUPPORTED (CONTROLLER_DEVICE_NUMBER > 0)
100 
101 #if !MODE_HOST_SUPPORTED && !MODE_DEVICE_SUPPORTED
102  #error please configure at least 1 TUSB_CFG_CONTROLLER_N_MODE to TUSB_MODE_HOST and/or TUSB_MODE_DEVICE
103 #endif
104 
105 //--------------------------------------------------------------------+
106 // COMMON OPTIONS
107 //--------------------------------------------------------------------+
115 #ifndef TUSB_CFG_DEBUG
116  #define TUSB_CFG_DEBUG 0
117  #warning TUSB_CFG_DEBUG is not defined, default value is 0
118 #endif
119 
120 #ifndef TUSB_CFG_ATTR_USBRAM
121  #error TUSB_CFG_ATTR_USBRAM is not defined, please help me know how to place data in accessible RAM for usb controller
122 #endif
123 
124 
125 #if (TUSB_CFG_OS != TUSB_OS_NONE) && !defined (TUSB_CFG_OS_TASK_PRIO)
126  #error TUSB_CFG_OS_TASK_PRIO need to be defined (hint: use the highest if possible)
127 #endif
128 
129 //#ifndef TUSB_CFG_CONFIGURATION_MAX
130 // #define TUSB_CFG_CONFIGURATION_MAX 1
131 // #warning TUSB_CFG_CONFIGURATION_MAX is not defined, default value is 1
132 //#endif
133 
134 //--------------------------------------------------------------------+
135 // HOST OPTIONS
136 //--------------------------------------------------------------------+
137 #if MODE_HOST_SUPPORTED
138  #ifndef TUSB_CFG_HOST_DEVICE_MAX
139  #define TUSB_CFG_HOST_DEVICE_MAX 1
140  #warning TUSB_CFG_HOST_DEVICE_MAX is not defined, default value is 1
141  #endif
142 
143  //------------- HUB CLASS -------------//
144  #if TUSB_CFG_HOST_HUB && (TUSB_CFG_HOST_DEVICE_MAX == 1)
145  #error there is no benefit enable hub with max device is 1. Please disable hub or increase TUSB_CFG_HOST_DEVICE_MAX
146  #endif
147 
148  //------------- HID CLASS -------------//
149  #define HOST_CLASS_HID ( TUSB_CFG_HOST_HID_KEYBOARD + TUSB_CFG_HOST_HID_MOUSE + TUSB_CFG_HOST_HID_GENERIC )
150 // #if HOST_CLASS_HID
151 // #define HOST_HCD_XFER_INTERRUPT
152 // #endif
153 
154  #ifndef TUSB_CFG_HOST_ENUM_BUFFER_SIZE
155  #define TUSB_CFG_HOST_ENUM_BUFFER_SIZE 256
156  #endif
157 
158  //------------- CLASS -------------//
159 #endif // MODE_HOST_SUPPORTED
160 
161 //--------------------------------------------------------------------+
162 // DEVICE OPTIONS
163 //--------------------------------------------------------------------+
164 #if MODE_DEVICE_SUPPORTED
165 
166  #define DEVICE_CLASS_HID ( TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + TUSB_CFG_DEVICE_HID_GENERIC )
167 
168  #if TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE > 64
169  #error Control Endpoint Max Package Size cannot larger than 64
170  #endif
171 
172  #ifndef TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE
173  #define TUSB_CFG_DEVICE_ENUM_BUFFER_SIZE 256
174  #endif
175 
176 #endif // MODE_DEVICE_SUPPORTED
177 
178 #endif /* _TUSB_TUSB_OPTION_H_ */
179