diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/index.html b/XilinxProcessorIPLib/drivers/dptx/examples/index.html index b2e4baaa..0a79dcc3 100755 --- a/XilinxProcessorIPLib/drivers/dptx/examples/index.html +++ b/XilinxProcessorIPLib/drivers/dptx/examples/index.html @@ -10,6 +10,7 @@
+ * MODIFICATION HISTORY: + * + * Ver Who Date Changes + * ----- ---- -------- ----------------------------------------------- + * 1.00a als 07/29/14 Initial creation. + *+ * +*******************************************************************************/ + +/******************************* Include Files ********************************/ + +#include "xdptx_example_common.h" + +/**************************** Function Prototypes *****************************/ + +u32 Dptx_AudioExample(XDptx *InstancePtr, u16 DeviceId); +static void Dptx_AudioInit(XDptx *InstancePtr); +static void Dptx_ConfigureAudioSrc(XDptx *InstancePtr); +static void Dptx_AudioSendInfoFrame(XDptx *InstancePtr); + +/**************************** Function Definitions ****************************/ + +/******************************************************************************/ +/** + * This function is the main function of the XDptx audio example. + * + * @param None. + * + * @return - XST_SUCCESS if the audio example finished successfully. + * - XST_FAILURE otherwise. + * + * @note None. + * +*******************************************************************************/ +int main(void) +{ + int Status; + + /* Run the XDptx audio example. */ + Status = Dptx_AudioExample(&DptxInstance, DPTX_DEVICE_ID); + if (Status != XST_SUCCESS) { + return XST_FAILURE; + } + + return XST_SUCCESS; +} + +/******************************************************************************/ +/** + * The main entry point for the audio example using the XDptx driver. This + * function will set up audio, initiate link training, and a video stream will + * start being sent over the main link. + * + * @param InstancePtr is a pointer to the XDptx instance. + * @param DeviceId is the unique device ID of the DisplayPort TX core + * instance. + * + * @return - XST_SUCCESS if the system was set up correctly and link + * training was successful. + * - XST_FAILURE otherwise. + * + * @note None. + * +*******************************************************************************/ +u32 Dptx_AudioExample(XDptx *InstancePtr, u16 DeviceId) +{ + u32 Status; + + /* Do platform initialization here. This is hardware system specific - + * it is up to the user to implement this function. */ + Dptx_PlatformInit(); + /*******************/ + + Status = Dptx_SetupExample(InstancePtr, DeviceId); + if (Status != XST_SUCCESS) { + return XST_FAILURE; + } + + /* Initialize DisplayPort audio. */ + Dptx_AudioInit(InstancePtr); + + XDptx_EnableTrainAdaptive(InstancePtr, TRAIN_ADAPTIVE); + XDptx_SetHasRedriverInPath(InstancePtr, TRAIN_HAS_REDRIVER); + + /* A sink monitor must be connected at this point. See the polling or + * interrupt examples for how to wait for a connection event. */ + Status = Dptx_Run(InstancePtr); + if (Status != XST_SUCCESS) { + return XST_FAILURE; + } + + return XST_SUCCESS; +} + +/******************************************************************************/ +/** + * This function will set up audio in the DisplayPort TX. The user will need + * to implement configuration of the audio stream and, if needed, sending of + * the info frame. + * + * @param InstancePtr is a pointer to the XDptx instance. + * + * @return None. + * + * @note The user needs to implement the Dptx_ConfigureAudioSrc and + * the Dptx_AudioSendInfoFrame functions to fulfill audio + * initialization. + * +*******************************************************************************/ +static void Dptx_AudioInit(XDptx *InstancePtr) +{ + u32 Fs; + u32 MAud; + u32 NAud; + u32 NumChs; + + /* Disable audio in the DisplayPort TX. This will also flush the buffers + * in the DisplayPort TX and set MUTE bit in VB-ID. */ + XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_AUDIO_CONTROL, + 0x0); + + /* Configure the audio source (the S/PDIF controller). It is up to the + * user to implement this function. */ + Dptx_ConfigureAudioSrc(InstancePtr); + /*******************/ + + /* Write audio info frame as per user requirements. This may be optional + * for some systems. 8 writes are required to register + * XDPTX_TX_AUDIO_INFO_DATA. It is up to the user to implement this + * function. */ + Dptx_AudioSendInfoFrame(InstancePtr); + /*******************/ + + Fs = 48; /* KHz (32 | 44.1 | 48) */ + if (InstancePtr->LinkConfig.LinkRate == XDPTX_LINK_BW_SET_540GBPS) { + MAud = 512 * Fs; + } + else if (InstancePtr->LinkConfig.LinkRate == + XDPTX_LINK_BW_SET_270GBPS) { + MAud = 512 * Fs; + } + else if (InstancePtr->LinkConfig.LinkRate == + XDPTX_LINK_BW_SET_162GBPS) { + MAud = 512 * Fs; + } + + /* Write the channel count. The value is (actual count - 1). */ + NumChs = 2; + XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_AUDIO_CHANNELS, + NumChs - 1); + + /* NAud = 540000 | 270000 | 162000 */ + NAud = 27 * InstancePtr->LinkConfig.LinkRate * 1000; + + XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_AUDIO_MAUD, MAud); + XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_AUDIO_NAUD, NAud); + + /* Enable audio in the DisplayPort TX. */ + XDptx_WriteReg(InstancePtr->Config.BaseAddr, XDPTX_TX_AUDIO_CONTROL, + 0x1); +} + +/******************************************************************************/ +/** + * This function needs to configure the audio source. + * + * @param InstancePtr is a pointer to the XDptx instance. + * + * @return None. + * + * @note The user needs to implement this. See XAPP1178 and the IP + * documentation for reference. + * +*******************************************************************************/ +static void Dptx_ConfigureAudioSrc(XDptx *InstancePtr) +{ + xil_printf("Dptx_ConfigureAudioSrc: User defined function here.\n"); +} + +/******************************************************************************/ +/** + * This function needs to send an info frame as per user requirements. + * + * @param InstancePtr is a pointer to the XDptx instance. + * + * @return None. + * + * @note The user needs to implement this. See XAPP1178 and the IP + * documentation for reference. + * @note This may be optional for some systems. + * @note A sequence of 8 writes are required to register + * XDPTX_TX_AUDIO_INFO_DATA. See XAPP1178 and the IP documentation + * for reference. + * +*******************************************************************************/ +static void Dptx_AudioSendInfoFrame(XDptx *InstancePtr) +{ + xil_printf("Dptx_AudioSendInfoFrame: User defined function here.\n"); +} diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_example_common.h b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_example_common.h index 3c4af098..ea1b4c12 100644 --- a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_example_common.h +++ b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_example_common.h @@ -62,7 +62,10 @@ /******************************* Include Files ********************************/ #include "xdptx.h" +#include "xil_printf.h" #include "xil_types.h" +#include "xparameters.h" +#include "xstatus.h" /**************************** Constant Definitions ****************************/ diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_intr_example.c b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_intr_example.c index 1bbd43b1..291457d4 100644 --- a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_intr_example.c +++ b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_intr_example.c @@ -62,11 +62,7 @@ /******************************* Include Files ********************************/ -#include "xdptx.h" #include "xdptx_example_common.h" -#include "xil_printf.h" -#include "xparameters.h" -#include "xstatus.h" #ifdef XPAR_INTC_0_DEVICE_ID /* For MicroBlaze systems. */ #include "xintc.h" diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_poll_example.c b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_poll_example.c index 2a6f2c56..837e7fd7 100644 --- a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_poll_example.c +++ b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_poll_example.c @@ -60,11 +60,7 @@ /******************************* Include Files ********************************/ -#include "xdptx.h" #include "xdptx_example_common.h" -#include "xil_printf.h" -#include "xparameters.h" -#include "xstatus.h" /**************************** Function Prototypes *****************************/ diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_selftest_example.c b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_selftest_example.c index 6833c05b..2e3cb4b5 100644 --- a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_selftest_example.c +++ b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_selftest_example.c @@ -50,11 +50,7 @@ /******************************* Include Files ********************************/ -#include "xdptx.h" #include "xdptx_example_common.h" -#include "xil_printf.h" -#include "xparameters.h" -#include "xstatus.h" /**************************** Function Prototypes *****************************/ diff --git a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_timer_example.c b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_timer_example.c index bee81a05..7ec18103 100644 --- a/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_timer_example.c +++ b/XilinxProcessorIPLib/drivers/dptx/examples/xdptx_timer_example.c @@ -63,11 +63,7 @@ /******************************* Include Files ********************************/ -#include "xdptx.h" #include "xdptx_example_common.h" -#include "xil_printf.h" -#include "xparameters.h" -#include "xstatus.h" #include "xtmrctr.h" /**************************** Function Prototypes *****************************/ diff --git a/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h b/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h index c1ec29ce..c43184db 100644 --- a/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h +++ b/XilinxProcessorIPLib/drivers/dptx/src/xdptx.h @@ -136,6 +136,14 @@ * function and, for the HPD pulse handler, the XDptx_SetHpdPulseHandler * function. * + * Audio + * + * The driver does not handle audio. For an example as to how to configure and + * transmit audio, dptx/examples/xdptx_audio_example.c illustrates the + * required sequence. 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. + * * Asserts * * Asserts are used within all Xilinx drivers to enforce constraints on argument @@ -144,7 +152,11 @@ * it is recommended that application developers leave asserts on during * development. * - * The driver currently supports single-stream transport (SST) functionality. + * Limitations + * + * - The driver currently supports single-stream transport (SST) functionality. + * - The driver does not handle audio. See the audio example in the driver + * examples directory for the required sequence for enabling audio. * * @note For a 5.4Gbps link rate, a high performance 7 series FPGA is * required with a speed grade of -2 or -3.