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

📄 wmplatform.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: WMPlatform.h 2326 2005-10-20 08:40:38Z ib $
 *
 * Common definitions to hide operating system differences.
 *
 *
 * Warning:
 *  This driver is specifically written for Wolfson Codecs. It is not a 
 *  general CODEC device driver.
 *
 *---------------------------------------------------------------------------*/
#ifndef __WMPLATFORM_H__
#define __WMPLATFORM_H__

/*
 * Include files
 */
/* The hardware layer */
#include "WMPlatformDefs.h"
#include "WMDeviceContext.h"

/*
 * Note we don't include WMPlatform_OS.h because most files which include 
 * WMPlatform.h are "cross-platform" (i.e. multiple operating systems) so
 * we can't include operating-system-specific files in it.
 */

/*
 * Global definitions
 */

/*
 * Make sure this exists.
 */
#ifndef NULL
#   define NULL 0
#endif

#ifdef __cplusplus
#	define WM_INLINE	inline
#else
#	define WM_INLINE	__inline
#endif

/*
 * Debugging
 */

#ifdef DEBUG
#   define WM_TRACE( _hDevice, args )  do                                      \
    {                                                                          \
        if ( WMSystemCallsAllowed( _hDevice ) )                                \
            WMTrace args;                                                      \
    } while ( 0 )
#   define WM_ASSERT( _hDevice, _cond ) if (!(_cond))                          \
    {                                                                          \
        WMDebugAssert( _hDevice, __FILE__, __LINE__, #_cond );                 \
    }
#else /* of DEBUG */
#   define WM_TRACE( hDevice, args ) 
#   define WM_ASSERT( hDevice, _cond )
#endif

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

/*
 * General Initialisation and shutdown.
 */

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformAllocateDeviceContext
 *
 * Returns a pointer to a device context for passing to the Raw functions.
 *
 * Parameters:
 *      devID       The device ID (e.g. WM_DEV_AC97_PRIMARY)
 *      ppContext   a variable to receive the pointer to the context structure.
 *
 * Returns:     WMSTATUS
 *        See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMPlatformAllocateDeviceContext( WM_DEVICE_ID      devID,
                                          WM_DEVICE_CONTEXT **ppContext
                                        );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformFreeDeviceContext
 *
 * Frees the device context.
 *
 * Parameters:
 *      hDevice             handle to the device
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformFreeDeviceContext( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformAllocatePlatformMemory
 *
 * Allocates and maps platform-specific memory (e.g. controller registers).
 *
 * This must do the following:
 * 
 *  - do any platform-specific allocation or mapping to allow access to
 *    (e.g.) controller registers, DMA, etc.
 * 
 * Note this function may get called multiple times for a given device
 * context, as different drivers load.  It should check whether each
 * allocation has already been done.
 * 
 * Parameters:
 *      hDevice     handle to the device
 *      driverID    The driver ID (e.g. WM_DRIVER_AUDIO)
 *
 * Returns:     WMSTATUS
 *        See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMPlatformAllocatePlatformMemory( WM_DEVICE_HANDLE  hDevice,
                                           WM_DRIVER_ID      driverID
                                         );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformFreePlatformMemory
 *
 * Frees and unmaps platform-specific memory (e.g. controller registers).
 *
 * Parameters:
 *      hDevice             handle to the device
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformFreePlatformMemory( WM_DEVICE_HANDLE hDevice );

/*
 * Timing functions.
 */

/*-----------------------------------------------------------------------------
 * Function:    GetMillisecondTimestamp
 *
 * Returns a 32-bit number containing the number of milliseconds since an
 * arbitrary point.  This is used for relative comparisons.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     unsigned int
 *      The timestamp.
 *---------------------------------------------------------------------------*/
unsigned int GetMillisecondTimestamp( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    MicroSleep
 *
 * Sleeps for the given number of microseconds, yielding if possible.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      microSeconds    The number of microseconds to sleep.
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void MicroSleep( WM_DEVICE_HANDLE hDevice, unsigned microSeconds );

/*-----------------------------------------------------------------------------
 * Function:    MilliSleep
 *
 * Sleeps for the given number of milliseconds, yielding if possible.
 *
 * Parameters:
 *      hDevice         handle to the device (from WMOpenDevice)
 *      milliSeconds    The number of milliseconds to sleep.
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void MilliSleep( WM_DEVICE_HANDLE hDevice, unsigned milliSeconds );

/*-----------------------------------------------------------------------------
 * Function: WMPlatformOutputToHexLeds
 * 
 * Purpose: Output a value to the hex leds 
 *  
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice).
 *      value       value to output to the hex leds.
 *
 * Returns:      void.
 *
 ----------------------------------------------------------------------------*/
void WMPlatformOutputToHexLeds( WM_DEVICE_HANDLE hDevice, unsigned long value );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformEnterSleep
 *
 * Enters sleep mode - powers down the device and does any state preservation
 * needed for restoring later.
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformEnterSleep( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformLeaveSleep
 *
 * Leaves sleep mode - powers the device back on again and restores any
 * settings which couldn't be preserved.
 *
 * Parameters:
 *      hDevice     handle to the device (from WMOpenDevice)
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformLeaveSleep( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformConfigureTouchGPIO
 *
 * This function configures the GPIO pins for the touch panel.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMPlatformConfigureTouchGPIO( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformUnconfigureTouchGPIO
 *
 * This function unconfigures the GPIO pins for the touch driver.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     WMSTATUS
 *      See WMStatus.h
 *---------------------------------------------------------------------------*/
WMSTATUS WMPlatformUnconfigureTouchGPIO( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformIsTouchGPIOSignalled
 *
 * This function returns whether the touch GPIO line is currently indicating
 * pen down.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     WM_BOOL
 *      TRUE    - pen detect GPIO is signalled.
 *      FALSE   - pen detect GPIO not signalled.
 *---------------------------------------------------------------------------*/
WM_BOOL WMPlatformIsTouchGPIOSignalled( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformEnableAmplifiers
 *
 * This function enables the onboard op amps.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformEnableAmplifiers( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMPlatformDisableAmplifiers
 *
 * This function disables the onboard op amps.
 *
 * Parameters:
 *      hDevice             handle to the device (from WMOpenDevice)
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMPlatformDisableAmplifiers( WM_DEVICE_HANDLE hDevice );

/*-----------------------------------------------------------------------------
 * Function:    WMFormatString
 *
 * This function returns a formatted string 
 * in the output parameter.
 *
 * Parameters:
 *      output  The formatted string.
 *		format  The format string.
 *      ...     Format parameters
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMFormatString( char * output, const char *format, ... );

#if defined(DEBUG) || WM_TESTING
/*-----------------------------------------------------------------------------
 * Function:    WMTrace
 *
 * Outputs a debug message on its own line.  This should append a carriage
 * return if the underlying trace mechanism does not.
 *
 * NB This function should only be called if system calls are allowed.  It does
 * no checking of its own.  The WM_TRACE macro makes the check and should
 * always be used instead if there is any doubt.
 *
 * Parameters:
 *		format  The format string.
 *      ...     Format parameters
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMTrace( const char *format, ... );

/*-----------------------------------------------------------------------------
 * Function:    WMDebugAssert
 *
 * Outputs a message if it is safe to do so (WMSystemCallsAllowed(hDevice) is
 * TRUE or hDevice is NULL).  Throws a debug exception, or loops infinitely
 * if that's not possible.
 *
 * Parameters:
 *      hDevice handle to the device (from WMOpenDevice), or NULL if
 *              not available.
 *      file    Source file of assertion (from __FILE__)
 *      line    Source line of assertion (from __LINE__)
 *      text    The textual form of the assertion.
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMDebugAssert( WM_DEVICE_HANDLE hDevice,
                    const char *file,
                    int line,
                    const char *text
                  );

/*-----------------------------------------------------------------------------
 * Function:    WMDebugBreakpoint
 *
 * Puts a breakpoint into the code.
 *
 * Parameters:
 *      none
 *
 * Returns:     void
 *---------------------------------------------------------------------------*/
void WMDebugBreakpoint();

#endif /* DEBUG || WM_TESTING */

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

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

⌨️ 快捷键说明

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