📄 wmplatformaclink.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: WMPlatformACLink.h 2357 2005-10-28 15:18:52Z ian $
*
* This file defines the platform-specific interface to the AC'97 required
* by the drivers for the Wolfson WM97xx AC'97 codecs.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
*---------------------------------------------------------------------------*/
#ifndef __WMPLATFORMACLINK_H__
#define __WMPLATFORMACLINK_H__
/*
* Include files
*/
#include "WMCommon.h"
#include "WMGlobals.h"
/*
* Definitions
*/
#define WMPlatformACLinkEnableController(_IpHandle) \
WMPlatformACLinkSetController(_IpHandle, TRUE)
#define WMPlatformACLinkDisableController(_IpHandle) \
WMPlatformACLinkSetController(_IpHandle, FALSE)
/*
* Global data.
*/
/* The global area of memory shared across all drivers */
extern volatile WM_SHARED_DATA *g_pWMData;
/*
* Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
/*-----------------------------------------------------------------------------
* These functions need to be re-written for each platform.
*/
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkInit
*
* Initialises the WM97xx platform-specific layer for the specific hardware
* and leaves it with the AC-Link up and running.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMPlatformACLinkInit( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkShutdown
*
* Shuts down the WM97xx platform-specific layer.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
void WMPlatformACLinkShutdown( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkRead
*
* 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 WMPlatformACLinkRead( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL *pValue
);
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkWrite
*
* Writes the value to the given register.
*
* Note: to clear GPIOs configured as interrupt sources (i.e. inputs held high
* by the sticky bit), use WM97PlatformClearGPIOs instead.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* reg register to write to
* value value to write
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMPlatformACLinkWrite( WM_DEVICE_HANDLE hDevice,
WM_REGTYPE reg,
WM_REGVAL value
);
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkClearGPIOInput
*
* Writes the given value to the GPIO status register on the codec, using
* slots 1 and 2 of the AC-link frame.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* regval the new value to write to the register. 0 clears sticky bits.
* Note: to preserve the values of output GPIOs, you must write
* the correct value to them (i.e. you cannot just write all
* zeroes if you have GPIO outputs).
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMPlatformACLinkClearGPIOInput( WM_DEVICE_HANDLE hDevice,
WM_REGVAL regval
);
#if WM_STREAM_AUXADC
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkReadCTCAuxADC
*
* 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 WMPlatformACLinkReadCTCAuxADC( WM_DEVICE_HANDLE hDevice,
WM_REGVAL *pValue
);
#endif /* WM_STREAM_AUXADC */
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkSetController
*
* Enables or disables the AC Link on the controller.
* After enabling a cold/warm reset must be performed for the link to come up.
* Before disabling the codec must be powered down.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
* enable Whether to enable the link.
*
* Returns: void
*---------------------------------------------------------------------------*/
void WMPlatformACLinkSetController( WM_DEVICE_HANDLE hDevice, WM_BOOL enable );
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkIsCodecReady
*
* Returns whether the AC link is enabled and available for reading and writing.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WM_BOOL
* TRUE if it's enabled.
*---------------------------------------------------------------------------*/
WM_BOOL WMPlatformACLinkIsCodecReady( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkColdReset
*
* Forces a cold reset of the WM97xx device, restoring everything to its
* default startup condition.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
WMSTATUS WMPlatformACLinkColdReset( WM_DEVICE_HANDLE hDevice );
/*-----------------------------------------------------------------------------
* Function: WMPlatformACLinkWarmReset
*
* Forces a warm reset of the WM97xx 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 WMPlatformACLinkWarmReset( WM_DEVICE_HANDLE hDevice );
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __WMPLATFORMACLINK_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -