Author Topic: Hub Driver on Embedded host  (Read 7883 times)

nvd

  • Member
  • ***
  • Posts: 42
Hub Driver on Embedded host
« on: March 03, 2013, 05:58:25 am »
Hi,
 Is there a Hub driver example available somewhere for Embedded host for reference?
 
Thanks
nvd

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Hub Driver on Embedded host
« Reply #1 on: March 03, 2013, 10:46:52 am »
Linux source code.

nvd

  • Member
  • ***
  • Posts: 42
Re: Hub Driver on Embedded host
« Reply #2 on: March 04, 2013, 12:29:37 am »
Oh yes! Thanks!

I think its uncommon to see hub support provided by USB host stack on microcontrolles/SoCs which do not run linux or other OS/RTOS.
Are there any such examples?

Regards,
nvd


 

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: Hub Driver on Embedded host
« Reply #3 on: March 04, 2013, 02:49:16 am »
Implementation of host driver for hub class is rather easier part of the job. It may be easier than Mass-Storage implementation, which has protocol over protocol (SCSI - BOT).

The hard part is,
Most of embedded host stack assume single device connection. It has just single set of global variables, for control transfer state machine, class-specific common variables. To support multiple devices over hub, you have to rewrite almost every line of existing host stack code, to change references of global variables to driver instance members. And then, you'll introduce management of instances at device connection/ disconnection.

Tsuneo

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Hub Driver on Embedded host
« Reply #4 on: March 05, 2013, 08:23:29 pm »
I wouldn't say a hub driver is easy. BOT is much simpler than a hub driver. Hubs have lots of state which have to be dealt with, they're quite unsual in that.

Tsuneo

  • Frequent Contributor
  • ****
  • Posts: 145
Re: Hub Driver on Embedded host
« Reply #5 on: March 07, 2013, 02:03:55 am »
The hub port state machine, on which host has to track and manage, is outlined well in this figure of the USB2.0 spec,
Figure 11-10. Downstream Facing Hub Port State Machine

As this figure also illustrates hub's internal states, the state machine on the host is more simplified.
- Powered off
- Disconnected
- Disabled
- Resetting
- Enabled
- Suspended
- Resuming

State transitions are straightforward, and ClearPortFeature/SetPortFeature requests, which move the states, appear on this figure.

The information of this figure, and the bit fields of GetPortStatus are enough to make the state machine.
Table 11-21. Port Status Field, wPortStatus
Table 11-22. Port Change Field, wPortChange

Tsuneo