dptxss: Added example for driver

This patch adds example files for driver

Signed-off-by: Shadul Shaikh <shaduls@xilinx.com>
This commit is contained in:
Shadul Shaikh 2015-07-08 15:18:10 +05:30 committed by Nava kishore Manne
parent 2cbc1673a1
commit 96076602b1
5 changed files with 2212 additions and 0 deletions

View file

@ -0,0 +1,29 @@
There are 4 DisplayPort Transmitter Subsystem examples include in this directory:
1) xdptxss_selftest_example.c : This self test example will call self test
functions of each DisplayPort TX Subsystem's sub-cores to verify that the sub-cores
are programmed.
2) xdptxss_mst_example.c : This multi-stream transport (MST) example shows how to use
the drivers's MST capabilities. This example reads the RX device MST capability.
Upon MST/SST capability, example sets the transport mode.
3) xdptxss_intr_example.c : This interrupt example shows how to set up the interrupt
system and specify the interrupt handlers for when a DisplayPort TX Subsystem
interrupt event occurs. An interrupt controller with a connection to the DisplayPort
TX Subsystem interrupt signal needs to exist in the hardware system.
4) xdptxss_debug_example.c : The debug example set up MST/SST mode based on RX capability
and prints debug information at the end. This example check whether DisplayPort TX
Subsystem is programmed in SST/MST. Upon MST/SST, reads EDID information and prints.
Additionally, in order to be able to use the interrupt, MST/SST, and debug examples,
the user will need to implement following functions:
1) DpTxSs_PlatformInit : This function needs to do all hardware system
initialization.
2) DpTxSs_StreamSrc* : These function need to configure the source of the stream
(pattern generators, video input, etc.) such that a video stream, with
timings and video attributes that correspond to the main stream attributes
(MSA) configuration, is received by the DisplayPort TX Subsystem.
Note: All example functions start with DpRxSs_*, while all DisplayPort TX Subsystem
driver functions start with XDpTxSs_*.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,560 @@
/******************************************************************************
*
* 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
* XILINX 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 xdptxss_intr_example.c
*
* This file contains a design example using the XDpTxSs driver in single stream
* (SST) transport or multi-stream transport (MST) mode with interrupts. Upon
* Hot-Plug-Detect (HPD - DisplayPort cable is plugged/unplugged or the monitor
* is turned on/off), DisplayPort TX Subsystem will read the capability of RX
* device and re-start the subsystem.
*
* @note This example requires an interrupt controller connected to the
* processor and the DisplayPort TX Subsystem HIP in the system.
* For this example to display output, the user need to implement
* initialization of the system (DpTxSs_PlatformInit) and after
* DisplayPort TX subsystem start (XDpTxSs_Start) is complete,
* implement configuration of the video stream source in order to
* provide the DisplayPort TX Subsystem HIP input.
* The functions DpTxSs_PlatformInit and DpTxSs_StreamSrc are
* declared and are left up to the user implement.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ---- --- -------- --------------------------------------------------
* 1.00 sha 07/01/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xdptxss.h"
#include "xil_printf.h"
#include "xil_types.h"
#include "xparameters.h"
#include "xstatus.h"
#ifdef XPAR_INTC_0_DEVICE_ID
/* For MicroBlaze systems. */
#include "xintc.h"
#else
/* For ARM/Zynq SoC systems. */
#include "xscugic.h"
#endif /* XPAR_INTC_0_DEVICE_ID */
/************************** Constant Definitions *****************************/
/*
* The following constants map to the names of the hardware instances.
* They are only defined here such that a user can easily change all the
* needed device IDs in one place.
* There is only one interrupt controlled to be selected from SCUGIC and GPIO
* INTC. INTC selection is based on INTC parameters defined xparameters.h file.
*/
#ifdef XPAR_INTC_0_DEVICE_ID
#define XINTC_DPTXSS_DP_INTERRUPT_ID XPAR_INTC_0_DPTXSS_0_VEC_ID
#define XINTC_DEVICE_ID XPAR_INTC_0_DEVICE_ID
#define XINTC XIntc
#define XINTC_HANDLER XIntc_InterruptHandler
#else /* Else part */
#define XINTC_DPTXSS_DP_INTERRUPT_ID XPAR_INTC_0_DPTXSS_0_VEC_ID
#define XINTC_DEVICE_ID XPAR_SCUGIC_SINGLE_DEVICE_ID
#define XINTC XScuGic
#define XINTC_HANDLER XScuGic_InterruptHandler
#endif /* XPAR_INTC_0_DEVICE_ID */
/* The unique device ID of the DisplayPort Transmitter Subsystem HIP instance
* to be used
*/
#define XDPTXSS_DEVICE_ID XPAR_DPTXSS_0_DEVICE_ID
/* If set to 1, example will run in MST mode. Otherwise, in SST mode.
* In MST mode, this example reads the EDID of RX devices if connected in
* daisy-chain.
*/
#define DPTXSS_MST 1
#define DPTXSS_LINK_RATE XDPTXSS_LINK_BW_SET_540GBPS
#define DPTXSS_LANE_COUNT XDPTXSS_LANE_COUNT_SET_4
/* The video resolution from the display mode timings (DMT) table to use for
* DisplayPort TX Subsystem. It can be set to use preferred video mode for
* EDID of RX device.
*/
#define DPTXSS_VID_MODE XVIDC_VM_USE_EDID_PREFERRED
/* The color depth (bits per color component) to use DisplayPort TX
* Subsystem.
*/
#define DPTXSS_BPC 8
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
u32 DpTxSs_IntrExample(u16 DeviceId);
u32 DpTxSs_PlatformInit(void);
u32 DpTxSs_StreamSrc(u8 VerticalSplit);
/* Interrupt helper functions */
u32 DpTxSs_SetupIntrSystem(void);
void DpTxSs_HpdEventHandler(void *InstancePtr);
void DpTxSs_HpdPulseHandler(void *InstancePtr);
static void DpTxSs_HpdEventCommon(XDpTxSs *InstancePtr, u8 Mode);
/************************** Variable Definitions *****************************/
XDpTxSs DpTxSsInst; /* The DPTX Subsystem instance.*/
XINTC IntcInst; /* The interrupt controller instance. */
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This is the main function for XDpTxSs interrupt example. If the
* DpTxSs_IntrExample function which sets up the system succeeds, this function
* will wait for the interrupts. Once a connection event or pulse is detected,
* DpTxSs will RX device capabilities and re-start the subsystem.
*
* @param None.
*
* @return
* - XST_FAILURE if the interrupt example was unsuccessful.
*
* @note Unless setup failed, main will never return since
* DpTxSs_IntrExample is blocking (it is waiting on interrupts
* for Hot-Plug-Detect (HPD) events.
*
******************************************************************************/
int main()
{
u32 Status;
xil_printf("------------------------------------------\n\r");
xil_printf("DisplayPort TX Subsystem interrupt example\n\r");
xil_printf("(c) 2015 by Xilinx\n\r");
xil_printf("-------------------------------------------\n\r\n\r");
Status = DpTxSs_IntrExample(XDPTXSS_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("DisplayPort TX Subsystem interrupt example "
"failed.");
return XST_FAILURE;
}
xil_printf("DisplayPort TX Subsystem interrupt example passed\n\r");
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function is the main entry point for the interrupt example using the
* XDpTxSs driver. This function will set up the system with interrupts and
* set up Hot-Plug-Event (HPD) handlers.
*
* @param DeviceId is the unique device ID of the DisplayPort TX
* Subsystem core.
*
* @return
* - XST_FAILURE if the system setup failed.
* - XST_SUCCESS should never return since this function, if setup
* was successful, is blocking.
*
* @note If system setup was successful, this function is blocking in
* order to illustrate interrupt handling taking place for HPD
* events.
*
******************************************************************************/
u32 DpTxSs_IntrExample(u16 DeviceId)
{
u32 Status;
XDpTxSs_Config *ConfigPtr;
/* Do platform initialization in this function. This is hardware
* system specific. It is up to the user to implement this function.
*/
xil_printf("PlatformInit\n\r");
Status = DpTxSs_PlatformInit();
if (Status != XST_SUCCESS) {
xil_printf("Platform init failed!\n\r");
}
xil_printf("Platform initialization done.\n\r");
/* Obtain the device configuration for the DisplayPort TX Subsystem */
ConfigPtr = XDpTxSs_LookupConfig(DeviceId);
if (!ConfigPtr) {
return XST_FAILURE;
}
/* Copy the device configuration into the DpTxSsInst's Config
* structure. */
Status = XDpTxSs_CfgInitialize(&DpTxSsInst, ConfigPtr,
ConfigPtr->BaseAddress);
if (Status != XST_SUCCESS) {
xil_printf("DPTXSS config initialization failed.\n\r");
return XST_FAILURE;
}
/* Check for SST/MST support */
if (DpTxSsInst.UsrOpt.MstSupport) {
xil_printf("\n\rINFO:DPTXSS is MST enabled. DPTXSS can be "
"switched to SST/MST\n\r\n\r");
}
else {
xil_printf("\n\rINFO:DPTXSS is SST enabled. DPTXSS works "
"only in SST mode.\n\r\n\r");
}
Status = DpTxSs_SetupIntrSystem();
if (Status != XST_SUCCESS) {
xil_printf("ERR: Interrupt system setup failed.\n\r");
return XST_FAILURE;
}
/* Do not return in order to allow interrupt handling to run. HPD events
* (connect, disconnect, and pulse) will be detected and handled.
*/
while (1);
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function initialize required platform-specifc peripherals.
*
* @param None.
*
* @return
* - XST_SUCCESS if required peripherals are initialized and
* configured successfully.
* - XST_FAILURE, otherwise.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_PlatformInit(void)
{
/* User is responsible to setup platform specific initialization */
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setup stream source to input DisplayPort TX Subsystem.
*
* @param VerticalSplit specifies whether to split video frame
* vertically into two different vertical halves.
* - 1 = Vertically split input frame
* - 0 = No vertically split input frame.
*
* @return
* - XST_SUCCESS if stream source is configured successfully.
* - XST_FAILURE, otherwise.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_StreamSrc(u8 VerticalSplit)
{
/* User is responsible to setup stream source to input DPTXSS */
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function sets up the interrupt system so interrupts can occur for the
* DisplayPort TX Subsystem core. The function is application-specific since
* the actual system may or may not have an interrupt controller. The DPTX
* Subsystem core could be directly connected to a processor without an
* interrupt controller. The user should modify this function to fit the
* application.
*
* @param None
*
* @return
* - XST_SUCCESS if interrupt setup was successful.
* - A specific error code defined in "xstatus.h" if an error
* occurs.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_SetupIntrSystem(void)
{
u32 Status;
XINTC *IntcInstPtr = &IntcInst;
/* Set the HPD interrupt handlers. */
XDpTxSs_SetCallBack(&DpTxSsInst, XDPTXSS_HANDLER_DP_HPD_EVENT,
DpTxSs_HpdEventHandler, &DpTxSsInst);
XDpTxSs_SetCallBack(&DpTxSsInst, XDPTXSS_HANDLER_DP_HPD_PULSE,
DpTxSs_HpdPulseHandler, &DpTxSsInst);
#ifdef XPAR_INTC_0_DEVICE_ID
/* Initialize the interrupt controller driver so that it's ready to
* use, specify the device ID that was generated in xparameters.h
*/
Status = XIntc_Initialize(IntcInstPtr, XINTC_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("Intc initialization failed!\n\r");
return XST_FAILURE;
}
/* Hook up interrupt service routine */
Status = XIntc_Connect(IntcInstPtr, XINTC_DPTXSS_DP_INTERRUPT_ID,
(XInterruptHandler)XDpTxSs_DpIntrHandler,
&DpTxSsInst);
if (Status != XST_SUCCESS) {
xil_printf("ERR: DP TX SS DP interrupt connect failed!\n\r");
return XST_FAILURE;
}
/* Enable the interrupt vector at the interrupt controller */
XIntc_Enable(IntcInstPtr, XINTC_DPTXSS_DP_INTERRUPT_ID);
/* Start the interrupt controller such that interrupts are recognized
* and handled by the processor
*/
Status = XIntc_Start(IntcInstPtr, XIN_REAL_MODE);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
#else
/* The configuration parameters of the interrupt controller */
XScuGic_Config *IntcConfig;
/* Initialize the interrupt controller driver so that it is ready to
* use.
*/
IntcConfig = XScuGic_LookupConfig(XINTC_DEVICE_ID);
if (NULL == IntcConfig) {
return XST_FAILURE;
}
Status = XScuGic_CfgInitialize(IntcInstPtr, IntcConfig,
IntcConfig->CpuBaseAddress);
if (Status != XST_SUCCESS) {
return XST_FAILURE;
}
/* Connect the device driver handler that will be called when an
* interrupt for the device occurs, the handler defined above performs
* the specific interrupt processing for the device
*/
Status = XScuGic_Connect(IntcInstPtr, XINTC_DPTXSS_DP_INTERRUPT_ID,
(Xil_InterruptHandler)XDpTxSs_DpIntrHandler,
&DpTxSsInst);
if (Status != XST_SUCCESS) {
xil_printf("ERR: DP TX SS DP interrupt connect failed!\n\r");
return XST_FAILURE;
}
/* Enable the interrupt for the Pixel Splitter device */
XScuGic_Enable(IntcInstance, XINTC_DPTXSS_DP_INTERRUPT_ID);
#endif
/* Initialize the exception table. */
Xil_ExceptionInit();
/* Register the interrupt controller handler with the exception
* table.
*/
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler)XINTC_HANDLER, IntcInstPtr);
/* Enable exceptions. */
Xil_ExceptionEnable();
return (XST_SUCCESS);
}
/*****************************************************************************/
/**
*
* This function is called when a Hot-Plug-Detect (HPD) event is received by
* the DisplayPort TX Subsystem core.
*
* @param InstancePtr is a pointer to the XDpTxSs instance.
*
* @return None.
*
* @note Use the XDpTxSs_SetCallback driver function to set this
* function as the handler for HPD event.
*
******************************************************************************/
void DpTxSs_HpdEventHandler(void *InstancePtr)
{
XDpTxSs *DpTxSsInstance = (XDpTxSs *)InstancePtr;
u32 IntrMask;
u32 Status;
/* Read interrupt */
IntrMask = XDpTxSs_ReadReg(DpTxSsInstance->DpPtr->Config.BaseAddr,
(XDPTXSS_INTERRUPT_MASK));
/* Disable HPD interrupts. */
XDpTxSs_WriteReg(DpTxSsInstance->DpPtr->Config.BaseAddr,
(XDPTXSS_INTERRUPT_MASK), IntrMask |
(XDPTXSS_INTERRUPT_MASK_HPD_PULSE_DETECTED_MASK) |
(XDPTXSS_INTERRUPT_MASK_HPD_EVENT_MASK));
xil_printf("+===> HPD connection event detected.\n\r");
if (XDpTxSs_IsConnected(DpTxSsInstance)) {
Status = XDpTxSs_IsMstCapable(DpTxSsInstance);
if ((Status == XST_SUCCESS) &&
DpTxSsInstance->Config.MstSupport) {
DpTxSs_HpdEventCommon(DpTxSsInstance, 1);
}
else if (Status == XST_NO_FEATURE) {
DpTxSs_HpdEventCommon(DpTxSsInstance, 0);
}
else {
xil_printf("ERR:AUX read transaction failed /timed "
"out.\n\r");
}
xil_printf("+===> HPD Connection event ISR is executed.\n\r");
}
else {
xil_printf("+===> HPD disconnection event detected.\n\r");
}
XDpTxSs_WriteReg(DpTxSsInstance->DpPtr->Config.BaseAddr,
(XDPTXSS_INTERRUPT_MASK), IntrMask);
}
/*****************************************************************************/
/**
*
* This function is called when a Hot-Plug-Detect (HPD) pulse is received by
* the DisplayPort TX Subsystem core.
*
* @param InstancePtr is a pointer to the XDpTxSs instance.
*
* @return None.
*
* @note Use the XDpTxSs_SetCallback driver function to set this
* function as the handler for HPD pulse.
*
******************************************************************************/
void DpTxSs_HpdPulseHandler(void *InstancePtr)
{
XDpTxSs *DpTxSsInstance = (XDpTxSs *)InstancePtr;
/* MST mode */
if(DpTxSsInstance->UsrOpt.MstSupport == 1) {
xil_printf("INFO:HPD Pulse event for MST.\n\r");
DpTxSs_HpdEventCommon(DpTxSsInstance, 1);
}
else if (DpTxSsInstance->UsrOpt.MstSupport == 0) {
xil_printf("INFO:HPD Pulse event for SST.\n\r");
DpTxSs_HpdEventCommon(DpTxSsInstance, 0);
}
}
/*****************************************************************************/
/**
*
* This is a common function to set up DisplayPort TX Subsystem for
* Hot-Plug-Event (HPD).
*
* @param InstancePtr is a pointer to the XDpTxSs instance.
* @param Mode specifies stream transport mode from the following
* - 1 = Multi Stream Transport
* - 0 = Single Stream Transport
*
* @return None.
*
* @note None.
*
******************************************************************************/
static void DpTxSs_HpdEventCommon(XDpTxSs *InstancePtr, u8 Mode)
{
u8 VSplitMode;
u32 Status;
if (Mode) {
/* Enable MST mode */
InstancePtr->UsrOpt.MstSupport =
InstancePtr->Config.MstSupport;
/* Restore maximum number of supported streams */
InstancePtr->UsrOpt.NumOfStreams =
InstancePtr->Config.NumMstStreams;
}
else {
/* Enable SST mode */
InstancePtr->UsrOpt.MstSupport = 0;
/* set maximum number of streams to one */
InstancePtr->UsrOpt.NumOfStreams = 1;
}
/* Set VmId to use EDID preferred timing */
InstancePtr->UsrOpt.VmId = XVIDC_VM_USE_EDID_PREFERRED;
/* Read capabilities of RX device */
XDpTxSs_GetRxCapabilities(InstancePtr);
/* Set link rate and lane count to maximum */
XDpTxSs_SetLinkRate(InstancePtr, XDPTXSS_LINK_BW_SET_540GBPS);
XDpTxSs_SetLaneCount(InstancePtr, XDPTXSS_LANE_COUNT_SET_4);
do {
Status = XDpTxSs_Start(InstancePtr);
} while (Status != XST_SUCCESS);
if ((InstancePtr->UsrOpt.VmId == (XVIDC_VM_UHD2_60_P)) &&
(InstancePtr->UsrOpt.MstSupport)) {
VSplitMode = 1;
}
else {
VSplitMode = 0;
}
DpTxSs_StreamSrc(VSplitMode);
}

View file

@ -0,0 +1,316 @@
/******************************************************************************
*
* 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
* XILINX 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 xdptxss_mst_example.c
*
* This file contains a design example using the XDpTxSs driver in single stream
* (SST) transport or multi-stream transport (MST) mode.
*
* @note For this example to display output, the user need to implement
* initialization of the system (DpTxSs_PlatformInit) and after
* DisplayPort TX subsystem start (XDpTxSs_Start) is complete,
* implement configuration of the video stream source in order to
* provide the DisplayPort TX Subsystem HIP input.
* The functions DpTxSs_PlatformInit and DpTxSs_StreamSrc are
* declared and are left up to the user implement.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ---- --- -------- --------------------------------------------------
* 1.00 sha 07/01/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xdptxss.h"
#include "xil_printf.h"
#include "xil_types.h"
#include "xparameters.h"
#include "xstatus.h"
/************************** Constant Definitions *****************************/
/* The unique device ID of the DisplayPort Transmitter Subsystem HIP instance
* to be used
*/
#define XDPTXSS_DEVICE_ID XPAR_DPTXSS_0_DEVICE_ID
/* If set to 1, example will run in MST mode. Otherwise, in SST mode.
* In MST mode, this example reads the EDID of RX devices if connected in
* daisy-chain.
*/
#define DPTXSS_MST 1
#define DPTXSS_LINK_RATE XDPTXSS_LINK_BW_SET_540GBPS
#define DPTXSS_LANE_COUNT XDPTXSS_LANE_COUNT_SET_4
/* The video resolution from the display mode timings (DMT) table to use for
* DisplayPort TX Subsystem. It can be set to use preferred video mode for
* EDID of RX device.
*/
#define DPTXSS_VID_MODE XVIDC_VM_USE_EDID_PREFERRED
/* The color depth (bits per color component) to use DisplayPort TX
* Subsystem.
*/
#define DPTXSS_BPC 8
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
u32 DpTxSs_MstExample(u16 DeviceId);
u32 DpTxSs_PlatformInit(void);
u32 DpTxSs_StreamSrc(u8 VerticalSplit);
/************************** Variable Definitions *****************************/
XDpTxSs DpTxSsInst; /* The DPTX Subsystem instance.*/
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This is the main function for XDpTxSs SST/MST example.
*
* @param None.
*
* @return
* - XST_SUCCESS if the MST/SST example passed.
* - XST_FAILURE if the MST/SST example was unsuccessful.
*
* @note None.
*
******************************************************************************/
int main()
{
u32 Status;
xil_printf("------------------------------------------\n\r");
xil_printf("DisplayPort TX Subsystem %s example\n\r",
DPTXSS_MST?"MST":"SST");
xil_printf("(c) 2015 by Xilinx\n\r");
xil_printf("-------------------------------------------\n\r\n\r");
Status = DpTxSs_MstExample(XDPTXSS_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("DisplayPort TX Subsystem %s example failed."
"\n\r",DPTXSS_MST?"MST":"SST");
return XST_FAILURE;
}
xil_printf("DisplayPort TX Subsystem %s example passed\n\r",
DPTXSS_MST?"MST":"SST");
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function is the main entry point for the MST/SST example using the
* XDpTxSs driver.
*
* @param DeviceId is the unique device ID of the DisplayPort TX
* Subsystem core.
*
* @return
* - XST_SUCCESS if DisplayPort TX Subsystem configured in SST/MST
* successfully.
* - XST_FAILURE, if DisplayPort TX Subsystem failed to configure
* in SST/MST.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_MstExample(u16 DeviceId)
{
u32 Status;
u8 VSplitMode = 0;
XDpTxSs_Config *ConfigPtr;
/* Do platform initialization in this function. This is hardware
* system specific. It is up to the user to implement this function.
*/
xil_printf("PlatformInit\n\r");
Status = DpTxSs_PlatformInit();
if (Status != XST_SUCCESS) {
xil_printf("Platform init failed!\n\r");
}
xil_printf("Platform initialization done.\n\r");
/* Obtain the device configuration for the DisplayPort TX Subsystem */
ConfigPtr = XDpTxSs_LookupConfig(DeviceId);
if (!ConfigPtr) {
return XST_FAILURE;
}
/* Copy the device configuration into the DpTxSsInst's Config
* structure. */
Status = XDpTxSs_CfgInitialize(&DpTxSsInst, ConfigPtr,
ConfigPtr->BaseAddress);
if (Status != XST_SUCCESS) {
xil_printf("DPTXSS config initialization failed.\n\r");
return XST_FAILURE;
}
/* Check for SST/MST support */
if (DpTxSsInst.UsrOpt.MstSupport) {
xil_printf("\n\rINFO:DPTXSS is MST enabled. DPTXSS can be "
"switched to SST/MST\n\r\n\r");
}
else {
xil_printf("\n\rINFO:DPTXSS is SST enabled. DPTXSS works "
"only in SST mode.\n\r\n\r");
}
/* Disable interrupts. */
Xil_ExceptionDisable();
/* Read capabilities of RX device */
Status = XDpTxSs_GetRxCapabilities(&DpTxSsInst);
if (Status != XST_SUCCESS) {
xil_printf("ERR: RX device is not connected.\r\n");
/* Enable interrupts. */
Xil_ExceptionEnable();
return XST_FAILURE;
}
/* Set Link rate and lane count to maximum */
XDpTxSs_SetLinkRate(&DpTxSsInst, DPTXSS_LINK_RATE);
XDpTxSs_SetLaneCount(&DpTxSsInst, DPTXSS_LANE_COUNT);
/* Set video mode */
XDpTxSs_SetVidMode(&DpTxSsInst, DPTXSS_VID_MODE);
/* Set BPC */
XDpTxSs_SetBpc(&DpTxSsInst, DPTXSS_BPC);
/* Check whether DPTXSS and RX device is in MST */
Status = XDpTxSs_IsMstCapable(&DpTxSsInst);
if (DpTxSsInst.UsrOpt.MstSupport && DPTXSS_MST &&
(Status == XST_SUCCESS)) {
/* Set DPTXSS in MST mode */
XDpTxSs_SetTransportMode(&DpTxSsInst, 1);
}
else {
/* Set DPTXSS in SST mode */
XDpTxSs_SetTransportMode(&DpTxSsInst, 0);
}
/* Start DPTXSS parameters set */
Status = XDpTxSs_Start(&DpTxSsInst);
if (Status != XST_SUCCESS) {
xil_printf("ERR:DPTX SS start failed\n\r");
/* Enable interrupts. */
Xil_ExceptionEnable();
return XST_FAILURE;
}
if ((DpTxSsInst.UsrOpt.VmId == (XVIDC_VM_UHD2_60_P)) &&
(DpTxSsInst.UsrOpt.MstSupport)) {
VSplitMode = 1;
}
else {
VSplitMode = 0;
}
/* Do stream setup in this function. It is up to the user to implement
* this function.
*/
DpTxSs_StreamSrc(VSplitMode);
/* Enable interrupts. */
Xil_ExceptionEnable();
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function initialize required platform-specifc peripherals.
*
* @param None.
*
* @return
* - XST_SUCCESS if required peripherals are initialized and
* configured successfully.
* - XST_FAILURE, otherwise.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_PlatformInit(void)
{
/* User is responsible to setup platform specific initialization */
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function setup stream source to input DisplayPort TX Subsystem.
*
* @param VerticalSplit specifies whether to split video frame
* vertically into two different vertical halves.
* - 1 = Vertically split input frame
* - 0 = No vertically split input frame.
*
* @return
* - XST_SUCCESS if stream source is configured successfully.
* - XST_FAILURE, otherwise.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_StreamSrc(u8 VerticalSplit)
{
/* User is responsible to setup stream source to input DPTXSS */
return XST_SUCCESS;
}

View file

@ -0,0 +1,162 @@
/******************************************************************************
*
* 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
* XILINX 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 xdptxss_selftest_example.c
*
* This file contains a design example using the XDpTxSs driver. It performs a
* self test on the DisplayPort Transmitter Subsystem Hierarchical IP that will
* test its sub-cores self test functions.
*
* @note None.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ---- --- -------- --------------------------------------------------
* 1.00 sha 07/01/15 Initial release.
* </pre>
*
******************************************************************************/
/***************************** Include Files *********************************/
#include "xdptxss.h"
#include "xil_printf.h"
#include "xil_types.h"
#include "xparameters.h"
#include "xstatus.h"
/************************** Constant Definitions *****************************/
/* The unique device ID of the DisplayPort Transmitter Subsystem HIP instance
* to be used
*/
#define XDPTXSS_DEVICE_ID XPAR_DPTXSS_0_DEVICE_ID
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** Function Prototypes ******************************/
u32 DpTxSs_SelfTestExample(u16 DeviceId);
/************************** Variable Definitions *****************************/
XDpTxSs DpTxSsInst; /* The DPTX Subsystem instance.*/
/************************** Function Definitions *****************************/
/*****************************************************************************/
/**
*
* This is the main function for XDpTxSs self test example.
*
* @param None.
*
* @return
* - XST_SUCCESS if the self test example passed.
* - XST_FAILURE if the self test example was unsuccessful.
*
* @note None.
*
******************************************************************************/
int main()
{
u32 Status;
xil_printf("---------------------------------\n\r");
xil_printf("DisplayPort TX Subsystem self test example\n\r");
xil_printf("(c) 2015 by Xilinx\n\r");
xil_printf("---------------------------------\n\r\n\r");
Status = DpTxSs_SelfTestExample(XDPTXSS_DEVICE_ID);
if (Status != XST_SUCCESS) {
xil_printf("DisplayPort TX Subsystem self test example "
"failed\n\r");
return XST_FAILURE;
}
xil_printf("DisplayPort TX Subsystem self test example passed\n\r");
return XST_SUCCESS;
}
/*****************************************************************************/
/**
*
* This function is the main entry point for the self test example using the
* XDpTxSs driver. This function check whether or not its sub-core drivers
* self test functions are in working state.
*
* @param DeviceId is the unique device ID of the DisplayPort TX
* Subsystem core.
*
* @return
* - XST_FAILURE if any of DisplayPort TX Subsystem sub-core self
* test failed.
* - XST_SUCCESS, if all of DisplayPort TX Subsystem sub-core self
* test passed.
*
* @note None.
*
******************************************************************************/
u32 DpTxSs_SelfTestExample(u16 DeviceId)
{
u32 Status;
XDpTxSs_Config *ConfigPtr;
/* Obtain the device configuration for the DisplayPort TX Subsystem */
ConfigPtr = XDpTxSs_LookupConfig(DeviceId);
if (!ConfigPtr) {
return XST_FAILURE;
}
/* Copy the device configuration into the DpTxSsInst's Config
* structure. */
Status = XDpTxSs_CfgInitialize(&DpTxSsInst, ConfigPtr,
ConfigPtr->BaseAddress);
if (Status != XST_SUCCESS) {
xil_printf("DPTXSS config initialization failed.\n\r");
return XST_FAILURE;
}
/* Run the self test. */
Status = XDpTxSs_SelfTest(&DpTxSsInst);
return Status;
}