Contiki-NG
Loading...
Searching...
No Matches
timing_alt.h
1/*
2 * Copyright (c) 2022, RISE Research Institutes of Sweden AB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 * OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef TIMING_ALT_H
35#define TIMING_ALT_H
36
37#include <stdint.h>
38
39#include "contiki.h"
40
41extern volatile int mbedtls_timing_alarmed;
42
43struct mbedtls_timing_hr_time {
44 struct timer timer;
45};
46
47typedef struct mbedtls_timing_delay_context {
48 struct mbedtls_timing_hr_time private_timer;
49 uint32_t private_int_ms;
50 uint32_t private_fin_ms;
51} mbedtls_timing_delay_context;
52
53void mbedtls_set_alarm(int seconds);
54
55int mbedtls_timing_get_delay(void *data);
56
57unsigned long mbedtls_timing_get_timer(struct mbedtls_timing_hr_time *val, int reset);
58
59unsigned long mbedtls_timing_hardclock(void);
60
61void mbedtls_timing_set_delay(void *data, uint32_t int_ms, uint32_t fin_ms);
62
63#endif /* !TIMING_ALT_H */
A timer.
Definition timer.h:84