📄 pmdriver.h
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
#ifndef _PMDRIVER_H_
#define _PMDRIVER_H_
#ifndef SHIP_BUILD
#define ZONE_ERROR DEBUGZONE(0)
#define ZONE_WARNING DEBUGZONE(1)
#define ZONE_VERBOSE DEBUGZONE(2)
#define ZONE_STATECHANGE DEBUGZONE(3)
#endif
// Battery voltage history for computing avg.
#define BATTERY_VOLTAGE_NUM_SAMPLES 5
// Maximum acceptable difference between readings (in mV)
#define BATTERY_VOLTAGE_MAX_DELTA 300
typedef struct
{
DWORD* pPCF50606Device;
HANDLE msgQueuePCFRead;
DWORD dwIndex;
DWORD* next;
} PCF50606OPEN, *PPCF50606OPEN;
typedef struct
{
DWORD dwBatteryVolatge; //mV
DWORD dwAverageBatteryVolatge; //mV
DWORD dwCurrentBatteryVoltage; //mV
DWORD dwBattVoltageIndex;
DWORD dwBattVoltageSamples;
DWORD dwBattVoltageDeltaPersist;
DWORD dwBattVoltageSampleArray[BATTERY_VOLTAGE_NUM_SAMPLES];
} PCFBATTERY, *PPCFBATTERY;
typedef struct
{
CRITICAL_SECTION csI2CAccess;
HANDLE msgQueuePCFWrite;
HANDLE msgQueuePMPOLICY;
HANDLE hevPCF50606Event;
DWORD dwOpenCount;
PPCF50606OPEN pOpenContextHead;
UCHAR pcfRegisterCache[64];
PCFBATTERY pcfBattery;
volatile XLLP_GPIO_T *v_pGPIORegs;
volatile XLLP_CLKMGR_T *v_pClkRegs;
volatile XLLP_OST_T *v_pOstRegs;
volatile XLLP_PI2C_T *v_pPI2CRegs;
volatile XLLP_I2C_T *v_pI2CRegs;
volatile XLLP_INTC_T *v_pIntcRegs;
} PCF50606, *PPCF50606;
#define WDTIME_VAL 0x01 // 3 min
#define WDT_BATT_TEST_MULTIPLE 20 // 20 x 3 min => 60 min between battery test.
DWORD
PDD_I2CWrite(LPCRITICAL_SECTION lpcsI2CAccess,
volatile XLLP_I2C_T *v_pI2CRegs,
volatile XLLP_OST_T *v_pOSTRegs,
UCHAR cRegisterAddress,
PUCHAR pBuffer,
DWORD Count);
DWORD
PDD_I2CRead(LPCRITICAL_SECTION lpcsI2CAccess,
volatile XLLP_I2C_T *v_pI2CRegs,
volatile XLLP_OST_T *v_pOSTRegs,
UCHAR cRegisterAddress,
PUCHAR bytesBuf,
DWORD Count);
BOOL
SendQueueMessage(HANDLE pMsgQueue,
LPVOID dwMessage,
DWORD dwSize);
void
StartCharger(PPCF50606 pPCF50606);
#endif //_PMDRIVER_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -