Commit Graph

13 Commits

Author SHA1 Message Date
Scott Shawcroft
7a3f86d184 Check usb_busy up front in usb background function.
Waiting to do so risks accidentally queueing another response.

Hopefully fixes #655 but we'll let @jerryneedell confirm.
2018-03-14 10:32:41 -07:00
Scott Shawcroft
8157248189 Move usb read finish into interrupt.
Having the `active_read = false` in the background function left
a chance that a new_write occurs before active_read is set to false.

In that case, we'll read the appropriate data rather than write it
and never clear the active write.

Hopefully fixes #655.
2018-03-13 11:29:29 -07:00
Dan Halbert
72c911be97 Support SPI flash chips for CIRCUITPY, using non-DMA SPI for now. 2017-11-27 21:00:24 -05:00
Scott Shawcroft
ef9a7f262a atmel-samd: Turn off nvmctl cache and rework active_read. 2017-11-08 16:01:38 -08:00
Scott Shawcroft
971bd7e9a6 atmel-samd: Improve MSC reliability.
* Be more liberal with critical sections to ensure ordering.
* Correct usb_busy so that it is busy when no errors occur on
  transfer. I believe it worked before because it would be false
  momentarily until a second transfer was attempted and a busy
  error was returned, therefore setting usb_busy to true. That
  risks the first "failed" transfer completing before a second one
  is attempted.
2017-11-08 12:42:50 -08:00
Scott Shawcroft
7a901cfccd atmel-samd: Align SCSI responses. 2017-11-08 10:47:22 -08:00
Scott Shawcroft
182a946b0e atmel-samd: Tweak mass storage code to finish read sooner. 2017-11-06 16:30:11 -08:00
Scott Shawcroft
4140b3b944 atmel-samd: Stop double CSW after MSC reads
This explicit zero length xfer leads to a second CSW packet. If
another read was started between the two CSWs then the host gets
confused and resets the device.

On reads, the CSW is automatically sent when we reply with the
total length. Writes must do it manually so they can wait for the
disk to flush the data.
2017-11-03 15:08:55 -07:00
Scott Shawcroft
54f2b698ce atmel-samd: remove infinite loop if USB MSC read fails. 2017-10-31 22:38:52 -07:00
Scott Shawcroft
4aeef100f6 atmel-samd: More USB polish
* Introduce a python script to generate the USB descriptor instead of
  a bunch of C macros. In the future, we can use this dynamically in
  CircuitPython.
* Add support for detecting read-only mass storage mounts.

Fixes #377
2017-10-30 18:29:20 -07:00
Scott Shawcroft
ee18b5cbab Don't use ERR_ABORTED. (#375) 2017-10-26 09:08:29 -04:00
Scott Shawcroft
d613776f0d atmel-samd: Add support for ERR_ABORTED to indicate medium not present. 2017-10-25 21:02:01 -04:00
Scott Shawcroft
73c15dcf8b Merge commit 'f869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c' into nrf2_merge
This is prep for merging in the NRF5 pull request.
2017-10-24 22:31:16 -07:00