📄 wmcontrollink.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: WMControlLink.h 2569 2006-01-10 12:40:03Z fb $
*
* This file contains platform-independent routines for communicating with
* Wolfson codecs.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
*---------------------------------------------------------------------------*/
#ifndef __WMCONTROLLINK_H__
#define __WMCONTROLLINK_H__
/*
* Include files
*/
#include "WMTypes.h"
/*
* Definitions
*/
/*
* Get the index of a driver.
*/
#define DRIVER_TO_INDEX( _driver ) ((int)(_driver))
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* Function: WMLinkInit
*
* Initialises the use of the control link by a given driver.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* driverId The driver ID (e.g. WM_DRIVER_AUDIO)
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMLinkInit( WM_DEVICE_HANDLE hDevice, WM_DRIVER_ID driverId );
/*-----------------------------------------------------------------------------
* Function: WMLinkShutdown
*
* Marks the end of use of the control link by this driver.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* driverId The driver ID (e.g. WM_DRIVER_AUDIO)
*
* Returns: void
*---------------------------------------------------------------------------*/
void WMLinkShutdown( WM_DEVICE_HANDLE hDevice, WM_DRIVER_ID driverId );
/*-----------------------------------------------------------------------------
* Function: WMRead
*
* Reads the value from the given register.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to read from
* pValue variable to receive value
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMRead( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL *pValue
);
/*-----------------------------------------------------------------------------
* Function: WMWrite
*
* Writes the value to the given register.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* value value to write
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMWrite( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL value
);
/*-----------------------------------------------------------------------------
* Function: WMSetField
*
* Sets the given field of the given register to the given value.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* value value to write
* mask bitmask of field to update - only bits set
* to 1 in the mask will be updated
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMSetField( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL value,
WM_REGVAL mask
);
/*-----------------------------------------------------------------------------
* Function: WMClearField
*
* Sets the given field of the given register to 0.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* mask bitmask of field to clear - only bits set
* to 1 in the mask will be updated
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMClearField( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL mask
);
/*-----------------------------------------------------------------------------
* Function: WMSetBits
*
* Sets the given bits of the given register to 1.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* bits bitmask of bits to set
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
#define WMSetBits( hDevice, reg, bits ) WMSetField( hDevice, reg, bits, bits )
/*-----------------------------------------------------------------------------
* Function: WMClearBits
*
* Sets the given bits of the given register to 0.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* bits bitmask of field to clear - only bits set
* to 1 in the mask will be updated
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
#define WMClearBits( hDevice, reg, bits ) WMClearField( hDevice, reg, bits )
/*-----------------------------------------------------------------------------
* Function: WMReset
*
* Forces a cold reset of the device, restoring everything to its
* default startup condition.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMReset( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMWake
*
* Forces a warm reset of the device, waking it up again but leaving it
* in its previous state (with all the register settings as they were before
* the sleep).
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h.
*---------------------------------------------------------------------------*/
WMSTATUS WMWake( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMIsDefaultRegValue
*
* Check to see if this is the default register value.
* Note : This function will only work if shadow registers are defined in the
* approprate chipdef.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to check
* value current value to compare against default
*
* Returns: WM_BOOL
* TRUE if it is the default reg value, FALSE if not.
*---------------------------------------------------------------------------*/
WM_BOOL WMIsDefaultRegValue( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL value
);
#if WM_AUXADC && WM_STREAM_AUXADC
/*-----------------------------------------------------------------------------
* Function: WMPlatformReadCTCAuxADC
*
* Reads the next ADC value from the stream in continuous conversion mode (CTC).
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* pValue variable to receive value
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMPlatformReadCTCAuxADC( WM_DEVICE_HANDLE hDevice,
WM_REGVAL *pValue
);
#endif /* WM_AUXADC && WM_STREAM_AUXADC */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WMCONTROLLINK_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -