Files
wolfssl/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c

45 lines
1.4 KiB
C
Raw Normal View History

2015-10-07 14:55:34 +09:00
/* time-STM32F2.c
*
* Copyright (C) 2006-2017 wolfSSL Inc.
2015-10-07 14:55:34 +09:00
*
2016-03-17 16:02:13 -06:00
* This file is part of wolfSSL.
2015-10-07 14:55:34 +09:00
*
* wolfSSL is free software; you can redistribute it and/or modify
* 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.
*
* wolfSSL is distributed in the hope that it will be useful,
* 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
2015-10-07 14:55:34 +09:00
*/
2016-03-17 16:02:13 -06:00
2015-10-07 14:55:34 +09:00
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <stdint.h>
#define DWT ((DWT_Type *) (0xE0001000UL) )
2015-10-07 14:55:34 +09:00
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)
2015-10-07 14:55:34 +09:00
{
if(reset) DWT->CYCCNT = 0 ;
return ((double)DWT->CYCCNT/SystemCoreClock) ;
}