📄 wmtesthelpers.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: WMTestHelpers.h 2656 2006-01-27 08:03:53Z fb $
*
* Helper functions for our testing.
*
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
* ---------------------------------------------------------------------------*/
#ifndef __WMTESTHELPERS_H__
#define __WMTESTHELPERS_H__
/*
* Include files
*/
/*
* Only build this if we are asked to.
*/
#if WM_TESTING
/*
* Global definitions
*/
/*
* The maximum number of registers for any of the
* devices.
*/
#define MAX_REGISTER_COUNT WM97_REGISTER_COUNT
/*
* Structure to save the value of a register
* and also mark if that value is from a valid
* register.
*/
typedef struct
{
WM_REGVAL value;
WM_BOOL valid;
} savedRegister;
/*
* Private data
*/
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* Function: WMTest_SaveState
*
* Helper function for the tests - gets the current register settings and
* global state for restoring after the test.
* If WM_CACHE_POWER_STATE is defined as TRUE this function will also
* save the cached power settings.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* pSavedRegs array to receive the valid register values
* powerRegs array of size MAX_GLOBAL_POWER_REGS to receive
* the power register values
* powerRequirements array of size WM_MAX_DRIVERS to receive
* each driver's power requirements
* WmPower what everyone wants to be powered up.
*
* Returns: WM_BOOL
* TRUE iff it worked.
*---------------------------------------------------------------------------*/
WM_BOOL WMTest_SaveState( WM_DEVICE_HANDLE hDevice,
savedRegister *pSavedRegs,
WM_REGVAL *powerRegs,
WM_POWERFLAG *powerRequirements,
WM_POWERFLAG *WmPower
);
/*-----------------------------------------------------------------------------
* Function: WMTest_RestoreState
*
* Restores a previously saved set of register settings and global state.
* If WM_CACHE_POWER_STATE is defined as TRUE this function will also
* restore the cached power settings.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* pSavedRegs array containing the valid register values
* powerRegs array containing the power register values
* powerRequirements array containing each driver's power requirements
* WmPower what everyone wants to be powered up.
*
* Returns: WM_BOOL
* TRUE iff it worked.
*---------------------------------------------------------------------------*/
WM_BOOL WMTest_RestoreState( WM_DEVICE_HANDLE hDevice,
const savedRegister *pSavedRegs,
WM_REGVAL *powerRegs,
WM_POWERFLAG *powerRequirements,
WM_POWERFLAG *WmPower
);
/*-----------------------------------------------------------------------------
* Function: WMTest_TraceRegisters
*
* Helper function for the tests - prints the contents of all registers.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WM_BOOL
* TRUE iff it worked.
*---------------------------------------------------------------------------*/
WM_BOOL WMTest_TraceRegisters( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMTest_CheckRegisters
*
* Helper function for the tests - checks that the current register settings
* match those provided.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* pRegisters array of expected register values
*
* Returns: WM_BOOL
* TRUE iff it worked.
*---------------------------------------------------------------------------*/
WM_BOOL WMTest_CheckRegisters( WM_DEVICE_HANDLE hDevice,
const WM_REGVAL *pExpected
);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* WM_TESTING */
#endif /* __WMTESTHELPERS_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -