Commit 33ddb566 authored by danicampora's avatar danicampora
Browse files

cc3200: Remove dependencies from FreeRTOS.

Use the simplelink wrappers instead. This is one step further
towards having a single module for the cc3200 and the cc3100.
parent 5c047b97
...@@ -10,12 +10,6 @@ ...@@ -10,12 +10,6 @@
#include "debug.h" #include "debug.h"
#include "modwlan.h" #include "modwlan.h"
#ifdef USE_FREERTOS
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#endif
#define SFLASH_TIMEOUT_MAX_MS 5500 #define SFLASH_TIMEOUT_MAX_MS 5500
#define SFLASH_WAIT_TIME_MS 5 #define SFLASH_WAIT_TIME_MS 5
...@@ -38,18 +32,15 @@ static bool sflash_access (_u32 mode, _i32 (* sl_FsFunction)(_i32 FileHdl, _u32 ...@@ -38,18 +32,15 @@ static bool sflash_access (_u32 mode, _i32 (* sl_FsFunction)(_i32 FileHdl, _u32
bool retval = false; bool retval = false;
// wlan must be enabled in order to access the serial flash // wlan must be enabled in order to access the serial flash
#ifdef USE_FREERTOS sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
xSemaphoreTake (xWlanSemaphore, portMAX_DELAY);
#endif
if (0 == sl_FsOpen(sflash_block_name, mode, NULL, &fileHandle)) { if (0 == sl_FsOpen(sflash_block_name, mode, NULL, &fileHandle)) {
if (SFLASH_BLOCK_SIZE == sl_FsFunction (fileHandle, 0, sflash_block_cache, SFLASH_BLOCK_SIZE)) { if (SFLASH_BLOCK_SIZE == sl_FsFunction (fileHandle, 0, sflash_block_cache, SFLASH_BLOCK_SIZE)) {
retval = true; retval = true;
} }
sl_FsClose (fileHandle, NULL, NULL, 0); sl_FsClose (fileHandle, NULL, NULL, 0);
} }
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
return retval; return retval;
} }
...@@ -64,16 +55,12 @@ DRESULT sflash_disk_init (void) { ...@@ -64,16 +55,12 @@ DRESULT sflash_disk_init (void) {
// Proceed to format the memory if not done yet // Proceed to format the memory if not done yet
for (int i = 0; i < SFLASH_BLOCK_COUNT; i++) { for (int i = 0; i < SFLASH_BLOCK_COUNT; i++) {
print_block_name (i); print_block_name (i);
#ifdef USE_FREERTOS sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
xSemaphoreTake (xWlanSemaphore, portMAX_DELAY);
#endif
// Create the block file if it doesn't exist // Create the block file if it doesn't exist
if (sl_FsGetInfo(sflash_block_name, 0, &FsFileInfo) < 0) { if (sl_FsGetInfo(sflash_block_name, 0, &FsFileInfo) < 0) {
if (!sl_FsOpen(sflash_block_name, FS_MODE_OPEN_CREATE(SFLASH_BLOCK_SIZE, 0), NULL, &fileHandle)) { if (!sl_FsOpen(sflash_block_name, FS_MODE_OPEN_CREATE(SFLASH_BLOCK_SIZE, 0), NULL, &fileHandle)) {
sl_FsClose(fileHandle, NULL, NULL, 0); sl_FsClose(fileHandle, NULL, NULL, 0);
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
memset(sflash_block_cache, 0xFF, SFLASH_BLOCK_SIZE); memset(sflash_block_cache, 0xFF, SFLASH_BLOCK_SIZE);
if (!sflash_access(FS_MODE_OPEN_WRITE, sl_FsWrite)) { if (!sflash_access(FS_MODE_OPEN_WRITE, sl_FsWrite)) {
return RES_ERROR; return RES_ERROR;
...@@ -81,15 +68,11 @@ DRESULT sflash_disk_init (void) { ...@@ -81,15 +68,11 @@ DRESULT sflash_disk_init (void) {
} }
else { else {
// Unexpected failure while creating the file // Unexpected failure while creating the file
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
return RES_ERROR; return RES_ERROR;
} }
} }
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
} }
sflash_init_done = true; sflash_init_done = true;
sflash_prblock = UINT32_MAX; sflash_prblock = UINT32_MAX;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H #include MICROPY_HAL_H
#include "py/obj.h" #include "py/obj.h"
#include "osi.h"
#include "inc/hw_types.h" #include "inc/hw_types.h"
#include "inc/hw_ints.h" #include "inc/hw_ints.h"
#include "inc/hw_memmap.h" #include "inc/hw_memmap.h"
......
...@@ -60,9 +60,7 @@ bool updater_check_path (void *path) { ...@@ -60,9 +60,7 @@ bool updater_check_path (void *path) {
bool updater_start (void) { bool updater_start (void) {
_u32 AccessModeAndMaxSize = FS_MODE_OPEN_WRITE; _u32 AccessModeAndMaxSize = FS_MODE_OPEN_WRITE;
SlFsFileInfo_t FsFileInfo; SlFsFileInfo_t FsFileInfo;
#ifdef USE_FREERTOS sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
xSemaphoreTake (xWlanSemaphore, portMAX_DELAY);
#endif
if (0 != sl_FsGetInfo((_u8 *)updater_data.path, 0, &FsFileInfo)) { if (0 != sl_FsGetInfo((_u8 *)updater_data.path, 0, &FsFileInfo)) {
// file doesn't exist, create it // file doesn't exist, create it
AccessModeAndMaxSize = FS_MODE_OPEN_CREATE(updater_data.fsize, 0); AccessModeAndMaxSize = FS_MODE_OPEN_CREATE(updater_data.fsize, 0);
...@@ -71,9 +69,7 @@ bool updater_start (void) { ...@@ -71,9 +69,7 @@ bool updater_start (void) {
updater_data.foffset = 0; updater_data.foffset = 0;
return true; return true;
} }
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
return false; return false;
} }
...@@ -115,7 +111,5 @@ void updater_finnish (void) { ...@@ -115,7 +111,5 @@ void updater_finnish (void) {
} }
} }
updater_data.fhandle = -1; updater_data.fhandle = -1;
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
} }
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
#define HAL_SYSTICK_PERIOD_US 1000U #define HAL_SYSTICK_PERIOD_US 1000U
#define UTILS_DELAY_US_TO_COUNT(us) (((us) * HAL_FCPU_MHZ) / 3) #define UTILS_DELAY_US_TO_COUNT(us) (((us) * HAL_FCPU_MHZ) / 3)
#define HAL_NVIC_INT_CTRL_REG (*((volatile uint32_t *) 0xE000ED04 ) )
#define HAL_VECTACTIVE_MASK (0x1FUL)
/****************************************************************************** /******************************************************************************
DEFINE TYPES DEFINE TYPES
******************************************************************************/ ******************************************************************************/
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include MICROPY_HAL_H #include MICROPY_HAL_H
#include "mptask.h" #include "mptask.h"
#include "simplelink.h" #include "simplelink.h"
#include "osi.h"
#include "debug.h" #include "debug.h"
/****************************************************************************** /******************************************************************************
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include "osi.h" #include "osi.h"
#ifdef USE_FREERTOS
//***************************************************************************** //*****************************************************************************
// //
//! \brief Application defined idle task hook //! \brief Application defined idle task hook
...@@ -115,5 +113,3 @@ void vApplicationTickHook( void ) ...@@ -115,5 +113,3 @@ void vApplicationTickHook( void )
{ {
HAL_IncrementTick(); HAL_IncrementTick();
} }
#endif //USE_FREERTOS
...@@ -59,12 +59,13 @@ ...@@ -59,12 +59,13 @@
#include "pybi2c.h" #include "pybi2c.h"
#include "pybsd.h" #include "pybsd.h"
#include "utils.h" #include "utils.h"
#include "gccollect.h"
#ifdef DEBUG #ifdef DEBUG
extern OsiTaskHandle mpTaskHandle; extern OsiTaskHandle mpTaskHandle;
extern OsiTaskHandle svTaskHandle; extern OsiTaskHandle svTaskHandle;
extern TaskHandle_t xSimpleLinkSpawnTaskHndl; extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
#endif #endif
/// \module pyb - functions related to the pyboard /// \module pyb - functions related to the pyboard
......
...@@ -37,17 +37,10 @@ ...@@ -37,17 +37,10 @@
#include "modwlan.h" #include "modwlan.h"
#include "pybioctl.h" #include "pybioctl.h"
#include "pybuart.h" #include "pybuart.h"
#include "osi.h"
#include "debug.h" #include "debug.h"
#include "serverstask.h" #include "serverstask.h"
#include "mpexception.h" #include "mpexception.h"
#ifdef USE_FREERTOS
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#endif
/****************************************************************************** /******************************************************************************
DEFINE TYPES DEFINE TYPES
...@@ -88,7 +81,6 @@ typedef struct _wlan_obj_t { ...@@ -88,7 +81,6 @@ typedef struct _wlan_obj_t {
uint8_t macAddr[SL_MAC_ADDR_LEN]; uint8_t macAddr[SL_MAC_ADDR_LEN];
uint8_t ssid_name[33]; uint8_t ssid_name[33];
uint8_t bssid[6]; uint8_t bssid[6];
bool servers_enabled;
// IPVv4 data // IPVv4 data
uint32_t ip; uint32_t ip;
...@@ -152,7 +144,7 @@ STATIC wlan_obj_t wlan_obj; ...@@ -152,7 +144,7 @@ STATIC wlan_obj_t wlan_obj;
/****************************************************************************** /******************************************************************************
DECLARE EXPORTED DATA DECLARE EXPORTED DATA
******************************************************************************/ ******************************************************************************/
SemaphoreHandle_t xWlanSemaphore = NULL; OsiLockObj_t wlan_LockObj;
/****************************************************************************** /******************************************************************************
DECLARE PRIVATE FUNCTIONS DECLARE PRIVATE FUNCTIONS
...@@ -355,11 +347,7 @@ void wlan_init0 (void) { ...@@ -355,11 +347,7 @@ void wlan_init0 (void) {
wlan_obj.mode = -1; wlan_obj.mode = -1;
wlan_obj.base.type = NULL; wlan_obj.base.type = NULL;
memset (wlan_obj.macAddr, 0, SL_MAC_ADDR_LEN); memset (wlan_obj.macAddr, 0, SL_MAC_ADDR_LEN);
#ifdef USE_FREERTOS ASSERT(OSI_OK == sl_LockObjCreate(&wlan_LockObj, "WlanLock"));
if (NULL == xWlanSemaphore) {
xWlanSemaphore = xSemaphoreCreateBinary();
}
#endif
wlan_initialize_data (); wlan_initialize_data ();
} }
...@@ -369,9 +357,7 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss ...@@ -369,9 +357,7 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
if (mode == ROLE_STA || mode == ROLE_AP || mode == ROLE_P2P) { if (mode == ROLE_STA || mode == ROLE_AP || mode == ROLE_P2P) {
if (wlan_obj.mode < 0) { if (wlan_obj.mode < 0) {
wlan_obj.mode = sl_Start(0, 0, 0); wlan_obj.mode = sl_Start(0, 0, 0);
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
} }
// get the mac address // get the mac address
...@@ -492,9 +478,7 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss ...@@ -492,9 +478,7 @@ modwlan_Status_t wlan_sl_enable (SlWlanMode_t mode, const char *ssid, uint8_t ss
void wlan_sl_disable (void) { void wlan_sl_disable (void) {
if (wlan_obj.mode >= 0) { if (wlan_obj.mode >= 0) {
#ifdef USE_FREERTOS sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
xSemaphoreTake (xWlanSemaphore, portMAX_DELAY);
#endif
wlan_obj.mode = -1; wlan_obj.mode = -1;
sl_Stop(SL_STOP_TIMEOUT); sl_Stop(SL_STOP_TIMEOUT);
} }
...@@ -543,14 +527,10 @@ STATIC void wlan_initialize_data (void) { ...@@ -543,14 +527,10 @@ STATIC void wlan_initialize_data (void) {
STATIC void wlan_reenable (SlWlanMode_t mode) { STATIC void wlan_reenable (SlWlanMode_t mode) {
// Stop and start again // Stop and start again
wlan_obj.mode = -1; wlan_obj.mode = -1;
#ifdef USE_FREERTOS sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
xSemaphoreTake (xWlanSemaphore, portMAX_DELAY);
#endif
sl_Stop(SL_STOP_TIMEOUT); sl_Stop(SL_STOP_TIMEOUT);
wlan_obj.mode = sl_Start(0, 0, 0); wlan_obj.mode = sl_Start(0, 0, 0);
#ifdef USE_FREERTOS sl_LockObjUnlock (&wlan_LockObj);
xSemaphoreGive (xWlanSemaphore);
#endif
ASSERT (wlan_obj.mode == mode); ASSERT (wlan_obj.mode == mode);
} }
...@@ -647,7 +627,8 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k ...@@ -647,7 +627,8 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
SlWlanMode_t mode = mp_obj_get_int(args[0]); SlWlanMode_t mode = mp_obj_get_int(args[0]);
// Stop all other processes using the wlan engine // Stop all other processes using the wlan engine
if ( (wlan_obj.servers_enabled = servers_are_enabled()) ) { bool servers_enabled;
if ( (servers_enabled = servers_are_enabled()) ) {
wlan_servers_stop(); wlan_servers_stop();
} }
if (mode == ROLE_AP) { if (mode == ROLE_AP) {
...@@ -667,7 +648,7 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k ...@@ -667,7 +648,7 @@ STATIC mp_obj_t wlan_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_k
} }
// Start the servers again // Start the servers again
if (wlan_obj.servers_enabled) { if (servers_enabled) {
servers_enable (); servers_enable ();
} }
} else if (wlan_obj.mode < 0) { } else if (wlan_obj.mode < 0) {
......
...@@ -48,12 +48,7 @@ typedef enum ...@@ -48,12 +48,7 @@ typedef enum
/****************************************************************************** /******************************************************************************
DECLARE PUBLIC DATA DECLARE PUBLIC DATA
******************************************************************************/ ******************************************************************************/
#ifdef USE_FREERTOS extern _SlLockObj_t wlan_LockObj;
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
extern SemaphoreHandle_t xWlanSemaphore;
#endif
/****************************************************************************** /******************************************************************************
DECLARE PUBLIC FUNCTIONS DECLARE PUBLIC FUNCTIONS
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include "pybpin.h" #include "pybpin.h"
#include "pybsd.h" #include "pybsd.h"
#include "ff.h" #include "ff.h"
#include "osi.h" #include "simplelink.h"
#include "debug.h" #include "debug.h"
#include "mpexception.h" #include "mpexception.h"
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "gccollect.h" #include "gccollect.h"
#include "gchelper.h" #include "gchelper.h"
#include "readline.h" #include "readline.h"
#include "osi.h"
#include "mptask.h" #include "mptask.h"
#include "mperror.h" #include "mperror.h"
#include "simplelink.h" #include "simplelink.h"
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "py/mpconfig.h" #include "py/mpconfig.h"
#include MICROPY_HAL_H #include MICROPY_HAL_H
#include "py/misc.h" #include "py/misc.h"
#include "osi.h"
#include "simplelink.h" #include "simplelink.h"
#include "serverstask.h" #include "serverstask.h"
#include "modwlan.h" #include "modwlan.h"
......
...@@ -57,11 +57,6 @@ ...@@ -57,11 +57,6 @@
#include <interrupt.h> #include <interrupt.h>
#include <utils.h> #include <utils.h>
//OSLib includes
#if defined(SL_PLATFORM_MULTI_THREADED)
#include <osi.h>
#endif
#define REG_INT_MASK_SET 0x400F7088 #define REG_INT_MASK_SET 0x400F7088
#define REG_INT_MASK_CLR 0x400F708C #define REG_INT_MASK_CLR 0x400F708C
......
...@@ -176,12 +176,7 @@ OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj) ...@@ -176,12 +176,7 @@ OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj)
return OSI_INVALID_PARAMS; return OSI_INVALID_PARAMS;
} }
if(pdTRUE != xSemaphoreGive( *pSyncObj )) xSemaphoreGive( *pSyncObj );
{
//In case of Semaphore, you are expected to get this if multiple sem
// give is called before sem take
return OSI_OK;
}
return OSI_OK; return OSI_OK;
} }
......
...@@ -66,6 +66,7 @@ extern "C" { ...@@ -66,6 +66,7 @@ extern "C" {
#include <string.h> #include <string.h>
#include "cc_pal.h" #include "cc_pal.h"
#include "debug.h"
/*! /*!
\def MAX_CONCURRENT_ACTIONS \def MAX_CONCURRENT_ACTIONS
......
...@@ -447,10 +447,8 @@ static void telnet_parse_input (uint8_t *str, int16_t *len) { ...@@ -447,10 +447,8 @@ static void telnet_parse_input (uint8_t *str, int16_t *len) {
static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len) { static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len) {
int32_t retries = 0; int32_t retries = 0;
#ifdef USE_FREERTOS
// abort sending if we happen to be within interrupt context // abort sending if we happen to be within interrupt context
if ((portNVIC_INT_CTRL_REG & portVECTACTIVE_MASK) == 0) { if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0) {
#endif
do { do {
_i16 result = sl_Send(sd, pBuf, len, 0); _i16 result = sl_Send(sd, pBuf, len, 0);
if (result > 0) { if (result > 0) {
...@@ -461,11 +459,10 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len) ...@@ -461,11 +459,10 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len)
} }
HAL_Delay (TELNET_WAIT_TIME_MS); HAL_Delay (TELNET_WAIT_TIME_MS);
} while (++retries <= TELNET_TX_RETRIES_MAX); } while (++retries <= TELNET_TX_RETRIES_MAX);
#ifdef USE_FREERTOS }
} else { else {
// TODO: blink the BLD // TODO: blink the BLD
} }
#endif
return false; return false;
} }
......
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Daniel Campora
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "std.h" #include "std.h"
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
...@@ -11,34 +37,21 @@ ...@@ -11,34 +37,21 @@
#include "prcm.h" #include "prcm.h"
#include "shamd5.h" #include "shamd5.h"
#include "hash.h" #include "hash.h"
#include "simplelink.h"
#ifdef USE_FREERTOS
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
#endif
static _SlLockObj_t hash_LockObj;
#ifdef USE_FREERTOS
static SemaphoreHandle_t xShamd5Semaphore = NULL;
#endif
void HASH_Init (void) { void HASH_Init (void) {
// Enable the Data Hashing and Transform Engine // Enable the Data Hashing and Transform Engine
MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK); MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
#ifdef USE_FREERTOS sl_LockObjCreate(&hash_LockObj, "HashLock");
vSemaphoreCreateBinary(xShamd5Semaphore);
#endif
} }
void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) { void HASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
sl_LockObjLock (&hash_LockObj, SL_OS_WAIT_FOREVER);
#ifdef USE_FREERTOS // reset the perihperal before starting any new operation
xSemaphoreTake (xShamd5Semaphore, portMAX_DELAY);
#endif
MAP_PRCMPeripheralReset(PRCM_DTHE); MAP_PRCMPeripheralReset(PRCM_DTHE);
// wait until the context is ready // wait until the context is ready
...@@ -62,11 +75,9 @@ void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen) { ...@@ -62,11 +75,9 @@ void HASH_SHAMD5Update (uint8_t *data, uint32_t datalen) {
} }
void HASH_SHAMD5Read (uint8_t *hash) { void HASH_SHAMD5Read (uint8_t *hash) {
// wait for the output to be ready. // wait for the output to be ready
while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0); while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0);
// read the result. // read the result
MAP_SHAMD5ResultRead(SHAMD5_BASE, hash);