From dc545d65125b375e54b1a3a9b9ed3d1d6cd7381d Mon Sep 17 00:00:00 2001 From: danicampora Date: Sun, 15 Mar 2015 20:15:14 +0100 Subject: [PATCH] cc3200: Do not reset the DTHE module before every SHA operation. According to the new SDK (1.1.0) this is not needed, and it's best not to do it, because this module is a shared resource. --- cc3200/util/hash.c | 13 ++++--------- cc3200/util/hash.h | 4 +++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cc3200/util/hash.c b/cc3200/util/hash.c index acd1475552..c25ebb2b06 100644 --- a/cc3200/util/hash.c +++ b/cc3200/util/hash.c @@ -40,20 +40,16 @@ #include "simplelink.h" -static _SlLockObj_t hash_LockObj; - - +/****************************************************************************** + DEFINE PUBLIC FUNCTIONS + ******************************************************************************/ void HASH_Init (void) { // Enable the Data Hashing and Transform Engine MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK); - sl_LockObjCreate(&hash_LockObj, "HashLock"); + MAP_PRCMPeripheralReset(PRCM_DTHE); } void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) { - sl_LockObjLock (&hash_LockObj, SL_OS_WAIT_FOREVER); - // reset the perihperal before starting any new operation - MAP_PRCMPeripheralReset(PRCM_DTHE); - // wait until the context is ready while ((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) == 0); @@ -79,5 +75,4 @@ void HASH_SHAMD5Read (uint8_t *hash) { while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0); // read the result MAP_SHAMD5ResultRead(SHAMD5_BASE, hash); - sl_LockObjUnlock (&hash_LockObj); } diff --git a/cc3200/util/hash.h b/cc3200/util/hash.h index edea1e3fce..ea7b9f78db 100644 --- a/cc3200/util/hash.h +++ b/cc3200/util/hash.h @@ -27,10 +27,12 @@ #ifndef HASH_H_ #define HASH_H_ +/****************************************************************************** + DECLARE PUBLIC FUNCTIONS + ******************************************************************************/ extern void HASH_Init (void); extern void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen); extern void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen); extern void HASH_SHAMD5Read (uint8_t *hash); - #endif /* HASH_H_ */