andrzej-kaczmarek commented on a change in pull request #2392:
URL: https://github.com/apache/mynewt-core/pull/2392#discussion_r507747562



##########
File path: hw/drivers/crypto/crypto_da1469x/src/crypto_da1469x.c
##########
@@ -73,7 +74,10 @@ do_dma_key_tx(const void *key, uint16_t keylen)
     da1469x_otp_set_mode(OTPC_MODE_READ);
 
     /* securely DMA hardware key from secret storage to QSPI decrypt engine */
-    dma_regs->DMA_REQ_MUX_REG |= 0xf000;
+    OS_ENTER_CRITICAL(sr);
+    /* Use the secure channel #7 */
+    MCU_DMA_SET_MUX(7, MCU_DMA_PERIPH_NONE);

Review comment:
       > I do think the macro should remain local and 
`da1469x_dma_acquire_xxx()` and `da1469x_dma_release_channel()` should be used 
instead of accessing `DMA_REQ_MUX_REG` directly (e.g. crypto driver should use 
these calls for channel 7 with the macro fixed).
   
   agree, acquire/release should be used since it also keeps track of used 
channels internally. if some pieces of code manually modify mux register, 
things may not works as expected... so if there's something that 
acquire/release does not do it should be fixed there




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to