Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/thirdpin/libopencm3.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/usb
AgeCommit message (Collapse)Author
2019-07-10FIX: [usb] Forgotten semicolonIlya Stolyarov
2019-07-09IMPR: [usb] Some style improvementsIlya Stolyarov
2019-07-07FIX: [usb] Delay after RCC enableIlya Stolyarov
2019-07-07FIX: [usb] usbd_dev->doeptsiz[] using 8 fields but has only 4Ilya Stolyarov
Signed-off-by: Ilya Stolyarov <i.stolyarov@thirdpin.ru>
2019-07-07FIX: [usb] usbd_dev->user_callback_ctr have 8 fields but iterate only 4Ilya Stolyarov
Signed-off-by: Ilya Stolyarov <i.stolyarov@thirdpin.ru>
2019-07-04FEAT: [ulpi] Registers and initializationIlya Stolyarov
2018-08-27usb: fix race between setup complete and endpoint nakKarl Palsson
See https://github.com/libopencm3/libopencm3/issues/873 Commentary describing this patch originally by zyp: ``` After looking further into it, I've concluded that my preliminary analysis looks correct. The problem is that setting CNAK before the SETUP complete event is received causes a race condition. The SETUP callback is called when the SETUP packet event is received, which means that setting CNAK from the callback is too early. Originally the problem was that CNAK was set by ep_read() which is called by the callback. #672 solved this by moving CNAK out of ep_read() and calling it after the SETUP complete event is received instead. The regression by #785 is caused by the introduction of flow control calls into the SETUP callback. They also set CNAK. To solve this properly, I propose changing the event handling code to only call the SETUP callback after the SETUP complete event is received. Unfortunately, this implies that the callback can't call ep_read() itself anymore, because the packet has to be read out of the FIFO before the SETUP complete event arrives. This implies a change of the API between the hardware drivers and _usbd_control_setup(). ``` L1 (st_usbfs) works and passes tests as before change F4 (dwc_otg_fs) works and now passes tests. (yay) LM4f still compiles, and has had the same style of implementation as st_usbfs, however has not been tested on any hardware.
2018-08-27usb: make usb_disconnect() weakDavid Lamparter
usb_disconnect() is board/platform specific for chips that don't have built-in handling for this. Allow the application to provide its own version of usb_disconnect() to handle this. See https://github.com/libopencm3/libopencm3/pull/924
2018-08-27usb: make strings "const char * const *"David Lamparter
This allows the pointer table to be in Flash, by using "static const char * const strings[] = { ... };" See https://github.com/libopencm3/libopencm3/pull/924
2018-08-17usb: prevent registering duplicate config callbacksKarl Palsson
Originally discussed at https://github.com/libopencm3/libopencm3/pull/722
2018-04-28efm32: Split efm32/lg into /lg and /common.kbob
Somewhat replaces some earlier work done by hg/lg, but much more complete, so we kept it as is, because it's bringing in even more parts after this. Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2018-03-03usb: Use enumerated return codesKarl Palsson
The enum usbd_request_return_codes has been available for some time. It should be used internally, not just by users of this code.
2018-03-03usb-msc: fix write acknowledgement bugSebastian Holzapfel
Fixes https://github.com/libopencm3/libopencm3/issues/409
2018-03-03usb-standard: fix alignment assumption for Cortex-M0 platformsSebastian Holzapfel
2018-03-03efm32hg: usb: add usb supportSebastian Holzapfel
2018-03-03usb-dwc: handle any-aligned buffersSebastian Holzapfel
This is required to support armv6m targets using this code.
2018-03-03usb: stm32fx07 -> usb_dwc_commonSebastian Holzapfel
The stm32fx07 is common DesignWare IP, used in both STM32 and EFM32 chips. Rename the files to make this more clear, and easier to use in other targets.
2017-06-09usb: Ensure control events are handled in orderVegard Storheil Eriksen
Use EP0 OUT flow control to NAK OUT packets when we're not yet expecting any. This prevents the status OUT event from arriving while the control state machine is still expecting the data IN completion event.
2017-03-31stmfx07: usb: Clean up FIFO read/write macro usage.Jochen Hoenicke
Use REBASE(OTG_FIFO(endpoint)) to access the FIFO. For the receive FIFO do not use the endpoint. There is only one receive FIFO so giving the endpoint is a no-op. Get rid of REBASE_FIFO macro.
2017-03-31stmfx07: usb: Enable ctrl_out only after done rcvd.Jochen Hoenicke
This fixes the problem where the first four bytes were skipped in the fifo.
2017-03-31stmfx07: usb: keep better track of rxbcntJochen Hoenicke
When reading a portion of the packet that is not divisible by 4 and not equal to rxbcnt the count could get off, since 4 bytes are read from the fifo in the last step but rxbcnt was only updated by the number of bytes the caller requested. We fix this by always subtracting four bytes (the number of bytes read from the fifo) when we read a word from the fifo. Care has to be taken in the last step so that rxbcnt doesn't underflow (it is an unsigned number). Note that reading in several small chunks not divisible by 4 doesn't work as the extra bytes read in the last step are always discarded.
2017-03-31stmfx07: usb: flush txfifo if not empty after SETUPJochen Hoenicke
After a SETUP packet on a control endpoint the transmit FIFO should usually be empty. If something bad happened, e.g. PC and device got out of sync, we want to clear the fifo. This should fix #668.
2017-03-31stmfx07: usb: poll DIEPINT before RXFLVLJochen Hoenicke
This is to interrupt for setup sequences on IN packet before checking for OUT packet received. This fixes the problem that usb_control_out stalls because we are not yet in STATUS_OUT phase. Related to #668.
2017-01-11stm32f4: USB support for newer OTG coresDavid Sidrane
Support for the conflicting bit definitions for vbus sensing on core id version 0x2000+ Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2016-11-21usb: dwc_otg: fix missing includesKarl Palsson
Went awol merging something :( (Yes, dwc_otg is theoretically shared with efm and co, but at present it's still pretty much the stm32 version) Fixes: 422d708384c76b8bf3a860bdd084e3010e28afa0
2016-11-21usb: dwc_otg: enable clocks automatically.Karl Palsson
ST usbfs-v1, v2, EFM32 USB, lm4f usb all automatically enable the clock in their _init routine. Do the same for the dwc_otg drivers to be consistent.
2016-03-08Fix misspellings using codespell toolAnatol Pomozov
2016-01-27usb: Return configuration = 0 in Addressed state.svo
This is as per USB 2.0 chapter 9 specifications, and enables passing of USB-IF Chapter 9 tests.
2015-12-15[Style] Stylefix sweep over the whole codebase.Piotr Esden-Tempski
2015-12-13Inital support for EFM32LGKuldeep Singh Dhaka
2015-10-14usb: Improved comments of USB APIfenugrec
usbd.h: more comments for bmRequestType and bmAttributes bitfield macros usbd.h: migrated and added API doxyblocks from implementations (*.c)
2015-10-11usb: short control IN might need a ZLPKarl Palsson
Control transfers can transfer less than was requested by the host in the wLength field. if this short transfer is a multiple of the endpoint's packet size, a zero length packet must be sent. Adds tests for a range of control transfer IN requests, and properly supports this in the core. Based heavily on work by Kuldeep Dhaka. See https://github.com/libopencm3/libopencm3/pull/505 and https://github.com/libopencm3/libopencm3/pull/194 for original discussion. Tested with stm32f4, stm32f103 and stm32l053.
2015-10-03usb: extract ST USB FS peripheral core. [BREAKING CHANGE]Karl Palsson
The breaking changes here changes in header location, and changes in driver name passed down to the usb stack. Changes affect: stm32f102/f103, stm32l1, and some f3 parts * instead of the confusingly generic "usb" use the name "st_usbfs" for the USB Full speed peripheral ST provides in a variety of their stm32 products. Include directives should change as: #include <libopencm3/stm32/usb.h> => <libopencm3/stm32/st_usbfs.h> * instead of the confusingly specific "f103" name for the driver, use "st_usbfs_v1" [BREAKING_CHANGE] Instead of: usbd_init(&stm32f103_usb_driver, .....) ==> usbd_init(&st_usbfs_v1_usb_driver, .....) ==> The purpose of these changes is to reduce some confusion around naming, but primarily to prepare for the "v2" peripheral available on stm32f0/l0 and some f3 devices. Work by Frantisek Burian, Kuldeep Singh Dhaka, Robin Kreis, fenugrec and zyp on irc, and all those forgotten.
2015-09-23usb: otg-dev: disable and flush endpoints on resetKarl Palsson
Only resetting the fifo memory pointers can result in corrupt data. Tested on f4 disco board with the gadget0 test suite.
2015-09-23usb: get_configuration should return bConfigurationValueKarl Palsson
Rather than the index of the config. This happens to be the same thing if you have zero based sequential configurations.
2015-09-23usb: Validate and accept set_configuration properlyKuldeep Singh Dhaka
Setting the same configuration again should act as a lightweight reset, not be ignored. This resulted in data toggle bits not being reset and alternet settings not being reset. Further, completely invalid configurations were accepted, when they should have result in a stall. (Section 9.4.7 of USB 2.0 spec) fixes Github issue #302 Tested-by: Karl Palsson <karlp@tweak.net.au>
2015-08-17usb: Move ti usb_lm4f.c from lm4f/ to usb/Kuldeep Singh Dhaka
Management of usb code is easier if everything is at one place
2015-08-17stm32/usb: otg_fs and otg_hs register definitionsAmir Hammad
* USB host register definitions added. * Extracted common register and bitfield definitions from 'otg_fs.h' and 'otg_hs.h' into new file 'otg_common.h'. Modified usb low-level drivers to adopt to new style of bitfields. * Fixed typo OTG_GOTGIN -> OTG_GOTGINT (according to the datasheet) Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
2015-07-30stm32: usb: Rename USB_DADDR_ENABLE flag per ref manualKuldeep Singh Dhaka
Use the standard REG_BIT name from the reference manuals, as specified in HACKING All the other bits have the correct naming.
2015-07-29usb: provide typedefs for all the function callbacks.Kuldeep Singh Dhaka
This makes it easier to read for most people, and makes it substantially easier to review changes in the function signatures themselves at a later date.
2015-07-29usb: fx07: correctly REBASE for both usb cores.Karl Palsson
Regression from 0cc0134f21b387a3a813feca1973c77587900ee2 When operating on registers in code that is common for both usb cores, make sure to use the REBASE macros to operate on the correct peripheral. Reported by: kuldeep Fixes github issue: #495
2015-07-29usb: correctly document return type.Karl Palsson
The three existing usb drivers have no possible path that doesn't return the object here, so I've left that comment, but it is plausible that future drivers might have some reason that allows failing to init. We should strive to avoid that though. Fixes github issue: #494
2015-07-15usb_f103: fix typo in bad merge for SOF callback.Karl Palsson
too many pulls :|
2015-07-15usb: Only enable the SOF interrupt if user_callback_sof is given.Frantisek Burian
Otherwise we get 1 kHz of SOF interrupts even if we don't need them. Originally reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274 but BuFran provided a reworked implementation.
2015-07-15usb_f103: Clear ISR bit as soon as possible, as for the other IRQs.Frantisek Burian
Reported by Uwe in https://github.com/libopencm3/libopencm3/pull/274 but expanded and provided by BuFran finally.
2015-03-30usb: fetch endpoint 0 max size from descriptorKuldeep Singh Dhaka
Instead of hardcoding. Fixes #303 Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2015-03-30Add provisions to support multiple altsettingsAndrey Smirnov
This commit implements the support for one interface to have multiple altsettings. It also adds hook that user can use to perform actions when the alsetting switch is performed by host. Changes: * For backward compatibility, placed a pointer instead of allocating memory for whole interface struct. * Always execute callback (even if the current interface alternate-settings matches). * Multiple configuration support. Signed-off-by: Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
2014-12-29[usb] fix user_callback_set_configFelix Ruess
USB using control callbacks was broken since d6bad27735a77b8daa90ce72b843cf08ba78697d Properly check if user usb control callback are registered, while here make sure user_callback_set_config callback pointers are initialized to NULL.
2014-12-19usb: Support for class specific endpoint descriptors.Daniel Thompson
Extends struct usb_endpoint_descriptor to make it possible to provide the USB host with class-specific extensions to endpoint descriptors. The approach taken, based on extra and extralen and removing the sizeof() from USB_DT_ENDPOINT_SIZE, is identical to the approach used to add class-specific extensions to interface descriptors. All libopencm3-examples use the USB_DT_ENDPOINT_SIZE (rather than directly using sizeof) so there should be no compatibility problems resulting from this change.
2014-12-19usb: Prevent memcpy() being called with NULL argumentsDaniel Thompson
If there is no additional iface data then iface->extra is NULL and iface->extralen is zero. Passing NULL to memcpy is undefined behaviour even if the length of data to copy is zero. In other words a conforming (debug) memcpy implementation is permitted to assert(dst && src) without checking the value of n. Add an extra branch to avoid this.