Skip to content
Open
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
3 changes: 3 additions & 0 deletions include/zephyr/drivers/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ static inline int dma_stop(const struct device *dev, uint32_t channel)
const struct dma_driver_api *api =
(const struct dma_driver_api *)dev->api;

if (api->stop == NULL) {
return -ENOSYS;
}
return api->stop(dev, channel);
}

Expand Down
9 changes: 8 additions & 1 deletion tests/drivers/dma/loop_transfer/src/test_dma_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ static int test_loop_repeated_start_stop(const struct device *dma)
static int chan_id;
enum pm_device_state init_state = pm_device_on_power_domain(dma) ?
PM_DEVICE_STATE_OFF : PM_DEVICE_STATE_SUSPENDED;
int res;

test_case_id = 0;
TC_PRINT("DMA memory to memory transfer started\n");
Expand Down Expand Up @@ -418,7 +419,13 @@ static int test_loop_repeated_start_stop(const struct device *dma)
return TC_FAIL;
}

if (dma_stop(dma, chan_id)) {
res = dma_stop(dma, chan_id);
if (res == -ENOSYS) {
TC_PRINT("Stop not supported.");
ztest_test_skip();
return TC_SKIP;
}
if (res) {
TC_PRINT("ERROR: transfer stop on stopped channel (%d)\n", chan_id);
return TC_FAIL;
}
Expand Down