1 /*
2  *  Linux Frame Buffer Device Configuration
3  *
4  *  � Copyright 1995-1998 by Geert Uytterhoeven
5  *		       (Geert.Uytterhoeven@cs.kuleuven.ac.be)
6  *
7  *  --------------------------------------------------------------------------
8  *
9  *  This file is subject to the terms and conditions of the GNU General Public
10  *  License. See the file COPYING in the main directory of the Linux
11  *  distribution for more details.
12  */
13 
14 
15 %{
16 
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 
21 #define Die Sys_Error
22 
23 #include "fbset.h"
24 
25 extern int yylex(void);
26 extern void yyerror(const char *s);
27 extern int line;
28 
29 
30 static struct VideoMode VideoMode;
31 
ClearVideoMode(void)32 static void ClearVideoMode(void)
33 {
34     memset(&VideoMode, 0, sizeof(VideoMode));
35     VideoMode.accel_flags = FB_ACCELF_TEXT;
36 }
37 
38 %}
39 
40 %start file
41 
42 %union {
43 	int		int_val;
44 	const char	*string;
45 }
46 
47 %token MODE GEOMETRY TIMINGS HSYNC VSYNC CSYNC GSYNC EXTSYNC BCAST LACED DOUBLE
48        RGBA NONSTD ACCEL GRAYSCALE
49 %token <int_val>	ENDMODE POLARITY BOOLEAN NUMBER
50 %token <string>		STRING
51 %%
52 
53 file	  : vmodes
54 	  ;
55 
56 
57 vmodes	  : /* empty */
58 	  | vmodes vmode
59 	  ;
60 
61 vmode	  : MODE STRING geometry timings options ENDMODE
62 	    {
63 		VideoMode.name = $2;
64 		AddVideoMode(&VideoMode);
65 		ClearVideoMode();
66 	    }
67 	  ;
68 
69 geometry  : GEOMETRY NUMBER NUMBER NUMBER NUMBER NUMBER
70 	    {
71 		ClearVideoMode();
72 		VideoMode.xres = $2;
73 		VideoMode.yres = $3;
74 		VideoMode.vxres = $4;
75 		VideoMode.vyres = $5;
76 		VideoMode.depth = $6;
77 	    }
78 	  ;
79 
80 timings	  : TIMINGS NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER
81 	    {
82 		VideoMode.pixclock = $2;
83 		VideoMode.left = $3;
84 		VideoMode.right = $4;
85 		VideoMode.upper = $5;
86 		VideoMode.lower = $6;
87 		VideoMode.hslen = $7;
88 		VideoMode.vslen = $8;
89 	    }
90 	  ;
91 
92 options	  : /* empty */
93 	  | options hsync
94 	  | options vsync
95 	  | options csync
96 	  | options gsync
97 	  | options extsync
98 	  | options bcast
99 	  | options laced
100 	  | options double
101 	  | options rgba
102 	  | options nonstd
103 	  | options accel
104 	  | options grayscale
105 	  ;
106 
107 hsync	  : HSYNC POLARITY
108 	    {
109 		VideoMode.hsync = $2;
110 	    }
111 	  ;
112 
113 vsync	  : VSYNC POLARITY
114 	    {
115 		VideoMode.vsync = $2;
116 	    }
117 	  ;
118 
119 csync	  : CSYNC POLARITY
120 	    {
121 		VideoMode.csync = $2;
122 	    }
123 	  ;
124 
125 gsync	  : GSYNC POLARITY
126 	    {
127 		VideoMode.gsync = $2;
128 	    }
129 	  ;
130 
131 extsync	  : EXTSYNC BOOLEAN
132 	    {
133 		VideoMode.extsync = $2;
134 	    }
135 	  ;
136 
137 bcast	  : BCAST BOOLEAN
138 	    {
139 		VideoMode.bcast = $2;
140 	    }
141 	  ;
142 
143 laced	  : LACED BOOLEAN
144 	    {
145 		VideoMode.laced = $2;
146 	    }
147 	  ;
148 
149 double	  : DOUBLE BOOLEAN
150 	    {
151 		VideoMode.dblscan = $2;
152 	    }
153 	  ;
154 
155 rgba      : RGBA STRING
156             {
157 		makeRGBA(&VideoMode, (const char*)$2);
158 	    }
159 	  ;
160 
161 nonstd    : NONSTD NUMBER
162             {
163 	    	VideoMode.nonstd = $2;
164 	    }
165 	  ;
166 
167 accel	  : ACCEL BOOLEAN
168 	    {
169 		VideoMode.accel_flags = $2;
170 	    }
171 	  ;
172 
173 grayscale : GRAYSCALE BOOLEAN
174 	    {
175 		VideoMode.grayscale = $2;
176 	    }
177 	  ;
178 
179 %%
180