00001 /* $Id: */ 00002 /****************************************************************************** 00003 * 00004 * (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved. 00005 * 00006 * This file contains confidential and proprietary information 00007 * of Xilinx, Inc. and is protected under U.S. and 00008 * international copyright and other intellectual property 00009 * laws. 00010 * 00011 * DISCLAIMER 00012 * This disclaimer is not a license and does not grant any 00013 * rights to the materials distributed herewith. Except as 00014 * otherwise provided in a valid license issued to you by 00015 * Xilinx, and to the maximum extent permitted by applicable 00016 * law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND 00017 * WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES 00018 * AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING 00019 * BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON- 00020 * INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and 00021 * (2) Xilinx shall not be liable (whether in contract or tort, 00022 * including negligence, or under any other theory of 00023 * liability) for any loss or damage of any kind or nature 00024 * related to, arising under or in connection with these 00025 * materials, including for any direct, or any indirect, 00026 * special, incidental, or consequential loss or damage 00027 * (including loss of data, profits, goodwill, or any type of 00028 * loss or damage suffered as a result of any action brought 00029 * by a third party) even if such damage or loss was 00030 * reasonably foreseeable or Xilinx had been advised of the 00031 * possibility of the same. 00032 * 00033 * CRITICAL APPLICATIONS 00034 * Xilinx products are not designed or intended to be fail- 00035 * safe, or for use in any application requiring fail-safe 00036 * performance, such as life-support or safety devices or 00037 * systems, Class III medical devices, nuclear facilities, 00038 * applications related to the deployment of airbags, or any 00039 * other applications that could lead to death, personal 00040 * injury, or severe property or environmental damage 00041 * (individually and collectively, "Critical 00042 * Applications"). Customer assumes the sole risk and 00043 * liability of any use of Xilinx products in Critical 00044 * Applications, subject only to applicable laws and 00045 * regulations governing limitations on product liability. 00046 * 00047 * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS 00048 * PART OF THIS FILE AT ALL TIMES. 00049 * 00050 ******************************************************************************/ 00051 /*****************************************************************************/ 00052 /** 00053 * 00054 * @file xosd.h 00055 * 00056 * This is main header file of the Xilinx MVI On-Screen-Display (OSD) device 00057 * driver. 00058 * 00059 * An OSD is an image superimposed on a screen picture, commonly used by modern 00060 * televisions, VCRs, and DVD players to display information such as volume, 00061 * channel, and time. 00062 * 00063 * Xilinx MVI OSD has the following main features: 00064 * 00065 * - Read Video Data one of three sources 00066 * - VFBC/Frame Buffer 00067 * - VideoBus 00068 * - Graphics Controller 00069 * - Alpha Compositing and Alpha Blending of up to 8 layers 00070 * - Up to 8 priorities, one for each of the layers 00071 * - Real-Time Graphics Controller 00072 * - Write Composited Video Data to either 00073 * - VFBC/Frame Buffer, or 00074 * - VideoBus 00075 * 00076 * For a full description of OSD features, please see the hardware spec. 00077 * 00078 * <b>Interrupt Service </b> 00079 * 00080 * Four interrupt types are supported: 00081 * 00082 * - Vertical Blank Interval Start Interrupt 00083 * - Vertical Blank Interval End Interrupt 00084 * - Frame Done Interrupt 00085 * - Error Interrupt 00086 * 00087 * <b>Software Initialization </b> 00088 * 00089 * Please follow the example provided with this driver for the steps 00090 * to use this driver. 00091 * 00092 * <b>Cache Coherency</b> 00093 * 00094 * <b>Alignment</b> 00095 * 00096 * <b>Limitations</b> 00097 * 00098 * <b>BUS Interface</b> 00099 * 00100 * <pre> 00101 * MODIFICATION HISTORY: 00102 * 00103 * Ver Who Date Changes 00104 * ----- ---- -------- ------------------------------------------------------- 00105 * 1.00a xd 08/18/08 First release 00106 * 1.01a xd 07/30/10 Added device version support; Supported doxygen; Fixed 00107 * CR #534952 00108 * 1.02a xd 12/21/10 Removed endian conversion for text bank loading 00109 * </pre> 00110 * 00111 ******************************************************************************/ 00112 00113 #ifndef XOSD_H /* prevent circular inclusions */ 00114 #define XOSD_H /* by using protection macros */ 00115 00116 #ifdef __cplusplus 00117 extern "C" { 00118 #endif 00119 00120 /***************************** Include Files *********************************/ 00121 00122 #include "xosd_hw.h" 00123 #include "xstatus.h" 00124 00125 /************************** Constant Definitions *****************************/ 00126 00127 /** @name Interrupt types for setting up callbacks 00128 * @{ 00129 */ 00130 #define XOSD_HANDLER_FRAMEDONE 1 /**< Frame Done interrupt */ 00131 #define XOSD_HANDLER_VBISTART 2 /**< Vertical Blank Interval Start 00132 * interrupt */ 00133 #define XOSD_HANDLER_VBIEND 3 /**< Vertical Blank Interval End 00134 * interrupt */ 00135 #define XOSD_HANDLER_ERROR 4 /**< Error condition interrupt */ 00136 /*@}*/ 00137 00138 /**************************** Type Definitions *******************************/ 00139 00140 /** 00141 * OSD device configuration structure. 00142 * Each OSD device should have a configuration structure associated 00143 */ 00144 typedef struct { 00145 u16 DeviceId; /**< DeviceId is the unique ID of the device */ 00146 u32 BaseAddress; /**< BaseAddress is the physical base address of 00147 * the device's registers */ 00148 u16 LayerNum; /**< The number of Layers */ 00149 u16 Layer0Type; /**< Type of Layer #0 */ 00150 u16 Layer1Type; /**< Type of Layer #1 */ 00151 u16 Layer2Type; /**< Type of Layer #2 */ 00152 u16 Layer3Type; /**< Type of Layer #3 */ 00153 u16 Layer4Type; /**< Type of Layer #4 */ 00154 u16 Layer5Type; /**< Type of Layer #5 */ 00155 u16 Layer6Type; /**< Type of Layer #6 */ 00156 u16 Layer7Type; /**< Type of Layer #7 */ 00157 00158 /**< Layer 0 */ 00159 u16 Layer0InstructionMemSize; /**< Instruction Memory Size */ 00160 u16 Layer0InstructionBoxEnable; /**< Instruction Box Enable */ 00161 u16 Layer0InstructionLineEnable; /**< Instruction Line Enable */ 00162 u16 Layer0InstructionTextEnable; /**< Instruction Text Enable */ 00163 u16 Layer0ColorLutSize; /**< Color Lut Size */ 00164 u16 Layer0ColorLutMemoryType; /**< Color Lut Memory Type */ 00165 u16 Layer0FontNumChars; /**< Font: Number of characters */ 00166 u16 Layer0FontWidth; /**< Font: Width */ 00167 u16 Layer0FontHeight; /**< Font: Height */ 00168 u16 Layer0FontBitsPerPixel; /**< Font: Number of bits per pixel 00169 */ 00170 u16 Layer0FontAsciiOffset; /**< Font: ASCII offset of 1st 00171 * character */ 00172 u16 Layer0TextNumStrings; /**< Text: Number of Strings */ 00173 u16 Layer0TextMaxStringLength; /**< Text: Maximum length of a 00174 * String */ 00175 00176 /**< Layer 1 */ 00177 u16 Layer1InstructionMemSize; /**< Instruction Memory Size */ 00178 u16 Layer1InstructionBoxEnable; /**< Instruction Box Enable */ 00179 u16 Layer1InstructionLineEnable; /**< Instruction Line Enable */ 00180 u16 Layer1InstructionTextEnable; /**< Instruction Text Enable */ 00181 u16 Layer1ColorLutSize; /**< Color Lut Size */ 00182 u16 Layer1ColorLutMemoryType; /**< Color Lut Memory Type */ 00183 u16 Layer1FontNumChars; /**< Font: Number of characters */ 00184 u16 Layer1FontWidth; /**< Font: Width */ 00185 u16 Layer1FontHeight; /**< Font: Height */ 00186 u16 Layer1FontBitsPerPixel; /**< Font: Number of bits per pixel 00187 */ 00188 u16 Layer1FontAsciiOffset; /**< Font: ASCII offset of 1st 00189 * character */ 00190 u16 Layer1TextNumStrings; /**< Text: Number of Strings */ 00191 u16 Layer1TextMaxStringLength; /**< Text: Maximum length of a 00192 * String */ 00193 00194 /**< Layer 2 */ 00195 u16 Layer2InstructionMemSize; /**< Instruction Memory Size */ 00196 u16 Layer2InstructionBoxEnable; /**< Instruction Box Enable */ 00197 u16 Layer2InstructionLineEnable; /**< Instruction Line Enable */ 00198 u16 Layer2InstructionTextEnable; /**< Instruction Text Enable */ 00199 u16 Layer2ColorLutSize; /**< Color Lut Size */ 00200 u16 Layer2ColorLutMemoryType; /**< Color Lut Memory Type */ 00201 u16 Layer2FontNumChars; /**< Font: Number of characters */ 00202 u16 Layer2FontWidth; /**< Font: Width */ 00203 u16 Layer2FontHeight; /**< Font: Height */ 00204 u16 Layer2FontBitsPerPixel; /**< Font: Number of bits per 00205 * pixel */ 00206 u16 Layer2FontAsciiOffset; /**< Font: ASCII offset of 1st 00207 * character */ 00208 u16 Layer2TextNumStrings; /**< Text: Number of Strings */ 00209 u16 Layer2TextMaxStringLength; /**< Text: Maximum length of a 00210 * String */ 00211 00212 /**< Layer 3 */ 00213 u16 Layer3InstructionMemSize; /**< Instruction Memory Size */ 00214 u16 Layer3InstructionBoxEnable; /**< Instruction Box Enable */ 00215 u16 Layer3InstructionLineEnable; /**< Instruction Line Enable */ 00216 u16 Layer3InstructionTextEnable; /**< Instruction Text Enable */ 00217 u16 Layer3ColorLutSize; /**< Color Lut Size */ 00218 u16 Layer3ColorLutMemoryType; /**< Color Lut Memory Type */ 00219 u16 Layer3FontNumChars; /**< Font: Number of characters */ 00220 u16 Layer3FontWidth; /**< Font: Width */ 00221 u16 Layer3FontHeight; /**< Font: Height */ 00222 u16 Layer3FontBitsPerPixel; /**< Font: Number of bits per pixel 00223 */ 00224 u16 Layer3FontAsciiOffset; /**< Font: ASCII offset of 1st 00225 * character */ 00226 u16 Layer3TextNumStrings; /**< Text: Number of Strings */ 00227 u16 Layer3TextMaxStringLength; /**< Text: Maximum length of a 00228 * String */ 00229 00230 /**< Layer 4 */ 00231 u16 Layer4InstructionMemSize; /**< Instruction Memory Size */ 00232 u16 Layer4InstructionBoxEnable; /**< Instruction Box Enable */ 00233 u16 Layer4InstructionLineEnable; /**< Instruction Line Enable */ 00234 u16 Layer4InstructionTextEnable; /**< Instruction Text Enable */ 00235 u16 Layer4ColorLutSize; /**< Color Lut Size */ 00236 u16 Layer4ColorLutMemoryType; /**< Color Lut Memory Type */ 00237 u16 Layer4FontNumChars; /**< Font: Number of characters */ 00238 u16 Layer4FontWidth; /**< Font: Width */ 00239 u16 Layer4FontHeight; /**< Font: Height */ 00240 u16 Layer4FontBitsPerPixel; /**< Font: Number of bits per 00241 * pixel */ 00242 u16 Layer4FontAsciiOffset; /**< Font: ASCII offset of 1st 00243 * character */ 00244 u16 Layer4TextNumStrings; /**< Text: Number of Strings */ 00245 u16 Layer4TextMaxStringLength; /**< Text: Maximum length of a 00246 * String */ 00247 00248 /**< Layer 5 */ 00249 u16 Layer5InstructionMemSize; /**< Instruction Memory Size */ 00250 u16 Layer5InstructionBoxEnable; /**< Instruction Box Enable */ 00251 u16 Layer5InstructionLineEnable; /**< Instruction Line Enable */ 00252 u16 Layer5InstructionTextEnable; /**< Instruction Text Enable */ 00253 u16 Layer5ColorLutSize; /**< Color Lut Size */ 00254 u16 Layer5ColorLutMemoryType; /**< Color Lut Memory Type */ 00255 u16 Layer5FontNumChars; /**< Font: Number of characters */ 00256 u16 Layer5FontWidth; /**< Font: Width */ 00257 u16 Layer5FontHeight; /**< Font: Height */ 00258 u16 Layer5FontBitsPerPixel; /**< Font: Number of bits per 00259 * pixel */ 00260 u16 Layer5FontAsciiOffset; /**< Font: ASCII offset of 1st 00261 * character */ 00262 u16 Layer5TextNumStrings; /**< Text: Number of Strings */ 00263 u16 Layer5TextMaxStringLength; /**< Text: Maximum length of a 00264 * String */ 00265 00266 /**< Layer 6 */ 00267 u16 Layer6InstructionMemSize; /**< Instruction Memory Size */ 00268 u16 Layer6InstructionBoxEnable; /**< Instruction Box Enable */ 00269 u16 Layer6InstructionLineEnable; /**< Instruction Line Enable */ 00270 u16 Layer6InstructionTextEnable; /**< Instruction Text Enable */ 00271 u16 Layer6ColorLutSize; /**< Color Lut Size */ 00272 u16 Layer6ColorLutMemoryType; /**< Color Lut Memory Type */ 00273 u16 Layer6FontNumChars; /**< Font: Number of characters */ 00274 u16 Layer6FontWidth; /**< Font: Width */ 00275 u16 Layer6FontHeight; /**< Font: Height */ 00276 u16 Layer6FontBitsPerPixel; /**< Font: Number of bits per 00277 * pixel */ 00278 u16 Layer6FontAsciiOffset; /**< Font: ASCII offset of 1st 00279 * character */ 00280 u16 Layer6TextNumStrings; /**< Text: Number of Strings */ 00281 u16 Layer6TextMaxStringLength; /**< Text: Maximum length of a 00282 * String */ 00283 00284 /**< Layer 7 */ 00285 u16 Layer7InstructionMemSize; /**< Instruction Memory Size */ 00286 u16 Layer7InstructionBoxEnable; /**< Instruction Box Enable */ 00287 u16 Layer7InstructionLineEnable; /**< Instruction Line Enable */ 00288 u16 Layer7InstructionTextEnable; /**< Instruction Text Enable */ 00289 u16 Layer7ColorLutSize; /**< Color Lut Size */ 00290 u16 Layer7ColorLutMemoryType; /**< Color Lut Memory Type */ 00291 u16 Layer7FontNumChars; /**< Font: Number of characters */ 00292 u16 Layer7FontWidth; /**< Font: Width */ 00293 u16 Layer7FontHeight; /**< Font: Height */ 00294 u16 Layer7FontBitsPerPixel; /**< Font: Number of bits per 00295 * pixel */ 00296 u16 Layer7FontAsciiOffset; /**< Font: ASCII offset of 1st 00297 * character */ 00298 u16 Layer7TextNumStrings; /**< Text: Number of Strings */ 00299 u16 Layer7TextMaxStringLength; /**< Text: Maximum length of a 00300 * String */ 00301 00302 } XOSD_Config; 00303 00304 /** 00305 * The XOSD Layer info structure 00306 */ 00307 typedef struct { 00308 u16 LayerType; /**< Type of the layer */ 00309 u16 InstructionNum; /**< The Number of Instructions */ 00310 u16 InstructionBoxEnable; /**< Instruction Box Enable */ 00311 u16 InstructionLineEnable; /**< Instruction Line Enable */ 00312 u16 InstructionTextEnable; /**< Instruction Text Enable */ 00313 u16 ColorLutSize; /**< Color Lut Size */ 00314 u16 ColorLutMemoryType; /**< Color Lut Memory Type */ 00315 u16 FontNumChars; /**< Font: Number of characters */ 00316 u16 FontWidth; /**< Font: Width */ 00317 u16 FontHeight; /**< Font: Height */ 00318 u16 FontBitsPerPixel; /**< Font: Number of bits per pixel */ 00319 u16 FontAsciiOffset; /**< Font: ASCII offset of 1st 00320 * character */ 00321 u16 TextNumStrings; /**< Text: Number of Strings */ 00322 u16 TextMaxStringLength; /**< Text: Maximum length of a 00323 * String */ 00324 00325 } XOSD_Layer; 00326 00327 /** 00328 * Callback type for all interrupts except error interrupt. 00329 * 00330 * @param CallBackRef is a callback reference passed in by the upper layer 00331 * when setting the callback functions, and passed back to the 00332 * upper layer when the callback is invoked. 00333 */ 00334 typedef void (*XOSD_CallBack) (void *CallBackRef); 00335 00336 /** 00337 * Callback type for Error interrupt. 00338 * 00339 * @param CallBackRef is a callback reference passed in by the upper layer 00340 * when setting the callback functions, and passed back to the 00341 * upper layer when the callback is invoked. 00342 * @param ErrorMask is a bit mask indicating the cause of the error. Its 00343 * value equals 'OR'ing one or more XOSD_IXR_* values defined in 00344 * xosd_hw.h 00345 */ 00346 typedef void (*XOSD_ErrorCallBack) (void *CallBackRef, u32 ErrorMask); 00347 00348 /** 00349 * The XOSD driver instance data. An instance must be allocated for each 00350 * OSD device in use. 00351 */ 00352 typedef struct { 00353 XOSD_Config Config; /**< Hardware configuration */ 00354 u32 IsReady; /**< Device and the driver instance are 00355 * initialized */ 00356 int InstructionInExternalMem; /**< Flag indicating if the instruction 00357 list is from external memory */ 00358 u32 ScreenHeight; /**< Screen Height of the OSD output */ 00359 u32 ScreenWidth; /**< Screen Width of the OSD output */ 00360 00361 XOSD_Layer Layers[XOSD_MAX_NUM_OF_LAYERS]; /**< Properties of layers */ 00362 00363 XOSD_CallBack VbiStartCallBack; /**< Call back for Vertical Blank 00364 * Interval (VBI) Start interrupt */ 00365 void *VbiStartRef; /**< To be passed to the VBI Start 00366 * interrupt callback */ 00367 00368 XOSD_CallBack VbiEndCallBack; /**< Call back for Vertical Blank 00369 * Interval (VBI) End interrupt */ 00370 void *VbiEndRef; /**< To be passed to the VBI End 00371 * interrupt callback */ 00372 00373 XOSD_CallBack FrameDoneCallBack;/**< Call back for Frame Done interrupt 00374 */ 00375 void *FrameDoneRef; /**< To be passed to the Frame Done 00376 * interrupt callback */ 00377 00378 XOSD_ErrorCallBack ErrCallBack; /**< Call back for Error interrupt */ 00379 void *ErrRef; /**< To be passed to the Error 00380 * interrupt callback */ 00381 00382 } XOSD; 00383 00384 /** 00385 * The XOSD_Instruction data structure for holding one GC instruction. 00386 */ 00387 typedef u32 XOSD_Instruction[XOSD_INS_SIZE]; 00388 00389 /***************** Macros (Inline Functions) Definitions *********************/ 00390 00391 /*****************************************************************************/ 00392 /** 00393 * 00394 * This macro enables an OSD device. 00395 * 00396 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00397 * 00398 * @return None. 00399 * 00400 * @note 00401 * C-style signature: 00402 * void XOSD_Enable(XOSD *InstancePtr); 00403 * 00404 ******************************************************************************/ 00405 #define XOSD_Enable(InstancePtr) \ 00406 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ 00407 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) | \ 00408 XOSD_CTL_EN_MASK) 00409 00410 /*****************************************************************************/ 00411 /** 00412 * 00413 * This macro disables an OSD device. 00414 * 00415 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00416 * 00417 * @return None. 00418 * 00419 * @note 00420 * C-style signature: 00421 * void XOSD_Disable(XOSD *InstancePtr); 00422 * 00423 ******************************************************************************/ 00424 #define XOSD_Disable(InstancePtr) \ 00425 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ 00426 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) & \ 00427 (~XOSD_CTL_EN_MASK)) 00428 00429 /*****************************************************************************/ 00430 /** 00431 * 00432 * This macro tell an OSD device to pick up the register updates. 00433 * 00434 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00435 * 00436 * @return None. 00437 * 00438 * @note 00439 * C-style signature: 00440 * void XOSD_RegUpdateEnable(XOSD *InstancePtr); 00441 * 00442 ******************************************************************************/ 00443 #define XOSD_RegUpdateEnable(InstancePtr) \ 00444 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ 00445 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) | \ 00446 XOSD_CTL_RUE_MASK) 00447 00448 /*****************************************************************************/ 00449 /** 00450 * 00451 * This macro tell an OSD device to ignore the register updates. 00452 * 00453 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00454 * 00455 * @return None. 00456 * 00457 * @note 00458 * C-style signature: 00459 * void XOSD_RegUpdateDisable(XOSD *InstancePtr); 00460 * 00461 ******************************************************************************/ 00462 #define XOSD_RegUpdateDisable(InstancePtr) \ 00463 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, \ 00464 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_CTL) & \ 00465 (~XOSD_CTL_RUE_MASK)) 00466 00467 /*****************************************************************************/ 00468 /** 00469 * 00470 * This macro resets an OSD device. 00471 * 00472 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00473 * 00474 * @return None. 00475 * 00476 * @note 00477 * C-style signature: 00478 * void XOSD_Reset(XOSD *InstancePtr); 00479 * 00480 ******************************************************************************/ 00481 #define XOSD_Reset(InstancePtr) \ 00482 { \ 00483 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_RST, \ 00484 XOSD_RST_RESET); \ 00485 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_CTL, 0); \ 00486 (InstancePtr)->InstructionInExternalMem = 0; \ 00487 (InstancePtr)->ScreenHeight = 0; \ 00488 (InstancePtr)->ScreenWidth = 0; \ 00489 } 00490 00491 /*****************************************************************************/ 00492 /** 00493 * 00494 * This macro enables the global interrupt on an OSD device. 00495 * 00496 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00497 * 00498 * @return None. 00499 * 00500 * @note 00501 * C-style signature: 00502 * void XOSD_IntrEnableGlobal(XOSD *InstancePtr); 00503 * 00504 ******************************************************************************/ 00505 #define XOSD_IntrEnableGlobal(InstancePtr) \ 00506 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_GIER, \ 00507 XOSD_GIER_GIE_MASK) 00508 00509 /*****************************************************************************/ 00510 /** 00511 * 00512 * This macro disables the global interrupt on an OSD device. 00513 * 00514 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00515 * 00516 * @return None. 00517 * 00518 * @note 00519 * C-style signature: 00520 * void XOSD_IntrDisableGlobal(XOSD *InstancePtr); 00521 * 00522 ******************************************************************************/ 00523 #define XOSD_IntrDisableGlobal(InstancePtr) \ 00524 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_GIER, 0) 00525 00526 /*****************************************************************************/ 00527 /** 00528 * 00529 * This macro enables the given individual interrupt(s) on an OSD device. 00530 * 00531 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00532 * 00533 * @param IntrType is the type of the interrupts to enable. Use OR'ing of 00534 * XOSD_IXR_* constants defined in xosd_hw.h to create this parameter 00535 * value. 00536 * 00537 * @return None 00538 * 00539 * @note 00540 * 00541 * The existing enabled interrupt(s) will remain enabled. 00542 * 00543 * C-style signature: 00544 * void XOSD_IntrEnable(XOSD *InstancePtr, u32 IntrType) 00545 * 00546 ******************************************************************************/ 00547 #define XOSD_IntrEnable(InstancePtr, IntrType) \ 00548 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_IER, \ 00549 ((IntrType) & XOSD_IXR_ALLINTR_MASK) | \ 00550 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER)) 00551 00552 /*****************************************************************************/ 00553 /** 00554 * 00555 * This macro disables the given individual interrupt(s) on an OSD device. 00556 * 00557 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00558 * 00559 * @param IntrType is the type of the interrupts to disable. Use OR'ing of 00560 * XOSD_IXR_* constants defined in xosd_hw.h to create this parameter 00561 * value. 00562 * 00563 * @return None 00564 * 00565 * @note 00566 * 00567 * Any other interrupt not covered by parameter IntrType, if enabled before 00568 * this macro is called, will remain enabled. 00569 * 00570 * C-style signature: 00571 * void XOSD_IntrDisable(XOSD *InstancePtr, u32 IntrType) 00572 * 00573 ******************************************************************************/ 00574 #define XOSD_IntrDisable(InstancePtr, IntrType) \ 00575 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_IER, \ 00576 ((~(IntrType)) & XOSD_IXR_ALLINTR_MASK) & \ 00577 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER)) 00578 00579 /*****************************************************************************/ 00580 /** 00581 * 00582 * This macro returns the pending interrupts of an OSD device. 00583 * 00584 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00585 * 00586 * @return The pending interrupts of the OSD. Use XOSD_IXR_* constants 00587 * defined in xosd_hw.h to interpret this value. 00588 * 00589 * @note 00590 * 00591 * C-style signature: 00592 * u32 XOSD_IntrGetPending(XOSD *InstancePtr) 00593 * 00594 ******************************************************************************/ 00595 #define XOSD_IntrGetPending(InstancePtr) \ 00596 (XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_IER) & \ 00597 XOSD_ReadReg((InstancePtr)->Config.BaseAddress, XOSD_ISR) & \ 00598 XOSD_IXR_ALLINTR_MASK) 00599 00600 /*****************************************************************************/ 00601 /** 00602 * 00603 * This macro clears/acknowledges pending interrupts of an OSD device. 00604 * 00605 * @param InstancePtr is a pointer to the OSD device instance to be worked on. 00606 * 00607 * @param IntrType is the pending interrupts to clear/acknowledge. Use OR'ing 00608 * of XOSD_IXR_* constants defined in xosd_hw.h to create this 00609 * parameter value. 00610 * 00611 * @return None 00612 * 00613 * @note 00614 * 00615 * C-style signature: 00616 * void XOSD_IntrClear(XOSD *InstancePtr, u32 IntrType) 00617 * 00618 ******************************************************************************/ 00619 #define XOSD_IntrClear(InstancePtr, IntrType) \ 00620 XOSD_WriteReg((InstancePtr)->Config.BaseAddress, XOSD_ISR, \ 00621 (IntrType) & XOSD_IXR_ALLINTR_MASK) 00622 00623 /************************** Function Prototypes ******************************/ 00624 00625 /* 00626 * Initialization and control functions in xosd.c 00627 */ 00628 00629 /* Initialization */ 00630 int XOSD_CfgInitialize(XOSD *InstancePtr, XOSD_Config *CfgPtr, 00631 u32 EffectiveAddr); 00632 00633 /* Set Vertical and Horizontal Blank Input Polarity Types */ 00634 void XOSD_SetBlankPolarity(XOSD *InstancePtr, int VerticalBlankPolarity, 00635 int HorizontalBlankPolarity); 00636 00637 /* Set/Get Screen Size of the OSD Output */ 00638 void XOSD_SetScreenSize(XOSD *InstancePtr, u32 Width, u32 Height); 00639 void XOSD_GetScreenSize(XOSD *InstancePtr, u32 *WidthPtr, u32 *HeightPtr); 00640 00641 /* Set/Get Background color */ 00642 void XOSD_SetBackgroundColor(XOSD *InstancePtr, u8 Red, u8 Blue, u8 Green); 00643 void XOSD_GetBackgroundColor(XOSD *InstancePtr, u8 *RedPtr, u8 *BluePtr, 00644 u8 *GreenPtr); 00645 00646 /* Layer related functions */ 00647 void XOSD_SetLayerDimension(XOSD *InstancePtr, u8 LayerIndex, u16 XStart, 00648 u16 YStart, u16 XSize, u16 YSize); 00649 void XOSD_GetLayerDimension(XOSD *InstancePtr, u8 LayerIndex, u16 *XStartPtr, 00650 u16 *YStartPtr, u16 *XSizePtr, u16 *YSizePtr); 00651 00652 void XOSD_SetLayerAlpha(XOSD *InstancePtr, u8 LayerIndex, 00653 u8 GlobalAlphaEnble, u8 GlobalAlphaValue); 00654 void XOSD_GetLayerAlpha(XOSD *InstancePtr, u8 LayerIndex, 00655 u8 *GlobalAlphaEnblePtr, 00656 u8 *GlobalAlphaValuePtr); 00657 00658 void XOSD_SetLayerPriority(XOSD *InstancePtr, u8 LayerIndex, u8 Priority); 00659 void XOSD_GetLayerPriority(XOSD *InstancePtr, u8 LayerIndex, u8 *PriorityPtr); 00660 00661 void XOSD_EnableLayer(XOSD *InstancePtr, u8 LayerIndex); 00662 void XOSD_DisableLayer(XOSD *InstancePtr, u8 LayerIndex); 00663 00664 /* Graphics Controller related functions */ 00665 void XOSD_LoadColorLUTBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, 00666 u32 *ColorData); 00667 void XOSD_LoadCharacterSetBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, 00668 u32 *CharSetData); 00669 void XOSD_LoadTextBank(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, 00670 u32 *TextData); 00671 void XOSD_SetActiveBank(XOSD *InstancePtr, u8 GcIndex, u8 ColorBankIndex, 00672 u8 CharBankIndex, u8 TextBankIndex, 00673 u8 InstructionBankIndex); 00674 00675 /* Create and load instruction(s) */ 00676 void XOSD_CreateInstruction(XOSD *InstancePtr, u32 *InstructionPtr, 00677 u8 GcIndex, u16 ObjType, u8 ObjSize, 00678 u16 XStart, u16 YStart, u16 XEnd, u16 YEnd, 00679 u8 TextIndex, u8 ColorIndex); 00680 void XOSD_LoadInstructionList(XOSD *InstancePtr, u8 GcIndex, u8 BankIndex, 00681 u32 *InstSetPtr, u32 InstNum); 00682 00683 /* Version functions */ 00684 void XOSD_GetVersion(XOSD *InstancePtr, u16 *Major, u16 *Minor, u16 *Revision); 00685 00686 /* 00687 * Initialization functions in xosd_sinit.c 00688 */ 00689 XOSD_Config *XOSD_LookupConfig(u16 DeviceId); 00690 00691 /* 00692 * Interrupt related functions in xosd_intr.c 00693 */ 00694 void XOSD_IntrHandler(void *InstancePtr); 00695 int XOSD_SetCallBack(XOSD *InstancePtr, u32 IntrType, 00696 void *CallBackFunc, void *CallBackRef); 00697 00698 00699 #ifdef __cplusplus 00700 } 00701 #endif 00702 00703 #endif /* end of protection macro */