Kinetis:usbdev clean up ensuring proper use of HW.

Remove magic numbers from code, documented the use of
  undocumented bits.

  Remove comments and code that were not appropriate for this
  hardware.

  Removed ifdef that's that were always compiled and removed code
  blocks that were never compiled.

  Ensure proper access order to hardware.
  Per the reference manual: disable endpoints prior to configuring buffer
  descriptor, then enable endpoints
  Reorganize interrupt processing order to offload data after processing
  errors.

  Reorganize initialization so that there is a clear initialization phase,
  reset phase for both the hardware and software structures.

  By breaking the initialization into smaller pieces, the reset interrupt
  only resets the resources within the controller that should be reset.

  Rework suspend and resume logic so they perform properly

  Made attach and detach functions optional. As they do not make sense for
  a bus powered device.

  Ensured the calls to up_usbinitalize up_usbuninitalize do not violate the
  USB spec.
This commit is contained in:
David Sidrane
2017-06-02 16:25:27 -10:00
parent 3f4d096707
commit 60c552ae0f
2 changed files with 368 additions and 337 deletions
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -66,6 +66,8 @@ struct usbotg_bdtentry_s
struct usbdev_s;
int kinetis_usbpullup(FAR struct usbdev_s *dev, bool enable);
void kinetis_usbsuspend(FAR struct usbdev_s *dev, bool resume);
#if defined(CONFIG_USBDEV_SELFPOWERED)
void khci_usbattach(void);
void khci_usbdetach(void);
#endif
#endif /* __ARCH_ARM_SRC_KINETIS_KINETIS_USBOTG_H */