Skip to content

Commit 1fea286

Browse files
ccli8adbridge
authored andcommitted
Guard from reordering DMA wait and post-wait for crypto modules
1 parent e352fc4 commit 1fea286

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

targets/TARGET_NUVOTON/TARGET_M480/crypto/crypto-misc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ static void crypto_submodule_prestart(volatile uint16_t *submodule_done)
200200
static bool crypto_submodule_wait(volatile uint16_t *submodule_done)
201201
{
202202
while (! *submodule_done);
203-
203+
204+
/* Ensure while loop above and subsequent code are not reordered */
205+
__DSB();
206+
204207
return true;
205208
}
206209

targets/TARGET_NUVOTON/TARGET_NUC472/crypto/crypto-misc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ static void crypto_submodule_prestart(volatile uint16_t *submodule_done)
200200
static bool crypto_submodule_wait(volatile uint16_t *submodule_done)
201201
{
202202
while (! *submodule_done);
203-
203+
204+
/* Ensure while loop above and subsequent code are not reordered */
205+
__DSB();
206+
204207
return true;
205208
}
206209

0 commit comments

Comments
 (0)