[haiku-development] Re: [GSoC] UVC Driver: EHCI

  • From: Gabriel Hartmann <gabriel.hartmann@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 18 Apr 2011 13:39:04 +1200

Hi Jérôme,

>> * if the Asynchronous Park Capability bit in the EHCI_HCCPARAMS register
> >> is a one, enable EHCI_USBCMD_ASPME and set the count to 3.
> >
> > I believe I've determined when the Asynchronous Park Capability bit is
> set,
> > and have enabled EHCI_USBCMD_ASPME in the command register and I think
> I've
> > set the count to 3 (although it would be nice to know what this value
> > means).
> Looks OK. 3 should be the default value when the capability is present.
> It might be better to have only one WriteOpReg() in both cases.

I've changed this to only have one WriteOpReg().

> >> * the register is written with the unmasked read value. Add a mask to
> the
> >> read value for written bits.
> >
> > I'm not exactly clear on what this statement means.  I know how to set
> and
> > shift values around in binary, and I think I understand how the functions
> > which read and write to registers work.
> The code the result of ReadOpReg(EHCI_USBCMD) in WriteOpReg(EHCI_USBCMD,
> x).
> If we don't mask the read value with for instance EHCI_USBCMD_ITC_MASK
> and EHCI_USBCMD_ASPMC_MASK, we can end up with a different written
> value than we wanted for EHCI_USBCMD_ITC or EHCI_USBCMD_ASPMC.
> This might be unnecessary but is considered good practice.

Do you think it matters at what point these masks are applied?  Should they
always be applied or are they dependent on some condition?  i.e. Should I
only apply the EHCI_USBCMD_ASPMC_MASK when the asynchronous park capability
bit is set?  Should the ITC mask always be applied?

I've applied the ITC mask just before we write back to the register and the
ASPMC mask only if the relevant bit is set.  Does this make sense?

-- Gabriel

Other related posts: