Commit Graph

17 Commits

Author SHA1 Message Date
Damien George d966a33486 stm32: Change header include guards from STMHAL to STM32 to match dir. 2018-02-15 15:47:04 +11:00
Damien George 5c320bd0b0 stm32: Introduce MICROPY_HW_ENABLE_USB and clean up USB config.
This patch allows to completely compile-out support for USB, and no-USB is
now the default.  If a board wants to enable USB it should define:

    #define MICROPY_HW_ENABLE_USB (1)

And then one or more of the following to select the USB PHY:

    #define MICROPY_HW_USB_FS (1)
    #define MICROPY_HW_USB_HS (1)
    #define MICROPY_HW_USB_HS_IN_FS (1)
2018-02-13 18:51:08 +11:00
Damien George 8e1cb58a23 stm32/usbdev: Fix USBD setup request handler to use correct recipient.
Prior to this patch the USBD driver did not handle the recipient correctly
for setup requests.  It was not interpreting the req->wIndex field in the
right way: in some cases this field indicates the endpoint number but the
code was assuming it always indicated the interface number.

This patch fixes this.  The only noticeable change is to the MSC
interface, which should now correctly respond to the USB_REQ_CLEAR_FEATURE
request and hence unmount properly from the host when requested.
2018-02-12 17:22:59 +11:00
Damien George db702ba722 stm32/usbdev: Add support for high-speed USB device mode.
This patch adds support in the USBD configuration and CDC-MSC-HID class for
high-speed USB mode.  To enable it the board configuration must define
USE_USB_HS, and either not define USE_USB_HS_IN_FS, or be an STM32F723 or
STM32F733 MCU which have a built-in HS PHY.  High-speed mode is then
selected dynamically by passing "high_speed=True" to the pyb.usb_mode()
function, otherwise it defaults to full-speed mode.

This patch has been tested on an STM32F733.
2018-02-01 17:57:44 +11:00
Damien George 3130424b54 stm32/usbdev: Add support for MSC-only USB device class.
Select this mode in boot.py via: pyb.usb_mode('MSC')
2018-02-01 15:47:16 +11:00
Damien George 1d4246a2e8 stm32/usbdev: Reduce dependency on py header files. 2018-02-01 12:44:16 +11:00
Damien George 3f6d3ccc11 stm32/usbdev: Pass thru correct val for SCSI PreventAllowMediumRemoval.
This value is "1" when the medium should not be removed, "0" otherwise.
2017-12-13 18:33:39 +11:00
Damien George f7f4bf0321 stm32/usbdev: Move all the USB device descriptor state into its struct. 2017-09-22 10:57:21 +10:00
Damien George 0ea73d2da7 stm32/usbdev: Simplify pointers to MSC state and block dev operations. 2017-09-21 21:51:12 +10:00
Damien George f8f17f48c5 stm32/usbdev: Put all state for the USB device driver in a struct. 2017-09-21 21:51:04 +10:00
Damien George b3b922f177 stm32/usbdev: Simplify HID tx/rx buffer passing. 2017-09-21 21:50:56 +10:00
Damien George e04b478050 stm32/usbdev: Simplify CDC tx/rx buffer passing. 2017-09-21 21:50:48 +10:00
Damien George 77e1da40e2 stm32/usbdev: Put all HID state in a struct. 2017-09-21 21:50:37 +10:00
Damien George 980b33177b stm32/usbdev: Put all CDC state in a struct. 2017-09-21 21:48:28 +10:00
Damien George 78602a217f stm32/usbdev: Make the USBD callback struct const so it can go in ROM. 2017-09-20 17:44:16 +10:00
Damien George f1dd0fd7df stm32: Remove unused usbd_msc.c file. 2017-09-06 14:50:08 +10:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00