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