Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ request id on families that have one). The *value* is meaningless to
supplied by whichever peripheral driver's own port knows which request line
its hardware is wired to. Use `DMDMA_REQUEST_NONE` for
`dmdma_direction_memory_to_memory` transfers, which need no request line.
For a peripheral direction, the request is interpreted by the target port;
zero is a valid selector on STM32F4/F7 and means hardware DMA channel 0.
`DMDMA_REQUEST_NONE` is used only with memory-to-memory direction. The
STM32 port continues to accept values 8 through 15 as aliases for channels
0 through 7 so modules built against older releases keep working.

### `dmdma_transfer_config_t`

Expand Down
5 changes: 5 additions & 0 deletions docs/dmdma.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ knows which controller/stream/request line its hardware is wired to opens
that exact stream directly and drives it the same way, just with a real
peripheral address and request line instead of `DMDMA_REQUEST_NONE`:

For STM32F4/F7 peripheral transfers, pass request `0` for hardware channel 0.
`DMDMA_REQUEST_NONE` (also zero) applies only to memory-to-memory transfers;
the transfer direction makes the two uses unambiguous. The STM32 port still
accepts legacy request `8` as a channel 0 alias.

```c
dmdma_transfer_config_t rx = {
.direction = dmdma_direction_peripheral_to_memory,
Expand Down
2 changes: 2 additions & 0 deletions include/dmdma_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ typedef enum
* peripheral driver's own port (e.g. dmuart's stm32f7 port) knows which
* request line its hardware is wired to. Use DMDMA_REQUEST_NONE for
* dmdma_direction_memory_to_memory transfers, which need no request line.
* For a peripheral direction, selector zero is passed to the port: on
* STM32F4/F7 it is hardware channel zero. Direction determines the meaning.
*/
typedef uint16_t dmdma_request_t;

Expand Down
8 changes: 2 additions & 6 deletions src/dmdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,8 @@ static int validate_transfer_config(dmdma_controller_t controller, const dmdma_t
{
return -EINVAL;
}
if (config->request == DMDMA_REQUEST_NONE)
{
/* A peripheral direction with no request line can never fire -
* almost certainly a caller that forgot to set it. */
return -EINVAL;
}
/* A request selector belongs to the target port. Zero is a valid
* hardware channel on STM32F4/F7 and must reach that port. */
}

if (((uintptr_t)config->source_address % (uintptr_t)config->source_width) != 0)
Expand Down
Loading