📄 wmpower.h
字号:
/*-----------------------------------------------------------------------------
* Copyright (c) Wolfson Microelectronics plc. All rights reserved.
*
* This software as well as any related documentation is furnished under
* license and may only be used or copied in accordance with the terms of the
* license. The information in this file is furnished for informational use
* only, is subject to change without notice, and should not be construed as
* a commitment by Wolfson Microelectronics plc. Wolfson Microelectronics plc
* assumes no responsibility or liability for any errors or inaccuracies that
* may appear in this document or any software that may be provided in
* association with this document.
*
* Except as permitted by such license, no part of this document may be
* reproduced, stored in a retrieval system, or transmitted in any form or by
* any means without the express written consent of Wolfson Microelectronics plc.
*
* $Id: WMPower.h 1828 2005-06-14 15:14:38Z ib $
*
* This file contains functionality for controlling power on wolfson codecs.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
*---------------------------------------------------------------------------*/
#ifndef __WMPOWER_H__
#define __WMPOWER_H__
/*
* Include files
*/
#include "WMTypes.h"
/*
* Definitions
*/
/*
* Power codes for powering up and off different sections.
*/
typedef unsigned short WM_POWERFLAG;
#define WM_POWER_ALL 0xFFFF
#define WM_POWER_NONE 0x0000
#define WM_POWER_LINK 0x0001
/* Audio sections */
#define WM_POWER_AUDIO 0x0FFE
#define WM_POWER_CLOCK 0x0002
#define WM_POWER_MIXERS 0x0004
#define WM_POWER_VREF 0x0008
#define WM_POWER_AUDIO_HIFI_ADC 0x0010
#define WM_POWER_AUDIO_HIFI_DAC_L 0x0020
#define WM_POWER_AUDIO_HIFI_DAC_R 0x0040
#define WM_POWER_AUDIO_VOICE_DAC 0x0080
#define WM_POWER_AUDIO_MONO_DAC 0x0100
#define WM_POWER_OUTPUTS 0x0200
#define WM_POWER_INPUTS 0x0400
#define WM9712_POWER_OUT2 WM_POWER_MIXERS
#define WM_POWER_AUDIO_HIFI_DAC ( WM_POWER_AUDIO_HIFI_DAC_L | \
WM_POWER_AUDIO_HIFI_DAC_R )
#define WM_POWER_AUDIO_ADCS WM_POWER_AUDIO_HIFI_ADC
#define WM_POWER_AUDIO_ADC WM_POWER_AUDIO_ADCS /* Deprecated should use WM_POWER_AUDIO_HIFI_ADCS */
#define WM_POWER_AUDIO_DACS ( WM_POWER_AUDIO_HIFI_DAC | \
WM_POWER_AUDIO_VOICE_DAC | \
WM_POWER_AUDIO_MONO_DAC )
#define WM_POWER_AUDIO_DAC WM_POWER_AUDIO_DACS /* Deprecated should use WM_POWER_AUDIO_DACS */
#define WM_POWER_AUDIO_FAST ( WM_POWER_MIXERS | \
WM_POWER_AUDIO_ADC | \
WM_POWER_AUDIO_DAC | \
WM_POWER_INPUTS | \
WM_POWER_OUTPUTS )
#define WM_POWER_AUDIO_PLAYBACK ( WM_POWER_MIXERS | \
WM_POWER_AUDIO_DACS | \
WM_POWER_INPUTS | \
WM_POWER_OUTPUTS )
#define WM_POWER_AUDIO_RECORD ( WM_POWER_MIXERS | \
WM_POWER_AUDIO_ADCS | \
WM_POWER_INPUTS | \
WM_POWER_OUTPUTS )
/* Touch and ADC sections */
#define WM_POWER_AUXADC_DIGITISER 0x1000
#define WM_POWER_PEN_DETECT 0x2000
#define WM_POWER_PEN_DETECTED 0x4000
#define WM_POWER_AUXADC WM_POWER_AUXADC_DIGITISER
#define WM_POWER_TOUCH (WM_POWER_AUXADC | WM_POWER_PEN_DETECT | WM_POWER_PEN_DETECTED)
/*
* Power Reg defines
*/
#define PWR_REG_1 0
#define PWR_REG_2 1
#define PWR_REG_3 2
#define PWR_REG_4 3
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* Function: WMPowerUp
*
* Called to power up the specific sections of the chip on behalf of this
* driver.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* driverId The driver ID (e.g. WM_DRIVER_TOUCH)
* powerSections The sections to power up.
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMPowerUp( WM_DEVICE_HANDLE hDevice,
WM_DRIVER_ID driverId,
WM_POWERFLAG powerSections
);
/*-----------------------------------------------------------------------------
* Function: WMPowerDown
*
* Called to power down the specific sections of the chip on behalf of this
* driver. Note if the driver can tell that the sections are still in use
* by another driver they will not actually be powered down.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* driverId The driver ID (e.g. WM_DRIVER_TOUCH)
* powerSections The sections to power down.
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMPowerDown( WM_DEVICE_HANDLE hDevice,
WM_DRIVER_ID driverId,
WM_POWERFLAG powerSections
);
/*-----------------------------------------------------------------------------
* Function: WMGetCurrentPowerState
*
* Returns the current power state - either cached or by looking at the register.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WM_POWERFLAG
* The current power state.
*---------------------------------------------------------------------------*/
WM_POWERFLAG WMGetCurrentPowerState( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: calcPowered
*
* Works out what should currently be powered up, based on what all the drivers
* are requesting and the various dependencies.
*
* NB This function only makes sense if we have global data pointer.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* driverId The device ID (e.g. WM_DRIVER_TOUCH)
* powerUp The sections to power up.
* powerDown The sections to power down.
* pCurrentPower A pointer to receive the current power state.
*
* Returns: WM_POWERFLAG
* The bitmask describing the sections which should be powered up.
*---------------------------------------------------------------------------*/
WM_POWERFLAG calcPowered( WM_DEVICE_HANDLE hDevice,
WM_DRIVER_ID driverId,
WM_POWERFLAG powerUp,
WM_POWERFLAG powerDown,
WM_POWERFLAG *pCurrentPower
);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WMPOWER_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -