⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmglobals.h

📁 pxa270平台 windows mobile 5.2 wm9713 触摸屏+音频驱动
💻 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: WMGlobals.h 3998 2006-10-03 13:00:37Z fb $
 *
 * Global data for Wolfson drivers.
 *
 * Warning:
 *  This driver is specifically written for Wolfson Codecs. It is not a 
 *  general CODEC device driver.
 *
 *---------------------------------------------------------------------------*/
#ifndef __WMGLOBALS_H__
#define __WMGLOBALS_H__

#include "WMCommon.h"
#include "WMCounters.h"
#include "WMAuxADC.h"

/*
 * The maximum number of drivers supported using the WDCL.
 */
#define WM_MAX_DRIVERS              8

/* 
 * The maximum number of power registers that we want to save in the global
 * registers. 
 */
#define MAX_GLOBAL_POWER_REGS		4

/*
 * The maximum number of registers that need to be shadowed.
 * Note: Currently the WM8753 has the most registers that
 *       need to be cached.
 */
#define WM_MAX_SHADOW_REGS          64    

/*
 * WM Globals area
 */

/*
 * Global flags.
 */
#define WM_POWERREG_VALID               0x02
#define WM_GPIO_CONFIGURED_AC97         0x04
#define WM_GPIO_CONFIGURED_I2S          0x08
#define WM_GPIO_CONFIGURED_HIFI         0x10
#define WM_GPIO_CONFIGURED_VOICE        0x20
#define WM_VOLUME_MUTED                 0x40

/*
 * ADC global data.
 */

/* The number of ADCs we can read */
#define ADC_COUNT   8

/* The touch history - first a point */
typedef struct tagWM_TOUCH_POINT
{
    WM_REGVAL       x;
    WM_REGVAL       y;
    int             matches;
    unsigned int    timestamp;
} WM_TOUCH_POINT;

/* And now the history */
typedef struct tagWM_TOUCH_HISTORY
{
    WM_TOUCH_POINT  points[WM_NUM_SAMPLES_PER_POINT];
    unsigned char   nextPoint;  /* Circular buffer pointer */
    unsigned char   lastPoint;  /* Circular buffer pointer */
    unsigned char   numPoints;  /* Number of points in buffer */
    unsigned char   rejected;   /* We reject the first few points */
} WM_TOUCH_HISTORY;

/* And the data */
typedef struct tagWM_ADC_DATA
{
    unsigned short      activeADCs;
    unsigned short      flags;
    WM_REGVAL           reading[ADC_COUNT];
    WM_REGVAL           lastReading[ADC_COUNT];
    WM_TOUCH_HISTORY    touchHistory;
} WM_ADC_DATA;

/* Flag definitions for the AUXADC driver */
#define WM_DRVCTX_AUXADC_INITIALISED      0x0001
#define WM_DRVCTX_AUXADC_STREAMING        0x0002
#define WM_DRVCTX_AUXADC_TOUCH_STREAMING  0x0004
#define WM_DRVCTX_AUXADC_ADC_STREAMING    0x0008
#define WM_TOUCH_HISTORY_PEN_DOWN         0x0010
#define WM_TOUCH_HISTORY_DEBOUNCING       0x0020

/*------------------------------------------------------------------------------
 * Audio global data.
 */

/* 
 * Defines for the position in the array that the
 * particular output PGA gain value is stored.
 */
#define WM_OUT_PGA_GAIN_HPL                0
#define WM_OUT_PGA_GAIN_HPR                1
#define WM_OUT_PGA_GAIN_SPKL               2
#define WM_OUT_PGA_GAIN_SPKR               3
#define WM_OUT_PGA_GAIN_MONO               4
#define WM_OUT_PGA_GAIN_OUT3               5
#define WM_OUT_PGA_GAIN_OUT4               6

#define WM_OUT_PGA_GAIN_HPL_INIT           ( 1U << WM_OUT_PGA_GAIN_HPL )
#define WM_OUT_PGA_GAIN_HPR_INIT           ( 1U << WM_OUT_PGA_GAIN_HPR )
#define WM_OUT_PGA_GAIN_SPKL_INIT          ( 1U << WM_OUT_PGA_GAIN_SPKL )
#define WM_OUT_PGA_GAIN_SPKR_INIT          ( 1U << WM_OUT_PGA_GAIN_SPKR )
#define WM_OUT_PGA_GAIN_MONO_INIT          ( 1U << WM_OUT_PGA_GAIN_MONO )
#define WM_OUT_PGA_GAIN_OUT3_INIT          ( 1U << WM_OUT_PGA_GAIN_OUT3 )
#define WM_OUT_PGA_GAIN_OUT4_INIT          ( 1U << WM_OUT_PGA_GAIN_OUT4 )

/*
 * The maximum number of output PGAs any device has.
 * Currently we have :
 * - Headphone Left
 * - Headphone Right
 * - Speaker Left
 * - Speaker Right
 * - Mono
 * - OUT3
 * - OUT4
 * A total of 7, but to keep the structure balanced
 * always use an even number.
 */
#define WM_OUT_PGA_COUNT                  8

typedef struct tagWM_AUDIO_DATA
{
    unsigned long   flags;
    unsigned short  mutes;
    unsigned short  streams;                /* 1U << stream */
    WM_SAMPLE_RATE  ADCRate;
    WM_SAMPLE_RATE  hifiDACRate;
    WM_SAMPLE_RATE  voiceDACRate;
    WM_SAMPLE_RATE  monoDACRate;
    unsigned long   outputPGAGainInit;
    int             outputPGAGain[WM_OUT_PGA_COUNT];
} WM_AUDIO_DATA;

/* Muting */
#define WM_MUTE_LINE_OUT                    (1U << WM_AUDIO_LINE_OUT)
#define WM_MUTE_SPEAKER                     (1U << WM_AUDIO_SPEAKER)
#define WM_MUTE_HEADPHONE                   (1U << WM_AUDIO_HEADPHONE)
#define WM_MUTE_MONO_OUT                    (1U << WM_AUDIO_MONO_OUT)
#define WM_MUTE_PHONE_OUT                   (1U << WM_AUDIO_PHONE_OUT)
#define WM_MUTE_EAR_SPEAKER                 (1U << WM_AUDIO_EAR_SPEAKER)

/* Enabled streams */
#define WM_STREAM_FLAG( _stream )           (1U << (_stream) )

/* Flags */
#define WM_AUDIO_BASS_BOOST                 0x00000001
#define WM_AUDIO_HIFI_CONFIGURED            0x00000010
#define WM_AUDIO_VOICE_CONFIGURED           0x00000020
#define WM_AUDIO_MONO_CONFIGURED            0x00000040
#define WM_AUDIO_HIFI_MASTER                0x00000100
#define WM_AUDIO_VOICE_MASTER               0x00000200

/*------------------------------------------------------------------------------
 * And now the parent structure holding all the global data
 */
typedef struct tagWM_SHARED_DATA
{   
    unsigned char   flags;   
    unsigned char   activeDrivers;

    unsigned short  powerStateFlags;  /* In/Out of sleep + Sleep state */
#if WM_CACHE_POWER_STATE
    WM_REGVAL       powerReg[ MAX_GLOBAL_POWER_REGS ];
    WM_POWERFLAG    powerRequirements[ WM_MAX_DRIVERS ];
    WM_POWERFLAG    WmPower;          /* Summary of what everyone wants powered up */
#else
    unsigned short  preSleepPower;    /* 1st device to enter sleep saves current power setting */
#endif

#if WM_AUXADC
    WM_ADC_DATA     adcData;
#endif

#if WM_AUDIO
    WM_AUDIO_DATA   audioData;
#endif

    WMCounters      Counters;

#if WM_USE_SHADOW_REGISTERS
    WM_REGVAL       shadowRegisters[ WM_MAX_SHADOW_REGS ];  
#endif /* WM_USE_SHADOW_REGISTERS */
} WM_SHARED_DATA;

/* powerStateFlags */
#define WM_ENTERING_SLEEP       0x0010  /* We are going to sleep */
#define WM_ASLEEP               0x0020  /* We are in sleep mode  */
#define WM_LEAVING_SLEEP        0x0040  /* We are waking up      */

#endif   /* __WMGLOBALS_H__ */
/*------------------------------ END OF FILE ---------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -