Skip to content

Commit

Permalink
drivers: dma: siwx917: Review comment changes
Browse files Browse the repository at this point in the history
Addressing the review comments (version 2).
This commit will be squashed before merging.

Signed-off-by: Sai Santhosh Malae <[email protected]>
  • Loading branch information
smalae committed Jan 16, 2025
1 parent 334bf33 commit 88bda47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ jobs:
working-directory: zephyr-silabs
shell: bash
run: |
west twister -s drivers.dma.chan_blen_transfer -p siwx917_rb4338a -x \
DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.overlay \
west twister -s drivers.dma.chan_blen_transfer -p siwx917_rb4338a \
-x DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.overlay \
-x EXTRA_CONF_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.conf \
-v --inline-logs
- name: Build Scatter-Gather DMA test
working-directory: zephyr-silabs
shell: bash
run: |
west twister -s drivers.dma.scatter_gather -K -p siwx917_rb4338a -x \
DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.overlay \
west twister -s drivers.dma.scatter_gather -K -p siwx917_rb4338a \
-x DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.overlay \
-x EXTRA_CONF_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.conf \
-v --inline-logs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/upstream-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ jobs:
working-directory: zephyr-silabs
shell: bash
run: |
west twister -s drivers.dma.chan_blen_transfer -p siwx917_rb4338a -x \
DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.overlay \
west twister -s drivers.dma.chan_blen_transfer -p siwx917_rb4338a \
-x DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.overlay \
-x EXTRA_CONF_FILE=$(pwd)/tests/drivers/dma/chan_blen_transfer/boards/siwx917_rb4338a.conf \
-v --inline-logs
- name: Build Scatter-Gather DMA test
working-directory: zephyr-silabs
shell: bash
run: |
west twister -s drivers.dma.scatter_gather -K -p siwx917_rb4338a -x \
DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.overlay \
west twister -s drivers.dma.scatter_gather -K -p siwx917_rb4338a \
-x DTC_OVERLAY_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.overlay \
-x EXTRA_CONF_FILE=$(pwd)/tests/drivers/dma/scatter_gather/boards/siwx917_rb4338a.conf \
-v --inline-logs
Expand Down
21 changes: 11 additions & 10 deletions drivers/dma/dma_silabs_siwx917.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ struct dma_siwx917_data {
*/
};

static inline int siwx917_is_peripheral_request(uint32_t dir)
static int siwx917_is_peripheral_request(uint32_t dir)
{
if (dir == MEMORY_TO_MEMORY) {
return 0;
}
if (dir == MEMORY_TO_PERIPHERAL || dir == PERIPHERAL_TO_MEMORY) {
return 1;
}
/* Invalid transfer direction */
return -1;
}

static inline int siwx917_data_width(uint32_t data_width)
static int siwx917_data_width(uint32_t data_width)
{
switch (data_width) {
case 1:
Expand All @@ -74,17 +75,17 @@ static inline int siwx917_data_width(uint32_t data_width)
}
}

static inline int siwx917_burst_length(uint32_t blen)
static bool siwx917_burst_length_is_valid(uint32_t blen)
{
switch (blen / 8) {
case 1:
return VALID_BURST_LENGTH; /* 8-bit burst */
return true; /* 8-bit burst */
default:
return -EINVAL;
return false;
}
}

static inline int siwx917_addr_adjustment(uint32_t adjustment)
static int siwx917_addr_adjustment(uint32_t adjustment)
{
switch (adjustment) {
case 0:
Expand All @@ -106,10 +107,10 @@ static int siwx917_sg_fill_desc(RSI_UDMA_DESC_T *descs, const struct dma_config
cfg = &descs[i].vsUDMAChaConfigData1;
/* Set the source and destination end addresses */
descs[i].pSrcEndAddr =
(uint32_t *)(block_addr->source_address +
(void *)(block_addr->source_address +
(block_addr->block_size - config->source_data_size));
descs[i].pDstEndAddr =
(uint32_t *)(block_addr->dest_address +
(void *)(block_addr->dest_address +
(block_addr->block_size - config->dest_data_size));
/* Set the source and destination data sizes */

Check notice on line 115 in drivers/dma/dma_silabs_siwx917.c

View workflow job for this annotation

GitHub Actions / compliance

You may want to run clang-format on this change

drivers/dma/dma_silabs_siwx917.c:115 - (block_addr->block_size - config->source_data_size)); - descs[i].pDstEndAddr = - (void *)(block_addr->dest_address + - (block_addr->block_size - config->dest_data_size)); + (block_addr->block_size - config->source_data_size)); + descs[i].pDstEndAddr = (void *)(block_addr->dest_address + + (block_addr->block_size - config->dest_data_size));
cfg->srcSize = siwx917_data_width(config->source_data_size);
Expand Down Expand Up @@ -245,8 +246,8 @@ static int siwx917_channel_config(const struct device *dev, RSI_UDMA_HANDLE_T ud
siwx917_data_width(config->dest_data_size) < 0) {
return -EINVAL;
}
if (siwx917_burst_length(config->source_burst_length) < 0 ||
siwx917_burst_length(config->dest_burst_length) < 0) {
if (siwx917_burst_length_is_valid(config->source_burst_length) == 0 ||
siwx917_burst_length_is_valid(config->dest_burst_length) == 0) {
return -EINVAL;
}
channel_control.srcSize = siwx917_data_width(config->source_data_size);
Expand Down

0 comments on commit 88bda47

Please sign in to comment.