1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** USBX Component */ 16 /** */ 17 /** User Specific */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* PORT SPECIFIC C INFORMATION RELEASE */ 26 /* */ 27 /* ux_user.h PORTABLE C */ 28 /* 6.3.0 */ 29 /* */ 30 /* AUTHOR */ 31 /* */ 32 /* Chaoqiong Xiao, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file contains user defines for configuring USBX in specific */ 37 /* ways. This file will have an effect only if the application and */ 38 /* USBX library are built with UX_INCLUDE_USER_DEFINE_FILE defined. */ 39 /* Note that all the defines in this file may also be made on the */ 40 /* command line when building USBX library and application objects. */ 41 /* */ 42 /* RELEASE HISTORY */ 43 /* */ 44 /* DATE NAME DESCRIPTION */ 45 /* */ 46 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 47 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 48 /* resulting in version 6.1 */ 49 /* 02-02-2021 Xiuwen Cai Modified comment(s), added */ 50 /* compile option for using */ 51 /* packet pool from NetX, */ 52 /* resulting in version 6.1.4 */ 53 /* 04-02-2021 Chaoqiong Xiao Modified comment(s), */ 54 /* added DFU_UPLOAD option, */ 55 /* added macro to enable */ 56 /* device bi-dir-endpoints, */ 57 /* added macro to disable CDC- */ 58 /* ACM transmission support, */ 59 /* resulting in version 6.1.6 */ 60 /* 06-02-2021 Xiuwen Cai Modified comment(s), added */ 61 /* transfer timeout value */ 62 /* options, */ 63 /* resulting in version 6.1.7 */ 64 /* 08-02-2021 Wen Wang Modified comment(s), */ 65 /* fixed spelling error, */ 66 /* resulting in version 6.1.8 */ 67 /* 10-15-2021 Chaoqiong Xiao Modified comment(s), */ 68 /* added option for assert, */ 69 /* resulting in version 6.1.9 */ 70 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ 71 /* added standalone support, */ 72 /* added option for device */ 73 /* audio feedback endpoint, */ 74 /* added option for MTP, */ 75 /* added options for HID */ 76 /* interrupt OUT support, */ 77 /* added option to validate */ 78 /* class code in enumeration, */ 79 /* resulting in version 6.1.10 */ 80 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ 81 /* added audio class features, */ 82 /* added device CDC_ACM and */ 83 /* printer write auto ZLP, */ 84 /* resulting in version 6.1.12 */ 85 /* 10-31-2022 Chaoqiong Xiao Modified comment(s), */ 86 /* deprecated ECM pool option, */ 87 /* added align minimal config, */ 88 /* added host stack instance */ 89 /* creation strategy control, */ 90 /* resulting in version 6.2.0 */ 91 /* 03-08-2023 Chaoqiong Xiao Modified comment(s), */ 92 /* added option to disable dev */ 93 /* alternate setting support, */ 94 /* added option to disable dev */ 95 /* framework initialize scan, */ 96 /* added option to reference */ 97 /* names by pointer to chars, */ 98 /* added option to enable */ 99 /* basic USBX error checking, */ 100 /* resulting in version 6.2.1 */ 101 /* 10-31-2023 Xiuwen Cai, CQ Xiao Modified comment(s), */ 102 /* refined memory management, */ 103 /* added zero copy support */ 104 /* in many device classes, */ 105 /* added a new mode to manage */ 106 /* endpoint buffer in classes, */ 107 /* added option for get string */ 108 /* requests with zero wIndex, */ 109 /* resulting in version 6.3.0 */ 110 /* */ 111 /**************************************************************************/ 112 113 #ifndef UX_USER_H 114 #define UX_USER_H 115 116 117 /* Define various build options for the USBX port. The application should either make changes 118 here by commenting or un-commenting the conditional compilation defined OR supply the defines 119 though the compiler's equivalent of the -D option. */ 120 121 /* Define USBX Generic Thread Stack Size. */ 122 /* #define UX_THREAD_STACK_SIZE (2 * 1024) */ 123 124 /* Define USBX Host Enum Thread Stack Size. The default is to use UX_THREAD_STACK_SIZE */ 125 /* 126 #define UX_HOST_ENUM_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE 127 */ 128 129 130 /* Define USBX Host HCD Thread Stack Size. The default is to use UX_THREAD_STACK_SIZE */ 131 /* 132 #define UX_HOST_HCD_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE 133 */ 134 135 /* Define USBX Host HNP Polling Thread Stack Size. The default is to use UX_THREAD_STACK_SIZE */ 136 /* 137 #define UX_HOST_HNP_POLLING_THREAD_STACK UX_THREAD_STACK_SIZE 138 */ 139 140 /* Override various options with default values already assigned in ux_api.h or ux_port.h. Please 141 also refer to ux_port.h for descriptions on each of these options. */ 142 143 /* Defined, this value represents minimal allocated memory alignment in number of bytes. 144 The default is UX_ALIGN_8 (0x07) to align allocated memory to 8 bytes. */ 145 /* #define UX_ALIGN_MIN UX_ALIGN_8 */ 146 147 /* Defined, this value represents how many ticks per seconds for a specific hardware platform. 148 The default is 1000 indicating 1 tick per millisecond. */ 149 150 /* #define UX_PERIODIC_RATE 1000 151 */ 152 #define UX_PERIODIC_RATE (TX_TIMER_TICKS_PER_SECOND) 153 154 /* Define control transfer timeout value in millisecond. 155 The default is 10000 milliseconds. */ 156 /* 157 #define UX_CONTROL_TRANSFER_TIMEOUT 10000 158 */ 159 160 /* Define non control transfer timeout value in millisecond. 161 The default is 50000 milliseconds. */ 162 /* 163 #define UX_NON_CONTROL_TRANSFER_TIMEOUT 50000 164 */ 165 166 167 /* Defined, this value is the maximum number of classes that can be loaded by USBX. This value 168 represents the class container and not the number of instances of a class. For instance, if a 169 particular implementation of USBX needs the hub class, the printer class, and the storage 170 class, then the UX_MAX_CLASSES value can be set to 3 regardless of the number of devices 171 that belong to these classes. */ 172 173 /* #define UX_MAX_CLASSES 3 174 */ 175 176 177 /* Defined, this value is the maximum number of classes in the device stack that can be loaded by 178 USBX. */ 179 180 /* #define UX_MAX_SLAVE_CLASS_DRIVER 1 181 */ 182 183 /* Defined, this value is the maximum number of interfaces in the device framework. */ 184 185 /* #define UX_MAX_SLAVE_INTERFACES 16 186 */ 187 188 /* Defined, this value represents the number of different host controllers available in the system. 189 For USB 1.1 support, this value will usually be 1. For USB 2.0 support, this value can be more 190 than 1. This value represents the number of concurrent host controllers running at the same time. 191 If for instance there are two instances of OHCI running, or one EHCI and one OHCI controller 192 running, the UX_MAX_HCD should be set to 2. */ 193 194 /* #define UX_MAX_HCD 1 195 */ 196 197 198 /* Defined, this value represents the maximum number of devices that can be attached to the USB. 199 Normally, the theoretical maximum number on a single USB is 127 devices. This value can be 200 scaled down to conserve memory. Note that this value represents the total number of devices 201 regardless of the number of USB buses in the system. */ 202 203 /* #define UX_MAX_DEVICES 127 204 */ 205 206 207 /* Defined, this value represents the current number of SCSI logical units represented in the device 208 storage class driver. */ 209 210 /* #define UX_MAX_SLAVE_LUN 1 211 */ 212 213 214 /* Defined, this value represents the maximum number of SCSI logical units represented in the 215 host storage class driver. */ 216 217 /* #define UX_MAX_HOST_LUN 1 218 */ 219 220 221 /* Defined, this value represents the maximum number of bytes received on a control endpoint in 222 the device stack. The default is 256 bytes but can be reduced in memory constrained environments. */ 223 224 /* #define UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH 256 225 */ 226 227 /* Defined, this value represents the endpoint buffer owner. 228 0 - The default, endpoint buffer is managed by core stack. Each endpoint takes UX_SLAVE_REQUEST_DATA_MAX_LENGTH bytes. 229 1 - Endpoint buffer managed by classes. In this case not all endpoints consume UX_SLAVE_REQUEST_DATA_MAX_LENGTH bytes. 230 */ 231 232 #define UX_DEVICE_ENDPOINT_BUFFER_OWNER 0 233 234 /* Defined, it enables device CDC ACM zero copy for bulk in/out endpoints (write/read). 235 Enabled, the endpoint buffer is not allocated in class, application must 236 provide the buffer for read/write, and the buffer must meet device controller driver (DCD) 237 buffer requirements (e.g., aligned and cache safe). 238 It only works if UX_DEVICE_ENDPOINT_BUFFER_OWNER is 1 (endpoint buffer managed by class). 239 */ 240 /* #define UX_DEVICE_CLASS_CDC_ACM_ZERO_COPY */ 241 242 /* Defined, it enables device HID zero copy and flexible queue support (works if HID owns endpoint buffer). 243 Enabled, the internal queue buffer is directly used for transfer, the APIs are kept to keep 244 backword compatibility, to AVOID KEEPING BUFFERS IN APPLICATION. 245 Flexible queue introduces initialization parameter _event_max_number and _event_max_length, 246 so each HID function could have different queue settings. 247 _event_max_number could be 2 ~ UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE. 248 Max of _event_max_length could be UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH. 249 If the initialization parameters are invalid (are 0s or exceed upper mentioned definition), 250 UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE and UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH are used to 251 calculate and allocate the queue. 252 */ 253 /* #define UX_DEVICE_CLASS_HID_ZERO_COPY */ 254 255 /* Defined, it enables device CDC_ECM zero copy support (works if CDC_ECM owns endpoint buffer). 256 Enabled, it requires that the NX IP default packet pool is in cache safe area, and buffer max 257 size is larger than UX_DEVICE_CLASS_CDC_ECM_ETHERNET_PACKET_SIZE (1536). 258 */ 259 /* #define UX_DEVICE_CLASS_CDC_ECM_ZERO_COPY */ 260 261 /* Defined, it enables device RNDIS zero copy support (works if RNDIS owns endpoint buffer). 262 Enabled, it requires that the NX IP default packet pool is in cache safe area, and buffer max 263 size is larger than UX_DEVICE_CLASS_RNDIS_MAX_PACKET_TRANSFER_SIZE (1600). 264 */ 265 /* #define UX_DEVICE_CLASS_RNDIS_ZERO_COPY */ 266 267 /* Defined, it enables zero copy support (works if PRINTER owns endpoint buffer). 268 Defined, it enables zero copy for bulk in/out endpoints (write/read). In this case, the endpoint 269 buffer is not allocated in class, application must provide the buffer for read/write, and the 270 buffer must meet device controller driver (DCD) buffer requirements (e.g., aligned and cache 271 safe if buffer is for DMA). 272 */ 273 /* #define UX_DEVICE_CLASS_PRINTER_ZERO_COPY */ 274 275 276 /* Defined, this value represents the maximum number of bytes that can be received or transmitted 277 on any endpoint. This value cannot be less than the maximum packet size of any endpoint. The default 278 is 4096 bytes but can be reduced in memory constrained environments. For cd-rom support in the storage 279 class, this value cannot be less than 2048. */ 280 281 #define UX_SLAVE_REQUEST_DATA_MAX_LENGTH (1024 * 2) 282 283 /* Defined, this enables processing of Get String Descriptor requests with zero Language ID. 284 The first language ID in the language ID framwork will be used if the request has a zero 285 Language ID. */ 286 /* #define UX_DEVICE_ENABLE_GET_STRING_WITH_ZERO_LANGUAGE_ID */ 287 288 /* Defined, this value includes code to handle storage Multi-Media Commands (MMC). E.g., DVD-ROM. 289 */ 290 291 /* #define UX_SLAVE_CLASS_STORAGE_INCLUDE_MMC */ 292 293 294 /* Defined, this value represents the maximum number of bytes that a storage payload can send/receive. 295 The default is 8K bytes but can be reduced in memory constrained environments. */ 296 #define UX_HOST_CLASS_STORAGE_MEMORY_BUFFER_SIZE (1024 * 8) 297 298 /* Define USBX Mass Storage Thread Stack Size. The default is to use UX_THREAD_STACK_SIZE. */ 299 300 /* #define UX_HOST_CLASS_STORAGE_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE 301 */ 302 303 /* Defined, this value represents the maximum number of Ed, regular TDs and Isochronous TDs. These values 304 depend on the type of host controller and can be reduced in memory constrained environments. */ 305 306 #define UX_MAX_ED 80 307 #define UX_MAX_TD 128 308 #define UX_MAX_ISO_TD 1 309 310 /* Defined, this value represents the maximum size of the HID decompressed buffer. This cannot be determined 311 in advance so we allocate a big block, usually 4K but for simple HID devices like keyboard and mouse 312 it can be reduced a lot. */ 313 314 #define UX_HOST_CLASS_HID_DECOMPRESSION_BUFFER 4096 315 316 /* Defined, this value represents the maximum number of HID usages for a HID device. 317 Default is 2048 but for simple HID devices like keyboard and mouse it can be reduced a lot. */ 318 319 #define UX_HOST_CLASS_HID_USAGES 2048 320 321 322 /* By default, each key in each HID report from the device is reported by ux_host_class_hid_keyboard_key_get 323 (a HID report from the device is received whenever there is a change in a key state i.e. when a key is pressed 324 or released. The report contains every key that is down). There are limitations to this method such as not being 325 able to determine when a key has been released. 326 327 Defined, this value causes ux_host_class_hid_keyboard_key_get to only report key changes i.e. key presses 328 and key releases. */ 329 330 /* #define UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE */ 331 332 /* Works when UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE is defined. 333 334 Defined, this value causes ux_host_class_hid_keyboard_key_get to only report key pressed/down changes; 335 key released/up changes are not reported. 336 */ 337 338 /* #define UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE_REPORT_KEY_DOWN_ONLY */ 339 340 /* Works when UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE is defined. 341 342 Defined, this value causes ux_host_class_hid_keyboard_key_get to report lock key (CapsLock/NumLock/ScrollLock) changes. 343 */ 344 345 /* #define UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE_REPORT_LOCK_KEYS */ 346 347 /* Works when UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE is defined. 348 349 Defined, this value causes ux_host_class_hid_keyboard_key_get to report modifier key (Ctrl/Alt/Shift/GUI) changes. 350 */ 351 352 /* #define UX_HOST_CLASS_HID_KEYBOARD_EVENTS_KEY_CHANGES_MODE_REPORT_MODIFIER_KEYS */ 353 354 355 /* Defined, this value represents the maximum number of media for the host storage class. 356 Default is 8 but for memory constrained resource systems this can ne reduced to 1. */ 357 358 #define UX_HOST_CLASS_STORAGE_MAX_MEDIA 2 359 360 /* Defined, this value includes code to handle storage devices that use the CB 361 or CBI protocol (such as floppy disks). It is off by default because these 362 protocols are obsolete, being superseded by the Bulk Only Transport (BOT) protocol 363 which virtually all modern storage devices use. 364 */ 365 366 /* #define UX_HOST_CLASS_STORAGE_INCLUDE_LEGACY_PROTOCOL_SUPPORT */ 367 368 /* Defined, this value forces the memory allocation scheme to enforce alignment 369 of memory with the UX_SAFE_ALIGN field. 370 */ 371 372 /* #define UX_ENFORCE_SAFE_ALIGNMENT */ 373 374 /* Defined, this value represents the number of packets in the CDC_ECM device class. 375 The default is 16. 376 */ 377 378 #define UX_DEVICE_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES 4 379 380 /* Defined, this value represents the number of packets in the CDC_ECM host class. 381 The default is 16. 382 */ 383 384 /* #define UX_HOST_CLASS_CDC_ECM_NX_PKPOOL_ENTRIES 16 */ 385 386 /* Defined, this value represents the number of milliseconds to wait for packet 387 allocation until invoking the application's error callback and retrying. 388 The default is 1000 milliseconds. 389 */ 390 391 /* #define UX_HOST_CLASS_CDC_ECM_PACKET_POOL_WAIT 10 */ 392 393 /* Defined, this value represents the number of milliseconds to wait for packet 394 pool availability checking loop. 395 The default is 100 milliseconds. 396 */ 397 398 /* #define UX_HOST_CLASS_CDC_ECM_PACKET_POOL_INSTANCE_WAIT 10 */ 399 400 /* Defined, this enables CDC ECM class to use the packet pool from NetX instance. 401 It's deprecated, packet pool from NetX instance is always used now. 402 */ 403 404 /* #define UX_HOST_CLASS_CDC_ECM_USE_PACKET_POOL_FROM_NETX */ 405 406 /* Defined, this value represents the number of milliseconds to wait for packet 407 allocation until invoking the application's error callback and retrying. 408 */ 409 410 /* #define UX_DEVICE_CLASS_CDC_ECM_PACKET_POOL_WAIT 10 */ 411 412 /* Defined, this value represents the the maximum length of HID reports on the 413 device. 414 */ 415 416 /* #define UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 64 */ 417 418 /* Defined, this value represents the the maximum number of HID events/reports 419 that can be queued at once. 420 */ 421 422 /* #define UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE 8 */ 423 424 425 /* Defined, this macro will disable DFU_UPLOAD support. */ 426 427 /* #define UX_DEVICE_CLASS_DFU_UPLOAD_DISABLE */ 428 429 /* Defined, this macro will enable DFU_GETSTATUS and DFU_GETSTATE in dfuERROR. */ 430 431 /* #define UX_DEVICE_CLASS_DFU_ERROR_GET_ENABLE */ 432 433 /* Defined, this macro will change status mode. 434 0 - simple mode, 435 status is queried from application in dfuDNLOAD-SYNC and dfuMANIFEST-SYNC state, 436 no bwPollTimeout. 437 1 - status is queried from application once requested, 438 b0-3 : media status 439 b4-7 : bStatus 440 b8-31: bwPollTimeout 441 bwPollTimeout supported. 442 */ 443 444 /* #define UX_DEVICE_CLASS_DFU_STATUS_MODE (1) */ 445 446 /* Defined, this value represents the default DFU status bwPollTimeout. 447 The value is 3 bytes long (max 0xFFFFFFu). 448 By default the bwPollTimeout is 1 (means 1ms). 449 */ 450 451 /* #define UX_DEVICE_CLASS_DFU_STATUS_POLLTIMEOUT (1) */ 452 453 /* Defined, this macro will enable custom request process callback. */ 454 455 /* #define UX_DEVICE_CLASS_DFU_CUSTOM_REQUEST_ENABLE */ 456 457 /* Defined, this macro disables CDC ACM non-blocking transmission support. */ 458 459 /* #define UX_DEVICE_CLASS_CDC_ACM_TRANSMISSION_DISABLE */ 460 461 /* Defined, device HID interrupt OUT transfer is supported. */ 462 463 /* #define UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT */ 464 465 /* defined, this macro enables device audio feedback endpoint support. */ 466 467 /* #define UX_DEVICE_CLASS_AUDIO_FEEDBACK_SUPPORT */ 468 469 /* Works if UX_DEVICE_ENDPOINT_BUFFER_OWNER is 1. 470 Defined, it represents feedback endpoint buffer size. 471 It should be larger than feedback endpoint max packet size in framework. */ 472 /* #define UX_DEVICE_CLASS_AUDIO_FEEDBACK_ENDPOINT_BUFFER_SIZE 8 */ 473 474 /* Defined, class _write is pending ZLP automatically (complete transfer) after buffer is sent. */ 475 476 /* #define UX_DEVICE_CLASS_CDC_ACM_WRITE_AUTO_ZLP */ 477 /* #define UX_DEVICE_CLASS_PRINTER_WRITE_AUTO_ZLP */ 478 479 /* defined, this macro enables device audio interrupt endpoint support. */ 480 481 /* define UX_DEVICE_CLASS_AUDIO_INTERRUPT_SUPPORT */ 482 483 /* Defined, this macro enables device bi-directional-endpoint support. */ 484 485 /* #define UX_DEVICE_BIDIRECTIONAL_ENDPOINT_SUPPORT */ 486 487 /* Defined, this macro disables interface alternate setting support. 488 Device stalls 489 */ 490 /* UX_DEVICE_ALTERNATE_SETTING_SUPPORT_DISABLE */ 491 492 493 /* Defined, this macro disables device framework scan, where max number of endpoints (except EP0) 494 and max number of interfaces are calculated at runtime, as a base to allocate memory for 495 interfaces and endpoints structures and their buffers. 496 Undefined, the following two macros must be defined to initialize memory structures. 497 */ 498 /* #define UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE */ 499 500 /* Works if UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined. 501 This value represents max number of endpoints (except EP0) activated at the same time. 502 */ 503 /* #define UX_MAX_DEVICE_ENDPOINTS 2 */ 504 505 /* Works if UX_DEVICE_INITIALIZE_FRAMEWORK_SCAN_DISABLE is defined. 506 This value represents max number of interfaces activated at the same time. 507 */ 508 /* #define UX_MAX_DEVICE_INTERFACES 1 */ 509 510 511 /* Defined, this macro enables device/host PIMA MTP support. */ 512 513 /* #define UX_PIMA_WITH_MTP_SUPPORT */ 514 515 /* Defined, this macro enables host device class code validation. 516 Only following USB-IF allowed device class code is allowed: 517 0x00, 0x02 (CDC Control), 0x09 (Hub), 0x11 (Billboard), 0xDC (Diagnostic), 0xEF (MISC), 0xFF (Vendor) 518 Refer to https://www.usb.org/defined-class-codes for more details. 519 */ 520 521 /* #define UX_HOST_DEVICE_CLASS_CODE_VALIDATION_ENABLE */ 522 523 524 /* Defined, host HID interrupt OUT transfer is supported. */ 525 526 /* #define UX_HOST_CLASS_HID_INTERRUPT_OUT_SUPPORT */ 527 528 /* Define HID report transfer timeout value in millisecond. 529 The default is 10000 milliseconds. */ 530 531 /* #define UX_HOST_CLASS_HID_REPORT_TRANSFER_TIMEOUT 10000 */ 532 533 /* Defined, host audio UAC 2.0 is supported. */ 534 /* #define UX_HOST_CLASS_AUDIO_2_SUPPORT */ 535 536 /* Defined, host audio optional feedback endpoint is supported. */ 537 /* #define UX_HOST_CLASS_AUDIO_FEEDBACK_SUPPORT */ 538 539 /* Defined, host audio optional interrupt endpoint is support. */ 540 /* #define UX_HOST_CLASS_AUDIO_INTERRUPT_SUPPORT */ 541 542 /* Defined, this value controls host configuration instance creation, include all 543 interfaces and endpoints physical resources. 544 Possible settings: 545 UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_ALL (0) - The default, create all inside configuration. 546 UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED (1) - Create things owned by class driver. 547 Not defined, default setting is applied. 548 */ 549 /* #define UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_CONTROL UX_HOST_STACK_CONFIGURATION_INSTANCE_CREATE_OWNED */ 550 551 /* Defined, the _name in structs are referenced by pointer instead of by contents. 552 By default the _name is an array of string that saves characters, the contents are compared to confirm match. 553 If referenced by pointer the address pointer to const string is saved, the pointers are compared to confirm match. 554 */ 555 /* #define UX_NAME_REFERENCED_BY_POINTER */ 556 557 /* Defined, this value will only enable the host side of usbx. */ 558 /* #define UX_HOST_SIDE_ONLY */ 559 560 /* Defined, this value will only enable the device side of usbx. */ 561 /* #define UX_DEVICE_SIDE_ONLY */ 562 563 /* Defined, this value will include the OTG polling thread. OTG can only be active if both host/device are present. 564 */ 565 566 #ifndef UX_HOST_SIDE_ONLY 567 #ifndef UX_DEVICE_SIDE_ONLY 568 569 /* #define UX_OTG_SUPPORT */ 570 571 #endif 572 #endif 573 574 /* Defined, this macro will enable the standalone mode of usbx. */ 575 /* #define UX_STANDALONE */ 576 577 /* Defined, this macro will remove the FileX dependency of host storage. 578 In this mode, sector access is offered instead of directly FileX FX_MEDIA support. 579 Use following APIs for media obtain and access: 580 - ux_host_class_storage_media_get : get instance of UX_HOST_CLASS_STORAGE_MEDIA 581 - ux_host_class_storage_media_lock : lock specific media for further read/write 582 - ux_host_class_storage_media_read : read sectors on locked media 583 - ux_host_class_storage_media_write : write sectors on locked media 584 - ux_host_class_storage_media_unlock : unlock media 585 Note it's forced defined/enabled in standalone mode of usbx. 586 */ 587 /* #define UX_HOST_CLASS_STORAGE_NO_FILEX */ 588 589 /* Defined, this value represents the maximum size of single transfers for the SCSI data phase. 590 By default it's 1024. 591 */ 592 593 #define UX_HOST_CLASS_STORAGE_MAX_TRANSFER_SIZE (1024 * 1) 594 595 /* Defined, this value represents the size of the log pool. 596 */ 597 #define UX_DEBUG_LOG_SIZE (1024 * 16) 598 599 /* Defined, this macro represents the non-blocking function to return time tick. 600 This macro is used only in standalone mode. 601 The tick rate is defined by UX_PERIODIC_RATE. 602 If it's not defined, or TX is not included, a external function must be 603 implement in application: 604 extern ULONG _ux_utility_time_get(VOID); 605 */ 606 /* #define _ux_utility_time_get() tx_time_get() */ 607 608 /* Defined, this macro represents the non-blocking function to disable interrupts 609 and return old interrupt setting flags. 610 If it's not defined, or TX is not included, a external function must be 611 implement in application: 612 extern ALIGN_TYPE _ux_utility_interrupt_disable(VOID); 613 */ 614 /* #define _ux_utility_interrupt_disable() _tx_thread_interrupt_disable() */ 615 616 /* Defined, this macro represents the non-blocking function to restore interrupts. 617 If it's not defined, or TX is not included, a external function must be 618 implement in application: 619 extern VOID _ux_utility_interrupt_restore(ALIGN_TYPE); 620 */ 621 /* #define _ux_utility_interrupt_restore(flags) _tx_thread_interrupt_restore(flags) */ 622 623 /* Defined, this enables the assert checks inside usbx. */ 624 #define UX_ENABLE_ASSERT 625 626 /* Defined, this defines the assert action taken when failure detected. By default 627 it halts without any output. */ 628 /* #define UX_ASSERT_FAIL for (;;) {tx_thread_sleep(UX_WAIT_FOREVER); } */ 629 630 631 /* Defined, this option enables the basic USBX error checking. This define is typically used 632 when the application is debugging and removed after the application is fully debugged. */ 633 /* 634 #define UX_ENABLE_ERROR_CHECKING 635 */ 636 637 638 /* DEBUG includes and macros for a specific platform go here. */ 639 #ifdef UX_INCLUDE_USER_DEFINE_BSP 640 #include "usb_bsp.h" 641 #include "usbh_hcs.h" 642 #include "usbh_stdreq.h" 643 #include "usbh_core.h" 644 #endif 645 646 #endif 647 648