forked from BabbleSim/ext_NRF52_hw_models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
time_machine_if.h
69 lines (58 loc) · 1.63 KB
/
time_machine_if.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright (c) 2018 Oticon A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Interface the HW models expect from the overall scheduler (this overall
* scheduler is the time machine in the nrf52_bsim target board)
*/
#ifndef _TIME_MACHINE_IF_H
#define _TIME_MACHINE_IF_H
#include "bs_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Get the absolute simulated time (microseconds since start)
* (as know by this device)
*/
bs_time_t tm_get_abs_time(void);
/**
* Get the simulated time as presented to the HW models
*
* Note: In principle HW models should only rely on this time, but they
* may access the absolute time for logging/tracing, or other purposes
*/
bs_time_t tm_get_hw_time();
/*
* Convert an absolute time into HW time
* (Absolute and HW time may be the same, but needs not be)
*/
bs_time_t tm_abs_time_to_hw_time(bs_time_t abstime);
/*
* Convert a HW time into absolute time
*/
bs_time_t tm_hw_time_to_abs_time(bs_time_t hwtime);
/*
* Notify the overall scheduler that an event time (timer) has been updated
*/
void tm_find_next_timer_to_trigger();
/*
* Return the next time of the next event the overall scheduler knows about
*/
bs_time_t tm_get_next_timer_abstime();
/*
* Note the time of the last interaction with the Babblesim Phy
*/
void tm_update_last_phy_sync_time(bs_time_t abs_time);
/*
* Set the maximum amount of time we are willing to be without communicating
* with the BabbleSim Phy. If at some point we would spend longer than that
* without any Phy activity a "wait" command would be sent.
*/
void tm_set_phy_max_resync_offset(bs_time_t offset_in_us);
#ifdef __cplusplus
}
#endif
#endif