1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

43197 Commits

Author SHA1 Message Date
Gunar Schorcht
ee83893496 drivers/periph_usbdev: TXFE not used any longer
After changing IN EPs also to use XFRC (Transfer Complete) interrupts in non-DMA mode, the TXFE (TX FIFO Empty) interrupt is no longer needed to signal the completion of an IN transfer.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
ea776c92b6 drivers/usbdev_synopsys_dwc2: handle RXFLVL interruprs in ISR
Since RXFLVL (RX FIFO Level) interrupt doen't complete transfers anymore, they are handled now directly in the ISR.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
d15f0f3a7b drivers/usbdev_synopsys_dwc2: use XFRC for OUT EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for OUT EPs in non-DMA mode. RXFLVL (RX FIFO Level) interrupts are no longer used to signal completed transfers, but only to copy data from FIFO to memory and to set a flag indicating that a SETUP stage is in progress. STUP (SETUP phase done) interrupts are then used to signal a completed SETUP stage and to reset the flags that indicates the SETUP stage. The flag that indicates the SETUP stage in progress is used to ignore additional XFRC interrupts for EP0 during the SETUP stage.
2023-04-16 23:24:23 +02:00
Gunar Schorcht
1ccafe1621 drivers/usbdev_synopsys_dwc2: use XFRC for IN EPs in non-DMA mode
XFRC (Transfer Complete) interrupts are now also used for IN EPs in non-DMA mode. TXFE (TX FIFO Empty) interrupts are not necessarily needed but are still enabled.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
1a37d3b9e0 drivers/usbdev_synopsys_dwc2: several cleanups 2023-04-16 22:59:11 +02:00
Gunar Schorcht
e3fb4e7cfb drivers/usbdev_synopsys_dwc2: add OTG interrupt handling 2023-04-16 22:59:11 +02:00
Gunar Schorcht
1d7224602d drivers/usbdev_synopsys_dwc2: print CID/HW debug info 2023-04-16 22:59:11 +02:00
Gunar Schorcht
ff9e9e3a7c drivers/usbdev_synopsys_dwc2: fix power modes for STM32 2023-04-16 22:59:11 +02:00
Gunar Schorcht
d35fa914c8 drivers/usbdev_synopsys_dwc2: fix a typo 2023-04-16 22:59:11 +02:00
Gunar Schorcht
98b6d75c14 drivers/usbdev_synopsys_dwc2: improve FIFO allocation doc 2023-04-16 22:59:11 +02:00
Gunar Schorcht
5b93c18414 cpu/stm32: clarify units in USB FIFO size definitions
Since the USB OTG FIFO sizes are partly defined in 32-bit words and partly in bytes, the documentation of the of the USB OTG FIFO size definitions is extended by the respective unit.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
9f894bc1ac cpu/efm32: clarify units in USB FIFO size definitions
Since the USB OTG FIFO sizes are partly defined in 32-bit words and partly in bytes, the documentation of the of the USB OTG FIFO size definitions is extended by the respective unit.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
0c9eb535eb cpu/esp32: clarify units in USB FIFO size definitions
Since the USB OTG FIFO sizes are partly defined in 32-bit words and partly in bytes, the documentation of the of the USB OTG FIFO size definitions is extended by the respective unit.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
9e8ef51283 drivers/usbdev_synopsys_dwc2: add thread context switch at ISR exit
The USB device driver ISR sets a thread flag of the waiting USBUS thread to indicate that it has to handle a USB device driver event. However, setting a thread flag only sets `sched_context_switch_request` to indicate that a thread context switch would be required, but it is not executed. Therefore, for STM32 MCUs, `cortexm_isr_end` was called to execute the context switch. Since the driver is also used by other platforms, this call is replaced by a direct call of `thread_yield_higher` if required. NOTE: For ESP32x SoC, such a thread context switch is implicitly executed at the end of each ISR if necessary.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
9528733a99 cpu/efm32: remove USB OTG HS definitions in vendor definitions
EFM32 MCUs do not support USB OTG HS mode. The according definitions are therefore removed from vendor definitions.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
457c0cffc3 cpu/esp32: remove USB OTG HS definitions in vendor definitions
ESP32 MCUs do not support USB OTG HS mode. The according definitions are therefore removed from vendor definitions.
2023-04-16 22:59:11 +02:00
Gunar Schorcht
8999a5083f drivers/usbdev_synopsys_dwc2: remove USB OTG HS definition dependencies
If the MCU/board has only an USB OTG FS peripheral or only an USB OTG HS peripheral, it should only need to specify the USB OTG FS definitions such as the number of EPs or the FIFO sizes or only the USB OTG HS definitions. This commit cleans up the code so that it is translatable without the respective definitions.
2023-04-16 22:59:11 +02:00
bors[bot]
1961274705
Merge #19471
19471: drivers/periph_usbdev: fix set device address r=bergzand a=gschorcht

### Contribution description

This PR allows to define when the device address is set on receipt of a SETUP with `SET ADDRESS Request`. It fixes the problem with enumeration of the Synopsys DWC2 USB OTG Core due to the wrong time of setting the device address.

Especially, it fixes the problem that the enumeration fails completely for the `stm32f723e-disco` board with CDC ECM if CDC ACM is not used and the additional reset cycles during the enumeration for a couple of platforms such as ESP32-S2 and ESP32-S3.

**Background**

The address in the USB device can be set either directly after the SETUP stage on receipt of the `SET ADDRESS Request` or after the associated STATUS stage. When the USB device address has to be set depends on the hardware implementation.
**Solution**

To control the time of setting the device address, a new define `USBDEV_SET_ADDR_AFTER_STATUS` is introduced.
If `USBDEV_SET_ADDR_AFTER_STATUS` has the value 1 (default), the address is set in the USB device after the STATUS stage. Since this is the default, existing `periph_usbdev` drivers shouldn't be affected. Overwriting `USBDEV_SET_ADDR_AFTER_STATUS`  with 0 in `periph_cpu.h` or in driver header file let the address set directly after the SETUP stage.

### Testing procedure

Use `tests/usbus_cdc_ecm`:

For `stm32f723e-disco` the enumeration doesn't work at all without this PR and works reliable with this PR.
```
USEMODULE='periph_usbdev_hs_utmi' BOARD=stm32f723e-disco make -C tests/usbus_cdc_ecm flash
```
For any ESP32-S2 or ESP32-S3 board, the enumeration requires an addition reset cycle in every third or fourth enumeration without this PR and doesn't require any reset cycle with this PR.
```
BOARD=esp32s2-devkit make -C tests/usbus_cdc_ecm flash
```
Other platforms should still work with this PR, for example ATSAM platform:
```
BOARD=arduino-mkr1000 make -C tests/usbus_cdc_ecm flash
```

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-04-16 15:33:53 +00:00
Gunar Schorcht
88cabbae64 drivers/usbdev_synopsys_dwc2: set USBDEV_SET_ADDR_AFTER_STATUS
DWC2 core requires that the device address has to be set directly after SETUP stage and not after the associated STATUS stage.
2023-04-16 17:14:08 +02:00
Gunar Schorcht
e46fa4a0b2 sys/usbus: use USBDEV_SET_ADDR_AFTER_STATUS
Use symbol `USBDEV_SET_ADDR_AFTER_STATUS` to determine whether the device address has to be set directly after SETUP stage or after the associated STATUS stage.
2023-04-16 17:14:08 +02:00
Gunar Schorcht
d675cd7290 drivers/periph_usbdev: define USBDEV_SET_ADDR_AFTER_STATUS
The address in the USB device can be set either directly after the SETUP stage on receipt of the `SET ADDRESS Request` or after the associated status stage. When the USB device address has to be set depends on the hardware. If `USBDEV_SET_ADDR_AFTER_STATUS` has the value 1 (default), the address is only set in the USB device after the status stage. Overwrite it with 0 in `periph_cpu.h` to set the address already directly after the SETUP stage.
2023-04-16 17:14:08 +02:00
bors[bot]
5a523ee894
Merge #19467
19467: drivers/at86rf2xx: fix default page being ignored r=maribu a=jia200x



Co-authored-by: Jose Alamos <jose@alamos.cc>
2023-04-13 16:26:35 +00:00
bors[bot]
acd02f1f9c
Merge #19466
19466: sys/shell: fix missing generic lora settings in ifconfig r=aabadie a=aabadie



Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
2023-04-13 12:16:03 +00:00
Jose Alamos
268487097b
drivers/at86rf2xx: fix default page 2023-04-13 11:10:54 +02:00
f50be77e05
tests/Makefile.boards.netif: add lora-e5-dev 2023-04-13 10:55:24 +02:00
a5699d0d5d
tests/Makefile.boards.netif: add nucleo-wl55jc 2023-04-13 10:55:24 +02:00
d733314ebe
sys/shell: fix missing generic lora settings in ifconfig 2023-04-13 10:55:23 +02:00
4ccbe0dbac
drivers/sx126x: add missing lora module dependency 2023-04-13 10:55:23 +02:00
bors[bot]
99b13cbb1b
Merge #19432 #19461
19432: boards/esp32: deduplication in common ESP32x board definitions r=benpicco a=gschorcht

### Contribution description

The PR reduced code duplication in `boards/common/esp32*`.

The PR moves the header files from `boards/common/esp32s3/include` that can be used for all types of ESP32x SoCs to a new common ESP32x board definition which is then included by all common ESP32x board definitions.

### Testing procedure

Green CI.

### Issues/PRs references


19461: drivers/enc28j60: fix ISR routine and bth r=benpicco a=peteut



Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
Co-authored-by: Alain Péteut <alain.peteut@yahoo.com>
2023-04-12 14:06:06 +00:00
bors[bot]
b342cdc4d4
Merge #19443
19443: drivers: add support for MTDs emulated in RAM r=dylad a=gschorcht

### Contribution description

This PR adds a driver to provide MTDs that are emulated in RAM. It allows to test MTD-based applications on boards that do not provide MTDs by hardware.

It includes also some small documentation fixes for `mtd.h` that were found while writing the driver.

### Testing procedure

The following tests should work on any board:

`tests/pkg_littlefs`
`tests/pkg_littlefs2`
`tests/pkg_spiffs`

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-04-12 09:57:18 +00:00
Gunar Schorcht
89f18c7821 tests/littlefs: remove blacklisted boards due to reduced sector count
Removing boards blacklisted for insufficient memory after reducing the number of sectors of the emulated MTD.
2023-04-12 11:37:24 +02:00
Gunar Schorcht
4af1fa6a3d tests/littlefs: reduce sector count for emulated MTD
A `SECTOR_COUNT` of 12 seems to be sufficient to work for this test in emulated MTD.
2023-04-12 11:23:58 +02:00
Gunar Schorcht
1d4d3e47b8 drivers/mtd_default: expose one SD Card and one MTD emulated 2023-04-12 06:27:12 +02:00
Gunar Schorcht
4bb283cb4b tests/usbus_msc: use emulated MTD as test mockup 2023-04-12 06:27:12 +02:00
Gunar Schorcht
631df7c69c tests/spiffs: use emulated MTD as test mockup 2023-04-12 06:27:12 +02:00
Gunar Schorcht
f724f34ac2 tests/littlefs2: use emulated MTD as test mockup 2023-04-12 06:27:12 +02:00
Gunar Schorcht
af5b75a9a1 tests/littlefs: use emulated MTD as test mockup 2023-04-12 06:27:12 +02:00
Gunar Schorcht
0cdcac96bc tests/unittests/test-mtd: use emulated MTD as test mockup 2023-04-12 06:27:12 +02:00
bors[bot]
10e4d5047c
Merge #19459
19459: drivers/usbus_synopsys_dwc2: fix interrupt handling in DMA mode r=dylad a=gschorcht

### Contribution description

This PR fixes the interrupt handling for IN endpoints in DMA mode.

In DMA mode, both the `XFRC` (Transfer Complete) interrupt and the `TXFE` (TX FIFO Empty) interrupt for IN EP1 ... EPn were used to generate the `USBDEV_EVENT_TR_COMPLETE`. This led to problems with USBUS MSC. With this fix, the `TXFE` interrupt is used only in non-DMA mode or only for IN EP0 in DMA mode while the `XFRC` (Transfer Complete) is used only in DMA mode for IN EP1 ... EPn.

### Testing procedure

This PR should work together with PR #19458 for SD Card interface for a board with USB HS port, for example:
```
USEMODULE='sdcard_spi mtd_sdcard_default periph_usbdev_hs_ulpi' \
CFLAGS='-DSDCARD_SPI_PARAM_CLK=GPIO_PIN\(PORT_I,1\) -DSDCARD_SPI_PARAM_MISO=GPIO_PIN\(PORT_B,14\) -DSDCARD_SPI_PARAM_MOSI=GPIO_PIN\(PORT_B,15\) -DSDCARD_SPI_PARAM_CS=GPIO_PIN\(PORT_A,8\)' \
BOARD=stm32f746g-disco make -j8 -C tests/usbus_msc flash
```
It should still work for CDC ECM for such a board:
```
USEMODULE='periph_usbdev_hs_ulpi stdio_cdc_acm' BOARD=stm32f746g-disco make -j8 -C tests/usbus_cdc_ecm flash
```

### Issues/PRs references


Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2023-04-11 19:30:24 +00:00
Gunar Schorcht
609c090ceb drivers/mtd_emulatd: MTD emulated in RAM for testing
This driver provides support for MTDs emulated in RAM to test MTD-based applications on boards that do not provide MTDs in hardware.
2023-04-11 17:42:10 +02:00
Gunar Schorcht
756197316d drivers/mtd: small fixes in doc 2023-04-11 17:42:10 +02:00
Alain Péteut
226b8cff52 drivers/enc28j60: fix PKTIF issue.
The PKTIF does not reliably report the status of pending packags.
Apply the proposed workaround [1].

[1] https://ww1.microchip.com/downloads/aemDocuments/documents/OTH/ProductDocuments/Errata/80349c.pdf
2023-04-11 12:23:18 +02:00
bors[bot]
4b9ed26839
Merge #17090
17090: usbus: Add support for endpoint halt condition r=gschorcht a=bergzand

### Contribution description

This PR adds support for the endpoint halt condition on the USBUS side.

Instead of directly stalling an endpoint, handlers should enable the
halt condition on an usbus endpoint to signal error condition.
This can then be cleared via a CLEAR FEATURE request from the host.

This PR also extends support for the GET STATUS requests to support endpoints
and interfaces as recipient. It also adds the SET and CLEAR FEATURE
requests for the endpoints with support to set and clear the halt
condition on an endpoint.

### Testing procedure

The feature can be shown when adding the following patch to the CDC_ECM code:

```Patch
diff --git a/sys/usb/usbus/cdc/ecm/cdc_ecm.c b/sys/usb/usbus/cdc/ecm/cdc_ecm.c
index f580209e03..3d87a67087 100644
--- a/sys/usb/usbus/cdc/ecm/cdc_ecm.c
+++ b/sys/usb/usbus/cdc/ecm/cdc_ecm.c
`@@` -31,7 +31,7 `@@`
 
 #include <string.h>
 
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
 #include "debug.h"
 
 static void _event_handler(usbus_t *usbus, usbus_handler_t *handler,
`@@` -335,7 +335,12 `@@` static void _transfer_handler(usbus_t *usbus, usbus_handler_t *handler,
         size_t len = 0;
         usbdev_ep_get(ep, USBOPT_EP_AVAILABLE, &len, sizeof(size_t));
         _store_frame_chunk(cdcecm);
-        if (len == USBUS_CDCECM_EP_DATA_SIZE) {
+        DEBUG("Length: %u\n", cdcecm->len);
+        if (cdcecm->len > 1000) {
+            usbus_endpoint_halt(cdcecm->ep_out);
+            _handle_rx_flush(cdcecm);
+        }
+        else if (len == USBUS_CDCECM_EP_DATA_SIZE) {
             usbdev_ep_ready(ep, 0);
         }
     }
diff --git a/sys/usb/usbus/usbus.c b/sys/usb/usbus/usbus.c
index 826966c929..1bed707e2d 100644
--- a/sys/usb/usbus/usbus.c
+++ b/sys/usb/usbus/usbus.c
`@@` -40,7 +40,7 `@@`
 #include <string.h>
 #include <errno.h>
 
-#define ENABLE_DEBUG             0
+#define ENABLE_DEBUG             1
 #include "debug.h"
 
 #define _USBUS_MSG_QUEUE_SIZE    (16)
```

With this patch, the CDC ECM code will trigger the halt condition after receiving more than 1000 bytes for a single network packet. For example with a `ping 2001:db8::2 -s 1200` (assuming `2001:db8::2` is the RIOT device).
On a nRF52840dk this looks like the following:

<details><summary>nRF52840dk</summary>

```
2021-10-31 21:24:26,271 # usbus: starting thread 3
2021-10-31 21:24:26,275 # usbus: Adding string descriptor number 1 for: "USB config"
2021-10-31 21:24:26,281 # usbus: Adding string descriptor number 2 for: "USB device"
2021-10-31 21:24:26,286 # usbus: Adding string descriptor number 3 for: "RIOT-os.org"
2021-10-31 21:24:26,292 # usbus: Adding string descriptor number 4 for: "AC1B17D1BE432280"
2021-10-31 21:24:26,294 # CDC ECM: initialization
2021-10-31 21:24:26,299 # usbus: Adding string descriptor number 5 for: "AAEC5F69468B"
2021-10-31 21:24:26,305 # NETOPT_RX_END_IRQ not implemented byusbus: USB suspend detected
2021-10-31 21:24:26,312 # main(): This is RIOT! (Version: 2022.01-devel-281-g7da001-pr/usbus/halt_endpoint)
2021-10-31 21:24:26,316 # Test application for the USBUS CDC ECM interface
2021-10-31 21:24:26,317 # 
2021-10-31 21:24:26,321 # This test pulls in parts of the GNRC network stack, use the
2021-10-31 21:24:26,327 # provided shell commands (i.e. ifconfig, ping6) to interact with
2021-10-31 21:24:26,330 # the CDC ECM based network interface.
2021-10-31 21:24:26,330 # 
2021-10-31 21:24:26,332 # Starting the shell now...
> 2021-10-31 21:24:26,481 # CDC ECM: Reset
2021-10-31 21:24:26,545 # CDC ECM: Reset
2021-10-31 21:24:26,631 # CDC ECM: Request: 0xb
2021-10-31 21:24:26,635 # CDC ECM: Changing active interface to alt 1
2021-10-31 21:24:26,638 # CDC ECM: sending link up indication
2021-10-31 21:24:26,645 # CDC ECM: Request: 0x43
2021-10-31 21:24:26,649 # CDC ECM: Not modifying filter to 0xc
2021-10-31 21:24:29,889 # CDC ECM: Request: 0x43
2021-10-31 21:24:29,893 # CDC ECM: Not modifying filter to 0xc
2021-10-31 21:24:29,901 # CDC ECM: Request: 0x43
2021-10-31 21:24:29,904 # CDC ECM: Not modifying filter to 0xe
2021-10-31 21:24:29,907 # CDC ECM: sending link speed indication
> ifconfig 4 add 2001:db8::2/64
2021-10-31 21:24:35,296 # ifconfig 4 add 2001:db8::2/64
2021-10-31 21:24:35,300 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:24:35,305 # success: added 2001:db8::2/64 to interface 4
2021-10-31 21:24:35,307 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:24:51,075 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:24:51,078 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:25:06,851 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:25:06,855 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:25:13,271 # CDC ECM: Request: 0x43
2021-10-31 21:25:13,274 # CDC ECM: Not modifying filter to 0xe
2021-10-31 21:25:13,275 # Length: 64
2021-10-31 21:25:13,276 # Length: 90
2021-10-31 21:25:13,521 # Length: 64
2021-10-31 21:25:13,522 # Length: 86
2021-10-31 21:25:13,569 # Length: 64
2021-10-31 21:25:13,570 # Length: 90
2021-10-31 21:25:14,927 # Length: 64
2021-10-31 21:25:14,927 # Length: 86
2021-10-31 21:25:14,931 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:25:14,935 # CDC_ECM: Handling TX xmit from netdev
2021-10-31 21:25:14,936 # Length: 64
2021-10-31 21:25:14,937 # Length: 128
2021-10-31 21:25:14,938 # Length: 192
2021-10-31 21:25:14,939 # Length: 256
2021-10-31 21:25:14,940 # Length: 320
2021-10-31 21:25:14,941 # Length: 384
2021-10-31 21:25:14,942 # Length: 448
2021-10-31 21:25:14,943 # Length: 512
2021-10-31 21:25:14,945 # Length: 576
2021-10-31 21:25:14,946 # Length: 640
2021-10-31 21:25:14,947 # Length: 704
2021-10-31 21:25:14,948 # Length: 768
2021-10-31 21:25:14,949 # Length: 832
2021-10-31 21:25:14,950 # Length: 896
2021-10-31 21:25:14,951 # Length: 960
2021-10-31 21:25:14,952 # Length: 1024
2021-10-31 21:25:14,954 # Endpoint 1 halted
2021-10-31 21:25:14,955 # Length: 64
2021-10-31 21:25:14,956 # Endpoint 1 unhalted
2021-10-31 21:25:15,961 # Length: 128
2021-10-31 21:25:15,962 # Length: 192
2021-10-31 21:25:15,963 # Length: 256
2021-10-31 21:25:15,964 # Length: 320
2021-10-31 21:25:15,966 # Length: 384
2021-10-31 21:25:15,967 # Length: 448
2021-10-31 21:25:15,968 # Length: 512
2021-10-31 21:25:15,969 # Length: 576
2021-10-31 21:25:15,970 # Length: 640
2021-10-31 21:25:15,971 # Length: 704
2021-10-31 21:25:15,972 # Length: 768
2021-10-31 21:25:15,973 # Length: 832
2021-10-31 21:25:15,974 # Length: 896
2021-10-31 21:25:15,975 # Length: 960
2021-10-31 21:25:15,977 # Length: 1024
2021-10-31 21:25:15,978 # Endpoint 1 halted
2021-10-31 21:25:15,979 # Length: 64
2021-10-31 21:25:15,981 # Endpoint 1 unhalted
```

</details>

Of interest in that excerpt are the two "Endpoint 1 halted" and "Endpoint 1 unhalted".

In Wireshark, dumping the USB traffic, this looks like:

![image](https://user-images.githubusercontent.com/5160052/139600179-df34d8a2-80b5-4485-a6f6-f3615090126f.png)

With the CLEAR FEATURE request visible to clear the stall condition on the endpoint

After the stall condition traffic to the device continues again normally without requiring a restart of the device or the USB connection.


### Issues/PRs references

Needs #17086 

Co-authored-by: Koen Zandberg <koen@bergzand.net>
2023-04-11 10:14:43 +00:00
7b2db7bf2b
usbus: Implement GET STATUS and SET/CLEAR FEATURE requests
This extends support for the GET STATUS requests to support endpoints
and interfaces as recipient. It also adds the SET and CLEAR FEATURE
requests for the endpoints with support to set and clear the halt
condition on an endpoint.
2023-04-11 11:12:53 +02:00
13b4f8de2c
usbus: Implement endpoint halt condition.
Instead of directly stalling an endpoint, handlers should enable the
halt condition on an usbus endpoint to signal error condition.
This can then be cleared via a CLEAR FEATURE request from the host.
2023-04-11 11:12:49 +02:00
bors[bot]
bbc5fc912e
Merge #19448
19448: dist/tools: Use `/usr/bin/env` to lookup Python. r=maribu a=peteut



Co-authored-by: Alain Péteut <alain.peteut@yahoo.com>
2023-04-11 05:21:52 +00:00
Alain Péteut
200c49dead drivers/enc28j60: do not block in ISR ctx. 2023-04-10 14:41:21 +02:00
Alain Péteut
25df307ea1 dist/tools: Use /usr/bin/env to lookup Python.
Fixes some Python scripts which didn't use `/usr/bin/env`.
2023-04-10 14:39:42 +02:00
bors[bot]
6f0ac0c092
Merge #19460
19460: cpu/stm32/usbdev_fs: fix ep registration and EP_REG assignments r=gschorcht a=dylad

### Contribution description
This PR provides two fixes for the `usbdev_fs` driver:

- Fix endpoints registration
- Fix assignment of toggleable bits in EP_REG(x) registers

These bugs were encountered with the USBUS MSC implementation.

Regarding the endpoints registration:

For the `usbdev_fs` peripheral, IN and OUT endpoints of the same index must have the same type.
For instance, if EP1 OUT is a bulk endpoint, EP1 IN must either be unused or used as bulk too but it cannot be used as interrupt or isochronous.
With the previous check, the following registration pattern (EP OUT Bulk -> EP IN Interrupt -> EP IN Bulk) would assign both EP OUT Bulk and EP IN Interrupt to same endpoint index. So the configuration would be broken.
Applying the same registration pattern with this patch would now produce EP OUT Bulk -> 1 / EP IN Interrupt -> 2 / EP IN Bulk 1. Which is a working configuration for this IP.

and for the second fix:

EP_REG(x) registers have a total of 6 toggleable bits. Those bits can only be toggled if we write a one to it, otherwise writing a zero has no effect
This commit fixes all the access to these registers to prevent from modifying these bits when not needed.
Without this patch, the endpoint status (VALID / NACK / STALL) can be erroneously modify because bits are not cleared when assigning the new content to the register and thus make the bits toggle and change values.

### Testing procedure
This can be tested with tests/usbus_msc on any board using this `usbdev_fs` driver.
It is easier to test this PR with #19443 alongside. Then the following would be enough:
`CFLAGS='-DSECTOR_COUNT=64' USEMODULE='mtd_emulated' make -j8 BOARD=p-nucleo-wb55 -C tests/usbus_msc flash`

Otherwise this can also be tested by attaching a SPI<->SDCARD adapter.

### Issues/PRs references
None.

Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2023-04-09 16:03:55 +00:00
bors[bot]
64201cdb57
Merge #19454
19454: cpu/stm32/periph_gpio_ll: Fix misleading comments r=gschorcht a=maribu

### Contribution description

The comments still claim STM32F1 support is missing, but this was recently added.

Also, drop an empty line to fix `too many consecutive empty lines` nitpick of the CI.

### Testing procedure

This since only changes comments, this won't effect the binaries. Technically, those comments would be Doxygen compatible comments. But as only Doxygen comments in headers are parsed, these are in practice regular plain comments.

### Issues/PRs references

https://github.com/RIOT-OS/RIOT/pull/19407 added basic GPIO LL support for STM32F1, https://github.com/RIOT-OS/RIOT/pull/19412 added the IRQ support on top of that.

Co-authored-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
2023-04-09 15:40:23 +00:00