00001 /* $Id: */ 00002 /****************************************************************************** 00003 -- (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved. 00004 -- 00005 -- This file contains confidential and proprietary information 00006 -- of Xilinx, Inc. and is protected under U.S. and 00007 -- international copyright and other intellectual property 00008 -- laws. 00009 -- 00010 -- DISCLAIMER 00011 -- This disclaimer is not a license and does not grant any 00012 -- rights to the materials distributed herewith. Except as 00013 -- otherwise provided in a valid license issued to you by 00014 -- Xilinx, and to the maximum extent permitted by applicable 00015 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND 00016 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES 00017 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING 00018 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- 00019 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and 00020 -- (2) Xilinx shall not be liable (whether in contract or tort, 00021 -- including negligence, or under any other theory of 00022 -- liability) for any loss or damage of any kind or nature 00023 -- related to, arising under or in connection with these 00024 -- materials, including for any direct, or any indirect, 00025 -- special, incidental, or consequential loss or damage 00026 -- (including loss of data, profits, goodwill, or any type of 00027 -- loss or damage suffered as a result of any action brought 00028 -- by a third party) even if such damage or loss was 00029 -- reasonably foreseeable or Xilinx had been advised of the 00030 -- possibility of the same. 00031 -- 00032 -- CRITICAL APPLICATIONS 00033 -- Xilinx products are not designed or intended to be fail- 00034 -- safe, or for use in any application requiring fail-safe 00035 -- performance, such as life-support or safety devices or 00036 -- systems, Class III medical devices, nuclear facilities, 00037 -- applications related to the deployment of airbags, or any 00038 -- other applications that could lead to death, personal 00039 -- injury, or severe property or environmental damage 00040 -- (individually and collectively, "Critical 00041 -- Applications"). Customer assumes the sole risk and 00042 -- liability of any use of Xilinx products in Critical 00043 -- Applications, subject only to applicable laws and 00044 -- regulations governing limitations on product liability. 00045 -- 00046 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS 00047 -- PART OF THIS FILE AT ALL TIMES. 00048 ******************************************************************************/ 00049 /*****************************************************************************/ 00050 /** 00051 * 00052 * @file xvtc.h 00053 * 00054 * This is the main header file of Xilinx MVI Video Timing Controller (VTC) 00055 * device driver. The VTC device detects video signals, independently 00056 * overrides any one of them, re-generates video signals with +/- delay and 00057 * with polarity inversion, and generates up to 16 one cycle Frame Sync outputs. 00058 * 00059 * The device has the following main features: 00060 * - Detect video signals: 00061 * - horizontal sync 00062 * - horizontal blank 00063 * - vertical sync 00064 * - vertical blank 00065 * - active video 00066 * - field id 00067 * - Independently override any one signal. 00068 * - Re-generate video signals with +/- delay and with polarity inversion. 00069 * - Generate up to 16 one cycle Frame Sync outputs. 00070 * 00071 * For a full description of VTC features, please see the hardware 00072 * specification. 00073 * 00074 * <b>Interrupt Service </b> 00075 * 00076 * The interrupt types supported are: 00077 * - Frame Sync Interrupts 0 - 15 00078 * - Generator interrupt 00079 * - Generator Active Video Interrupt 00080 * - Generator VBLANK Interrupt 00081 * - Detector interrupt: 00082 * - Detector Active Video Interrupt 00083 * - Detector VBLANK Interrupt 00084 * - Signal Lock interrupt 00085 * - Active Chroma signal lock 00086 * - Active Video Signal Lock 00087 * - Field ID Signal Lock 00088 * - Vertical Blank Signal Lock 00089 * - Vertical Sync Signal Lock 00090 * - Horizontal Blank Signal Lock 00091 * - Horizontal Sync Signal Lock 00092 * 00093 * <b>Software Initialization </b> 00094 * 00095 * The application needs to do following steps in order for preparing the 00096 * VTC to be ready to process video signal handling. 00097 * 00098 * - Call XVtc_LookupConfig() using a device ID to find the device 00099 * configuration. 00100 * - Call XVtc_CfgInitialize() to initialize the device and the driver 00101 * instance associated with it. 00102 * - Call XVtc_SetGenerator() to set up the video signals to generate, 00103 * if desired. 00104 * - Call XVtc_SetPolarity() to set up the video signal polarity. 00105 * - Call XVtc_SetSource() for source selection 00106 * - Call XVtc_SetGeneratorHoriOffset() to set up the Generator 00107 * VBlank/VSync horizontal offsets, if values other than the default are 00108 * needed 00109 * - Call XVtc_EnableSync(), if generator needs to be synced to the detector 00110 * - Call XVtc_Enable() to enable/start the VTC device. 00111 * 00112 * <b> Examples </b> 00113 * 00114 * An example is provided with this driver to demonstrate the driver usage. 00115 * 00116 * <b>Cache Coherency</b> 00117 * 00118 * <b>Alignment</b> 00119 * 00120 * <b>Limitations</b> 00121 * 00122 * <b>BUS Interface</b> 00123 * 00124 * <pre> 00125 * MODIFICATION HISTORY: 00126 * 00127 * Ver Who Date Changes 00128 * ----- ---- -------- ----------------------------------------------- 00129 * 1.00a xd 08/05/08 First release 00130 * 1.01a xd 07/23/10 Added GIER; Added more h/w generic info into 00131 * xparameters.h; Feed callbacks with pending 00132 * interrupt info. Added Doxygen & Version support 00133 * 2.00a xd 05/13/11 1. Renamed to "Video Timing Controller" 00134 * 2. Added Generator/Detector VBlank/VSync 00135 * Horizontal offset setup/fetch support; 00136 * 3. Renamed the IP to support to be axi_vtc; 00137 * 4. Supported sync between generator and detector; 00138 * 5. Renamed XVtc_SetSync() to XVtc_SetFSync(); 00139 * 6. Renamed XVtc_GetSync() to XVtc_GetFSync(); 00140 * 7. Removed unnecessary register write in 00141 * XVtc_Reset(); 00142 * 8. Corrected driver name in .mdd file 00143 * 9. Updated register bit definition(a few fields grow 00144 * from 12 to 13 bit wide) 00145 * 2.00a cm 05/25/11 1. Renamed XVtc_SetSkip() to XVtc_SetSkipLine(); 00146 * 2. Renamed XVtc_GetSkip() to XVtc_GetSkipLine(); 00147 * 3. Added XVtc_SetSkipPixel(); 00148 * 4. Added XVtc_GetSkipPixel(); 00149 * 5. Renamed XVTC_CTL_GACS_MASK to XVTC_CTL_GACLS_MASK 00150 * 6. Added XVTC_CTL_GACPS_MASK 00151 * </pre> 00152 * 00153 ******************************************************************************/ 00154 00155 #ifndef XVTC_H /* prevent circular inclusions */ 00156 #define XVTC_H /* by using protection macros */ 00157 00158 #ifdef __cplusplus 00159 extern "C" { 00160 #endif 00161 00162 /***************************** Include Files *********************************/ 00163 00164 #include "xvtc_hw.h" 00165 #include "xstatus.h" 00166 00167 /************************** Constant Definitions *****************************/ 00168 00169 /** @name Interrupt Types for setting up Callbacks 00170 * @{ 00171 */ 00172 #define XVTC_HANDLER_FRAMESYNC 1 /**< A frame sync event interrupt type */ 00173 #define XVTC_HANDLER_LOCK 2 /**< A signal lock event interrupt type */ 00174 #define XVTC_HANDLER_DETECTOR 3 /**< A detector event interrupt type */ 00175 #define XVTC_HANDLER_GENERATOR 4 /**< A generator event interrupt type */ 00176 #define XVTC_HANDLER_ERROR 5 /**< An error condition interrupt type */ 00177 /*@}*/ 00178 00179 /** @name Options for enabling VTC modules 00180 * @{ 00181 */ 00182 #define XVTC_EN_GENERATOR 1 /**< To enable generator */ 00183 #define XVTC_EN_DETECTOR 2 /**< To enable detector */ 00184 /*@}*/ 00185 00186 /** @name Address gap between two register next to each other 00187 * @{ 00188 */ 00189 #define XVTC_REG_ADDRGAP 4 00190 /*@}*/ 00191 00192 /**************************** Type Definitions *******************************/ 00193 00194 /** 00195 * This typedef contains configuration information for a VTC device. 00196 * Each VTC device should have a configuration structure associated 00197 */ 00198 typedef struct { 00199 u16 DeviceId; /**< DeviceId is the unique ID of the device */ 00200 u32 BaseAddress; /**< BaseAddress is the physical base address of the 00201 * device's registers */ 00202 } XVtc_Config; 00203 00204 /** 00205 * This typedef contains Polarity configuration information for a VTC 00206 * device. 00207 */ 00208 typedef struct { 00209 u8 ActiveChromaPol; /**< Active Chroma Output Polarity */ 00210 u8 ActiveVideoPol; /**< Active Video Output Polarity */ 00211 u8 FieldIdPol; /**< Field ID Output Polarity */ 00212 u8 VBlankPol; /**< Vertical Blank Output Polarity */ 00213 u8 VSyncPol; /**< Vertical Sync Output Polarity */ 00214 u8 HBlankPol; /**< Horizontal Blank Output Polarity */ 00215 u8 HSyncPol; /**< Horizontal Sync Output Polarity */ 00216 } XVtc_Polarity; 00217 00218 /** 00219 * This typedef contains Source Selection configuration information for a 00220 * VTC device. 00221 */ 00222 typedef struct { 00223 00224 u8 VChromaSrc; /**< Start of Active Chroma Register Source 00225 * Select */ 00226 u8 VActiveSrc; /**< Vertical Active Video Start Register 00227 * Source Select */ 00228 u8 VBackPorchSrc; /**< Vertical Back Porch Start Register Source 00229 * Select */ 00230 u8 VSyncSrc; /**< Vertical Sync Start Register Source Select 00231 */ 00232 u8 VFrontPorchSrc; /**< Vertical Front Porch Start Register Source 00233 * Select */ 00234 u8 VTotalSrc; /**< Vertical Total Register Source Select */ 00235 00236 u8 HActiveSrc; /**< Horizontal Active Video Start Register 00237 * Source Select */ 00238 u8 HBackPorchSrc; /**< Horizontal Back Porch Start Register 00239 * Source Select */ 00240 u8 HSyncSrc; /**< Horizontal Sync Start Register Source 00241 * Select */ 00242 u8 HFrontPorchSrc; /**< Horizontal Front Porch Start Register 00243 * Source Select */ 00244 u8 HTotalSrc; /**< Horizontal Total Register Source Select */ 00245 00246 } XVtc_SourceSelect; 00247 00248 /** 00249 * This typedef contains the VTC signal configuration used by the 00250 * Generator/Detector modules in a VTC device. 00251 */ 00252 typedef struct { 00253 00254 u16 HFrontPorchStart; /**< Horizontal Front Porch Start Cycle Count*/ 00255 u16 HTotal; /**< Horizontal total clock cycles per Line */ 00256 u16 HBackPorchStart; /**< Horizontal Back Porch Start Cycle Count */ 00257 u16 HSyncStart; /**< Horizontal Sync Start Cycle Count */ 00258 u16 HActiveStart; /**< Horizontal Active Video Start Cycle Count 00259 */ 00260 00261 u16 V0FrontPorchStart; /**< Vertical Front Porch Start Line Count 00262 * (Field 0) */ 00263 u16 V0Total; /**< Total lines per Frame (Field 0) */ 00264 u16 V0BackPorchStart; /**< Vertical Back Porch Start Line Count 00265 * (Field 0) */ 00266 u16 V0SyncStart; /**< Vertical Sync Start Line Count (Field 0)*/ 00267 u16 V0ChromaStart; /**< Active Chroma Start Line Count (Field 0)*/ 00268 u16 V0ActiveStart; /**< Vertical Active Video Start Line Count 00269 * (Field 0) */ 00270 00271 u16 V1FrontPorchStart; /**< Vertical Front Porch Start Line Count 00272 * (Field 1) */ 00273 u16 V1Total; /**< Total lines per Frame (Field 1) */ 00274 u16 V1BackPorchStart; /**< Vertical Back Porch Start Line Count 00275 * (Field 1) */ 00276 u16 V1SyncStart; /**< Vertical Sync Start Line Count (Field 1)*/ 00277 u16 V1ChromaStart; /**< Active Chroma Start Line Count (Field 1)*/ 00278 u16 V1ActiveStart; /**< Vertical Active Video Start Line Count 00279 * (Field 1) */ 00280 00281 } XVtc_VtcSignal; 00282 00283 00284 /** 00285 * This typedef contains Detector/Generator VBlank/VSync Horizontal Offset 00286 * configuration information for a VTC device. 00287 */ 00288 typedef struct { 00289 u16 V0BlankHoriStart;/**< Vertical Blank Hori Offset Start (field 0) */ 00290 u16 V0BlankHoriEnd; /**< Vertical Blank Hori Offset End (field 0) */ 00291 u16 V0SyncHoriStart; /**< Vertical Sync Hori Offset Start (field 0) */ 00292 u16 V0SyncHoriEnd; /**< Vertical Sync Hori Offset End (field 0) */ 00293 u16 V1BlankHoriStart;/**< Vertical Blank Hori Offset Start (field 1) */ 00294 u16 V1BlankHoriEnd; /**< Vertical Blank Hori Offset End (field 1) */ 00295 u16 V1SyncHoriStart; /**< Vertical Sync Hori Offset Start (field 1) */ 00296 u16 V1SyncHoriEnd; /**< Vertical Sync Hori Offset End (field 1) */ 00297 } XVtc_HoriOffsets; 00298 00299 /** 00300 * Callback type for all interrupts except error interrupt. 00301 * 00302 * @param CallBackRef is a callback reference passed in by the upper layer 00303 * when setting the callback functions, and passed back to the 00304 * upper layer when the callback is invoked. 00305 * @param Mask is a bit mask indicating the cause of the event. For 00306 * current device version, this parameter is "OR" of 0 or more 00307 * XVTC_IXR_* constants defined in xvtc_hw.h 00308 */ 00309 typedef void (*XVtc_CallBack) (void *CallBackRef, u32 Mask); 00310 00311 /** 00312 * Callback type for Error interrupt. 00313 * 00314 * @param CallBackRef is a callback reference passed in by the upper layer 00315 * when setting the callback functions, and passed back to the 00316 * upper layer when the callback is invoked. 00317 * @param ErrorMask is a bit mask indicating the cause of the error. For 00318 * current device version, this parameter always have value 0 and 00319 * could be ignored. 00320 */ 00321 typedef void (*XVtc_ErrorCallBack) (void *CallBackRef, u32 ErrorMask); 00322 00323 /** 00324 * The XVtc driver instance data. An instance must be allocated for each 00325 * VTC device in use. 00326 */ 00327 typedef struct { 00328 XVtc_Config Config; /**< hardware configuration */ 00329 u32 IsReady; /**< Device and the driver instance 00330 * are initialized */ 00331 00332 XVtc_CallBack FrameSyncCallBack; /**< Call back for Frame Sync 00333 * interrupt */ 00334 void *FrameSyncRef; /**< To be passed to the Frame 00335 * Sync interrupt callback */ 00336 00337 XVtc_CallBack LockCallBack; /**< Call back for Signal Lock 00338 * interrupt */ 00339 void *LockRef; /**< To be passed to the Signal 00340 * Lock interrupt callback */ 00341 00342 XVtc_CallBack DetectorCallBack; /**< Call back for Detector 00343 * interrupt */ 00344 void *DetectorRef; /**< To be passed to the Detector 00345 * interrupt callback */ 00346 00347 XVtc_CallBack GeneratorCallBack; /**< Call back for Generator 00348 * interrupt */ 00349 void *GeneratorRef; /**< To be passed to the 00350 * Generator interrupt 00351 * callback */ 00352 00353 XVtc_ErrorCallBack ErrCallBack; /**< Call back for Error 00354 * interrupt */ 00355 void *ErrRef; /**< To be passed to the Error 00356 * interrupt callback */ 00357 00358 } XVtc; 00359 00360 /***************** Macros (Inline Functions) Definitions *********************/ 00361 00362 /*****************************************************************************/ 00363 /** 00364 * 00365 * This macro resets a VTC device. 00366 * 00367 * @param InstancePtr is a pointer to the VTC device instance to be worked 00368 * on. 00369 * 00370 * @return None 00371 * 00372 * @note 00373 * C-style signature: 00374 * void XVtc_Reset(XVtc *InstancePtr) 00375 * 00376 ******************************************************************************/ 00377 #define XVtc_Reset(InstancePtr) \ 00378 { \ 00379 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_RESET, \ 00380 XVTC_RESET_RESET_MASK); \ 00381 } 00382 00383 /*****************************************************************************/ 00384 /** 00385 * 00386 * This macro enables synchronization of the Generator with the Detector on 00387 * the given VTC device. 00388 * 00389 * @param InstancePtr is a pointer to the VTC device instance to be worked 00390 * on. 00391 * 00392 * @return None 00393 * 00394 * @note 00395 * C-style signature: 00396 * void XVtc_EnableSync(XVtc *InstancePtr) 00397 * 00398 ******************************************************************************/ 00399 #define XVtc_EnableSync(InstancePtr) \ 00400 { \ 00401 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_CTL, \ 00402 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_CTL) | \ 00403 XVTC_CTL_SE_MASK); \ 00404 } 00405 00406 /*****************************************************************************/ 00407 /** 00408 * 00409 * This macro disables synchronization of the Generator with the Detector on 00410 * the given VTC device. 00411 * 00412 * @param InstancePtr is a pointer to the VTC device instance to be worked 00413 * on. 00414 * 00415 * @return None 00416 * 00417 * @note 00418 * C-style signature: 00419 * void XVtc_DisableSync(XVtc *InstancePtr) 00420 * 00421 ******************************************************************************/ 00422 #define XVtc_DisableSync(InstancePtr) \ 00423 { \ 00424 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_CTL, \ 00425 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_CTL) & \ 00426 ~XVTC_CTL_SE_MASK); \ 00427 } 00428 00429 /*****************************************************************************/ 00430 /** 00431 * This function gets the status of the Detector in a VTC device. 00432 * 00433 * @param InstancePtr is a pointer to the VTC device instance to be 00434 * worked on. 00435 * 00436 * @return The Detector Status. Use XVTC_DS_* in xvtc_hw.h to interpret 00437 * the returned value. 00438 * 00439 * @note 00440 * C-style signature: 00441 * u32 XVtc_GetDetectionStatus(XVtc *InstancePtr) 00442 * 00443 ******************************************************************************/ 00444 #define XVtc_GetDetectionStatus(InstancePtr) \ 00445 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_DS) 00446 00447 /*****************************************************************************/ 00448 /** 00449 * 00450 * This macro enables the global interrupt on a VTC device. 00451 * 00452 * @param InstancePtr is a pointer to the VTC device instance to be 00453 * worked on. 00454 * 00455 * @return None. 00456 * 00457 * @note 00458 * C-style signature: 00459 * void XVtc_IntrEnableGlobal(XVtc *InstancePtr); 00460 * 00461 ******************************************************************************/ 00462 #define XVtc_IntrEnableGlobal(InstancePtr) \ 00463 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_GIER,\ 00464 XVTC_GIER_GIE_MASK) 00465 00466 /*****************************************************************************/ 00467 /** 00468 * 00469 * This macro disables the global interrupt on a VTC device. 00470 * 00471 * @param InstancePtr is a pointer to the VTC device instance to be 00472 * worked on. 00473 * 00474 * @return None. 00475 * 00476 * @note 00477 * C-style signature: 00478 * void XVtc_IntrDisableGlobal(XVtc *InstancePtr); 00479 * 00480 ******************************************************************************/ 00481 #define XVtc_IntrDisableGlobal(InstancePtr) \ 00482 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_GIER, 0) 00483 00484 /*****************************************************************************/ 00485 /** 00486 * 00487 * This macro enables individual interrupts of a VTC device. 00488 * 00489 * @param InstancePtr is a pointer to the VTC device instance to be worked 00490 * on. 00491 * 00492 * @param IntrType is the type of the interrupts to enable. Use OR'ing of 00493 * XVTC_IXR_* constants defined in xvtc_hw.h to create this 00494 * parameter value. 00495 * 00496 * @return None 00497 * 00498 * @note 00499 * 00500 * The existing enabled interrupt(s) will remain enabled. 00501 * 00502 * C-style signature: 00503 * void XVtc_IntrEnable(XVtc *InstancePtr, u32 IntrType) 00504 * 00505 ******************************************************************************/ 00506 #define XVtc_IntrEnable(InstancePtr, IntrType) \ 00507 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_IER, \ 00508 ((IntrType) & XVTC_IXR_ALLINTR_MASK) | \ 00509 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_IER)) 00510 00511 /*****************************************************************************/ 00512 /** 00513 * 00514 * This macro disables individual interrupts of a VTC device. 00515 * 00516 * @param InstancePtr is a pointer to the VTC device instance to be worked 00517 * on. 00518 * 00519 * @param IntrType is the type of the interrupts to disable. Use OR'ing of 00520 * XVTC_IXR_* constants defined in xvtc_hw.h to create this 00521 * parameter value. 00522 * 00523 * @return None 00524 * 00525 * @note 00526 * 00527 * Any other interrupt not covered by parameter IntrType, if enabled before 00528 * this macro is called, will remain enabled. 00529 * 00530 * C-style signature: 00531 * void XVtc_IntrDisable(XVtc *InstancePtr, u32 IntrType) 00532 * 00533 ******************************************************************************/ 00534 #define XVtc_IntrDisable(InstancePtr, IntrType) \ 00535 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_IER, \ 00536 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_IER) \ 00537 & ((~(IntrType)) & XVTC_IXR_ALLINTR_MASK)) 00538 00539 /*****************************************************************************/ 00540 /** 00541 * 00542 * This macro returns the pending interrupts of a VTC device. 00543 * 00544 * @param InstancePtr is a pointer to the VTC device instance to be worked 00545 * on. 00546 * 00547 * @return The pending interrupts of the VTC. Use XVTC_IXR_* constants 00548 * defined in xvtc_hw.h to interpret this value. 00549 * 00550 * @note 00551 * 00552 * C-style signature: 00553 * u32 XVtc_IntrGetPending(XVtc *InstancePtr) 00554 * 00555 ******************************************************************************/ 00556 #define XVtc_IntrGetPending(InstancePtr) \ 00557 (XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_IER) & \ 00558 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, XVTC_ISR) & \ 00559 XVTC_IXR_ALLINTR_MASK) 00560 00561 /*****************************************************************************/ 00562 /** 00563 * 00564 * This macro clears/acknowledges pending interrupts of a VTC device. 00565 * 00566 * @param InstancePtr is a pointer to the VTC device instance to be worked 00567 * on. 00568 * 00569 * @param IntrType is the pending interrupts to clear/acknowledge. Use OR'ing 00570 * of XVTC_IXR_* constants defined in xvtc_hw.h to create this 00571 * parameter value. 00572 * 00573 * @return None 00574 * 00575 * @note 00576 * 00577 * C-style signature: 00578 * void XVtc_IntrClear(XVtc *InstancePtr, u32 IntrType) 00579 * 00580 ******************************************************************************/ 00581 #define XVtc_IntrClear(InstancePtr, IntrType) \ 00582 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, XVTC_ISR, \ 00583 (IntrType) & XVTC_IXR_ALLINTR_MASK) 00584 00585 /*****************************************************************************/ 00586 /** 00587 * 00588 * This macro sets the edge at which the following interrupts trigger: 00589 * - XVTC_IXR_ACL_MASK 00590 * - XVTC_IXR_AVL_MASK 00591 * - XVTC_IXR_FIL_MASK 00592 * - XVTC_IXR_VBL_MASK 00593 * - XVTC_IXR_VSL_MASK 00594 * - XVTC_IXR_HBL_MASK 00595 * - XVTC_IXR_HSL_MASK 00596 * 00597 * @param InstancePtr is a pointer to the VTC device instance to be worked 00598 * on. 00599 * 00600 * @param LockPolarity indicates the edge at which the interrupts above 00601 * trigger. Use any non-0 for triggering on rising edge of lock. Use 0 00602 * for triggering on falling edge of lock. 00603 * 00604 * @return None 00605 * 00606 * @note 00607 * 00608 * C-style signature: 00609 * void XVtc_IntrSetLockPolarity(XVtc *InstancePtr, 00610 * u32 LockPolarity) 00611 * 00612 ******************************************************************************/ 00613 #define XVtc_IntrSetLockPolarity(InstancePtr, LockPolarity) \ 00614 { \ 00615 if (LockPolarity) { \ 00616 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, \ 00617 XVTC_CTL, \ 00618 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, \ 00619 XVTC_CTL) | XVTC_CTL_LP_MASK); \ 00620 } \ 00621 else { \ 00622 XVtc_WriteReg((InstancePtr)->Config.BaseAddress, \ 00623 XVTC_CTL, \ 00624 XVtc_ReadReg((InstancePtr)->Config.BaseAddress, \ 00625 XVTC_CTL) & (~XVTC_CTL_LP_MASK)); \ 00626 } \ 00627 } 00628 00629 /************************** Function Prototypes ******************************/ 00630 00631 /* 00632 * Initialization and control functions in xvtc.c 00633 */ 00634 00635 /* Initialization */ 00636 int XVtc_CfgInitialize(XVtc *InstancePtr, XVtc_Config *CfgPtr, 00637 u32 EffectiveAddr); 00638 00639 /* Enabling and Disabling */ 00640 void XVtc_Enable(XVtc *InstancePtr, u32 Type); 00641 void XVtc_Disable(XVtc *InstancePtr, u32 Type); 00642 00643 /* Polarity setting */ 00644 void XVtc_SetPolarity(XVtc *InstancePtr, XVtc_Polarity *PolarityPtr); 00645 void XVtc_GetPolarity(XVtc *InstancePtr, XVtc_Polarity *PolarityPtr); 00646 00647 /* Source selection */ 00648 void XVtc_SetSource(XVtc *InstancePtr, XVtc_SourceSelect *SourcePtr); 00649 void XVtc_GetSource(XVtc *InstancePtr, XVtc_SourceSelect *SourcePtr); 00650 00651 /* Skipping setting */ 00652 void XVtc_SetSkipLine(XVtc *InstancePtr, int GeneratorChromaSkip); 00653 void XVtc_GetSkipLine(XVtc *InstancePtr, int *GeneratorChromaSkipPtr); 00654 void XVtc_SetSkipPixel(XVtc *InstancePtr, int GeneratorChromaSkip); 00655 void XVtc_GetSkipPixel(XVtc *InstancePtr, int *GeneratorChromaSkipPtr); 00656 00657 /* VTC generator/detector setting/fetching */ 00658 void XVtc_SetGenerator(XVtc *InstancePtr, XVtc_VtcSignal *SignalCfgPtr); 00659 void XVtc_GetGenerator(XVtc *InstancePtr, XVtc_VtcSignal *SignalCfgPtr); 00660 void XVtc_GetDetector(XVtc *InstancePtr, XVtc_VtcSignal *SignalCfgPtr); 00661 00662 /* Delay setting */ 00663 void XVtc_SetDelay(XVtc *InstancePtr, int VertDelay, int HoriDelay); 00664 void XVtc_GetDelay(XVtc *InstancePtr, int *VertDelayPtr, int *HoriDelayPtr); 00665 00666 /* Frame Sync setting */ 00667 void XVtc_SetFSync(XVtc *InstancePtr, u16 FrameSyncIndex, 00668 u16 VertStart, u16 HoriStart); 00669 void XVtc_GetFSync(XVtc *InstancePtr, u16 FrameSyncIndex, 00670 u16 *VertStartPtr, u16 *HoriStartPtr); 00671 00672 /* Horizontal Offset Setting */ 00673 void XVtc_SetGeneratorHoriOffset(XVtc *InstancePtr, 00674 XVtc_HoriOffsets *HoriOffset); 00675 void XVtc_GetGeneratorHoriOffset(XVtc *InstancePtr, 00676 XVtc_HoriOffsets *HoriOffset); 00677 void XVtc_GetDetectorHoriOffset(XVtc *InstancePtr, 00678 XVtc_HoriOffsets *HoriOffset); 00679 00680 00681 /* Version functions */ 00682 void XVtc_GetVersion(XVtc *InstancePtr, u16 *Major, u16 *Minor, u16 *Revision); 00683 00684 /* 00685 * Initialization function(s) in xvtc_sinit.c 00686 */ 00687 XVtc_Config *XVtc_LookupConfig(u16 DeviceId); 00688 00689 /* 00690 * Interrupt related function(s) in xvtc_intr.c 00691 */ 00692 void XVtc_IntrHandler(void *InstancePtr); 00693 int XVtc_SetCallBack(XVtc *InstancePtr, u32 IntrType, 00694 void *CallBackFunc, void *CallBackRef); 00695 00696 00697 #ifdef __cplusplus 00698 } 00699 #endif 00700 00701 #endif /* end of protection macro */