blob: b73ac292bb4a00908e7f73637379a37201f06b96 (
plain)
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
|
/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Timer module for Chrome EC operating system */
#ifndef __EC_TIMER_H
#define __EC_TIMER_H
#include "common.h"
#include "task_id.h"
/* Micro-second timestamp. */
typedef union {
uint64_t val;
struct {
uint32_t lo;
uint32_t hi;
} le /* little endian words */;
} timestamp_t;
/* Initializes the Timer module. */
int timer_init(void);
/**
* Launches a one-shot timer.
*
* tstamp : timestamp in micro-seconds when the timer expires
* tskid : identifier of the task owning the timer
*/
int timer_arm(timestamp_t tstamp, task_id_t tskid);
/**
* Cancels a running timer.
*
* tskid : identifier of the task owning the timer
*/
int timer_cancel(task_id_t tskid);
/**
* Busy wait the selected number of micro-seconds
*/
void udelay(unsigned us);
/**
* Sleep during the selected number of micro-seconds
*
* The current task will be de-scheduled until the delay expired
*
* Note: if an event happens before the end of sleep, the function will return.
*/
void usleep(unsigned us);
/**
* Get the current timestamp from the system timer
*/
timestamp_t get_time(void);
#endif /* __EC_TIMER_H */
|