dp: rx: Added callback for video mode change interrupts.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2015-01-16 14:15:09 -08:00 committed by Nava kishore Manne
parent a94f816019
commit bdc15ffdfe
2 changed files with 103 additions and 0 deletions

View file

@ -61,6 +61,17 @@ typedef struct {
link. */ link. */
} XDprx_LinkConfig; } XDprx_LinkConfig;
/******************************************************************************/
/**
* Callback type which represents the handler for interrupts.
*
* @param InstancePtr is a pointer to the XDprx instance.
*
* @note None.
*
*******************************************************************************/
typedef void (*XDprx_IntrHandler)(void *InstancePtr);
/** /**
* The XDprx driver instance data. The user is required to allocate a variable * The XDprx driver instance data. The user is required to allocate a variable
* of this type for every XDprx device in the system. A pointer to a variable of * of this type for every XDprx device in the system. A pointer to a variable of
@ -81,6 +92,13 @@ typedef struct {
void *UserTimerPtr; /**< Pointer to a timer instance void *UserTimerPtr; /**< Pointer to a timer instance
used by the custom user used by the custom user
delay/sleep function. */ delay/sleep function. */
XDptx_IntrHandler IntrVmChangeHandler; /**< Callback function for video
mode change
interrupts. */
void *IntrVmChangeCallbackRef; /**< A pointer to the user data
passed to the video mode
change callback
function. */
} XDprx; } XDprx;
/**************************** Function Prototypes *****************************/ /**************************** Function Prototypes *****************************/
@ -101,4 +119,8 @@ void XDprx_SetUserTimerHandler(XDprx *InstancePtr,
XDp_TimerHandler CallbackFunc, void *CallbackRef); XDp_TimerHandler CallbackFunc, void *CallbackRef);
void XDprx_WaitUs(XDprx *InstancePtr, u32 MicroSeconds); void XDprx_WaitUs(XDprx *InstancePtr, u32 MicroSeconds);
/* xdprx_intr.c: Interrupt handling functions. */
void XDptx_SetIntrVmChangeHandler(XDptx *InstancePtr,
XDprx_IntrHandler CallbackFunc, void *CallbackRef);
#endif /* XDPRX_H_ */ #endif /* XDPRX_H_ */

View file

@ -0,0 +1,81 @@
/*******************************************************************************
*
* Copyright (C) 2015 Xilinx, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* Use of the Software is limited solely to applications:
* (a) running on a Xilinx device, or
* (b) that interact with a Xilinx device through a bus or interconnect.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Xilinx shall not be used
* in advertising or otherwise to promote the sale, use or other dealings in
* this Software without prior written authorization from Xilinx.
*
*******************************************************************************/
/******************************************************************************/
/**
*
* @file xdprx_intr.c
*
* This file contains functions related to XDprx interrupt handling.
*
* @note None.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- ---- -------- -----------------------------------------------
* </pre>
*
*******************************************************************************/
/******************************* Include Files ********************************/
#include "xdprx.h"
/**************************** Function Definitions ****************************/
/******************************************************************************/
/**
* This function installs a callback function for when a video mode change
* interrupt occurs.
*
* @param InstancePtr is a pointer to the XDprx instance.
* @param CallbackFunc is the address to the callback function.
* @param CallbackRef is the user data item that will be passed to the
* callback function when it is invoked.
*
* @return None.
*
* @note None.
*
*******************************************************************************/
void XDptx_SetIntrVmChangeHandler(XDptx *InstancePtr,
XDprx_IntrHandler CallbackFunc, void *CallbackRef)
{
/* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(CallbackFunc != NULL);
Xil_AssertVoid(CallbackRef != NULL);
InstancePtr->IntrVmChangeHandler = CallbackFunc;
InstancePtr->IntrVmChangeCallbackRef = CallbackRef;
}