1 /*******************************************************************************
3 * Copyright (C) 2017 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 *******************************************************************************/
32 /******************************************************************************/
37 * This file implements all the functions related to the Video Pipeline of the
38 * DisplayPort Subsystem.
40 * Features supported by this driver
41 * - Live Video and Graphics input.
42 * - Non-Live Video Graphics input.
43 * - Output Formats Supported - RGB, YUV444, YUV4222.
47 * MODIFICATION HISTORY:
49 * Ver Who Date Changes
50 * ----- ---- -------- -----------------------------------------------
51 * 1.0 aad 06/24/17 Initial release.
52 * 2.0 aad 10/07/17 Added Enums for Video and Audio sources.
55 *******************************************************************************/
57 /* Prevent circular inclusions by using protection macros. */
61 /******************************* Include Files ********************************/
62 #include "xavbuf_hw.h"
64 /****************************** Type Definitions ******************************/
66 * This typedef describes all the Video Formats supported by the driver
69 //Non-Live Video Formats
96 // Non-Live Graphics formats
111 //Live Input/Output Video/Graphics Formats
126 } XAVBuf_VideoFormat;
129 * This data structure describes video planes.
138 * This typedef describes the video source list
141 XAVBUF_VIDSTREAM1_LIVE,
142 XAVBUF_VIDSTREAM1_NONLIVE,
143 XAVBUF_VIDSTREAM1_TPG,
144 XAVBUF_VIDSTREAM1_NONE,
145 } XAVBuf_VideoStream;
148 * This typedef describes the graphics source list
151 XAVBUF_VIDSTREAM2_DISABLEGFX = 0x0,
152 XAVBUF_VIDSTREAM2_NONLIVE_GFX = 0x4,
153 XAVBUF_VIDSTREAM2_LIVE_GFX = 0x8,
154 XAVBUF_VIDSTREAM2_NONE = 0xC0,
158 * This typedef describes the audio stream 1 source list
161 XAVBUF_AUDSTREAM1_LIVE = 0x00,
162 XAVBUF_AUDSTREAM1_NONLIVE = 0x10,
163 XAVBUF_AUDSTREAM1_TPG = 0x20,
164 XAVBUF_AUDSTREAM1_NO_AUDIO = 0x30,
165 } XAVBuf_AudioStream1;
168 * This typedef describes the audio stream 2 source list
171 XAVBUF_AUDSTREAM2_NO_AUDIO = 0X00,
172 XAVBUF_AUDSTREAM2_AUDIOGFX = 0X40,
173 } XAVBuf_AudioStream2;
176 * This typedef describes the attributes associated with the video formats.
179 XAVBuf_VideoFormat VideoFormat;
181 XAVBuf_VideoModes Mode;
187 } XAVBuf_VideoAttribute;
190 * This typedef stores the attributes of an audio stream
195 } XAVBuf_AudioAttribute;
198 * This typedef stores the data associated with the Audio Video input modes.
201 XAVBuf_VideoAttribute *NonLiveVideo, *NonLiveGraphics;
202 XAVBuf_VideoAttribute *LiveVideo, *LiveGraphics;
203 XAVBuf_AudioAttribute *Audio, *GraphicsAudio;
204 XAVBuf_VideoStream VideoSrc;
205 XAVBuf_GfxStream GraphicsSrc;
206 XAVBuf_AudioStream1 AudioSrc1;
207 XAVBuf_AudioStream2 AudioSrc2;
208 u8 AudioClk, VideoClk;
212 * This structure stores the background color information.
218 } XAVBuf_BlenderBgClr;
221 * This typedef stores the AVBuf Configuration information.
229 * This typedef stores all the attributes associated to the Blender block of the
230 * DisplayPort Subsystem
235 XAVBuf_VideoAttribute *OutputVideo;
239 * The XAVBuf driver instance data. The user is required to allocate a variable
240 * of this type for every XAVBUF instance in the system. A pointer to this type
241 * is then passed to the driver API functions
244 XAVBuf_Config Config;
245 XAVBuf_AVModes AVMode;
246 XAVBuf_Blender Blender;
250 /**************************** Function Prototypes *****************************/
252 /* xavbuf.c: Setup and initialization functions. */
253 void XAVBuf_CfgInitialize(XAVBuf *InstancePtr, u32 BaseAddr, u16 DeviceId);
255 /* xavbuf.c: Functions to setup the Input Video and Audio sources */
256 void XAVBuf_InputVideoSelect(XAVBuf *InstancePtr, XAVBuf_VideoStream VidStream,
257 XAVBuf_GfxStream GfxStream);
258 void XAVBuf_InputAudioSelect(XAVBuf *InstancePtr, XAVBuf_AudioStream1 AudStream,
259 XAVBuf_AudioStream2 AudioStream2);
261 /* xavbuf.c: Functions to setup the Video Format attributes */
262 int XAVBuf_SetInputNonLiveVideoFormat(XAVBuf *InstancePtr,
263 XAVBuf_VideoFormat Format);
264 int XAVBuf_SetInputNonLiveGraphicsFormat(XAVBuf *InstancePtr,
265 XAVBuf_VideoFormat Format);
266 int XAVBuf_SetInputLiveVideoFormat(XAVBuf *InstancePtr,
267 XAVBuf_VideoFormat Format);
268 int XAVBuf_SetInputLiveGraphicsFormat(XAVBuf *InstancePtr,
269 XAVBuf_VideoFormat Format);
270 int XAVBuf_SetOutputVideoFormat(XAVBuf *InstancePtr, XAVBuf_VideoFormat Format);
271 XAVBuf_VideoAttribute *XAVBuf_GetLiveVideoAttribute(XAVBuf_VideoFormat Format);
272 XAVBuf_VideoAttribute *XAVBuf_GetNLiveVideoAttribute(XAVBuf_VideoFormat Format);
273 XAVBuf_VideoAttribute *XAVBuf_GetNLGraphicsAttribute(XAVBuf_VideoFormat Format);
275 /* xavbuf.c: Functions to setup the clock sources for video and audio */
276 void XAVBuf_SetAudioVideoClkSrc(XAVBuf *InstancePtr, u8 VideoClk, u8 AudioClk);
278 /* xavbuf.c: Functions that setup Video and Graphics pipeline depending on the
279 * sources and format selected.
281 void XAVBuf_ConfigureVideoPipeline(XAVBuf *InstancePtr);
282 void XAVBuf_ConfigureGraphicsPipeline(XAVBuf *InstancePtr);
284 /* Functions to setup Blender Properties */
285 void XAVBuf_BlendSetBgColor(XAVBuf *InstancePtr, XAVBuf_BlenderBgClr *Color);
286 void XAVBuf_SetBlenderAlpha(XAVBuf *InstancePtr, u8 Alpha, u8 Enable);
287 void XAVBuf_SoftReset(XAVBuf *InstancePtr);
288 void XABuf_LineResetDisable(XAVBuf *InstancePtr, u8 Disable);
289 void XAVBuf_ConfigureOutputVideo(XAVBuf *InstancePtr);
291 /* Audio Configuration functions */
292 void XAVBuf_AudioSoftReset(XAVBuf *InstancePtr);
293 void XAVBuf_AudioMixerVolumeControl(XAVBuf *InstancePtr, u8 Channel0Volume,
296 /* DPDMA Interface functions */
297 void XAVBuf_EnableGraphicsBuffers(XAVBuf *InstancePtr, u8 Enable);
298 void XAVBuf_EnableVideoBuffers(XAVBuf *InstancePtr, u8 Enable);
299 void XAVBuf_EnableAudio0Buffers(XAVBuf *InstancePtr, u8 Enable);
300 void XAVBuf_EnableAudio1Buffers(XAVBuf *InstancePtr, u8 Enable);