📄 wminterrupts_raw.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: WMInterrupts_Raw.h 1944 2005-07-28 13:41:05Z fb $
*
* This file contains XScale Interrupt-handling functionality for the drivers for
* the Wolfson chips.
*
* Warning:
* This driver is specifically written for Wolfson Codecs. It is not a
* general CODEC device driver.
*
* This platform file is specifically designed to work with the Lubbock and
* Mainstone XScale platforms from Intel. There is no guarantee of correct
* operation with other platforms/controllers.
*
* -----------------------------------------------------------------------------*/
#ifndef __WMINTERRUPTS_RAW_H__
#define __WMINTERRUPTS_RAW_H__
/*
* The interrupt functions have two modes of operation. They can either be
* used as macros or as functions. To use them as macros and avoid the overhead
* of a function call, define WM_INLINE_FUNCTIONS before including this file.
*
* All these macros/functions must be callable at interrupt-level. I.e. they
* must not make any system calls or use paged memory. They should be very
* quick in operation - the whole system is probably stopped waiting for them
* to complete.
*/
/*
* Include files
*/
#include "WMPlatform_Raw.h"
#include "WMPlatformDeviceContext.h"
/*
* Private data
*/
/*
* DMA channels - used for detecting which channel generated an interrupt.
*/
#define WMDMAC_HIFIAUDIOXMIT ( 0x1 << WMDMA_STEREO_OUT )
#define WMDMAC_HIFIAUDIORCV ( 0x1 << WMDMA_STEREO_IN )
#if WM_VOICE
#define WMDMAC_VOICEAUDIOXMIT ( 0x1 << WMDMA_VOICE_OUT )
#define WMDMAC_VOICEAUDIORCV ( 0x1 << WMDMA_VOICE_IN )
#else
#define WMDMAC_VOICEAUDIOXMIT 0
#define WMDMAC_VOICEAUDIORCV 0
#endif /* WM_VOICE */
#define WMDMA_AUDIO_INTR ( WMDMAC_HIFIAUDIOXMIT | \
WMDMAC_HIFIAUDIORCV | \
WMDMAC_VOICEAUDIOXMIT | \
WMDMAC_VOICEAUDIORCV \
)
/*
* Function prototypes
*/
/*
* Make them all inline if asked for.
*/
#if WM_INLINE_FUNCTIONS
# define WMEnablePenInterrupt WMInlineEnablePenInterrupt
# define WMDisablePenInterrupt WMInlineDisablePenInterrupt
# define WMClearPenInterrupt WMInlineClearPenInterrupt
# define WMRequestTimerInterrupt WMInlineRequestTimerInterrupt
# define WMCancelTimerInterrupt WMInlineCancelTimerInterrupt
#endif
/*-----------------------------------------------------------------------------
* Function: WMEnablePenInterrupt
*
* Requests an interrupt when the pen detect GPIO triggers.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
#define WMInlineEnablePenInterrupt( hDevice ) \
do { \
WM_XSCALE_DEVICE_CONTEXT *pDeviceContext = \
(WM_XSCALE_DEVICE_CONTEXT *) hDevice; \
\
/* It's an input */ \
WM_CONFIGURE_PEN_DETECT_INTERRUPT( pDeviceContext ); \
\
/* Trigger on rising edge, and not on falling edge */ \
WM_SET_PEN_DETECT_INTERRUPT_ACTIVE_HIGH( pDeviceContext ); \
WM_CLEAR_PEN_DETECT_INTERRUPT_ACTIVE_LOW( pDeviceContext ); \
\
/* Make sure the interrupt is cleared */ \
WMInlineClearPenInterrupt( hDevice ); \
\
/* \
* NB We don't enable the interrupt here - that's the \
* responsibility of the operating system interrupt layer. \
*/ \
} while (0)
/*-----------------------------------------------------------------------------
* Function: WMDisablePenInterrupt
*
* Cancels the interrupt when the pen detect GPIO triggers.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
#define WMInlineDisablePenInterrupt( hDevice ) \
do { \
WM_XSCALE_DEVICE_CONTEXT *pDeviceContext = \
(WM_XSCALE_DEVICE_CONTEXT *) hDevice; \
\
/* Don't trigger on rising edge or falling edge */ \
WM_CLEAR_PEN_DETECT_INTERRUPT_ACTIVE_LOW( pDeviceContext ); \
WM_CLEAR_PEN_DETECT_INTERRUPT_ACTIVE_HIGH( pDeviceContext ); \
\
/* Make sure the interrupt is cleared */ \
WMInlineClearPenInterrupt( hDevice ); \
} while (0)
/*-----------------------------------------------------------------------------
* Function: WMClearPenInterrupt
*
* Clears the pen detect GPIO interrupt.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
#define WMInlineClearPenInterrupt( hDevice ) \
do { \
WM_XSCALE_DEVICE_CONTEXT *pDeviceContext = \
(WM_XSCALE_DEVICE_CONTEXT *) hDevice; \
\
WM_CLEAR_PEN_DETECT_INTERRUPT( pDeviceContext ); \
} while (0)
/*-----------------------------------------------------------------------------
* Function: WMRequestTimerInterrupt
*
* Requests a timer interrupt after the interval specified in WMConfig.h.
* This is WM_TOUCH_SAMPLE_RATE and is given as a fraction of a second
* (i.e. timer frequency).
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: WMSTATUS
* See WMStatus.h
*---------------------------------------------------------------------------*/
#define WMInlineRequestTimerInterrupt( hDevice ) \
do { \
WM_XSCALE_DEVICE_CONTEXT *pDeviceContext = \
(WM_XSCALE_DEVICE_CONTEXT *) hDevice; \
\
/* Set up the timeout register */ \
pDeviceContext->v_pOSTimerRegs->osmr1 = \
pDeviceContext->v_pOSTimerRegs->oscr0 + \
WM_TOUCH_POLL_TIMEOUT; \
\
/* Generate an interrupt when the timer is > OSMR1 */ \
pDeviceContext->v_pOSTimerRegs->oier |= XLLP_OIER_E1; \
\
/* Enable OSMR1 interrupt */ \
pDeviceContext->v_pIntRegs->icmr |= ICMR_OSMR1; \
\
/* Clear any outstanding interrupt on OSMR1 */ \
pDeviceContext->v_pOSTimerRegs->ossr = XLLP_OSSR_M1; \
} while (0)
/*-----------------------------------------------------------------------------
* Function: WMCancelTimerInterrupt
*
* Ensures previously requested timer interrupts are cancelled.
*
* Parameters:
* hDevice handle to the device (from WMOpenDevice)
*
* Returns: void
*---------------------------------------------------------------------------*/
#define WMInlineCancelTimerInterrupt( hDevice ) \
do { \
WM_XSCALE_DEVICE_CONTEXT *pDeviceContext = \
(WM_XSCALE_DEVICE_CONTEXT *) hDevice; \
\
/* Disable OSMR1 interrupt */ \
pDeviceContext->v_pIntRegs->icmr &= ~ICMR_OSMR1; \
\
/* Disable interrupt OSMR1 timer interrupt */ \
pDeviceContext->v_pOSTimerRegs->oier &= ~XLLP_OIER_E1; \
\
/* Clear any outstanding interrupt on OSMR1 */ \
pDeviceContext->v_pOSTimerRegs->ossr = XLLP_OSSR_M1; \
} while (0)
#endif /* __WMINTERRUPTS_RAW_H__ */
/*------------------------------ END OF FILE ---------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -