timer.h (e573bdb324c78fac56655a493bea843842c9d9f8) timer.h (435ae76edd3a90fc4dd2f582052d7362cb8bdad7)
1/*
2 * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _TIMER_H_
8#define _TIMER_H_
9
10/*
11 * Get the current timer count
12 *
1/*
2 * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#ifndef _TIMER_H_
8#define _TIMER_H_
9
10/*
11 * Get the current timer count
12 *
13 * @dev: The Timer device
13 * @dev: The timer device
14 * @count: pointer that returns the current timer count
15 * @return: 0 if OK, -ve on error
16 */
17int timer_get_count(struct udevice *dev, unsigned long *count);
14 * @count: pointer that returns the current timer count
15 * @return: 0 if OK, -ve on error
16 */
17int timer_get_count(struct udevice *dev, unsigned long *count);
18
18/*
19 * Get the timer input clock frequency
20 *
19/*
20 * Get the timer input clock frequency
21 *
21 * @dev: The Timer device
22 * @dev: The timer device
22 * @return: the timer input clock frequency
23 */
24unsigned long timer_get_rate(struct udevice *dev);
25
26/*
23 * @return: the timer input clock frequency
24 */
25unsigned long timer_get_rate(struct udevice *dev);
26
27/*
27 * struct timer_ops - Driver model Timer operations
28 * struct timer_ops - Driver model timer operations
28 *
29 *
29 * The uclass interface is implemented by all Timer devices which use
30 * The uclass interface is implemented by all timer devices which use
30 * driver model.
31 */
32struct timer_ops {
33 /*
34 * Get the current timer count
35 *
31 * driver model.
32 */
33struct timer_ops {
34 /*
35 * Get the current timer count
36 *
36 * @dev: The Timer device
37 * @dev: The timer device
37 * @count: pointer that returns the current timer count
38 * @return: 0 if OK, -ve on error
39 */
40 int (*get_count)(struct udevice *dev, unsigned long *count);
41};
42
43/*
44 * struct timer_dev_priv - information about a device used by the uclass
45 *
46 * @clock_rate: the timer input clock frequency
47 */
48struct timer_dev_priv {
49 unsigned long clock_rate;
50};
51
52#endif /* _TIMER_H_ */
38 * @count: pointer that returns the current timer count
39 * @return: 0 if OK, -ve on error
40 */
41 int (*get_count)(struct udevice *dev, unsigned long *count);
42};
43
44/*
45 * struct timer_dev_priv - information about a device used by the uclass
46 *
47 * @clock_rate: the timer input clock frequency
48 */
49struct timer_dev_priv {
50 unsigned long clock_rate;
51};
52
53#endif /* _TIMER_H_ */