Skip to content

Commit dc545d6

Browse files
committed
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.
1 parent b2cb75e commit dc545d6

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cc3200/util/hash.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@
4040
#include "simplelink.h"
4141

4242

43-
static _SlLockObj_t hash_LockObj;
44-
45-
43+
/******************************************************************************
44+
DEFINE PUBLIC FUNCTIONS
45+
******************************************************************************/
4646
void HASH_Init (void) {
4747
// Enable the Data Hashing and Transform Engine
4848
MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
49-
sl_LockObjCreate(&hash_LockObj, "HashLock");
49+
MAP_PRCMPeripheralReset(PRCM_DTHE);
5050
}
5151

5252
void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
53-
sl_LockObjLock (&hash_LockObj, SL_OS_WAIT_FOREVER);
54-
// reset the perihperal before starting any new operation
55-
MAP_PRCMPeripheralReset(PRCM_DTHE);
56-
5753
// wait until the context is ready
5854
while ((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) == 0);
5955

@@ -79,5 +75,4 @@ void HASH_SHAMD5Read (uint8_t *hash) {
7975
while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0);
8076
// read the result
8177
MAP_SHAMD5ResultRead(SHAMD5_BASE, hash);
82-
sl_LockObjUnlock (&hash_LockObj);
8378
}

cc3200/util/hash.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
#ifndef HASH_H_
2828
#define HASH_H_
2929

30+
/******************************************************************************
31+
DECLARE PUBLIC FUNCTIONS
32+
******************************************************************************/
3033
extern void HASH_Init (void);
3134
extern void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
3235
extern void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
3336
extern void HASH_SHAMD5Read (uint8_t *hash);
3437

35-
3638
#endif /* HASH_H_ */

0 commit comments

Comments
 (0)