arch/arm/src/stm32h7/stm32_dma.c:
* Include <inttypes.h> explicitly for format specifiers.
* In functions stm32_mdma_capable(), stm32_mdma_dump(),
stm32_sdma_setup(), stm32_sdma_capable(), stm32_sdma_dump(),
stm32_bdma_setup(), stm32_bdma_capable(), stm32_bdma_dump(),
stm32_dmamux_dump(), stm32_dmachannel(), stm32_dmafree(), and
stm32_dmadump():
Where appropriate, use format specifiers from <inttypes.h> in
calls to dmainfo(). This removes numerous compiler warnings
like:
warning: format '%x' expects argument of type 'unsigned int',
but argument 3 has type 'uint32_t {aka long unsigned int}'
[-Wformat=]
* In function stm32_mdma_disable():
Remove wrong redefinition of 'dmachan' parameter as a local
variable. This fixes the following compiler error that occurs
when building with CONFIG_STM32H7_MDMA:
chip/stm32_dma.c:930:17: error: 'dmachan' redeclared as
different kind of symbol
DMA_CHANNEL dmachan = (DMA_CHANNEL)handle;
^~~~~~~
chip/stm32_dma.c:928:44: note: previous definition of 'dmachan'
was here
static void stm32_mdma_disable(DMA_CHANNEL dmachan)
^~~~~~~
chip/stm32_dma.c:930:43: error: 'handle' undeclared (first use
in this function); did you mean 'random'?
DMA_CHANNEL dmachan = (DMA_CHANNEL)handle;
^~~~~~
random
For example Windows RNDIS driver issues SETUP requests that are 76 bytes
long. Previously NuttX would read them all, but only if they arrive at
the same time. If host transfer scheduling causes a pause between the
two DATA packets, stm32_ep0out_receive() would proceed with an incomplete
transfer. The rest of the data could either be skipped by the error handler
branch, or be left in NAK state forever, stopping any further communication
on the endpoint.
This commit changes it so that the whole transfer has to be received before
SETUP handler is called. Depending on CONFIG_USBDEV_SETUP_MAXDATASIZE any
excess bytes will be discarded, but doing this in a controlled way ensures
deterministic behavior. In the specific case of RNDIS, the trailing bytes
are unused padding bytes and can be safely discarded.
Gracefully handle output queue full conditions. This shouldn't happen
in practice as the host is supposed to limit the number of commands
simultaneously in execution.
Reset the response queue on RNDIS_RESET_MSG. This way communication
can recover even if host and device get out of sync.
Sometimes Windows would send RNDIS_KEEPALIVE_MSG and RNDIS_QUERY_MSG close
to each other. This would cause the latter command to overwrite the reply for
the prior command. This in turn will cause Windows to drop the connection after
a 20 second timeout.
Easy way to reproduce the issue is to open the Windows "Adapter Status" dialog that
shows the realtime TX/RX byte counts. This causes multiple RNDIS_QUERY_MSGs per
second, and the connection will drop in less than an hour.
This commit fixes this issue, and other potential race conditions (such as USB
descriptor read in middle on RNDIS query) by using a separate queue for the reply
packets.
This fixes the following error with CONFIG_SIM_SANITIZE=y on macOS.
```
CP: /Users/yamamoto/git/nuttx/nuttx/include/nuttx/config.h
CC: nettest_host.c
CC: nettest_server.c
LD: tcpserver
Undefined symbols for architecture x86_64:
"___asan_handle_no_return", referenced from:
_nettest_server in nettest_server.hobj
"___asan_init", referenced from:
_asan.module_ctor in nettest_host.hobj
_asan.module_ctor in nettest_server.hobj
"___asan_option_detect_stack_use_after_return", referenced from:
_nettest_server in nettest_server.hobj
"___asan_register_image_globals", referenced from:
_asan.module_ctor in nettest_server.hobj
"___asan_report_load1", referenced from:
_nettest_server in nettest_server.hobj
"___asan_report_load4", referenced from:
_nettest_server in nettest_server.hobj
"___asan_report_store1", referenced from:
_nettest_server in nettest_server.hobj
"___asan_report_store2", referenced from:
_nettest_server in nettest_server.hobj
"___asan_report_store4", referenced from:
_nettest_server in nettest_server.hobj
"___asan_stack_malloc_1", referenced from:
_nettest_server in nettest_server.hobj
"___asan_unregister_image_globals", referenced from:
_asan.module_dtor in nettest_server.hobj
"___asan_version_mismatch_check_apple_clang_1100", referenced from:
_asan.module_ctor in nettest_host.hobj
_asan.module_ctor in nettest_server.hobj
"___ubsan_handle_add_overflow", referenced from:
_nettest_server in nettest_server.hobj
"___ubsan_handle_builtin_unreachable", referenced from:
_nettest_server in nettest_server.hobj
"___ubsan_handle_pointer_overflow", referenced from:
_nettest_server in nettest_server.hobj
"___ubsan_handle_shift_out_of_bounds", referenced from:
_nettest_server in nettest_server.hobj
"___ubsan_handle_sub_overflow", referenced from:
_nettest_server in nettest_server.hobj
"___ubsan_handle_type_mismatch_v1", referenced from:
_nettest_server in nettest_server.hobj
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```