Skip to content
Open
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
29 changes: 20 additions & 9 deletions drivers/dma/dma_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
if (!stream->hal_override) {
dma_stm32_clear_ht(dma, id);
}
stream->dma_callback(dev, stream->user_data, callback_arg, DMA_STATUS_BLOCK);
stream->dma_callback(dev, stream->user_data,
callback_arg, DMA_STATUS_BLOCK);
} else if (stm32_dma_is_tc_irq_active(dma, id)) {
/* Circular buffer never stops receiving as long as peripheral is enabled */
if (!stream->cyclic) {
Expand All @@ -127,18 +128,25 @@
if (!stream->hal_override) {
dma_stm32_clear_tc(dma, id);
}
stream->dma_callback(dev, stream->user_data, callback_arg, DMA_STATUS_COMPLETE);
if (stream->dma_callback != NULL) {
stream->dma_callback(dev, stream->user_data,
callback_arg, DMA_STATUS_COMPLETE);
}
} else if (stm32_dma_is_unexpected_irq_happened(dma, id)) {
LOG_ERR("Unexpected irq happened.");
stream->dma_callback(dev, stream->user_data,
callback_arg, -EIO);
if (stream->dma_callback != NULL) {
stream->dma_callback(dev, stream->user_data,
callback_arg, -EIO);

Check warning on line 139 in drivers/dma/dma_stm32.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACE_BEFORE_TAB

drivers/dma/dma_stm32.c:139 please, no space before tabs

Check failure on line 139 in drivers/dma/dma_stm32.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODE_INDENT

drivers/dma/dma_stm32.c:139 code indent should use tabs where possible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ttwards, note that tabulations are 8 space character wide in Zephyr.
CI compliance check also complains on mixes of tab and spaces here and there.

For info, C source files can use up to 100char/line so feel free to use this range without line escapes when applicable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but two callings of stream->dma_callback reach 100~110 chars.
Shoud I use tab only?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoud I use tab only?

You should use tab (8-char long) as much as possible, then fine tune with spaces.

}
} else {
LOG_ERR("Transfer Error.");
stream->busy = false;
dma_stm32_dump_stream_irq(dev, id);
dma_stm32_clear_stream_irq(dev, id);
stream->dma_callback(dev, stream->user_data,
callback_arg, -EIO);
if (stream->dma_callback != NULL) {
stream->dma_callback(dev, stream->user_data,
callback_arg, -EIO);

Check warning on line 148 in drivers/dma/dma_stm32.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACE_BEFORE_TAB

drivers/dma/dma_stm32.c:148 please, no space before tabs

Check failure on line 148 in drivers/dma/dma_stm32.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODE_INDENT

drivers/dma/dma_stm32.c:148 code indent should use tabs where possible
}
}
}

Expand Down Expand Up @@ -492,10 +500,13 @@
#endif
LL_DMA_Init(dma, dma_stm32_id_to_stream(id), &DMA_InitStruct);

LL_DMA_EnableIT_TC(dma, dma_stm32_id_to_stream(id));
/* Enable transfer complete ISR if in non-cyclic mode or a callback is requested */
if ((!stream->cyclic) || (stream->dma_callback != NULL)) {
LL_DMA_EnableIT_TC(dma, dma_stm32_id_to_stream(id));
}

/* Enable Half-Transfer irq if circular mode is enabled */
if (stream->cyclic) {
/* Enable Half-Transfer irq if circular mode is enabled and a callback is requested */
if (stream->cyclic && stream->dma_callback != NULL) {
LL_DMA_EnableIT_HT(dma, dma_stm32_id_to_stream(id));
}

Expand Down
Loading