/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/timing.h

  • Committer: Suren A. Chilingaryan
  • Date: 2016-03-02 04:47:04 UTC
  • Revision ID: csa@suren.me-20160302044704-wncsxtf6sx0r0tps
Documentation update

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
extern "C" {
9
9
#endif
10
10
 
 
11
 
 
12
/**
 
13
 * Add the specified number of microseconds to the time stored in \p tv
 
14
 * @param[in,out] tv    - timestamp
 
15
 * @param[in] timeout   - number of microseconds to add 
 
16
 * @return              - error code or 0 for correctness
 
17
 */
11
18
int pcilib_add_timeout(struct timeval *tv, pcilib_timeout_t timeout);
 
19
 
 
20
/**
 
21
 * Computes the deadline by adding the specified number of microseconds to the current timestamp
 
22
 * @param[out] tv       - the deadline
 
23
 * @param[in] timeout   - number of microseconds to add 
 
24
 * @return              - error code or 0 for correctness
 
25
 */
12
26
int pcilib_calc_deadline(struct timeval *tv, pcilib_timeout_t timeout);
13
 
int pcilib_check_deadline(struct timeval *tve, pcilib_timeout_t timeout);
14
 
pcilib_timeout_t pcilib_calc_time_to_deadline(struct timeval *tve);
 
27
 
 
28
/**
 
29
 * Check if we are within \p timeout microseconds before the specified deadline or already past it
 
30
 * @param[in] tv        - the deadline
 
31
 * @param[in] timeout   - maximum number of microseconds before deadline
 
32
 * @return              - 1 if we are within \p timeout microseconds before deadline or past it, 0 - otherwise
 
33
 */
 
34
int pcilib_check_deadline(struct timeval *tv, pcilib_timeout_t timeout);
 
35
 
 
36
/**
 
37
 * Compute the remaining time to deadline
 
38
 * @param[in] tv        - the deadline
 
39
 * @return              - number of microseconds until deadline or 0 if we are already past it
 
40
 */
 
41
pcilib_timeout_t pcilib_calc_time_to_deadline(struct timeval *tv);
 
42
 
 
43
/**
 
44
 * Executes sleep until the specified deadline
 
45
 * Real-time capabilities are not used. TThe sleep could wake slightly after the specified deadline.
 
46
 * @param[in] tv        - the deadline
 
47
 * @return              - error code or 0 for correctness
 
48
 */
15
49
int pcilib_sleep_until_deadline(struct timeval *tv);
 
50
 
 
51
/**
 
52
 * Computes the number of microseconds between 2 timestamps.
 
53
 * This function expects that \p tve is after \p tvs.
 
54
 * @param[in] tve       - the end of the time interval
 
55
 * @param[in] tvs       - the beginning of the time interval
 
56
 * @return              - number of microseconds between two timestamps
 
57
 */
 
58
pcilib_timeout_t pcilib_timediff(struct timeval *tve, struct timeval *tvs);
 
59
 
 
60
/**
 
61
 * Compares two timestamps
 
62
 * @param[in] tv1       - the first timestamp
 
63
 * @param[in] tv2       - the second timestamp
 
64
 * @return              - 0 if timestamps are equal, 1 if the first timestamp is after the second, or -1 if the second is after the first.
 
65
 */
16
66
int pcilib_timecmp(struct timeval *tv1, struct timeval *tv2);
17
 
pcilib_timeout_t pcilib_timediff(struct timeval *tve, struct timeval *tvs);
18
67
 
19
68
 
20
69
#ifdef __cplusplus