Files
wolfssl/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c

137 lines
3.2 KiB
C
Raw Normal View History

2013-11-07 10:29:01 +09:00
/* main.c
*
* Copyright (C) 2006-2017 wolfSSL Inc.
2013-11-07 10:29:01 +09:00
*
2016-03-17 16:02:13 -06:00
* This file is part of wolfSSL.
2013-11-07 10:29:01 +09:00
*
2015-01-06 12:14:15 -07:00
* wolfSSL is free software; you can redistribute it and/or modify
2013-11-07 10:29:01 +09:00
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
2015-01-06 12:14:15 -07:00
* wolfSSL is distributed in the hope that it will be useful,
2013-11-07 10:29:01 +09:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2016-03-17 16:02:13 -06:00
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2013-11-07 10:29:01 +09:00
*/
2013-11-07 10:29:01 +09:00
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include "wolfcrypt/test/test.h"
2017-12-31 11:31:54 +09:00
#include <time.h>
2013-11-07 10:29:01 +09:00
#warning "write MPU specific Set ups\n"
static void SystemClock_Config (void) {
}
static void MPU_Config (void) {
}
static void CPU_CACHE_Enable (void) {
}
2013-11-07 10:29:01 +09:00
2017-12-31 11:31:54 +09:00
extern uint32_t os_time;
#ifdef RTE_CMSIS_RTOS_RTX
uint32_t HAL_GetTick(void) {
return os_time;
}
#endif
time_t time(time_t *t){
return os_time ;
}
#ifdef WOLFSSL_CURRTIME_OSTICK
#include <stdint.h>
extern uint32_t os_time;
double current_time(int reset)
{
if(reset) os_time = 0 ;
return (double)os_time /1000.0;
}
#else
#include <stdint.h>
#define DWT ((DWT_Type *) (0xE0001000UL) )
typedef struct
{
uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */
uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */
} DWT_Type;
extern uint32_t SystemCoreClock ;
double current_time(int reset)
{
if(reset) DWT->CYCCNT = 0 ;
return ((double)DWT->CYCCNT/SystemCoreClock) ;
}
#endif
2013-11-07 10:29:01 +09:00
/*-----------------------------------------------------------------------------
* Initialize a Flash Memory Card
*----------------------------------------------------------------------------*/
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
2013-11-07 10:29:01 +09:00
static void init_filesystem (void) {
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
2013-11-07 10:29:01 +09:00
retv = fmount ("M0:");
if (retv == fsOK) {
2013-11-07 10:29:01 +09:00
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
2013-11-07 10:29:01 +09:00
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
2013-11-07 10:29:01 +09:00
/*-----------------------------------------------------------------------------
* mian entry
2013-11-07 10:29:01 +09:00
*----------------------------------------------------------------------------*/
void benchmark_test(void *arg) ;
int main()
2013-11-07 10:29:01 +09:00
{
void * arg = NULL ;
MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
printf("=== Start: Crypt Benchmark ===\n") ;
benchmark_test(arg) ;
printf("=== End: Crypt Benchmark ===\n") ;
2014-04-11 16:20:12 +09:00
2013-11-07 10:29:01 +09:00
}