zoukankan      html  css  js  c++  java
  • segger usbh struct

      1 typedef struct USBH_HOST_DRIVER_INST {                          
      2   U32                             Magic;
      3   USBH_DLIST                      HostControllerList;
      4   U32                             HostControllerCount;
      5   USBH_DLIST                      NotificationList;             // Registered PNP notifications
      6   U32                             NotificationCount;            // *** USBH_RegisterPnPNotification()
      7   USBH_DLIST                      DelayedPnPNotificationList;   // Delayed Pnp notifications
      8   U32                             DelayedPnPNotificationCount;  // called in an timer routine
      9   USBH_TIMER_HANDLE               DelayedPnPNotifyTimer;        // call Delayed Pnp notifications
     10   USBH_DLIST                      EnumErrorNotificationList;    // *** USBH_RegisterEnumErrorNotification()
     11   U32                             EnumErrorNotificationCount;   // *** USBH_RegisterEnumErrorNotification()
     12   USBH_INTERFACE_ID               NextInterfaceId;              // Next free ID's for a new enumerated device
     13   USBH_DEVICE_ID                  NextDeviceId;                 // Next free ID's for a new enumerated device
     14 } USBH_HOST_DRIVER_INST;
     15 
     16 typedef struct USBH_GLOBAL {
     17   U8                              ConfigCompleted;
     18   U8                              InitCompleted;
     19   USBH_HC_HANDLE                  hHC;                          // Context for the host controller driver
     20   USBH_HC_BD_HANDLE               hHCBD;                        // Handle of the bus driver of a host controller
     21   USBH_HOST_DRIVER_INST           DriverInst;                   //
     22   USBH_HOST_DRIVER              * pDriver;                      // USBH_HOST_INIT_FUNC, USBH_HOST_EXIT_FUNC, etc.
     23   USBH_ON_SETCONFIGURATION_FUNC * pfOnSetConfiguration;         // USBH_SetOnSetConfiguration()
     24   void                          * pOnSetConfigContext;          // USBH_SetOnSetConfiguration()
     25   struct {                                                      // Config **************
     26   U32                             TransferBufferSize;           // USBH_AssignMemory() USBH_AssignTransferMemory()
     27   U8                              NumRootHubs;
     28   U8                              RootHubPortsAlwaysPowered;
     29   U8                              RootHubPerPortPowered;
     30   U8                              RootHubSupportOvercurrent;
     31   U8                              NumUSBDevices;                // USBH_ConfigMaxUSBDevices()
     32   U8                              NumBulkEndpoints;             // USBH_ConfigMaxNumEndpoints()
     33   U8                              NumIntEndpoints;              // USBH_ConfigMaxNumEndpoints()
     34   U8                              NumIsoEndpoints;              // USBH_ConfigMaxNumEndpoints()
     35   U8                              SupportExternalHubs;          // USBH_ConfigSupportExternalHubs()
     36   U8                              SetHighIsPowerOn;
     37   U32                             DefaultPowerGoodTime;
     38   }                               Config;                       // Config **************
     39   U8                              IsRunning;                    // USBH_Task()
     40   U8                              TimerTaskIsRunning;
     41   U8                              ISRTaskIsRunning;             // USBH_ISRTask()
     42   USBH_DRIVER_REMOVE_FUNC       * pfDriverRemove;
     43 } USBH_GLOBAL;                                                  // void USBH_ON_PNP_EVENT_FUNC(USBH_INTERFACE_ID InterfaceId);
     44                                                                 // USBH_GetInterfaceInfo( InterfaceId, &InterfaceInfo ) 
     45 struct USB_DEVICE {                                             // USBH_BD_GetDeviceById( DeviceId ) =  InterfaceInfo.DeviceId
     46   U32                    Magic;
     47   USBH_DLIST             ListEntry;                             // To store this object in the host controller object
     48   USBH_DLIST             TempEntry;                             // To store this object in an temporary list
     49   USBH_BOOL              TempFlag;
     50   long                   RefCount;                              // deleted when ( RefCount == 0 )   ?
     51   USBH_HOST_CONTROLLER * pHostController;                       // Pointer to the owning host controller
     52 
     53   USBH_DLIST             UsbInterfaceList;                      // List for interfaces
     54   unsigned int           InterfaceCount;                        // USB_X_INTERFACE_ARRAY[ *** InterfaceCount *** ]
     55 
     56   USBH_HUB_PORT        * pParentPort;                           // This is the hub port where this device is connected to
     57   U8                     UsbAddress;                            // This is the USB address of the device
     58   USBH_SPEED             DeviceSpeed;                           // pSpeed of the device connection
     59   U8                     MaxFifoSize;                           // The FIFO size <--- Host Controller --->
     60   U8                     ConfigurationIndex;                    // The index of the current configuration
     61   U8                     NumConfigurations;                     // The index of the current configuration
     62   USBH_DEVICE_DESCRIPTOR DeviceDescriptor;                      // Device Descriptor
     63   U8                  ** ppConfigDesc;                          // Points to the All configuration descriptors
     64   U16                  * paConfigSize;                          // paConfigSize[ index ]
     65   U8                   * pConfigDescriptor;                     // Points to the current configuration descriptor
     66   U16                    ConfigDescriptorSize;                  // Size of the current configuration descriptor
     67   U16                    LanguageId;                            // First language ID
     68   U8                   * pSerialNumber;                         // Serial number without header, UNICODE
     69   unsigned int           SerialNumberSize;
     70   U16                    DevStatus;                             // Device status returned from USB GetStatus
     71   USBH_DEFAULT_EP        DefaultEp;                             // Embedded default endpoint
     72   USB_HUB              * pUsbHub;                               // This pointer is valid if the device is a hub
     73   USB_DEV_STATE          State;                                 // Current device state
     74   USBH_URB               EnumUrb;                               // Embedded URB
     75   void                 * pCtrlTransferBuffer;                   // Used from USBH_BD_ProcessEnum and ProcessEnumHub()
     76   unsigned int           CtrlTransferBufferSize;
     77   URB_SUB_STATE          SubState;
     78   DEV_ENUM_STATE         EnumState;
     79   USBH_BOOL              EnumSubmitFlag;                        // Used during enumeration if the device is as an hub
     80   POST_ENUM_FUNC       * pfPostEnumFunction;
     81   void                 * pPostEnumerationContext;
     82   USBH_DEVICE_ID         DeviceId;                              // Device ID for this device
     83 };
     84 
     85 struct USB_INTERFACE {                                          // USBH_GetInterfaceByInterfaceId( InterfaceId )
     86   U32                   Magic;
     87   USBH_DLIST            ListEntry;                              // To store this object in the device object
     88   USB_DEVICE          * pDevice;                                // Backward pointer
     89 
     90   USBH_DLIST            UsbEndpointList;                        // List for endpoints
     91   unsigned int          EndpointCount;                          // USB_X_ENDPOINT_ARRAY[ *** USB_X_ENDPOINT *** ]
     92 
     93   U8                    CurrentAlternateSetting;                //
     94   U8                  * pInterfaceDescriptor;                   // Interface Descriptor
     95   U8                  * pAlternateSettingDescriptor;
     96   U8                    NewAlternateSetting;                    //
     97   U8                  * pNewAlternateSettingDescriptor;
     98   unsigned int          OpenCount;                              //
     99   U8                    ExclusiveUsed;                          //           EndpointCount <= USB_MAX_ENDPOINTS
    100   USB_ENDPOINT        * pEpMap[USB_MAX_ENDPOINTS];              // A map for fast access to endpoint structures
    101   USBH_INTERFACE_ID     InterfaceId;                            // ID of this interface
    102 };
    103 
    104 typedef struct USB_ENDPOINT {
    105   USBH_DLIST            ListEntry;                              // to store this object in the interface object
    106   U32                   Magic;
    107   USB_INTERFACE       * pUsbInterface;                          // Backward pointer
    108   U8                  * pEndpointDescriptor;                    // Endpoint Descriptor
    109   USBH_HC_EP_HANDLE     hEP;                                    // Endpoint handle must be used to submit an URB
    110   U32                   UrbCount;
    111 } USB_ENDPOINT;

  • 相关阅读:
    [luoguP2622] 关灯问题II(状压最短路)
    [luoguP2016] 战略游戏(DP)
    FileUpload
    Mysql -- JDBC
    Mysql优化
    Mysql锁
    Mysql索引
    Mysql事务
    Mysql基本语句
    Listener
  • 原文地址:https://www.cnblogs.com/shangdawei/p/2704558.html
Copyright © 2011-2022 走看看