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

📄 wmgpio.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: WMGPIO.h 2410 2005-11-14 10:59:18Z fb $
 *
 * This file contains platform-independent routines for controlling GPIO on
 * Wolfson codecs.
 *
 * Warning:
 *  This driver is specifically written for Wolfson Codecs. It is not a 
 *  general CODEC device driver.
 *
 *---------------------------------------------------------------------------*/
#ifndef __WMGPIO_H__
#define __WMGPIO_H__

/*
 * Include files
 */
#include "WMTypes.h"
#include "WMGPIODefs.h"

/*
 * Definitions
 */

/*
 * Function prototypes
 */
#ifdef __cplusplus
extern "C" {
#endif

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOConfig
 *
 * Configure the GPIO direction as an input or and output.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to configure.
 *      direction           the direction of the GPIO.
 *                          WM_GPIO_OUTPUT to set it as an ouput.
 *                          WM_GPIO_INPUT to set it as an input.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOConfig( WM_DEVICE_HANDLE hDevice, 
                       WM_GPIO_PIN gpio,
                       unsigned short direction 
                     );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOSetInputPolarity
 *
 * Set the GPIO polarity.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to change.
 *      polarity            the polarity of the GPIO.
 *                          WM_GPIO_ACTIVE_HIGH for active high.
 *                          WM_GPIO_ACTIVE_LOW for active low.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOSetInputPolarity( WM_DEVICE_HANDLE hDevice, 
                                 WM_GPIO_PIN gpio,
                                 unsigned short polarity 
                               );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOEnableSticky
 *
 * Enable the GPIO sticky bit. The sticky bit is used by GPIOs that are set 
 * up as inputs to hold the status bit. 
 * The sticky bit is cleared by calling WMGPIOClearInput(). 
 *
 * Note: Both the global wake bit and the wake up bit of the GPIO must be set 
 *       for the sticky bit to work correctly.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to change.
 *      enable              set the sticky bit if TRUE, clear the sticky bit
 *                          if FALSE.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOEnableSticky( WM_DEVICE_HANDLE hDevice, 
                             WM_GPIO_PIN gpio,
                             WM_BOOL enable 
                           );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOEnableWakeUp
 *
 * Enable the GPIO WakeUp bit. The wake up bit allows the GPIO to do two things.
 * It can wake up the AC Link, if the codec is sleeping. 
 * It will also set bit 0 of slot 12, the GPIO interrupt (GPIO_INT) bit.
 *
 * Note: Both the global wake bit and the sticky bit of the GPIO must be set 
 *       for the wake up bit to work correctly.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to change.
 *      enable              set the wakeup bit set if TRUE, cleared if FALSE.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOEnableWakeUp( WM_DEVICE_HANDLE hDevice, 
                             WM_GPIO_PIN gpio,
                             WM_BOOL enable 
                           );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOEnableAlternateFunction
 *
 * Enables the GPIO to use its alternate function.
 * NOTE: This function call will only work with GPIOs that have alternate 
 *       functions.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to change.
 *      enable              Selects the alternative function if TRUE,
 *                          uses the GPIO if FALSE.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOEnableAlternateFunction( WM_DEVICE_HANDLE hDevice, 
                                        WM_GPIO_PIN gpio,
                                        WM_BOOL enable
                                      );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOInvertIRQ
 *
 * Set the IRQ signal to be inverted.
 * NOTE: This function assumes that GPIO2/IRQ has been configured for
 *       use as the alternate function IRQ.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      invert              inverted if TRUE, non-inverted if FALSE.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOInvertIRQ( WM_DEVICE_HANDLE hDevice, 
                          WM_BOOL invert
                        );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOEnableGlobalWake
 *
 * Enable the global GPIO wake-up. If any GPIO has both its sticky bit and
 * its wake up bit set, this allows the GPIO to do two things. It can wake up
 * the AC Link, if the codec is sleeping. It will also set bit 0 of slot 12, 
 * the GPIO interrupt (GPIO_INT) bit.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      enable              enabled if TRUE, disabled if FALSE.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOEnableGlobalWake( WM_DEVICE_HANDLE hDevice, 
                                 WM_BOOL enable
                               );


/*-----------------------------------------------------------------------------
 * Function:    WMGPIOSetOutputLevel
 *
 * If the GPIO is configured as an output, this function will set the level of
 * the GPIO.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to change.
 *      level               the level to set the GPIO to.
 *                          WM_GPIO_OUTPUT_HIGH to set it high.
 *                          WM_GPIO_OUTPUT_LOW to set it low.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOSetOutputLevel( WM_DEVICE_HANDLE hDevice, 
                               WM_GPIO_PIN gpio,
                               unsigned short level
                             );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOGetOutputLevel
 *
 * If the GPIO is configured as an output, this function will return the 
 * current level of the GPIO.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to check.
 *      pLevel              variable to receive GPIO level.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
*---------------------------------------------------------------------------*/
WMSTATUS WMGPIOGetOutputLevel( WM_DEVICE_HANDLE hDevice, 
                               WM_GPIO_PIN gpio,
                               unsigned short *pLevel
                             );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOIsSignalled
 *
 * Check to see if the input GPIO has been signalled. 
 * A GPIO is signalled when the level changes to match the GPIO's polarity.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to check.
 *
 * Returns:     WM_BOOL     TRUE if the status bit is set,
 *                          FALSE if the status bit is clear.
 *---------------------------------------------------------------------------*/
WM_BOOL WMGPIOIsSignalled( WM_DEVICE_HANDLE hDevice, 
                           WM_GPIO_PIN gpio
                         );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOClearInput
 *
 * Clear the status of the GPIO.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to clear.
 *
 * Returns:     WMSTATUS
 *		See WMStatus.h.
 *		<values/meanings>
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOClearInput( WM_DEVICE_HANDLE hDevice, 
                           WM_GPIO_PIN gpio
                         );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOHasAltFunc
 *
 * Does this GPIO have an alternate function.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to check.
 *
 * Returns:     WMSTATUS
 *                          WMS_RETURN_TRUE if the GPIO has an alternate
 *                          function.
 *                          WMS_RETURN_FALSE if the GPIO does not 
 *                          have an alternate function.
 *                          WMS_UNSUPPORTED if the GPIO is not available
 *                          on this device.
 *                          See WMStatus.h for all other values and meanings.
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOHasAltFunc( WM_DEVICE_HANDLE hDevice, 
                           WM_GPIO_PIN gpio
                         );

/*-----------------------------------------------------------------------------
 * Function:    WMGPIOHasVirtualGPIO
 *
 * Does this GPIO have a virtual GPIO function.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *      gpio                the GPIO to check.
 *
 * Returns:     WMSTATUS
 *                          WMS_RETURN_TRUE if the GPIO has a virtual
 *                          function.
 *                          WMS_RETURN_FALSE if the GPIO does not 
 *                          have a virtual function.
 *                          WMS_UNSUPPORTED if the GPIO is not available
 *                          on this device.
 *                          See WMStatus.h for all other values and meanings.
 *---------------------------------------------------------------------------*/
WMSTATUS WMGPIOHasVirtualGPIO( WM_DEVICE_HANDLE hDevice, 
                               WM_GPIO_PIN gpio
                             );


#ifdef __cplusplus
}   /* extern "C" */
#endif

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

⌨️ 快捷键说明

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