7
7
#include <errno.h>
8
8
#include <zephyr/irq.h>
9
9
#include <zephyr/sys/util.h>
10
+ #include <zephyr/sys/sys_io.h>
10
11
#include <zephyr/device.h>
11
12
#include <zephyr/drivers/dma.h>
12
13
#include <zephyr/drivers/clock_control.h>
@@ -269,7 +270,7 @@ static int dma_siwx91x_start(const struct device *dev, uint32_t channel)
269
270
if (udma_table [channel ].vsUDMAChaConfigData1 .srcInc != UDMA_SRC_INC_NONE &&
270
271
udma_table [channel ].vsUDMAChaConfigData1 .dstInc != UDMA_DST_INC_NONE ) {
271
272
/* Apply software trigger to start transfer */
272
- cfg -> reg -> CHNL_SW_REQUEST |= BIT ( channel );
273
+ sys_set_bit (( mem_addr_t ) & cfg -> reg -> CHNL_SW_REQUEST , channel );
273
274
}
274
275
return 0 ;
275
276
}
@@ -303,11 +304,7 @@ static int dma_siwx91x_get_status(const struct device *dev, uint32_t channel,
303
304
return - EINVAL ;
304
305
}
305
306
/* Read the channel status register */
306
- if (cfg -> reg -> CHANNEL_STATUS_REG & BIT (channel )) {
307
- stat -> busy = 1 ;
308
- } else {
309
- stat -> busy = 0 ;
310
- }
307
+ stat -> busy = sys_test_bit ((mem_addr_t )& cfg -> reg -> CHANNEL_STATUS_REG , channel );
311
308
312
309
/* Obtain the transfer direction from channel descriptors */
313
310
if (udma_table [channel ].vsUDMAChaConfigData1 .srcInc == UDMA_SRC_INC_NONE ) {
@@ -379,7 +376,7 @@ static void dma_siwx91x_isr(const struct device *dev)
379
376
/* Transfer complete, call user callback */
380
377
data -> dma_callback (dev , data -> cb_data , channel , 0 );
381
378
}
382
- cfg -> reg -> UDMA_DONE_STATUS_REG = BIT ( channel );
379
+ sys_write32 ( BIT ( channel ), ( mem_addr_t ) & cfg -> reg -> UDMA_DONE_STATUS_REG );
383
380
} else {
384
381
/* Call UDMA ROM IRQ handler. */
385
382
ROMAPI_UDMA_WRAPPER_API -> uDMAx_IRQHandler (& udma_resources , udma_resources .desc ,
@@ -388,7 +385,7 @@ static void dma_siwx91x_isr(const struct device *dev)
388
385
if (udma_resources .desc [channel ].vsUDMAChaConfigData1 .srcInc != UDMA_SRC_INC_NONE &&
389
386
udma_resources .desc [channel ].vsUDMAChaConfigData1 .dstInc != UDMA_DST_INC_NONE ) {
390
387
/* Set the software trigger bit for starting next transfer */
391
- cfg -> reg -> CHNL_SW_REQUEST |= BIT ( channel );
388
+ sys_set_bit (( mem_addr_t ) & cfg -> reg -> CHNL_SW_REQUEST , channel );
392
389
}
393
390
}
394
391
out :
0 commit comments