Commit Graph

52 Commits

Author SHA1 Message Date
Karl Palsson b7ec3f0b11 tests: usb gadget0: ti: use dummy delay handlers
Not full test coverage, obviously, but at least let it compile until the
delay methods have been implemented.
2018-08-27 15:51:17 +00:00
Karl Palsson 4b3dda2968 tests: usb-gadget0: gitignore generated linker scripts 2018-08-27 15:11:32 +00:00
Karl Palsson 8cf3a20bff tests: usb gadget0: add ti lm4f120xl board
This has failing tests, and doesn't implement (yet) the delay routines,
so it won't even compile without disabling that functionality in the
core gadget0 code.  However, it passes most tests, and it demonstrates
that the changes made to the setup handling earlier haven't broken USB
on this platform.
2018-08-27 15:11:32 +00:00
Karl Palsson 42e43515c6 usb gadget0: ctrl write/read loopback tests
This is based on linux's gadget0 intel loopback tests, and also github
pr: https://github.com/libopencm3/libopencm3/pull/592

Note that this captures the currently broken control loopback issues on
dwc_otg devices.

See https://github.com/libopencm3/libopencm3/issues/873 and all linked
issues.

Current status is passing on f3, f0, and failing on f4.
2018-08-27 15:11:32 +00:00
Karl Palsson 144911a25b stm32: usb gadget0: implement loopback
The loopback functionality was never implemented, not for regular bulk
endpoints.  By adding it, and adding pairs of endpoints, we can easily
catch buffer management problems.  These tests currently fail on
st_usbfs devices.

This did require renumbering the endpoints, as dwc_otg_fs only offers
three endpoints in each direction, and they can't be arbitrary numbers,
unlike on st_usbfs.

See https://github.com/libopencm3/libopencm3/pull/880 and related tickets.
2018-08-17 00:16:13 +00:00
Karl Palsson d465291f45 tests: use the new auto depends on library
Provided in ea5d3cb7 genlink: provide LIBDEPS for libopencm3 itself
2018-08-17 00:15:01 +00:00
Karl Palsson 72e1ffdc72 usb-gadget0: stm32f3: drop debug, be more consistent
Don't spew loop prints, be more like all the other targets.
2018-07-29 20:31:17 +00:00
Karl Palsson 64e26832c7 tests: makefiles need to handle linker script generators too
Without this you get errors about not finding the linker script (because
it will be generated) and linker errors due to bare -l flags.
2018-07-03 22:23:00 +00:00
Karl Palsson ea6a5a7efd tests: rules.mk: avoid non-posix brace expansion
Brace expansion is not posix defined, even if it's widely available.
Avoid it's use for portability.
2018-06-08 10:02:42 +00:00
Karl Palsson dc64929b78 tests: gadget0: add stm32f3-disco
Another readily available board with a user USB port, and this one lets
you test the st usbfs peripheral on a device with trace facilities.
2018-05-01 22:23:47 +00:00
Karl Palsson b25a1ae0eb gadget0: work around "ValueError: The device has no langid"
pyusb quirk.
2018-05-01 22:23:47 +00:00
Karl Palsson 0a07355520 gadget0: stm32l1: target the "hw1" test board explicitly
There's still no commonly available l1 with usb from ST, so target our
own developed test host board instead of one developer's private board.
2018-04-14 18:40:54 +00:00
Karl Palsson cbef4a15e4 tests: gadget0: use proper usb enums 2018-03-02 22:42:05 +00:00
Sebastian Holzapfel d79674db09 tests: gadget0: efm32hg: add gadget0 test for efm32hg 2018-03-02 22:42:05 +00:00
Karl Palsson 5cb852efde travis: build gadget-zero tests as well
This helps catch some perhaps unintended api changes
2018-03-02 22:42:04 +00:00
Karl Palsson f71798b360 tests: gadget0: stm32l1: fix wait state declaration
Fixes: ec1d2855b stm32l1: rcc: use better naming for flash wait states
2018-02-24 12:46:08 +00:00
Karl Palsson 8f892a8e81 tests: gadget0: include sample udev rules and document 2017-10-02 21:46:38 +00:00
Amitesh Singh 821f4a49ea tests: gadget0: stm32f1 hack should be consistent
D+ is PA12 not PA11.  The reason this worked before, is because the line
before made PA12 output, and without setting the GPIO_ODR register
_before_ hand, this meant as soon as it was switched to output, it
received the reset value of GPIO_ODR for PA12, ie, 0.  (Effectively
doing a "free" gpio_clear(GPIOA, GPIO12)

Because GPIO11 wasn't configured to be an output, the confusing
gpio_clear(GPIOA, GPIO11) was simply configuring the pullup/down value
of the input, which was still ignored, as it was (out of reset) in input
floating mode.

Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2017-09-01 21:55:32 +00:00
Mike Naberezny 6cfbc5ac6a Remove unused Python variables 2017-06-24 12:37:27 +00:00
Mike Naberezny 860d10940b Remove unused Python imports 2017-06-23 14:42:59 +00:00
Karl Palsson d97c1b0435 tests: gadget0: delay between calls to trigger races
Attempt to be more brutal by delaying more often, instead of always
promptly servicing the usb stack.

This is implemented via using timer6 to do a known number of
microseconds busy delay, and so only works on platforms that have
reached at least core timer functionality, and provide the
rcc_apb1_frequency variable.

NOTE! This will _fail_ on devices using the st_usbfs drivers at present,
but the code _should_ work, and the tests land to verify that the
library fix, fixes the problem. (see subsequent commit)
2017-06-08 23:01:45 +00:00
Karl Palsson e652121931 tests: gadget0: stm32l0: use new clock helpers.
Doesn't actually change the test results, but gets more coverage from
the same test case.
2017-06-08 23:01:45 +00:00
Karl Palsson f594ddb395 tests: gadget-zero: run against all attached targets
Less command line arguments, more automatic "do what I mean"
2017-06-08 23:01:45 +00:00
Karl Palsson a0a7f77d4c tests: connect to existing openocd if running
Connect to an existing and pass the correct path name.
2017-05-06 12:50:49 +00:00
Karl Palsson 16f3042fa8 tests: gadget0: allow specifying DUT on CLI
Easier than editing the file each time.
2017-03-30 21:48:07 +00:00
Jochen Hoenicke 56bb7c295a tests: gadget0: clean-up
Drop unnecessary ; in python
2017-03-30 21:48:07 +00:00
Jochen Hoenicke afb66508a4 tests: gadget0: remove magic constants 2017-03-30 21:48:07 +00:00
Karl Palsson c9c5cb7c9c style: fix some of the easier style bugs
No real changes.
2017-03-30 21:48:07 +00:00
fenugrec c3512f4de5 tests: gadget0: test for unaligned buffer read/writes.
This currently fails on stm32F072, which is expected but not normal.
See GH issues #401 , #461
2016-10-01 15:46:33 +00:00
Karl Palsson c585336766 tests: gadget0: pull up endpoint size constant 2016-10-01 15:15:36 +00:00
Karl Palsson cdd2054fe4 tests: update gadget zero readme docs for actually running
Fixes Github issue #652
2016-08-18 23:34:35 +00:00
Karl Palsson ba9cb7dc5d minor stylecheck cleanups 2016-02-29 21:30:31 +00:00
Karl Palsson 84dec14d60 tests: extract serials to optional local config
Instead of having committed files containing a single developer's serials, use
optional includes to include a local config file for each board.

If you have only a single board connected, simply:

$ make -f Makefile.<board> clean all flash

If you have multiple boards connected, make sure to fill in the appropriate
hla_serial in your openocd.<board>.local.cfg file, and then run the same
commands.
2016-02-28 17:47:28 +00:00
Karl Palsson 63fda0a231 tests: gadget0: config should be 0 in addressed state 2016-01-27 00:13:05 +00:00
Karl Palsson 8225089cc9 tests: show expected, actual _and_ custom messages
See
https://docs.python.org/2/library/unittest.html#unittest.TestCase.longMessage

Allows showing the 42 != 69 : custom message instead of _only_ showing the
custom message if one was specified.
2016-01-27 00:13:05 +00:00
Karl Palsson e6f6122965 tests: trivial: drop redundant ; 2016-01-27 00:12:59 +00:00
Oliver Meier 5996ac606b tests: usb gadget0: Add stm32f429i-disco support
The F429i board has the user USB OTG port connected to the HS capable
OTG core, rather than the FS OTG core.  It is still only operating in FS
mode, as you need a ULPI phy to use HS mode.
2016-01-05 18:11:59 +00:00
Karl Palsson b81588da74 tests: gadget0: Update for namespace cleanups
Fixes: 3a7cbec776
2016-01-05 18:00:00 +00:00
Piotr Esden-Tempski b1049f9a6f [Style] Stylefix sweep over the whole codebase. 2015-12-14 22:57:15 +01:00
Karl Palsson 27b826bc4a tests: Allow user override of C/CXX/CPP/LD flags
As recently added to the library, allow the tests to be compiled with user
overridable flags too
2015-10-11 19:15:06 +00:00
Karl Palsson 3ed12b6fd9 usb: short control IN might need a ZLP
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-11 18:43:11 +00:00
Karl Palsson 4b54b35582 tests:gadget0: stm32l0: drop RCC test code
Don't commit commented out code! bad!
2015-10-06 01:06:30 +00:00
Karl Palsson 52dc61403d tests: gadget0: use proper usb enumerations
Eliminate warnings.  carry over from developing in a different tree.
2015-10-06 01:05:36 +00:00
Karl Palsson e7ea622037 tests: gadget0: Add stm32l053 disco support
Much more complicated clock setup, but tests all pass once you get past that
step.
2015-10-06 00:54:53 +00:00
Karl Palsson c097343634 tests: gadget0: F0: drop unnecessary code.
* Only the L1 needed to include flash settings
* whitespace and comment cleanup
* drop redundant clock setting calls
2015-10-04 00:28:16 +00:00
Karl Palsson f5eb96caf3 usb: Add st_usbfs_v2 for f0/l0 devices
Based on previous work, add a new driver for the v2 usb peripheral found on
stm32f0 and l0 devices.

Correspondingly, add a usb gadget zero test suite for the f0.  L0 device level
code isn't yet ready, but will add the test case when it moves in.

Work by Frantisek Burian, Kuldeep
Singh Dhaka, Robin Kreis, fenugrec and zyp on irc, and all those forgotten.
2015-10-03 02:03:58 +00:00
Karl Palsson e121243ce2 usb: extract ST USB FS peripheral core. [BREAKING CHANGE]
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-10-03 01:32:34 +00:00
Karl Palsson 1480c6ee4b tests: gadget0: add stm32l1 target
As with F103 generic, there's no readily available L1 board with USB device
A custom LED is used to track boot process, but otherwise this should be
portable to any L1 board, except for the openocd configuration file.

Tests pass straight away, which is good, as it uses the existing f103 usb
driver.
2015-10-03 01:29:49 +00:00
Karl Palsson 58d5de26f3 tests: gadget0: add stm32f103 target
There's no F1 discovery style board with usb device, so this is for a "generic"
device.  The USB portion should be safe, but there's a led used for bootup that
is board specific, and of course the clock source is board specific.

Related, the openocd config file is rather custom to my own setup, but shows
what you need to customize for your test environment.

Further, as the F1 usb core doesn't include support for soft disconnect, use
the very hacky method of dragging the pin low to force reenumeration on reset.
Very very useful for development purposes!
2015-10-03 01:18:17 +00:00
Karl Palsson 39c29b8fdf tests: rules.mk: kill rcs/sccs support
If you can read this, you're not using a version control system affected by
this change ;)

Before: make -d | wc -l ==> 992
After:  make -d | wc -l ==> 452
2015-10-03 00:59:26 +00:00