1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu
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
..
arm7_common cpu/arm7_common: drop cyclic include 2022-12-13 15:55:17 +01:00
atmega32u4 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega128rfa1 cpu/atmega128rfa1/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
atmega256rfr2 cpu/atmega256rfr2/Kconfig: select default transceiver 2023-01-19 15:34:19 +01:00
atmega328p cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega1281 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega1284p cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega2560 cpu/atmega_common: implement periph/gpio_ll{,_irq} 2022-05-02 14:44:55 +02:00
atmega_common sys/flash_utils: add helpers for placing variables in flash 2023-02-27 12:31:03 +01:00
atxmega Merge pull request #18619 from maribu/core/mutex/cleanup 2022-10-03 10:58:07 +02:00
avr8_common cpu/avr8_common: Wrap stdio.h 2023-02-27 12:31:03 +01:00
cc26x0_cc13x0 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cc26x2_cc13x2 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cc26xx_cc13xx boards/common/cc26xx_cc13xx: Fix flashing with upstream OpenOCD 2023-01-10 22:39:35 +01:00
cc2538 cpu: call early_init() 2023-01-08 22:26:12 +01:00
cortexm_common cpu: Add TLS symbols for newer picolibc to linker scripts 2023-03-02 22:55:22 -08:00
efm32 cpu/efm32: pwm_init errors are zeros 2023-03-17 13:02:20 +01:00
esp32 cpu/esp32: add RMT configuration type 2023-03-29 00:47:35 +02:00
esp8266 cpu/esp_common: use generic WIFI_SSID/WIFI_PASS defines 2023-02-17 15:32:03 +01:00
esp_common cpu/esp_common: add RINGBUF_TYPE_NOSPLIT to ringbuffer 2023-03-28 18:48:55 +02:00
fe310 cpu: call early_init() 2023-01-08 22:26:12 +01:00
gd32v cpu/gd32v: fix gpio_read in periph_gpio 2023-03-24 07:40:23 +01:00
kinetis cpu: call early_init() 2023-01-08 22:26:12 +01:00
lm4f120 cpu: call early_init() 2023-01-08 22:26:12 +01:00
lpc23xx cpu: Add TLS symbols for newer picolibc to linker scripts 2023-03-02 22:55:22 -08:00
lpc1768 cpu: call early_init() 2023-01-08 22:26:12 +01:00
msp430_common cpu: call early_init() 2023-01-08 22:26:12 +01:00
msp430fxyz cpu/msp430: add Kconfig 2021-12-02 16:33:19 +01:00
native Merge #19343 #19349 #19353 #19361 #19363 2023-03-08 02:09:42 +00:00
nrf5x_common cpu/nrf5x_common: Implement timer_set() 2022-12-23 14:48:08 +01:00
nrf51 cpu: call early_init() 2023-01-08 22:26:12 +01:00
nrf52 cpu/nrf52: Add stall functions to usbdev 2023-02-28 11:00:05 +01:00
nrf9160 cpu: call early_init() 2023-01-08 22:26:12 +01:00
qn908x cpu: call early_init() 2023-01-08 22:26:12 +01:00
riscv_common Merge #19341 #19345 2023-03-04 22:00:55 +00:00
rpx0xx cpu/rpx0xx: Update vendor header files 2023-03-22 19:34:29 +01:00
sam0_common sam0/usbdev: partial revert of #17086 2023-03-13 13:49:42 +01:00
sam3 cpu: call early_init() 2023-01-08 22:26:12 +01:00
sam_common cpu/sam_common: make use of cortexm.ld 2022-09-23 15:55:12 +02:00
samd5x cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
samd21 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
saml1x cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
saml21 cpu/sam0_common: move adc_res_t to common code 2023-01-17 17:18:07 +01:00
stellaris_common
stm32 Merge #19460 2023-04-09 16:03:55 +00:00
doc.txt docs/doxygen : Add CPU section 2021-07-09 10:47:42 +02:00
Kconfig treewide: change Kconfig prefix for module symbols 2020-08-31 09:57:28 +02:00