From b45d77cbe56301a968e67e032475d66fe34db8c7 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Mon, 26 Jan 2015 00:32:54 -0800 Subject: [PATCH] dp: rx: Added audio info and extension packet received interrupt handlers. XDp_RxSetIntrInfoPktHandler and XDp_RxSetIntrExtPktHandler. Signed-off-by: Andrei-Liviu Simion --- XilinxProcessorIPLib/drivers/dp/src/xdp.h | 30 +++++++- .../drivers/dp/src/xdp_intr.c | 74 ++++++++++++++++++- 2 files changed, 99 insertions(+), 5 deletions(-) diff --git a/XilinxProcessorIPLib/drivers/dp/src/xdp.h b/XilinxProcessorIPLib/drivers/dp/src/xdp.h index a3b1030e..908cef6d 100644 --- a/XilinxProcessorIPLib/drivers/dp/src/xdp.h +++ b/XilinxProcessorIPLib/drivers/dp/src/xdp.h @@ -222,8 +222,14 @@ * * Audio * - * The driver does not handle audio. For an example as to how to configure and - * transmit audio, examples/xdptx_audio_example.c illustrates the required + * The driver in RX mode of operation may received audio info and extension + * packets. When this happens, if interrupts are enabled, the appropriate + * handlers will be invoked. + * Control functions are available for enabling, disabling, and resetting audio + * in the DisplayPort RX core. + * + * The TX driver does not handle audio. For an example as to how to configure + * and transmit audio, examples/xdptx_audio_example.c illustrates the required * sequence in the TX mode of operation. The user will need to configure the * audio source connected to the Displayport TX instance and set up the audio * info frame as per user requirements. @@ -704,7 +710,21 @@ typedef struct { passed to the valid video callback function. */ - XDp_IntrHandler IntrTrainingDoneHandler;/**< Callback function for + XDp_IntrHandler IntrInfoPktHandler; /**< Callback function for audio + info packet received + interrupts. */ + void *IntrInfoPktCallbackRef; /**< A pointer to the user data + passed to the audio info + packet callback + function. */ + XDp_IntrHandler IntrExtPktHandler; /**< Callback function for audio + extension packet + received interrupts. */ + void *IntrExtPktCallbackRef; /**< A pointer to the user data + passed to the audio + extension packet + callback function. */ + XDp_IntrHandler IntrTrainingDoneHandler; /**< Callback function for training done interrupts. */ void *IntrTrainingDoneCallbackRef; /**< A pointer to the user data @@ -857,6 +877,10 @@ void XDp_RxSetIntrTrainingLostHandler(XDp *InstancePtr, XDp_IntrHandler CallbackFunc, void *CallbackRef); void XDp_RxSetIntrVideoHandler(XDp *InstancePtr, XDp_IntrHandler CallbackFunc, void *CallbackRef); +void XDp_RxSetIntrInfoPktHandler(XDp *InstancePtr, + XDp_IntrHandler CallbackFunc, void *CallbackRef); +void XDp_RxSetIntrExtPktHandler(XDp *InstancePtr, + XDp_IntrHandler CallbackFunc, void *CallbackRef); void XDp_RxSetIntrTrainingDoneHandler(XDp *InstancePtr, XDp_IntrHandler CallbackFunc, void *CallbackRef); void XDp_RxSetIntrBwChangeHandler(XDp *InstancePtr, diff --git a/XilinxProcessorIPLib/drivers/dp/src/xdp_intr.c b/XilinxProcessorIPLib/drivers/dp/src/xdp_intr.c index 7cb7aadb..27ad230c 100644 --- a/XilinxProcessorIPLib/drivers/dp/src/xdp_intr.c +++ b/XilinxProcessorIPLib/drivers/dp/src/xdp_intr.c @@ -396,6 +396,62 @@ void XDp_RxSetIntrVideoHandler(XDp *InstancePtr, InstancePtr->RxInstance.IntrVideoCallbackRef = CallbackRef; } +/******************************************************************************/ +/** + * This function installs a callback function for when an audio info packet + * interrupt occurs. + * + * @param InstancePtr is a pointer to the XDp 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 XDp_RxSetIntrInfoPktHandler(XDp *InstancePtr, + XDp_IntrHandler CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(XDp_GetCoreType(InstancePtr) == XDP_RX); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + InstancePtr->RxInstance.IntrInfoPktHandler = CallbackFunc; + InstancePtr->RxInstance.IntrInfoPktCallbackRef = CallbackRef; +} + +/******************************************************************************/ +/** + * This function installs a callback function for when an audio extension packet + * interrupt occurs. + * + * @param InstancePtr is a pointer to the XDp 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 XDp_RxSetIntrExtPktHandler(XDp *InstancePtr, + XDp_IntrHandler CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(XDp_GetCoreType(InstancePtr) == XDP_RX); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + InstancePtr->RxInstance.IntrExtPktHandler = CallbackFunc; + InstancePtr->RxInstance.IntrExtPktCallbackRef = CallbackRef; +} + /******************************************************************************/ /** * This function installs a callback function for when a training done interrupt @@ -623,8 +679,8 @@ static void XDp_RxInterruptHandler(XDp *InstancePtr) { u32 IntrStatus; u8 IntrVmChange, IntrPowerState, IntrNoVideo, IntrVBlank, - IntrTrainingLost, IntrVideo, IntrTrainingDone, IntrBwChange, - IntrTp1, IntrTp2, IntrTp3; + IntrTrainingLost, IntrVideo, IntrInfoPkt, IntrExtPkt, + IntrTrainingDone, IntrBwChange, IntrTp1, IntrTp2, IntrTp3; /* Determine what kind of interrupt(s) occurred. * Note: XDP_RX_INTERRUPT_CAUSE is an RC (read-clear) register. */ @@ -637,6 +693,9 @@ static void XDp_RxInterruptHandler(XDp *InstancePtr) IntrTrainingLost = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_TRAINING_LOST_MASK); IntrVideo = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_VIDEO_MASK); + + IntrInfoPkt = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_INFO_PKT_MASK); + IntrExtPkt = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_EXT_PKT_MASK); IntrTrainingDone = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_TRAINING_DONE_MASK); IntrBwChange = (IntrStatus & XDP_RX_INTERRUPT_CAUSE_BW_CHANGE_MASK); @@ -707,4 +766,15 @@ static void XDp_RxInterruptHandler(XDp *InstancePtr) InstancePtr->RxInstance.IntrBwChangeHandler( InstancePtr->RxInstance.IntrBwChangeCallbackRef); } + + /* An audio info packet has been received. */ + if (IntrInfoPkt) { + InstancePtr->RxInstance.IntrInfoPktHandler( + InstancePtr->RxInstance.IntrInfoPktCallbackRef); + } + /* An audio extension packet has been received. */ + if (IntrExtPkt) { + InstancePtr->RxInstance.IntrExtPktHandler( + InstancePtr->RxInstance.IntrExtPktCallbackRef); + } }