aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/usbdev/class/inc
AgeCommit message (Collapse)Author
2020-07-25stm32/usbdev: Fix calculation of SCSI LUN size with multiple LUNs.Damien George
The SCSI driver calls GetCapacity to get the block size and number of blocks of the underlying block-device/LUN. It caches these values and uses them later on to verify that reads/writes are within the bounds of the LUN. But, prior to this commit, there was only one set of cached values for all LUNs, so the bounds checking for a LUN could use incorrect values, values from one of the other LUNs that most recently updated the cached values. This would lead to failed SCSI requests. This commit fixes this issue by having separate cached values for each LUN. Signed-off-by: Damien George <damien@micropython.org>
2019-09-11stm32/usb: Verify number of used endpoints doesn't exceed maximum.Damien George
2019-09-11stm32/usb: Add support for VCP+MSC+HID mode, incl 2xVCP and 3xVCP.Damien George
2019-07-16stm32/usb: Add config options to disable USB MSC and/or HID.Damien George
The new configurations MICROPY_HW_USB_MSC and MICROPY_HW_USB_HID can be used by a board to enabled or disable MSC and/or HID. They are both enabled by default.
2019-06-11stm32/usbd_msc: Provide Mode Sense response data in MSC interface.Damien George
Eventually these responses could be filled in by a function to make their contents dynamic, depending on the attached logical units. But for now they are fixed, and this patch fixes the MODE SENSE(6) responses so it is the correct length with the correct header.
2019-06-11stm32/usbd_msc: Provide custom irquiry processing by MSC interface.Damien George
So the MSC interface can customise the inquiry response based on the attached logical units.
2019-05-31stm32/usb: Include py/mpconfig.h instead of mpconfigboard.h.Damien George
Because py/mpconfig.h has header include guards.
2019-05-31stm32/usb: Support up to 3 VCP interfaces on USB device peripheral.Damien George
To enable define MICROPY_HW_USB_CDC_NUM to 3.
2019-05-30stm32/usb: Refactor CDC VCP code to enable N CDC interfaces.Damien George
The board config option MICROPY_HW_USB_ENABLE_CDC2 is now changed to MICROPY_HW_USB_CDC_NUM, and the latter should be defined to the maximum number of CDC interfaces to support (defaults to 1).
2018-10-15stm32/usbd_cdc_interface: Refactor USB CDC tx code to not use SOF IRQ.Damien George
Prior to this commit the USB CDC used the USB start-of-frame (SOF) IRQ to regularly check if buffered data needed to be sent out to the USB host. This wasted resources (CPU, power) if no data needed to be sent. This commit changes how the USB CDC transmits buffered data: - When new data is first available to send the data is queued immediately on the USB IN endpoint, ready to be sent as soon as possible. - Subsequent additions to the buffer (via usbd_cdc_try_tx()) will wait. - When the low-level USB driver has finished sending out the data queued in the USB IN endpoint it calls usbd_cdc_tx_ready() which immediately queues any outstanding data, waiting for the next IN frame. The benefits on this new approach are: - SOF IRQ does not need to run continuously so device has a better chance to sleep for longer, and be more responsive to other IRQs. - Because SOF IRQ is off, current consumption is reduced by a small amount, roughly 200uA when USB is connected (measured on PYBv1.0). - CDC tx throughput (USB IN) on PYBv1.0 is about 2.3 faster (USB OUT is unchanged). - When USB is connected, Python code that is executing is slightly faster because SOF IRQ no longer interrupts continuously. - On F733 with USB HS, CDC tx throughput is about the same as prior to this commit. - On F733 with USB HS, Python code is about 5% faster because of no SOF. As part of this refactor, the serial port should no longer echo initial characters when the serial port is first opened (this only used to happen rarely on USB FS, but on USB HS is was more evident).
2018-10-15stm32/usbd_cdc_interface: Handle disconnect IRQ to set VCP disconnected.Damien George
pyb.USB_VCP().isconnected() will now return False if the USB is disconnected after having previously been connected. See issue #4210.
2018-05-14stm32/usb: Add ability to have 2x VCP interfaces on the one USB device.Damien George
This patch adds the configuration MICROPY_HW_USB_ENABLE_CDC2 which enables a new USB device configuration at runtime: VCP+VCP+MSC. It will give two independent VCP interfaces available via pyb.USB_VCP(0) and pyb.USB_VCP(1). The first one is the usual one and has the REPL on it. The second one is available for general use. This configuration is disabled by default because if the mode is not used then it takes up about 2200 bytes of RAM. Also, F4 MCUs can't support this mode on their USB FS peripheral (eg PYBv1.x) because they don't have enough endpoints. The USB HS peripheral of an F4 supports it, as well as both the USB FS and USB HS peripherals of F7 MCUs.
2018-05-14stm32/usb: Change HID report funcs to take HID state, not usbdev state.Damien George
2018-05-14stm32/usb: Change CDC tx/rx funcs to take CDC state, not usbdev state.Damien George
2018-05-14stm32/usb: Make CDC endpoint definitions private to core usbdev driver.Damien George
2018-05-14stm32/usb: Combine HID lower-layer and interface state into one struct.Damien George
2018-05-14stm32/usb: Combine CDC lower-layer and interface state into one struct.Damien George
2018-05-11stm32/usbdev: Remove unused RxState variable, and unused struct.Damien George
2018-05-11stm32/usbdev: Convert files to unix line endings.Damien George
Also remove trailing whitespace and convert tabs to spaces.
2018-02-15stm32: Change header include guards from STMHAL to STM32 to match dir.Damien George
2018-02-13stm32: Introduce MICROPY_HW_ENABLE_USB and clean up USB config.Damien George
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-01stm32/usbdev: Add support for high-speed USB device mode.Damien George
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-01stm32/usbdev: Reduce dependency on py header files.Damien George
2017-09-22stm32/usbdev: Move all the USB device descriptor state into its struct.Damien George
2017-09-21stm32/usbdev: Simplify pointers to MSC state and block dev operations.Damien George
2017-09-21stm32/usbdev: Put all state for the USB device driver in a struct.Damien George
2017-09-21stm32/usbdev: Simplify HID tx/rx buffer passing.Damien George
2017-09-21stm32/usbdev: Simplify CDC tx/rx buffer passing.Damien George
2017-09-21stm32/usbdev: Put all HID state in a struct.Damien George
2017-09-21stm32/usbdev: Put all CDC state in a struct.Damien George
2017-09-20stm32/usbdev: Make the USBD callback struct const so it can go in ROM.Damien George
2017-09-06ports: Make new ports/ sub-directory and move all ports there.Damien George
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.