1/*
2 * Copyright 2012, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _CPUIDLE_MODULE_H
6#define _CPUIDLE_MODULE_H
7
8
9#include <module.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define CPUIDLE_CSTATE_MAX	8
16#define CSTATE_NAME_LENGTH	32
17#define B_CPUIDLE_MODULE_NAME "generic/cpuidle/v1"
18
19
20struct CpuidleStat {
21	uint64		usageCount;
22	bigtime_t	usageTime;
23};
24
25
26struct CpuidleInfo {
27	int32		cstateSleep;
28	CpuidleStat	stats[CPUIDLE_CSTATE_MAX];
29};
30
31struct CpuidleDevice;
32
33struct CpuidleCstate {
34	char	name[CSTATE_NAME_LENGTH];
35	int32	latency;
36	int32	(*EnterIdle)(int32 state, CpuidleDevice *device);
37	void	*pData;
38};
39
40
41struct CpuidleDevice {
42	CpuidleCstate	cStates[CPUIDLE_CSTATE_MAX];
43	int32			cStateCount;
44};
45
46
47struct CpuidleModuleInfo {
48	module_info	info;
49	status_t	(*AddDevice)(CpuidleDevice *device);
50};
51
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif		// _CPUIDLE_MODULE_H
58