timing.h
Go to the documentation of this file.
/*
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#ifndef MBEDTLS_TIMING_H
#define MBEDTLS_TIMING_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(MBEDTLS_TIMING_ALT)
// Regular implementation
//
struct mbedtls_timing_hr_time
{
unsigned char opaque[32];
};
typedef struct mbedtls_timing_delay_context
{
struct mbedtls_timing_hr_time timer;
uint32_t int_ms;
uint32_t fin_ms;
} mbedtls_timing_delay_context;
#else /* MBEDTLS_TIMING_ALT */
#include "timing_alt.h"
#endif /* MBEDTLS_TIMING_ALT */
extern volatile int mbedtls_timing_alarmed;
unsigned long mbedtls_timing_hardclock( void );
unsigned long mbedtls_timing_get_timer( struct mbedtls_timing_hr_time *val, int reset );
void mbedtls_set_alarm( int seconds );
void mbedtls_timing_set_delay( void *data, uint32_t int_ms, uint32_t fin_ms );
int mbedtls_timing_get_delay( void *data );
#if defined(MBEDTLS_SELF_TEST)
int mbedtls_timing_self_test( int verbose );
#endif
#ifdef __cplusplus
}
#endif
#endif /* timing.h */
mbedtls_timing_hr_time
timer structure
Definition: timing.h:46
mbedtls_timing_get_delay
int mbedtls_timing_get_delay(void *data)
Get the status of delays (Memory helper: number of delays passed.)
mbedtls_set_alarm
void mbedtls_set_alarm(int seconds)
Setup an alarm clock.
mbedtls_timing_self_test
int mbedtls_timing_self_test(int verbose)
Checkup routine.
mbedtls_timing_get_timer
unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset)
Return the elapsed time in milliseconds.
mbedtls_timing_alarmed
volatile int mbedtls_timing_alarmed
mbedtls_timing_delay_context
Context for mbedtls_timing_set/get_delay()
Definition: timing.h:54
mbedtls_timing_delay_context::timer
struct mbedtls_timing_hr_time timer
Definition: timing.h:56
mbedtls_timing_hardclock
unsigned long mbedtls_timing_hardclock(void)
Return the CPU cycle counter value.
mbedtls_timing_delay_context::fin_ms
uint32_t fin_ms
Definition: timing.h:58
config.h
Configuration options (set of defines)
mbedtls_timing_delay_context::int_ms
uint32_t int_ms
Definition: timing.h:57
mbedtls_timing_delay_context
struct mbedtls_timing_delay_context mbedtls_timing_delay_context
Context for mbedtls_timing_set/get_delay()
mbedtls_timing_hr_time::opaque
unsigned char opaque[32]
Definition: timing.h:48
mbedtls_timing_set_delay
void mbedtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms)
Set a pair of delays to watch (See mbedtls_timing_get_delay().)