2012-07-04 19:28:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2012, Haiku, Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _CPUIDLE_MODULE_H
|
|
|
|
#define _CPUIDLE_MODULE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <module.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define CPUIDLE_CSTATE_MAX 8
|
|
|
|
#define CSTATE_NAME_LENGTH 32
|
2012-08-04 18:12:40 +04:00
|
|
|
#define B_CPUIDLE_MODULE_NAME "generic/cpuidle/v1"
|
2012-07-04 19:28:43 +04:00
|
|
|
|
|
|
|
|
2012-07-07 15:41:27 +04:00
|
|
|
struct CpuidleStat {
|
2012-07-04 19:28:43 +04:00
|
|
|
uint64 usageCount;
|
|
|
|
bigtime_t usageTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct CpuidleInfo {
|
2012-07-07 15:41:27 +04:00
|
|
|
int32 cstateSleep;
|
|
|
|
CpuidleStat stats[CPUIDLE_CSTATE_MAX];
|
2012-07-04 19:28:43 +04:00
|
|
|
};
|
|
|
|
|
2012-08-04 18:12:40 +04:00
|
|
|
struct CpuidleDevice;
|
2012-07-04 19:28:43 +04:00
|
|
|
|
|
|
|
struct CpuidleCstate {
|
|
|
|
char name[CSTATE_NAME_LENGTH];
|
|
|
|
int32 latency;
|
2012-08-04 18:12:40 +04:00
|
|
|
int32 (*EnterIdle)(int32 state, CpuidleDevice *device);
|
2012-07-04 19:28:43 +04:00
|
|
|
void *pData;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-04 18:12:40 +04:00
|
|
|
struct CpuidleDevice {
|
2012-07-04 19:28:43 +04:00
|
|
|
CpuidleCstate cStates[CPUIDLE_CSTATE_MAX];
|
|
|
|
int32 cStateCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-04 18:12:40 +04:00
|
|
|
struct CpuidleModuleInfo {
|
2012-07-07 17:52:56 +04:00
|
|
|
module_info info;
|
2012-08-04 18:12:40 +04:00
|
|
|
status_t (*AddDevice)(CpuidleDevice *device);
|
2012-07-07 17:52:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-07-04 19:28:43 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _CPUIDLE_MODULE_H
|