Developer World
Spresense SDK Library v3.3.0-375c679
vesagtf.h
1/****************************************************************************
2 * include/nuttx/video/vesagtf.h
3 * EDID (Extended Display Identification Data) Format
4 *
5 * Copyright (C) 2019 Gregory Nutt. All rights reserved.
6 * Author: Gregory Nutt <gnutt@nuttx.org>
7 *
8 * Derives from logic in FreeBSD which has an equivalent 3-clause BSD
9 * license:
10 *
11 * Copyright (c) 2006 Itronix Inc. All rights reserved.
12 * Written by Garrett D'Amore for Itronix Inc.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 *
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in
22 * the documentation and/or other materials provided with the
23 * distribution.
24 * 3. Neither the name NuttX nor the names of its contributors may be
25 * used to endorse or promote products derived from this software
26 * without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
35 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGE.
40 *
41 ****************************************************************************/
42
43#ifndef __INCLUDE_NUTTX_VIDEO_VESAGTF_H
44#define __INCLUDE_NUTTX_VIDEO_VESAGTF_H
45
46/****************************************************************************
47 * Pre-processor Definitions
48 ****************************************************************************/
49
50/* Default values to use for params. */
51
52#define VESAGTF_MARGIN_PPT 18 /* 1.8% */
53#define VESAGTF_MIN_PORCH 1 /* minimum front porch */
54#define VESAGTF_VSYNC_RQD 3 /* vsync width in lines */
55#define VESAGTF_HSYNC_PCT 8 /* width of hsync % of total line */
56#define VESAGTF_MIN_VSBP 550 /* min vsync + back porch (usec) */
57#define VESAGTF_M 600 /* blanking formula gradient */
58#define VESAGTF_C 40 /* blanking formula offset */
59#define VESAGTF_K 128 /* blanking formula scaling factor */
60#define VESAGTF_J 20 /* blanking formula scaling factor */
61
62#define VESAGTF_FLAG_ILACE 0x0001/* use interlace */
63#define VESAGTF_FLAG_MARGINS 0x0002/* use margins */
64
65/****************************************************************************
66 * Pre-processor Definitions
67 ****************************************************************************/
68
69/* Use VESA GTF formula to generate a monitor mode, given resolution and
70 * refresh rates.
71 */
72
74{
75 unsigned int margin_ppt; /* Bertical margin size, percent * 10 think
76 * parts-per-thousand */
77 unsigned int min_porch; /* Minimum front porch */
78 unsigned int vsync_rqd; /* Width of vsync in lines */
79 unsigned int hsync_pct; /* Hsync as % of total width */
80 unsigned int min_vsbp; /* Minimum vsync + back porch (usec) */
81 unsigned int m; /* Blanking formula gradient */
82 unsigned int c; /* Blanking formula offset */
83 unsigned int k; /* Blanking formula scaling factor */
84 unsigned int j; /* Blanking formula scaling factor */
85};
86
87/****************************************************************************
88 * Public Function Prototypes
89 ****************************************************************************/
90
91struct videomode_s; /* Forward reference */
92
93/****************************************************************************
94 * Name: vesagtf_mode
95 *
96 * Description:
97 * Use VESA GTF formula to generate monitor timings. Assumes default
98 * GTF parameters, non-interlaced, and no margins.
99 *
100 ****************************************************************************/
101
102void vesagtf_mode(unsigned int x, unsigned int y, unsigned int refresh,
103 FAR struct videomode_s *videomode);
104
105/****************************************************************************
106 * Name: vesagtf_mode_params
107 *
108 * Description:
109 * vesagtf_mode_params() - as defined by the GTF Timing Standard, compute
110 * the Stage 1 Parameters using the vertical refresh frequency. In other
111 * words: input a desired resolution and desired refresh rate, and
112 * output the GTF mode timings.
113 *
114 ****************************************************************************/
115
116void vesagtf_mode_params(unsigned int x,
117 unsigned int y,
118 unsigned int refresh,
119 FAR struct vesagtf_params *params,
120 unsigned int flags,
121 FAR struct videomode_s *videomode);
122
123#endif /* __INCLUDE_NUTTX_VIDEO_VESAGTF_H */
Definition: vesagtf.h:74
Definition: videomode.h:84