From de3fbb44664e3a6a85f4f88768d3a04c76c380a7 Mon Sep 17 00:00:00 2001 From: Andrei-Liviu Simion Date: Fri, 16 Jan 2015 14:39:33 -0800 Subject: [PATCH] dp: rx: Added callback for training pattern interrupts. Signed-off-by: Andrei-Liviu Simion --- XilinxProcessorIPLib/drivers/dp/src/xdprx.h | 27 +++++++ .../drivers/dp/src/xdprx_intr.c | 81 +++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/XilinxProcessorIPLib/drivers/dp/src/xdprx.h b/XilinxProcessorIPLib/drivers/dp/src/xdprx.h index 854633d1..6c65dc5e 100644 --- a/XilinxProcessorIPLib/drivers/dp/src/xdprx.h +++ b/XilinxProcessorIPLib/drivers/dp/src/xdprx.h @@ -145,6 +145,27 @@ typedef struct { passed to the bandwidth change callback function. */ + XDptx_IntrHandler IntrTp1Handler; /**< Callback function for + training pattern 1 + interrupts. */ + void *IntrTp1CallbackRef; /**< A pointer to the user data + passed to the training + pattern 1 callback + function. */ + XDptx_IntrHandler IntrTp2Handler; /**< Callback function for + training pattern 2 + interrupts. */ + void *IntrTp2CallbackRef; /**< A pointer to the user data + passed to the training + pattern 2 callback + function. */ + XDptx_IntrHandler IntrTp3Handler; /**< Callback function for + training pattern 3 + interrupts. */ + void *IntrTp3CallbackRef; /**< A pointer to the user data + passed to the training + pattern 3 callback + function. */ } XDprx; /**************************** Function Prototypes *****************************/ @@ -182,5 +203,11 @@ void XDptx_SetIntrTrainingDoneHandler(XDptx *InstancePtr, XDprx_IntrHandler CallbackFunc, void *CallbackRef); void XDptx_SetIntrBwChangeHandler(XDptx *InstancePtr, XDprx_IntrHandler CallbackFunc, void *CallbackRef); +void XDptx_SetIntrTp1Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef); +void XDptx_SetIntrTp2Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef); +void XDptx_SetIntrTp3Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef); #endif /* XDPRX_H_ */ diff --git a/XilinxProcessorIPLib/drivers/dp/src/xdprx_intr.c b/XilinxProcessorIPLib/drivers/dp/src/xdprx_intr.c index c36c0afa..374c562d 100644 --- a/XilinxProcessorIPLib/drivers/dp/src/xdprx_intr.c +++ b/XilinxProcessorIPLib/drivers/dp/src/xdprx_intr.c @@ -268,3 +268,84 @@ void XDptx_SetIntrBwChangeHandler(XDptx *InstancePtr, InstancePtr->IntrBwChangeHandler = CallbackFunc; InstancePtr->IntrBwChangeCallbackRef = CallbackRef; } + +/******************************************************************************/ +/** + * This function installs a callback function for when a training pattern 1 + * 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_SetIntrTp1Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + InstancePtr->IntrTp1Handler = CallbackFunc; + InstancePtr->IntrTp1CallbackRef = CallbackRef; +} + +/******************************************************************************/ +/** + * This function installs a callback function for when a training pattern 2 + * 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_SetIntrTp2Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + InstancePtr->IntrTp2Handler = CallbackFunc; + InstancePtr->IntrTp2CallbackRef = CallbackRef; +} + +/******************************************************************************/ +/** + * This function installs a callback function for when a training pattern 3 + * 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_SetIntrTp3Handler(XDptx *InstancePtr, + XDprx_IntrHandler CallbackFunc, void *CallbackRef) +{ + /* Verify arguments. */ + Xil_AssertVoid(InstancePtr != NULL); + Xil_AssertVoid(CallbackFunc != NULL); + Xil_AssertVoid(CallbackRef != NULL); + + InstancePtr->IntrTp3Handler = CallbackFunc; + InstancePtr->IntrTp3CallbackRef = CallbackRef; +}