📄 wmconfiginternal.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: WMConfigInternal.h 2563 2005-12-21 17:06:11Z ian $
*
* Header file containing configuration options for the Wolfson drivers.
*
* These configuration options take the form of preprocessor symbols which
* are generally either defined or not defined. They can either be defined
* in this file by uncommenting them, or can be defined in the build (e.g.
* in the make file or on the build command line).
*
* This file is used to configure the library based on WMConfig.h and
* WMPlatformConfig.h .
*
* NOTE: If you need to change the configuration of the library you should
* change either WMConfig.h or WMPlatformConfig.h and NOT this file.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
*---------------------------------------------------------------------------*/
#ifndef __WMCONFIGINTERNAL_H__
#define __WMCONFIGINTERNAL_H__
/*
* Include files.
*/
/******************************************************************************
* Some checks and combinations. You should not edit anything past this point.
*/
/******************************************************************************
* Build configuration.
*/
#ifndef WM_INLINE_FUNCTIONS
# define WM_INLINE_FUNCTIONS FALSE
#endif
/*
* The template code turns off AC97 and I2S. This causes build errors.
* To check the template code, we need a way of turning these on again
* internally.
*/
#if defined( WM_INTERNAL_BUILD ) && defined( WM_TEMPLATE_BUILD )
# undef WM_AC97
# define WM_AC97 TRUE
# undef WM_I2S
# define WM_I2S TRUE
# undef WM_VOICE
# define WM_VOICE TRUE
# undef WMDMA_DMA_STORE_DEBUG
# define WMDMA_DMA_STORE_DEBUG TRUE
#endif
/*
* Software-equivalent products. These have the same programming interface,
* and only differ in the features which are included, or in hardware-level
* differences.
*/
/* Intialise self-contained #defines */
# define WM_MULTIPLE_CHIP_SUPPORT FALSE
# define WM9705_FAMILY FALSE
# define WM9707_FAMILY FALSE
# define WM9712_FAMILY FALSE
# define WM9713_FAMILY FALSE
# define WMI2S_FAMILY FALSE
# define WMI2S_GENERIC_FAMILY FALSE
# define WM8731_FAMILY FALSE
# define WM8753_FAMILY FALSE
#if WM9705 || WM9710
# undef WM9705_FAMILY
# define WM9705_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULTIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM9705
# endif
#endif
#if WM9703 || WM9707 || WM9708 || WM9717
# undef WM9707_FAMILY
# define WM9707_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULTIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM9707
# endif
#endif
#if WM9711 || WM9712
# undef WM9712_FAMILY
# define WM9712_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULTIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM9712
# endif
#endif
#if WM9713 || WM9714
# undef WM9713_FAMILY
# define WM9713_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULTIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM9713
# endif
#endif
#if WMI2S_GENERIC
# undef WMI2S_FAMILY
# define WMI2S_FAMILY TRUE
# undef WMI2S_GENERIC_FAMILY
# define WMI2S_GENERIC_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WMI2S_7BIT_ADDR
# endif
#else
# undef WMI2S_GENERIC
#endif
/* WM8731 only supports certain MCLK rates */
#if WM8711 || WM8721 || WM8731 || WM8734
# if 12288000 == WM_MCLK_FREQUENCY || 18432000 == WM_MCLK_FREQUENCY || \
11289600 == WM_MCLK_FREQUENCY || 16934400 == WM_MCLK_FREQUENCY || \
12000000 == WM_MCLK_FREQUENCY
# undef WM8731_FAMILY
# define WM8731_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM8731
# endif
# else
# undef WM8731
# endif
#endif
#if WM8753
# undef WM8753_FAMILY
# define WM8753_FAMILY TRUE
# if defined( WM_CHIP_FAMILY ) || WM_MULTIPLE_CHIP_SUPPORT
# if !WM_MULIPLE_CHIP_SUPPORT
# undef WM_MULTIPLE_CHIP_SUPPORT
# define WM_MULTIPLE_CHIP_SUPPORT TRUE
# endif
# undef WM_CHIP_FAMILY
# else
# define WM_CHIP_FAMILY WM_CHIP_WM8753
# endif
#endif
/*
* Make sure we're supporting something.
*/
#if !WM9705_FAMILY && !WM9707_FAMILY && \
!WM9712_FAMILY && !WM9713_FAMILY && \
!WM8731_FAMILY && !WM8753_FAMILY && \
!WMI2S_FAMILY
# error Please specify at least one device.
#endif
#if WM9705_FAMILY || WM9707_FAMILY || WM9712_FAMILY || WM9713_FAMILY
# ifdef WM_AC97
# if !WM_AC97
/* The platform does not appear to support AC97 which these devices need */
# error The WM97XX family of devices need to use AC97
# endif
# else
# define WM_AC97 TRUE
# endif
#else
# undef WM_AC97
# define WM_AC97 FALSE
#endif
#if WMI2S_FAMILY || WM8731_FAMILY || WM8753_FAMILY
# ifdef WM_I2S
# if !WM_I2S
/* The platform does not appear to support I2S which these devices need */
# error The generic Wolfson I2S family and the WM87XX family of devices need to use I2S
# endif
# else
# define WM_I2S TRUE
# endif
# if WM8731_FAMILY || WM8753_FAMILY
# if !WM_USE_SHADOW_REGISTERS
# error The generic Wolfson I2S family and the WM87xx devices require shadow registers. Please define WM_USE_SHADOW_REGISTERS as TRUE
# endif
# endif
#else
# undef WM_I2S
# define WM_I2S FALSE
#endif
/* The family define checks should ensure that this never happens */
#if !WM_AC97 && !WM_I2S
# error Please specify at least one of AC97 or I2S
#endif
/*
* An efficient way of working out the device type if we've only got one.
*/
#if WM_MULTIPLE_CHIP_SUPPORT
# define WM_DEVICE_TYPE( _hDevice ) WMHANDLE_TO_DEVICE( _hDevice )->deviceType
#else
# define WM_DEVICE_TYPE( _hDevice ) WM_CHIP_FAMILY
#endif
/*
* The following set of definitions allow us to do device-checking in a way
* which makes it easy for the compiler to optimise where possible.
*
* The set of macros IS_WMxxxx_FAMILY() have the following behaviour.
*
* 1) If the library is not compiled with support for that device, it's an automatic
* failure (equates to 0).
*
* 2a) If the library is compiled with support for only that device, it's an automatic
* pass (equates to 1).
*
* 2b) If the library is compiled with support for multiple devices, including that
* device, it needs to check the device type in the device context.
*/
/* _WM_CHIPCHECK encapsulates the decision between 2a and 2b above */
#define _WM_CHIPCHECK( _chip, _hDevice ) ( _chip == WM_DEVICE_TYPE( _hDevice ) )
/* Now each macro decides between case 1 and case 2(a or b) above */
/* WM9705 family */
#if WM9705_FAMILY
# define IS_WM9705_FAMILY( _hDevice ) _WM_CHIPCHECK( WM_CHIP_WM9705, _hDevice )
# define IS_WM9705_FAMILY_ID( _ID ) ( WM_CHIP_WM9705 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM9705_FAMILY( _hDevice ) FALSE
# define IS_WM9705_FAMILY_ID( _ID ) FALSE
#endif
/* WM9707 family */
#if WM9707_FAMILY
# define IS_WM9707_FAMILY( _hDevice ) _WM_CHIPCHECK( WM_CHIP_WM9707, _hDevice )
# define IS_WM9707_FAMILY_ID( _ID ) ( WM_CHIP_WM9707 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM9707_FAMILY( _hDevice ) FALSE
# define IS_WM9707_FAMILY_ID( _ID ) FALSE
#endif
/* WM9712 family */
#if WM9712_FAMILY
# define IS_WM9712_FAMILY( _hDevice ) _WM_CHIPCHECK( WM_CHIP_WM9712, _hDevice )
# define IS_WM9712_FAMILY_ID( _ID ) ( WM_CHIP_WM9712 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM9712_FAMILY( _hDevice ) FALSE
# define IS_WM9712_FAMILY_ID( _ID ) FALSE
#endif
/* WM9713 family */
#if WM9713_FAMILY
# define IS_WM9713_FAMILY( _hDevice ) _WM_CHIPCHECK( WM_CHIP_WM9713, _hDevice )
# define IS_WM9713_FAMILY_ID( _ID ) ( WM_CHIP_WM9713 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM9713_FAMILY( _hDevice ) FALSE
# define IS_WM9713_FAMILY_ID( _ID ) FALSE
#endif
/* WMI2S_GENERIC family */
#if WMI2S_GENERIC_FAMILY
# define IS_WMI2S_GENERIC_FAMILY( _hDevice ) ( _WM_CHIPCHECK( WM_CHIP_WMI2S_7BIT_ADDR , _hDevice ) || \
_WM_CHIPCHECK( WM_CHIP_WMI2S_8BIT_ADDR , _hDevice ) )
# define IS_WMI2S_GENERIC_FAMILY_ID( _ID ) ( WM_CHIP_WMI2S_7BIT_ADDR == WM_DEV_GET_CHIP( _ID ) || \
WM_CHIP_WMI2S_8BIT_ADDR == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WMI2S_GENERIC_FAMILY( _hDevice ) FALSE
# define IS_WMI2S_GENERIC_FAMILY_ID( _ID ) FALSE
#endif
/* WM8731 family - includes codecs WM8731 and WM8734 and DACs WM8711 and WM8721 */
#if WM8731_FAMILY
# define IS_WM8731_FAMILY( _hDevice ) ( _WM_CHIPCHECK( WM_CHIP_WM8711, _hDevice ) || \
_WM_CHIPCHECK( WM_CHIP_WM8731, _hDevice ) )
# define IS_WM8731_FAMILY_ID( _ID ) ( WM_CHIP_WM8711 == WM_DEV_GET_CHIP( _ID ) || \
WM_CHIP_WM8731 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM8731_FAMILY( _hDevice ) FALSE
# define IS_WM8731_FAMILY_ID( _ID ) FALSE
#endif
/* WM8753 family */
#if WM8753_FAMILY
# define IS_WM8753_FAMILY( _hDevice ) _WM_CHIPCHECK( WM_CHIP_WM8753, _hDevice )
# define IS_WM8753_FAMILY_ID( _ID ) ( WM_CHIP_WM8753 == WM_DEV_GET_CHIP( _ID ) )
#else
# define IS_WM8753_FAMILY( _hDevice ) FALSE
# define IS_WM8753_FAMILY_ID( _ID ) FALSE
#endif
/*
* Revision number tests:
* EQUALS: exact match
* BELOW: revision is less than test
* ATMOST: revision less than or equal to test
* ATLEAST: revision greater than or equal to test
* ABOVE: revision greater than test
*/
#define WM_REVISION_EQUALS( _hDevice, _revision ) \
( (_revision) == WMHANDLE_TO_DEVICE( _hDevice )->revision )
#define WM_REVISION_BELOW( _hDevice, _revision ) \
( WMHANDLE_TO_DEVICE( _hDevice )->revision < (_revision) )
#define WM_REVISION_ATMOST( _hDevice, _revision ) \
( WMHANDLE_TO_DEVICE( _hDevice )->revision <= (_revision) )
#define WM_REVISION_ATLEAST( _hDevice, _revision ) \
( WMHANDLE_TO_DEVICE( _hDevice )->revision >= (_revision) )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -