dp: rx: Added interrupt handler.
The interrupt handler arbitrates interrupts to appropriate handlers. Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
parent
7f0b844897
commit
f588c504e9
4 changed files with 155 additions and 55 deletions
|
@ -187,6 +187,7 @@ void XDprx_SetUserTimerHandler(XDprx *InstancePtr,
|
|||
void XDprx_WaitUs(XDprx *InstancePtr, u32 MicroSeconds);
|
||||
|
||||
/* xdprx_intr.c: Interrupt handling functions. */
|
||||
void XDprx_InterruptHandler(XDprx *InstancePtr);
|
||||
void XDprx_SetIntrVmChangeHandler(XDprx *InstancePtr,
|
||||
XDprx_IntrHandler CallbackFunc, void *CallbackRef);
|
||||
void XDprx_SetIntrPowerStateHandler(XDprx *InstancePtr,
|
||||
|
|
|
@ -53,6 +53,105 @@
|
|||
|
||||
/**************************** Function Definitions ****************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function is the interrupt handler for the XDprx driver.
|
||||
*
|
||||
* When an interrupt happens, it first detects what kind of interrupt happened,
|
||||
* then decides which callback function to invoke.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDprx instance.
|
||||
*
|
||||
* @return None.
|
||||
*
|
||||
* @note None.
|
||||
*
|
||||
*******************************************************************************/
|
||||
void XDprx_InterruptHandler(XDprx *InstancePtr)
|
||||
{
|
||||
u32 IntrStatus;
|
||||
u8 IntrVmChange, IntrPowerState, IntrNoVideo, IntrVBlank,
|
||||
IntrTrainingLost, IntrVideo, IntrTrainingDone, IntrBwChange,
|
||||
IntrTp1, IntrTp2, IntrTp3;
|
||||
|
||||
/* Determine what kind of interrupt(s) occurred.
|
||||
* Note: XDPRX_INTERRUPT_STATUS is an RC (read-clear) register. */
|
||||
IntrStatus = XDprx_ReadReg(InstancePtr->Config.BaseAddr,
|
||||
XDPRX_INTERRUPT_CAUSE);
|
||||
IntrVmChange = (IntrStatus & 0x00001);
|
||||
IntrPowerState = ((IntrStatus & 0x00002) >> 1);
|
||||
IntrNoVideo = ((IntrStatus & 0x00004) >> 2);
|
||||
IntrVBlank = ((IntrStatus & 0x00008) >> 3);
|
||||
IntrTrainingLost = ((IntrStatus & 0x00010) >> 4);
|
||||
IntrVideo = ((IntrStatus & 0x00040) >> 6);
|
||||
IntrTrainingDone = ((IntrStatus & 0x04000) >> 14);
|
||||
IntrBwChange = ((IntrStatus & 0x08000) >> 15);
|
||||
IntrTp1 = ((IntrStatus & 0x10000) >> 16);
|
||||
IntrTp2 = ((IntrStatus & 0x20000) >> 17);
|
||||
IntrTp3 = ((IntrStatus & 0x40000) >> 18);
|
||||
|
||||
/* Training pattern 1 has started. */
|
||||
if (IntrTp1) {
|
||||
InstancePtr->IntrTp1Handler(InstancePtr->IntrTp1CallbackRef);
|
||||
}
|
||||
/* Training pattern 2 has started. */
|
||||
if (IntrTp2) {
|
||||
InstancePtr->IntrTp2Handler(InstancePtr->IntrTp2CallbackRef);
|
||||
}
|
||||
/* Training pattern 3 has started. */
|
||||
if (IntrTp3) {
|
||||
InstancePtr->IntrTp3Handler(InstancePtr->IntrTp3CallbackRef);
|
||||
}
|
||||
/* Training lost - the link has been lost. */
|
||||
if (IntrTrainingLost) {
|
||||
InstancePtr->IntrTrainingLostHandler(
|
||||
InstancePtr->IntrTrainingLostCallbackRef);
|
||||
}
|
||||
/* The link has been trained. */
|
||||
else if (IntrTrainingDone) {
|
||||
InstancePtr->IntrTrainingDoneHandler(
|
||||
InstancePtr->IntrTrainingDoneCallbackRef);
|
||||
}
|
||||
|
||||
/* A change has been detected in the current video transmitted on the
|
||||
* link as indicated by the main stream attributes (MSA) fields. The
|
||||
* horizontal and vertical resolution parameters are monitored for
|
||||
* changes. */
|
||||
if (IntrVmChange) {
|
||||
InstancePtr->IntrVmChangeHandler(
|
||||
InstancePtr->IntrVmChangeCallbackRef);
|
||||
}
|
||||
/* The VerticalBlanking_Flag in the VB-ID field of the received stream
|
||||
* indicates the start of the vertical blanking interval. */
|
||||
if (IntrVBlank) {
|
||||
InstancePtr->IntrVBlankHandler(
|
||||
InstancePtr->IntrVBlankCallbackRef);
|
||||
}
|
||||
/* The receiver has detected the no-video flags in the VB-ID field after
|
||||
* active video has been received. */
|
||||
if (IntrNoVideo) {
|
||||
InstancePtr->IntrNoVideoHandler(
|
||||
InstancePtr->IntrNoVideoCallbackRef);
|
||||
}
|
||||
/* A valid video frame is detected on the main link. */
|
||||
else if (IntrVideo) {
|
||||
InstancePtr->IntrVideoHandler(
|
||||
InstancePtr->IntrVideoCallbackRef);
|
||||
}
|
||||
|
||||
/* The transmitter has requested a change in the current power state of
|
||||
* the receiver core. */
|
||||
if (IntrPowerState) {
|
||||
InstancePtr->IntrPowerStateHandler(
|
||||
InstancePtr->IntrPowerStateCallbackRef);
|
||||
}
|
||||
/* A change in the bandwidth has been detected. */
|
||||
if (IntrBwChange) {
|
||||
InstancePtr->IntrBwChangeHandler(
|
||||
InstancePtr->IntrBwChangeCallbackRef);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function installs a callback function for when a video mode change
|
||||
|
|
|
@ -623,11 +623,11 @@ void XDptx_ClearMsaValues(XDptx *InstancePtr, u8 Stream);
|
|||
void XDptx_SetMsaValues(XDptx *InstancePtr, u8 Stream);
|
||||
|
||||
/* xdptx_intr.c: Interrupt handling functions. */
|
||||
void XDptx_HpdInterruptHandler(XDptx *InstancePtr);
|
||||
void XDptx_SetHpdEventHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdEventHandler CallbackFunc, void *CallbackRef);
|
||||
void XDptx_SetHpdPulseHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdPulseHandler CallbackFunc, void *CallbackRef);
|
||||
void XDptx_HpdInterruptHandler(XDptx *InstancePtr);
|
||||
|
||||
/* xdptx_selftest.c: Self test function. */
|
||||
u32 XDptx_SelfTest(XDptx *InstancePtr);
|
||||
|
|
|
@ -56,60 +56,6 @@
|
|||
|
||||
/**************************** Function Definitions ****************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function installs a callback function for when a hot-plug-detect event
|
||||
* interrupt occurs.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDptx 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_SetHpdEventHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdEventHandler CallbackFunc, void *CallbackRef)
|
||||
{
|
||||
/* Verify arguments. */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(CallbackFunc != NULL);
|
||||
Xil_AssertVoid(CallbackRef != NULL);
|
||||
|
||||
InstancePtr->HpdEventHandler = CallbackFunc;
|
||||
InstancePtr->HpdEventCallbackRef = CallbackRef;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function installs a callback function for when a hot-plug-detect pulse
|
||||
* interrupt occurs.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDptx 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_SetHpdPulseHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdPulseHandler CallbackFunc, void *CallbackRef)
|
||||
{
|
||||
/* Verify arguments. */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(CallbackFunc != NULL);
|
||||
Xil_AssertVoid(CallbackRef != NULL);
|
||||
|
||||
InstancePtr->HpdPulseHandler = CallbackFunc;
|
||||
InstancePtr->HpdPulseCallbackRef = CallbackRef;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function is the interrupt handler for the XDptx driver.
|
||||
|
@ -178,3 +124,57 @@ void XDptx_HpdInterruptHandler(XDptx *InstancePtr)
|
|||
XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_INTERRUPT_MASK,
|
||||
IntrMask);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function installs a callback function for when a hot-plug-detect event
|
||||
* interrupt occurs.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDptx 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_SetHpdEventHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdEventHandler CallbackFunc, void *CallbackRef)
|
||||
{
|
||||
/* Verify arguments. */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(CallbackFunc != NULL);
|
||||
Xil_AssertVoid(CallbackRef != NULL);
|
||||
|
||||
InstancePtr->HpdEventHandler = CallbackFunc;
|
||||
InstancePtr->HpdEventCallbackRef = CallbackRef;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/**
|
||||
* This function installs a callback function for when a hot-plug-detect pulse
|
||||
* interrupt occurs.
|
||||
*
|
||||
* @param InstancePtr is a pointer to the XDptx 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_SetHpdPulseHandler(XDptx *InstancePtr,
|
||||
XDptx_HpdPulseHandler CallbackFunc, void *CallbackRef)
|
||||
{
|
||||
/* Verify arguments. */
|
||||
Xil_AssertVoid(InstancePtr != NULL);
|
||||
Xil_AssertVoid(CallbackFunc != NULL);
|
||||
Xil_AssertVoid(CallbackRef != NULL);
|
||||
|
||||
InstancePtr->HpdPulseHandler = CallbackFunc;
|
||||
InstancePtr->HpdPulseCallbackRef = CallbackRef;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue