1 /* 2 * Copyright 2003-2006, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Michael Lotz <mmlr@mlotz.ch> 7 * Niels S. Reedijk 8 */ 9 #ifndef _USB_PRIVATE_H 10 #define _USB_PRIVATE_H 11 12 13 #include <device_manager.h> 14 #include <bus/USB.h> 15 16 #include "usbspec_private.h" 17 #include <lock.h> 18 #include <Referenceable.h> 19 #include <util/Vector.h> 20 21 // include vm.h before iovec_support.h for generic_memcpy, which is used by the bus drivers. 22 #include <vm/vm.h> 23 #include <util/iovec_support.h> 24 25 26 #define TRACE_OUTPUT(x, y, z...) \ 27 { \ 28 dprintf("usb %s%s %" B_PRId32 ": ", y, (x)->TypeName(), (x)->USBID()); \ 29 dprintf(z); \ 30 } 31 32 //#define TRACE_USB 33 #ifdef TRACE_USB 34 #define TRACE(x...) TRACE_OUTPUT(this, "", x) 35 #define TRACE_STATIC(x, y...) TRACE_OUTPUT(x, "", y) 36 #define TRACE_MODULE(x...) dprintf("usb " USB_MODULE_NAME ": " x) 37 #else 38 #define TRACE(x...) /* nothing */ 39 #define TRACE_STATIC(x, y...) /* nothing */ 40 #define TRACE_MODULE(x...) /* nothing */ 41 #endif 42 43 #define TRACE_ALWAYS(x...) TRACE_OUTPUT(this, "", x) 44 #define TRACE_ERROR(x...) TRACE_OUTPUT(this, "error ", x) 45 #define TRACE_MODULE_ALWAYS(x...) dprintf("usb " USB_MODULE_NAME ": " x) 46 #define TRACE_MODULE_ERROR(x...) dprintf("usb " USB_MODULE_NAME ": " x) 47 48 extern device_manager_info *gDeviceManager; 49 50 51 class Hub; 52 class Stack; 53 class Device; 54 class Transfer; 55 class BusManager; 56 class Pipe; 57 class ControlPipe; 58 class Object; 59 class PhysicalMemoryAllocator; 60 61 62 struct usb_host_controller_info { 63 module_info info; 64 status_t (*control)(uint32 op, void *data, size_t length); 65 status_t (*add_to)(Stack *stack); 66 }; 67 68 69 struct usb_driver_cookie { 70 usb_id device; 71 void *cookie; 72 usb_driver_cookie *link; 73 }; 74 75 76 struct usb_driver_info { 77 const char *driver_name; 78 usb_support_descriptor *support_descriptors; 79 uint32 support_descriptor_count; 80 const char *republish_driver_name; 81 usb_notify_hooks notify_hooks; 82 usb_driver_cookie *cookies; 83 usb_driver_info *link; 84 }; 85 86 87 struct change_item { 88 bool added; 89 Device *device; 90 change_item *link; 91 }; 92 93 94 struct rescan_item { 95 const char *name; 96 rescan_item *link; 97 }; 98 99 100 typedef enum { 101 USB_SPEED_LOWSPEED = 0, 102 USB_SPEED_FULLSPEED, 103 USB_SPEED_HIGHSPEED, 104 USB_SPEED_SUPERSPEED, 105 USB_SPEED_SUPERSPEEDPLUS, 106 USB_SPEED_MAX = USB_SPEED_SUPERSPEEDPLUS 107 } usb_speed; 108 109 110 typedef enum { 111 USB_CHANGE_CREATED = 0, 112 USB_CHANGE_DESTROYED, 113 USB_CHANGE_PIPE_POLICY_CHANGED 114 } usb_change; 115 116 117 #define USB_OBJECT_NONE 0x00000000 118 #define USB_OBJECT_PIPE 0x00000001 119 #define USB_OBJECT_CONTROL_PIPE 0x00000002 120 #define USB_OBJECT_INTERRUPT_PIPE 0x00000004 121 #define USB_OBJECT_BULK_PIPE 0x00000008 122 #define USB_OBJECT_ISO_PIPE 0x00000010 123 #define USB_OBJECT_INTERFACE 0x00000020 124 #define USB_OBJECT_DEVICE 0x00000040 125 #define USB_OBJECT_HUB 0x00000080 126 127 128 class Stack { 129 public: 130 Stack(); 131 ~Stack(); 132 133 status_t InitCheck(); 134 135 bool Lock(); 136 void Unlock(); 137 138 usb_id GetUSBID(Object *object); 139 void PutUSBID(Object *object); 140 141 // Acquires a reference to the object. 142 Object * GetObject(usb_id id); 143 144 // only for the kernel debugger (and doesn't acquire a reference) 145 Object * GetObjectNoLock(usb_id id) const; 146 147 void AddBusManager(BusManager *bus); 148 int32 IndexOfBusManager(BusManager *bus) const; 149 BusManager * BusManagerAt(int32 index) const; 150 151 status_t AllocateChunk(void **logicalAddress, 152 phys_addr_t *physicalAddress, 153 size_t size); 154 status_t FreeChunk(void *logicalAddress, 155 phys_addr_t physicalAddress, 156 size_t size); 157 158 area_id AllocateArea(void **logicalAddress, 159 phys_addr_t *physicalAddress, 160 size_t size, const char *name); 161 162 void NotifyDeviceChange(Device *device, 163 rescan_item **rescanList, 164 bool added); 165 void RescanDrivers(rescan_item *rescanItem); 166 167 // USB API 168 status_t RegisterDriver(const char *driverName, 169 const usb_support_descriptor * 170 descriptors, 171 size_t descriptorCount, 172 const char *republishDriverName); 173 174 status_t InstallNotify(const char *driverName, 175 const usb_notify_hooks *hooks); 176 status_t UninstallNotify(const char *driverName); 177 178 usb_id USBID() const { return 0; } 179 const char * TypeName() const { return "stack"; } 180 181 void Explore(); 182 183 private: 184 static int32 ExploreThread(void *data); 185 186 Vector<BusManager *> fBusManagers; 187 thread_id fExploreThread; 188 sem_id fExploreSem; 189 190 mutex fStackLock; 191 mutex fExploreLock; 192 PhysicalMemoryAllocator * fAllocator; 193 194 uint32 fObjectIndex; 195 uint32 fObjectMaxCount; 196 Object ** fObjectArray; 197 198 usb_driver_info * fDriverList; 199 }; 200 201 202 /* 203 * This class manages a bus. It is created by the Stack object 204 * after a host controller gives positive feedback on whether the hardware 205 * is found. 206 */ 207 class BusManager { 208 public: 209 BusManager(Stack *stack, device_node* node); 210 virtual ~BusManager(); 211 212 virtual status_t InitCheck(); 213 214 bool Lock(); 215 void Unlock(); 216 217 int8 AllocateAddress(); 218 void FreeAddress(int8 address); 219 220 virtual Device * AllocateDevice(Hub *parent, 221 int8 hubAddress, uint8 hubPort, 222 usb_speed speed); 223 virtual void FreeDevice(Device *device); 224 225 virtual status_t Start(); 226 virtual status_t Stop(); 227 228 virtual status_t StartDebugTransfer(Transfer *transfer); 229 virtual status_t CheckDebugTransfer(Transfer *transfer); 230 virtual void CancelDebugTransfer(Transfer *transfer); 231 232 virtual status_t SubmitTransfer(Transfer *transfer); 233 virtual status_t CancelQueuedTransfers(Pipe *pipe, 234 bool force); 235 236 virtual status_t NotifyPipeChange(Pipe *pipe, 237 usb_change change); 238 239 Object * RootObject() const 240 { return fRootObject; } 241 242 Hub * GetRootHub() const { return fRootHub; } 243 void SetRootHub(Hub *hub) { fRootHub = hub; } 244 245 virtual const char * TypeName() const = 0; 246 247 device_node * Node() const 248 { return fNode; } 249 protected: 250 usb_id USBID() const { return fStackIndex; } 251 252 protected: 253 bool fInitOK; 254 255 private: 256 ControlPipe * _GetDefaultPipe(usb_speed); 257 258 mutex fLock; 259 260 bool fDeviceMap[128]; 261 int8 fDeviceIndex; 262 263 Stack * fStack; 264 ControlPipe * fDefaultPipes[USB_SPEED_MAX + 1]; 265 Hub * fRootHub; 266 Object * fRootObject; 267 268 usb_id fStackIndex; 269 270 device_node* fNode; 271 }; 272 273 274 class Object : public BReferenceable { 275 public: 276 Object(Stack *stack, BusManager *bus); 277 Object(Object *parent); 278 virtual ~Object(); 279 280 Object * Parent() const { return fParent; } 281 282 BusManager * GetBusManager() const 283 { return fBusManager; } 284 Stack * GetStack() const { return fStack; } 285 286 usb_id USBID() const { return fUSBID; } 287 288 virtual uint32 Type() const { return USB_OBJECT_NONE; } 289 virtual const char * TypeName() const { return "object"; } 290 291 // Convenience functions for standard requests 292 virtual status_t SetFeature(uint16 selector); 293 virtual status_t ClearFeature(uint16 selector); 294 virtual status_t GetStatus(uint16 *status); 295 296 protected: 297 void PutUSBID(bool waitForIdle = true); 298 void WaitForIdle(); 299 300 private: 301 Object * fParent; 302 BusManager * fBusManager; 303 Stack * fStack; 304 usb_id fUSBID; 305 }; 306 307 308 /* 309 * The Pipe class is the communication management between the hardware and 310 * the stack. It creates packets, manages these and performs callbacks. 311 */ 312 class Pipe : public Object { 313 public: 314 enum pipeDirection { In, Out, Default }; 315 316 Pipe(Object *parent); 317 virtual ~Pipe(); 318 319 virtual void InitCommon(int8 deviceAddress, 320 uint8 endpointAddress, 321 usb_speed speed, 322 pipeDirection direction, 323 size_t maxPacketSize, 324 uint8 interval, 325 int8 hubAddress, uint8 hubPort); 326 virtual void InitSuperSpeed(uint8 maxBurst, 327 uint16 bytesPerInterval); 328 329 virtual uint32 Type() const { return USB_OBJECT_PIPE; } 330 virtual const char * TypeName() const { return "pipe"; } 331 332 int8 DeviceAddress() const 333 { return fDeviceAddress; } 334 usb_speed Speed() const { return fSpeed; } 335 pipeDirection Direction() const { return fDirection; } 336 uint8 EndpointAddress() const 337 { return fEndpointAddress; } 338 size_t MaxPacketSize() const 339 { return fMaxPacketSize; } 340 uint8 Interval() const { return fInterval; } 341 342 // SuperSpeed-only parameters 343 uint8 MaxBurst() const 344 { return fMaxBurst; } 345 uint16 BytesPerInterval() const 346 { return fBytesPerInterval; } 347 348 // Hub port being the one-based logical port number on the hub 349 void SetHubInfo(int8 address, uint8 port); 350 int8 HubAddress() const 351 { return fHubAddress; } 352 uint8 HubPort() const { return fHubPort; } 353 354 virtual bool DataToggle() const 355 { return fDataToggle; } 356 virtual void SetDataToggle(bool toggle) 357 { fDataToggle = toggle; } 358 359 status_t SubmitTransfer(Transfer *transfer); 360 virtual status_t CancelQueuedTransfers(bool force); 361 362 void SetControllerCookie(void *cookie) 363 { fControllerCookie = cookie; } 364 void * ControllerCookie() const 365 { return fControllerCookie; } 366 367 // Convenience functions for standard requests 368 virtual status_t SetFeature(uint16 selector); 369 virtual status_t ClearFeature(uint16 selector); 370 virtual status_t GetStatus(uint16 *status); 371 372 protected: 373 friend class Device; 374 375 private: 376 int8 fDeviceAddress; 377 uint8 fEndpointAddress; 378 pipeDirection fDirection; 379 usb_speed fSpeed; 380 size_t fMaxPacketSize; 381 uint8 fInterval; 382 uint8 fMaxBurst; 383 uint16 fBytesPerInterval; 384 int8 fHubAddress; 385 uint8 fHubPort; 386 bool fDataToggle; 387 void * fControllerCookie; 388 }; 389 390 391 class ControlPipe : public Pipe { 392 public: 393 ControlPipe(Object *parent); 394 virtual ~ControlPipe(); 395 396 virtual void InitCommon(int8 deviceAddress, 397 uint8 endpointAddress, 398 usb_speed speed, 399 pipeDirection direction, 400 size_t maxPacketSize, 401 uint8 interval, 402 int8 hubAddress, uint8 hubPort); 403 404 virtual uint32 Type() const { return USB_OBJECT_PIPE 405 | USB_OBJECT_CONTROL_PIPE; } 406 virtual const char * TypeName() const 407 { return "control pipe"; } 408 409 // The data toggle is not relevant 410 // for control transfers, as they are 411 // always enclosed by a setup and 412 // status packet. The toggle always 413 // starts at 1. 414 virtual bool DataToggle() const { return true; } 415 virtual void SetDataToggle(bool toggle) {} 416 417 status_t SendRequest(uint8 requestType, 418 uint8 request, uint16 value, 419 uint16 index, uint16 length, 420 void *data, size_t dataLength, 421 size_t *actualLength); 422 static void SendRequestCallback(void *cookie, 423 status_t status, void *data, 424 size_t actualLength); 425 426 status_t QueueRequest(uint8 requestType, 427 uint8 request, uint16 value, 428 uint16 index, uint16 length, 429 void *data, size_t dataLength, 430 usb_callback_func callback, 431 void *callbackCookie); 432 433 virtual status_t CancelQueuedTransfers(bool force); 434 435 private: 436 mutex fSendRequestLock; 437 sem_id fNotifySem; 438 status_t fTransferStatus; 439 size_t fActualLength; 440 }; 441 442 443 class InterruptPipe : public Pipe { 444 public: 445 InterruptPipe(Object *parent); 446 447 virtual uint32 Type() const { return USB_OBJECT_PIPE 448 | USB_OBJECT_INTERRUPT_PIPE; } 449 virtual const char * TypeName() const 450 { return "interrupt pipe"; } 451 452 status_t QueueInterrupt(void *data, 453 size_t dataLength, 454 usb_callback_func callback, 455 void *callbackCookie); 456 }; 457 458 459 class BulkPipe : public Pipe { 460 public: 461 BulkPipe(Object *parent); 462 463 virtual void InitCommon(int8 deviceAddress, 464 uint8 endpointAddress, 465 usb_speed speed, 466 pipeDirection direction, 467 size_t maxPacketSize, 468 uint8 interval, 469 int8 hubAddress, uint8 hubPort); 470 471 virtual uint32 Type() const { return USB_OBJECT_PIPE 472 | USB_OBJECT_BULK_PIPE; } 473 virtual const char * TypeName() const { return "bulk pipe"; } 474 475 status_t QueueBulk(void *data, 476 size_t dataLength, 477 usb_callback_func callback, 478 void *callbackCookie); 479 status_t QueueBulkV(iovec *vector, size_t vectorCount, 480 usb_callback_func callback, void *callbackCookie); 481 status_t QueueBulkV(physical_entry *vector, size_t vectorCount, 482 usb_callback_func callback, void *callbackCookie);}; 483 484 485 class IsochronousPipe : public Pipe { 486 public: 487 IsochronousPipe(Object *parent); 488 489 virtual uint32 Type() const { return USB_OBJECT_PIPE 490 | USB_OBJECT_ISO_PIPE; } 491 virtual const char * TypeName() const { return "iso pipe"; } 492 493 status_t QueueIsochronous(void *data, 494 size_t dataLength, 495 usb_iso_packet_descriptor * 496 packetDescriptor, 497 uint32 packetCount, 498 uint32 *startingFrameNumber, 499 uint32 flags, 500 usb_callback_func callback, 501 void *callbackCookie); 502 503 status_t SetPipePolicy(uint8 maxQueuedPackets, 504 uint16 maxBufferDurationMS, 505 uint16 sampleSize); 506 status_t GetPipePolicy(uint8 *maxQueuedPackets, 507 uint16 *maxBufferDurationMS, 508 uint16 *sampleSize); 509 510 private: 511 uint8 fMaxQueuedPackets; 512 uint16 fMaxBufferDuration; 513 uint16 fSampleSize; 514 }; 515 516 517 class Interface : public Object { 518 public: 519 Interface(Object *parent, 520 uint8 interfaceIndex); 521 522 virtual uint32 Type() const 523 { return USB_OBJECT_INTERFACE; } 524 virtual const char * TypeName() const { return "interface"; } 525 526 // Convenience functions for standard requests 527 virtual status_t SetFeature(uint16 selector); 528 virtual status_t ClearFeature(uint16 selector); 529 virtual status_t GetStatus(uint16 *status); 530 531 private: 532 uint8 fInterfaceIndex; 533 }; 534 535 536 class Device : public Object { 537 public: 538 Device(Object *parent, int8 hubAddress, 539 uint8 hubPort, 540 usb_device_descriptor &desc, 541 int8 deviceAddress, 542 usb_speed speed, bool isRootHub, 543 void *controllerCookie = NULL); 544 virtual ~Device(); 545 546 status_t InitCheck(); 547 548 virtual status_t Changed(change_item **changeList, 549 bool added); 550 551 virtual uint32 Type() const 552 { return USB_OBJECT_DEVICE; } 553 virtual const char * TypeName() const { return "device"; } 554 555 ControlPipe * DefaultPipe() const 556 { return fDefaultPipe; } 557 558 virtual status_t GetDescriptor(uint8 descriptorType, 559 uint8 index, uint16 languageID, 560 void *data, size_t dataLength, 561 size_t *actualLength); 562 563 int8 DeviceAddress() const 564 { return fDeviceAddress; } 565 const usb_device_descriptor * DeviceDescriptor() const; 566 usb_speed Speed() const { return fSpeed; } 567 568 const usb_configuration_info * Configuration() const; 569 const usb_configuration_info * ConfigurationAt(uint8 index) const; 570 status_t SetConfiguration( 571 const usb_configuration_info * 572 configuration); 573 status_t SetConfigurationAt(uint8 index); 574 status_t Unconfigure(bool atDeviceLevel); 575 576 status_t SetAltInterface( 577 const usb_interface_info * 578 interface); 579 580 void InitEndpoints(int32 interfaceIndex); 581 void ClearEndpoints(int32 interfaceIndex); 582 583 virtual status_t ReportDevice( 584 usb_support_descriptor * 585 supportDescriptors, 586 uint32 supportDescriptorCount, 587 const usb_notify_hooks *hooks, 588 usb_driver_cookie **cookies, 589 bool added, bool recursive); 590 virtual status_t BuildDeviceName(char *string, 591 uint32 *index, size_t bufferSize, 592 Device *device); 593 594 device_node * RegisterNode(device_node* parent = NULL); 595 596 int8 HubAddress() const 597 { return fHubAddress; } 598 uint8 HubPort() const { return fHubPort; } 599 600 void SetControllerCookie(void *cookie) 601 { fControllerCookie = cookie; } 602 void * ControllerCookie() const 603 { return fControllerCookie; } 604 device_node * Node() const 605 { return fNode; } 606 void SetNode(device_node* node) { fNode = node; } 607 608 // Convenience functions for standard requests 609 virtual status_t SetFeature(uint16 selector); 610 virtual status_t ClearFeature(uint16 selector); 611 virtual status_t GetStatus(uint16 *status); 612 613 protected: 614 usb_device_descriptor fDeviceDescriptor; 615 bool fInitOK; 616 617 private: 618 bool fAvailable; 619 bool fIsRootHub; 620 usb_configuration_info * fConfigurations; 621 usb_configuration_info * fCurrentConfiguration; 622 usb_speed fSpeed; 623 int8 fDeviceAddress; 624 int8 fHubAddress; 625 uint8 fHubPort; 626 ControlPipe * fDefaultPipe; 627 void * fControllerCookie; 628 device_node* fNode; 629 }; 630 631 632 class Hub : public Device { 633 public: 634 Hub(Object *parent, int8 hubAddress, 635 uint8 hubPort, 636 usb_device_descriptor &desc, 637 int8 deviceAddress, 638 usb_speed speed, bool isRootHub, 639 void *controllerCookie = NULL); 640 virtual ~Hub(); 641 642 virtual status_t Changed(change_item **changeList, 643 bool added); 644 645 virtual uint32 Type() const { return USB_OBJECT_DEVICE 646 | USB_OBJECT_HUB; } 647 virtual const char * TypeName() const { return "hub"; } 648 649 virtual status_t GetDescriptor(uint8 descriptorType, 650 uint8 index, uint16 languageID, 651 void *data, size_t dataLength, 652 size_t *actualLength); 653 654 Device * ChildAt(uint8 index) const 655 { return fChildren[index]; } 656 657 status_t UpdatePortStatus(uint8 index); 658 status_t ResetPort(uint8 index); 659 status_t DisablePort(uint8 index); 660 661 void Explore(change_item **changeList); 662 static void InterruptCallback(void *cookie, 663 status_t status, void *data, 664 size_t actualLength); 665 666 virtual status_t ReportDevice( 667 usb_support_descriptor * 668 supportDescriptors, 669 uint32 supportDescriptorCount, 670 const usb_notify_hooks *hooks, 671 usb_driver_cookie **cookies, 672 bool added, bool recursive); 673 virtual status_t BuildDeviceName(char *string, 674 uint32 *index, size_t bufferSize, 675 Device *device); 676 677 private: 678 status_t _DebouncePort(uint8 index); 679 680 InterruptPipe * fInterruptPipe; 681 usb_hub_descriptor fHubDescriptor; 682 683 usb_port_status fInterruptStatus[USB_MAX_PORT_COUNT]; 684 usb_port_status fPortStatus[USB_MAX_PORT_COUNT]; 685 Device * fChildren[USB_MAX_PORT_COUNT]; 686 }; 687 688 689 /* 690 * A Transfer is allocated on the heap and passed to the Host Controller in 691 * SubmitTransfer(). It is generated for all queued transfers. If queuing 692 * succeds (SubmitTransfer() returns with >= B_OK) the Host Controller takes 693 * ownership of the Transfer and will delete it as soon as it has called the 694 * set callback function. If SubmitTransfer() failes, the calling function is 695 * responsible for deleting the Transfer. 696 * Also, the transfer takes ownership of the usb_request_data passed to it in 697 * SetRequestData(), but does not take ownership of the data buffer set by 698 * SetData(). 699 */ 700 class Transfer { 701 public: 702 Transfer(Pipe *pipe); 703 ~Transfer(); 704 705 Pipe * TransferPipe() const { return fPipe; } 706 707 void SetRequestData(usb_request_data *data); 708 usb_request_data * RequestData() const { return fRequestData; } 709 710 void SetIsochronousData( 711 usb_isochronous_data *data); 712 usb_isochronous_data * IsochronousData() const 713 { return fIsochronousData; } 714 715 void SetData(uint8 *buffer, size_t length); 716 uint8 * Data() const 717 { return fPhysical ? NULL : (uint8 *)fData.base; } 718 size_t DataLength() const { return fData.length; } 719 720 bool IsPhysical() const { return fPhysical; } 721 722 void SetVector(iovec *vector, size_t vectorCount); 723 void SetVector(physical_entry *vector, size_t vectorCount); 724 generic_io_vec * Vector() { return fVector; } 725 size_t VectorCount() const { return fVectorCount; } 726 727 uint16 Bandwidth() const { return fBandwidth; } 728 729 bool IsFragmented() const { return fFragmented; } 730 void AdvanceByFragment(size_t actualLength); 731 size_t FragmentLength() const; 732 733 status_t InitKernelAccess(); 734 status_t PrepareKernelAccess(); 735 736 void SetCallback(usb_callback_func callback, 737 void *cookie); 738 usb_callback_func Callback() const 739 { return fCallback; } 740 void * CallbackCookie() const 741 { return fCallbackCookie; } 742 743 void Finished(uint32 status, 744 size_t actualLength); 745 746 usb_id USBID() const { return 0; } 747 const char * TypeName() const { return "transfer"; } 748 749 private: 750 void _CheckFragmented(); 751 status_t _CalculateBandwidth(); 752 753 // Data that is related to the transfer 754 BReference<Pipe> fPipe; 755 generic_io_vec fData; 756 generic_io_vec * fVector; 757 size_t fVectorCount; 758 void * fBaseAddress; 759 bool fPhysical; 760 bool fFragmented; 761 size_t fActualLength; 762 area_id fUserArea; 763 area_id fClonedArea; 764 765 usb_callback_func fCallback; 766 void * fCallbackCookie; 767 768 // For control transfers 769 usb_request_data * fRequestData; 770 771 // For isochronous transfers 772 usb_isochronous_data * fIsochronousData; 773 774 // For bandwidth management. 775 // It contains the bandwidth necessary in microseconds 776 // for either isochronous, interrupt or control transfers. 777 // Not used for bulk transactions. 778 uint16 fBandwidth; 779 }; 780 781 782 // Interface between usb_bus and underlying implementation (xhci_pci) 783 typedef struct usb_bus_interface { 784 driver_module_info info; 785 } usb_bus_interface; 786 787 788 typedef struct { 789 driver_module_info info; 790 status_t (*get_stack)(void** stack); 791 } usb_for_controller_interface; 792 793 #define USB_FOR_CONTROLLER_MODULE_NAME "bus_managers/usb/controller/driver_v1" 794 795 // bus manager device interface for peripheral driver 796 typedef struct { 797 driver_module_info info; 798 799 } usb_device_interface; 800 801 802 #define USB_DEVICE_MODULE_NAME "bus_managers/usb/device/driver_v1" 803 804 #endif // _USB_PRIVATE_H 805