Software Drivers

xvtc.c File Reference


Detailed Description

This is main code of Xilinx MVI Video Timing Controller (VTC) device driver. The VTC device detects and generates video sync signals to Video IP cores like MVI Video Scaler. Please see xvtc.h for more details of the driver.

 MODIFICATION HISTORY:

 Ver	Who	Date		Changes
 -----	----	--------	-----------------------------------------------
 1.00a	xd	08/05/08	First release
 1.01a	xd	07/23/10	Added GIER; Added more h/w generic info into
				xparameters.h; Feed callbacks with pending
				interrupt info. Added Doxygen & Version support
 3.00a cjm  08/01/12 Converted from xio.h to xil_io.h, translating
                     basic types, MB cache functions, exceptions and
                     assertions to xil_io format. 
                     Replaced the following 
                     "XExc_Init" -> "Xil_ExceptionInit"
                     "XExc_RegisterHandler" -> "Xil_ExceptionRegisterHandler"
                     "XEXC_ID_NON_CRITICAL_INT" -> "XIL_EXCEPTION_ID_INT"
                     "XExceptionHandler" -> "Xil_ExceptionHandler"
                     "XExc_mEnableExceptions" -> "Xil_ExceptionEnable"
                     "XEXC_NON_CRITICAL" -> "XIL_EXCEPTION_NON_CRITICAL"
                     "XExc_DisableExceptions" -> "Xil_ExceptionDisable"
                     "XExc_RemoveHandler" -> "Xil_ExceptionRemoveHandler"
                     "microblaze_enable_interrupts" -> "Xil_ExceptionEnable"
                     "microblaze_disable_interrupts" -> "Xil_ExceptionDisable"

                     "XCOMPONENT_IS_STARTED" -> "XIL_COMPONENT_IS_STARTED"
                     "XCOMPONENT_IS_READY" -> "XIL_COMPONENT_IS_READY"

                     "XASSERT_NONVOID" -> "Xil_AssertNonvoid"
                     "XASSERT_VOID_ALWAYS" -> "Xil_AssertVoidAlways"
                     "XASSERT_VOID" -> "Xil_AssertVoid"
                     "Xil_AssertVoid_ALWAYS" -> "Xil_AssertVoidAlways" 
                     "XAssertStatus" -> "Xil_AssertStatus"
                     "XAssertSetCallback" -> "Xil_AssertCallback"

                     "XASSERT_OCCURRED" -> "XIL_ASSERT_OCCURRED"
                     "XASSERT_NONE" -> "XIL_ASSERT_NONE"

                     "microblaze_disable_dcache" -> "Xil_DCacheDisable"
                     "microblaze_enable_dcache" -> "Xil_DCacheEnable"
                     "microblaze_enable_icache" -> "Xil_ICacheEnable"
                     "microblaze_disable_icache" -> "Xil_ICacheDisable"
                     "microblaze_init_dcache_range" -> "Xil_DCacheInvalidateRange"

                     "XCache_DisableDCache" -> "Xil_DCacheDisable"
                     "XCache_DisableICache" -> "Xil_ICacheDisable"
                     "XCache_EnableDCache" -> "Xil_DCacheEnableRegion"
                     "XCache_EnableICache" -> "Xil_ICacheEnableRegion"
                     "XCache_InvalidateDCacheLine" -> "Xil_DCacheInvalidateRange"

                     "XUtil_MemoryTest32" -> "Xil_TestMem32"
                     "XUtil_MemoryTest16" -> "Xil_TestMem16"
                     "XUtil_MemoryTest8" -> "Xil_TestMem8"

                     "xutil.h" -> "xil_testmem.h"

                     "xbasic_types.h" -> "xil_types.h"
                     "xio.h" -> "xil_io.h"

                     "XIo_In32" -> "Xil_In32"
                     "XIo_Out32" -> "Xil_Out32"

                     "XTRUE" -> "TRUE"
                     "XFALSE" -> "FALSE"
                     "XNULL" -> "NULL"

                     "Xuint8" -> "u8"
                     "Xuint16" -> "u16"
                     "Xuint32" -> "u32"
                     "Xint8" -> "char"
                     "Xint16" -> "short"
                     "Xint32" -> "long"
                     "Xfloat32" -> "float"
                     "Xfloat64" -> "double"
                     "Xboolean" -> "int"
                     "XTEST_FAILED" -> "XST_FAILURE"
                     "XTEST_PASSED" -> "XST_SUCCESS"
 4.00a cjm  02/08/13 Removed XVTC_CTL_HASS_MASK
 5.00a cjm  08/07/13 Replaced CTL in Polarity and Encoding register defines
                     with "POL" and "ENC"
 5.00a cjm  10/30/13 Removed type parameter from XVtc_Enable()   
                     XVtc_Enable() now enables both generator & detector.
                     Added XVtc_EnableGenerator() to enable only the Generator  
                     Added XVtc_EnableDetector() to enable only the Detector
 5.00a cjm  11/01/13 Added Timing, VideoMode and Signal Conversion Functions:
                       XVtc_ConvVideoMode2Timing()
                       XVtc_ConvTiming2Signal()
                       XVtc_ConvSignal2Timing()
                       XVtc_ConvTiming2VideoMode()
                     Added Timing and Video Mode Set/Get Functions:
                       XVtc_SetGeneratorTiming()
                       XVtc_SetGeneratorVideoMode()
                       XVtc_GetGeneratorTiming()
                       XVtc_GetGeneratorVideoMode()
                       XVtc_GetDetectorTiming()
                       XVtc_GetDetectorVideoMode()
                     Updated XVtc_GetGeneratorHoriOffset and XVtc_SetGeneratorHoriOffset
                     For adding interlaced/field-1 registers setting/getting
                     Updated XVtc_SetGenerator() to align vsync to hsync horizontally
                     by default
                     Added Field 1 set/get to XVtc_SetGenerator(), XVtc_GetGenerator()
                     and XVtc_GetDetector()
 5.00a cjm  11/03/13 Added Chroma/field parity bit masks
                     Replaced old timing bit masks/shifts with Start/End Bit
                     masks/shifts

 

#include "xvtc.h"
#include "xenv.h"

Functions

int XVtc_CfgInitialize (XVtc *InstancePtr, XVtc_Config *CfgPtr, u32 EffectiveAddr)
void XVtc_EnableGenerator (XVtc *InstancePtr)
void XVtc_EnableDetector (XVtc *InstancePtr)
void XVtc_Enable (XVtc *InstancePtr)
void XVtc_DisableGenerator (XVtc *InstancePtr)
void XVtc_DisableDetector (XVtc *InstancePtr)
void XVtc_Disable (XVtc *InstancePtr)
void XVtc_SetPolarity (XVtc *InstancePtr, XVtc_Polarity *PolarityPtr)
void XVtc_GetPolarity (XVtc *InstancePtr, XVtc_Polarity *PolarityPtr)
void XVtc_GetDetectorPolarity (XVtc *InstancePtr, XVtc_Polarity *PolarityPtr)
void XVtc_SetSource (XVtc *InstancePtr, XVtc_SourceSelect *SourcePtr)
void XVtc_GetSource (XVtc *InstancePtr, XVtc_SourceSelect *SourcePtr)
void XVtc_SetSkipLine (XVtc *InstancePtr, int GeneratorChromaSkip)
void XVtc_GetSkipLine (XVtc *InstancePtr, int *GeneratorChromaSkipPtr)
void XVtc_SetSkipPixel (XVtc *InstancePtr, int GeneratorChromaSkip)
void XVtc_GetSkipPixel (XVtc *InstancePtr, int *GeneratorChromaSkipPtr)
void XVtc_SetDelay (XVtc *InstancePtr, int VertDelay, int HoriDelay)
void XVtc_GetDelay (XVtc *InstancePtr, int *VertDelayPtr, int *HoriDelayPtr)
void XVtc_SetFSync (XVtc *InstancePtr, u16 FrameSyncIndex, u16 VertStart, u16 HoriStart)
void XVtc_GetFSync (XVtc *InstancePtr, u16 FrameSyncIndex, u16 *VertStartPtr, u16 *HoriStartPtr)
void XVtc_SetGeneratorHoriOffset (XVtc *InstancePtr, XVtc_HoriOffsets *HoriOffsets)
void XVtc_GetGeneratorHoriOffset (XVtc *InstancePtr, XVtc_HoriOffsets *HoriOffsets)
void XVtc_GetDetectorHoriOffset (XVtc *InstancePtr, XVtc_HoriOffsets *HoriOffsets)
void XVtc_SetGenerator (XVtc *InstancePtr, XVtc_Signal *SignalCfgPtr)
void XVtc_GetGenerator (XVtc *InstancePtr, XVtc_Signal *SignalCfgPtr)
void XVtc_GetDetector (XVtc *InstancePtr, XVtc_Signal *SignalCfgPtr)
void XVtc_GetVersion (XVtc *InstancePtr, u16 *Major, u16 *Minor, u16 *Revision)


Function Documentation

int XVtc_CfgInitialize XVtc InstancePtr,
XVtc_Config CfgPtr,
u32  EffectiveAddr
 

This function initializes a VTC device. This function must be called prior to using a VTC device. Initialization of a VTC includes setting up the instance data, and ensuring the hardware is in a quiescent state.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
CfgPtr points to the configuration structure associated with the VTC device.
EffectiveAddr is the base address of the device. If address translation is being used, then this parameter must reflect the virtual base address. Otherwise, the physical address should be used.
Returns:
XST_SUCCESS

void XVtc_Disable XVtc InstancePtr  ) 
 

This function disables a VTC device - Detector and Generator at same time..

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_DisableDetector XVtc InstancePtr  ) 
 

This function disables a VTC Detector device

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_DisableGenerator XVtc InstancePtr  ) 
 

This function disables a VTC Generator device

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_Enable XVtc InstancePtr  ) 
 

This function enables a VTC device - Detector and Generator at same time.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_EnableDetector XVtc InstancePtr  ) 
 

This function enables a VTC Detector device

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_EnableGenerator XVtc InstancePtr  ) 
 

This function enables a VTC Generator device

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Returns:
NONE.

void XVtc_GetDelay XVtc InstancePtr,
int *  VertDelayPtr,
int *  HoriDelayPtr
 

This function gets the Generator delay setting used by a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
VertDelayPtr will point to a value indicating the number of total lines per frame to delay the generator output after this function returns.
HoriDelayPtr will point to a value indicating the number of total clock cycles per line to delay the generator output after this function returns.
Returns:
NONE.

void XVtc_GetDetector XVtc InstancePtr,
XVtc_Signal SignalCfgPtr
 

This function gets the VTC signal setting used by the Detector module in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
SignalCfgPtr is a pointer to a VTC signal configuration which will be populated with the setting used by the Detector module in the VTC device once this function returns.
Returns:
NONE.

void XVtc_GetDetectorHoriOffset XVtc InstancePtr,
XVtc_HoriOffsets HoriOffsets
 

This function gets the VBlank/VSync Horizontal Offsets detected by the Detector in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
HoriOffsets points to a VBlank/VSync Horizontal Offset configuration structure that will be populated with the setting detected on the Detector in the given VTC device after this function returns.
Returns:
NONE.

void XVtc_GetDetectorPolarity XVtc InstancePtr,
XVtc_Polarity PolarityPtr
 

This function gets the input polarity setting used by a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
PolarityPtr points to a Polarity configuration structure that will be populated with the setting used on the VTC device after this function returns.
Returns:
NONE.

void XVtc_GetFSync XVtc InstancePtr,
u16  FrameSyncIndex,
u16 *  VertStartPtr,
u16 *  HoriStartPtr
 

This function gets the SYNC setting of a Frame Sync used by VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
FrameSyncIndex indicates the index number of the frame sync. The valid range is from 0 to 15.
VertStartPtr will point to the value that indicates the vertical line count during which the Frame Sync is active once this function returns.
HoriStartPtr will point to the value that indicates the horizontal cycle count during which the Frame Sync is active once this function returns.
Returns:
NONE.

void XVtc_GetGenerator XVtc InstancePtr,
XVtc_Signal SignalCfgPtr
 

This function gets the VTC signal setting used by the Generator module in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
SignalCfgPtr is a pointer to a VTC signal configuration which will be populated with the setting used by the Generator module in the VTC device once this function returns.
Returns:
NONE.

void XVtc_GetGeneratorHoriOffset XVtc InstancePtr,
XVtc_HoriOffsets HoriOffsets
 

This function gets the VBlank/VSync Horizontal Offsets currently used by the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
HoriOffsets points to a VBlank/VSync Horizontal Offset configuration structure that will be populated with the setting currently used on the Generator in the given VTC device after this function returns.
Returns:
NONE.

void XVtc_GetPolarity XVtc InstancePtr,
XVtc_Polarity PolarityPtr
 

This function gets the output polarity setting used by a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
PolarityPtr points to a Polarity configuration structure that will be populated with the setting used on the VTC device after this function returns.
Returns:
NONE.

void XVtc_GetSkipLine XVtc InstancePtr,
int *  GeneratorChromaSkipPtr
 

This function gets the line skip setting used by the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
GeneratorChromaSkipPtr will point to the value indicating whether 1 line is skipped between active chroma for the Generator module after this function returns. value 1 means that 1 line is skipped, and 0 means that no lines are skipped
Returns:
NONE.

void XVtc_GetSkipPixel XVtc InstancePtr,
int *  GeneratorChromaSkipPtr
 

This function gets the pixel skip setting used by the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
GeneratorChromaSkipPtr will point to the value indicating whether 1 pixel is skipped between active chroma for the Generator module after this function returns. value 1 means that 1 pixel is skipped, and 0 means that no pixels are skipped
Returns:
NONE.

void XVtc_GetSource XVtc InstancePtr,
XVtc_SourceSelect SourcePtr
 

This function gets the source select setting used by a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on
SourcePtr points to a source select configuration structure that will be populated with the setting used on the VTC device after this function returns
Returns:
NONE

void XVtc_GetVersion XVtc InstancePtr,
u16 *  Major,
u16 *  Minor,
u16 *  Revision
 

This function returns the version of a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
Major points to an unsigned 16-bit variable that will be assigned with the major version number after this function returns. Value range is from 0x0 to 0xF.
Minor points to an unsigned 16-bit variable that will be assigned with the minor version number after this function returns. Value range is from 0x00 to 0xFF.
Revision points to an unsigned 16-bit variable that will be assigned with the revision version number after this function returns. Value range is from 0xA to 0xF.
Returns:
None.
Note:
Example: Device version should read v2.01.c if major version number is 0x2, minor version number is 0x1, and revision version number is 0xC.

void XVtc_SetDelay XVtc InstancePtr,
int  VertDelay,
int  HoriDelay
 

This function sets up the Generator delay setting of a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
VertDelay indicates the number of total lines per frame to delay the generator output. The valid range is from 0 to 4095.
HoriDelay indicates the number of total clock cycles per line to delay the generator output. The valid range is from 0 to 4095.
Returns:
NONE.

void XVtc_SetFSync XVtc InstancePtr,
u16  FrameSyncIndex,
u16  VertStart,
u16  HoriStart
 

This function sets up the SYNC setting of a Frame Sync used by VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
FrameSyncIndex indicates the index number of the frame sync. The valid range is from 0 to 15.
VertStart indicates the vertical line count during which the Frame Sync is active. The valid range is from 0 to 4095.
HoriStart indicates the horizontal cycle count during which the Frame Sync is active. The valid range is from 0 to 4095.
Returns:
NONE.

void XVtc_SetGenerator XVtc InstancePtr,
XVtc_Signal SignalCfgPtr
 

This function sets up VTC signal to be used by the Generator module in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
SignalCfgPtr is a pointer to the VTC signal configuration to be used by the Generator module in the VTC device.
Returns:
NONE.

void XVtc_SetGeneratorHoriOffset XVtc InstancePtr,
XVtc_HoriOffsets HoriOffsets
 

This function sets the VBlank/VSync Horizontal Offsets for the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
HoriOffsets points to a VBlank/VSync Horizontal Offset configuration with the setting to use on the VTC device.
Returns:
NONE.

void XVtc_SetPolarity XVtc InstancePtr,
XVtc_Polarity PolarityPtr
 

This function sets up the output polarity of a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
PolarityPtr points to a Polarity configuration structure w/ the setting to use on the VTC device.
Returns:
NONE.

void XVtc_SetSkipLine XVtc InstancePtr,
int  GeneratorChromaSkip
 

This function sets up the line skip setting of the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
GeneratorChromaSkip indicates whether to skip 1 line between active chroma for the Generator module. Use Non-0 value for this parameter to skip 1 line, and 0 to not skip lines
Returns:
NONE.

void XVtc_SetSkipPixel XVtc InstancePtr,
int  GeneratorChromaSkip
 

This function sets up the pixel skip setting of the Generator in a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on.
GeneratorChromaSkip indicates whether to skip 1 pixel between active chroma for the Generator module. Use Non-0 value for this parameter to skip 1 pixel, and 0 to not skip pixels
Returns:
NONE.

void XVtc_SetSource XVtc InstancePtr,
XVtc_SourceSelect SourcePtr
 

This function sets up the source selecting of a VTC device.

Parameters:
InstancePtr is a pointer to the VTC device instance to be worked on
SourcePtr points to a Source Selecting configuration structure with the setting to use on the VTC device.
Returns:
NONE.
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.