ast_2dtool.h revision de78e416
1/*
2 * Copyright (c) 2005 ASPEED Technology Inc.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the authors not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission.  The authors makes no representations
11 * about the suitability of this software for any purpose.  It is provided
12 * "as is" without express or implied warranty.
13 *
14 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 */
22
23/* Eng Capability Definition */
24#define	ENG_CAP_Sync				0x0001
25#define	ENG_CAP_ScreenToScreenCopy		0x0002
26#define	ENG_CAP_SolidFill			0x0004
27#define	ENG_CAP_SolidLine			0x0008
28#define	ENG_CAP_DashedLine			0x0010
29#define	ENG_CAP_Mono8x8PatternFill		0x0020
30#define	ENG_CAP_Color8x8PatternFill		0x0040
31#define	ENG_CAP_CPUToScreenColorExpand		0x0080
32#define	ENG_CAP_ScreenToScreenColorExpand	0x0100
33#define	ENG_CAP_Clipping			0x0200
34#define ENG_CAP_ALL	(ENG_CAP_Sync | ENG_CAP_ScreenToScreenCopy | ENG_CAP_SolidFill	|	\
35                         ENG_CAP_SolidLine | ENG_CAP_DashedLine |				\
36                         ENG_CAP_Mono8x8PatternFill | ENG_CAP_Color8x8PatternFill |		\
37                         ENG_CAP_Clipping);
38
39/* CMDQ Definition */
40#define    AGP_CMD_QUEUE                   	1
41#define    VM_CMD_QUEUE                    	0
42#define    VM_CMD_MMIO                     	2
43
44#define    CMD_QUEUE_SIZE_256K             	0x00040000
45#define    CMD_QUEUE_SIZE_512K             	0x00080000
46#define    CMD_QUEUE_SIZE_1M               	0x00100000
47#define    CMD_QUEUE_SIZE_2M               	0x00200000
48#define    CMD_QUEUE_SIZE_4M               	0x00400000
49
50/* CMD Type Info */
51#define    PKT_NULL_CMD             		0x00009561
52
53#define    PKT_SINGLE_LENGTH        		8
54#define    PKT_SINGLE_CMD_HEADER    		0x00009562
55
56typedef struct  _PKT_SC
57{
58    ULONG    PKT_SC_dwHeader;
59    ULONG    PKT_SC_dwData[1];
60
61} PKT_SC, *PPKT_SC;
62
63/* Eng Reg. Limitation */
64#define	MAX_SRC_X				0x7FF
65#define	MAX_SRC_Y				0x7FF
66#define	MAX_DST_X				0x7FF
67#define	MAX_DST_Y				0x7FF
68
69#define	MASK_SRC_PITCH				0x1FFF
70#define	MASK_DST_PITCH				0x1FFF
71#define	MASK_DST_HEIGHT				0x7FF
72#define	MASK_SRC_X				0xFFF
73#define	MASK_SRC_Y				0xFFF
74#define	MASK_DST_X				0xFFF
75#define	MASK_DST_Y				0xFFF
76#define	MASK_RECT_WIDTH				0x7FF
77#define	MASK_RECT_HEIGHT			0x7FF
78#define MASK_CLIP				0xFFF
79
80#define MASK_LINE_X        			0xFFF
81#define MASK_LINE_Y           			0xFFF
82#define MASK_LINE_ERR   			0x3FFFFF
83#define MASK_LINE_WIDTH   			0x7FF
84#define MASK_LINE_K1				0x3FFFFF
85#define MASK_LINE_K2				0x3FFFFF
86
87#define MAX_PATReg_Size				256
88
89/* Eng Reg. Definition */
90/* MMIO Reg */
91#define MMIOREG_SRC_BASE	(pAST->MMIOVirtualAddr + 0x8000)
92#define MMIOREG_SRC_PITCH	(pAST->MMIOVirtualAddr + 0x8004)
93#define MMIOREG_DST_BASE	(pAST->MMIOVirtualAddr + 0x8008)
94#define MMIOREG_DST_PITCH	(pAST->MMIOVirtualAddr + 0x800C)
95#define MMIOREG_DST_XY		(pAST->MMIOVirtualAddr + 0x8010)
96#define MMIOREG_SRC_XY		(pAST->MMIOVirtualAddr + 0x8014)
97#define MMIOREG_RECT_XY		(pAST->MMIOVirtualAddr + 0x8018)
98#define MMIOREG_FG		(pAST->MMIOVirtualAddr + 0x801C)
99#define MMIOREG_BG		(pAST->MMIOVirtualAddr + 0x8020)
100#define MMIOREG_FG_SRC		(pAST->MMIOVirtualAddr + 0x8024)
101#define MMIOREG_BG_SRC		(pAST->MMIOVirtualAddr + 0x8028)
102#define MMIOREG_MONO1		(pAST->MMIOVirtualAddr + 0x802C)
103#define MMIOREG_MONO2		(pAST->MMIOVirtualAddr + 0x8030)
104#define MMIOREG_CLIP1		(pAST->MMIOVirtualAddr + 0x8034)
105#define MMIOREG_CLIP2		(pAST->MMIOVirtualAddr + 0x8038)
106#define MMIOREG_CMD		(pAST->MMIOVirtualAddr + 0x803C)
107#define MMIOREG_PAT		(pAST->MMIOVirtualAddr + 0x8100)
108
109#define MMIOREG_LINE_XY         (pAST->MMIOVirtualAddr + 0x8010)
110#define MMIOREG_LINE_Err        (pAST->MMIOVirtualAddr + 0x8014)
111#define MMIOREG_LINE_WIDTH      (pAST->MMIOVirtualAddr + 0x8018)
112#define MMIOREG_LINE_K1         (pAST->MMIOVirtualAddr + 0x8024)
113#define MMIOREG_LINE_K2         (pAST->MMIOVirtualAddr + 0x8028)
114#define MMIOREG_LINE_STYLE1     (pAST->MMIOVirtualAddr + 0x802C)
115#define MMIOREG_LINE_STYLE2     (pAST->MMIOVirtualAddr + 0x8030)
116
117/* CMDQ Reg */
118#define CMDQREG_SRC_BASE	(0x00 << 24)
119#define CMDQREG_SRC_PITCH	(0x01 << 24)
120#define CMDQREG_DST_BASE	(0x02 << 24)
121#define CMDQREG_DST_PITCH	(0x03 << 24)
122#define CMDQREG_DST_XY		(0x04 << 24)
123#define CMDQREG_SRC_XY		(0x05 << 24)
124#define CMDQREG_RECT_XY		(0x06 << 24)
125#define CMDQREG_FG		(0x07 << 24)
126#define CMDQREG_BG		(0x08 << 24)
127#define CMDQREG_FG_SRC		(0x09 << 24)
128#define CMDQREG_BG_SRC		(0x0A << 24)
129#define CMDQREG_MONO1		(0x0B << 24)
130#define CMDQREG_MONO2		(0x0C << 24)
131#define CMDQREG_CLIP1		(0x0D << 24)
132#define CMDQREG_CLIP2		(0x0E << 24)
133#define CMDQREG_CMD		(0x0F << 24)
134#define CMDQREG_PAT		(0x40 << 24)
135
136#define CMDQREG_LINE_XY         (0x04 << 24)
137#define CMDQREG_LINE_Err        (0x05 << 24)
138#define CMDQREG_LINE_WIDTH      (0x06 << 24)
139#define CMDQREG_LINE_K1         (0x09 << 24)
140#define CMDQREG_LINE_K2         (0x0A << 24)
141#define CMDQREG_LINE_STYLE1     (0x0B << 24)
142#define CMDQREG_LINE_STYLE2     (0x0C << 24)
143
144/* CMD Reg. Definition */
145#define   CMD_BITBLT                 		0x00000000
146#define   CMD_LINEDRAW               		0x00000001
147#define   CMD_COLOREXP               		0x00000002
148#define   CMD_ENHCOLOREXP            		0x00000003
149#define   CMD_MASK            	        	0x00000007
150
151#define   CMD_DISABLE_CLIP           		0x00000000
152#define   CMD_ENABLE_CLIP            		0x00000008
153
154#define   CMD_COLOR_08               		0x00000000
155#define   CMD_COLOR_16               		0x00000010
156#define   CMD_COLOR_32               		0x00000020
157
158#define   CMD_SRC_SIQ                		0x00000040
159
160#define   CMD_TRANSPARENT               	0x00000080
161
162#define   CMD_PAT_FGCOLOR            		0x00000000
163#define   CMD_PAT_MONOMASK           		0x00010000
164#define   CMD_PAT_PATREG             		0x00020000
165
166#define   CMD_OPAQUE                 		0x00000000
167#define   CMD_FONT_TRANSPARENT          	0x00040000
168
169#define   CMD_X_INC				0x00000000
170#define   CMD_X_DEC				0x00200000
171
172#define   CMD_Y_INC				0x00000000
173#define   CMD_Y_DEC				0x00100000
174
175#define   CMD_DRAW_LAST_PIXEL           	0x00000000
176#define   CMD_NOT_DRAW_LAST_PIXEL       	0x00800000
177
178#define   CMD_DISABLE_LINE_STYLE     		0x00000000
179#define   CMD_ENABLE_LINE_STYLE      		0x40000000
180
181#define   CMD_RESET_STYLE_COUNTER       	0x80000000
182#define   CMD_NOT_RESET_STYLE_COUNTER   	0x00000000
183
184#define   BURST_FORCE_CMD            		0x80000000
185
186/* Line */
187#define	LINEPARAM_XM				0x00000001
188#define	LINEPARAM_X_DEC				0x00000002
189#define	LINEPARAM_Y_DEC				0x00000004
190
191typedef struct _LINEPARAM {
192    USHORT	dsLineX;
193    USHORT	dsLineY;
194    USHORT	dsLineWidth;
195    ULONG	dwErrorTerm;
196    ULONG	dwK1Term;
197    ULONG	dwK2Term;
198    ULONG	dwLineAttributes;
199} LINEPARAM, *PLINEPARAM;
200
201typedef struct {
202
203    LONG X1;
204    LONG Y1;
205    LONG X2;
206    LONG Y2;
207
208} _LINEInfo;
209
210/* Macro */
211/* MMIO 2D Macro */
212#define ASTSetupSRCBase_MMIO(base) \
213      { \
214        do { \
215           *(ULONG *)(MMIOREG_SRC_BASE) = (ULONG) (base); \
216        } while (*(volatile ULONG *)(MMIOREG_SRC_BASE) != (ULONG) (base)); \
217      }
218#define ASTSetupSRCPitch_MMIO(pitch) \
219      { \
220        do { \
221           *(ULONG *)(MMIOREG_SRC_PITCH) = (ULONG)(pitch << 16); \
222        } while (*(volatile ULONG *)(MMIOREG_SRC_PITCH) != (ULONG)(pitch << 16)); \
223      }
224#define ASTSetupDSTBase_MMIO(base) \
225      { \
226        do { \
227           *(ULONG *)(MMIOREG_DST_BASE) = (ULONG)(base); \
228        } while (*(volatile ULONG *)(MMIOREG_DST_BASE) != (ULONG)(base)); \
229      }
230#define ASTSetupDSTPitchHeight_MMIO(pitch, height) \
231      { \
232        ULONG dstpitch; \
233        dstpitch = (ULONG)((pitch << 16) + ((height) & MASK_DST_HEIGHT)); \
234        do { \
235           *(ULONG *)(MMIOREG_DST_PITCH) = dstpitch; \
236        } while (*(volatile ULONG *)(MMIOREG_DST_PITCH) != dstpitch); \
237      }
238#define ASTSetupDSTXY_MMIO(x, y) \
239      { \
240        ULONG dstxy; \
241        dstxy = (ULONG)(((x & MASK_DST_X) << 16) + (y & MASK_DST_Y)); \
242        do { \
243           *(ULONG *)(MMIOREG_DST_XY) = dstxy; \
244        } while (*(volatile ULONG *)(MMIOREG_DST_XY) != dstxy); \
245      }
246#define ASTSetupSRCXY_MMIO(x, y) \
247      { \
248        ULONG srcxy; \
249        srcxy = (ULONG)(((x & MASK_SRC_X) << 16) + (y & MASK_SRC_Y)); \
250        do { \
251           *(ULONG *)(MMIOREG_SRC_XY) = srcxy; \
252        } while (*(volatile ULONG *)(MMIOREG_SRC_XY) != srcxy); \
253      }
254#define ASTSetupRECTXY_MMIO(x, y) \
255      { \
256        ULONG rectxy; \
257        rectxy = (ULONG)(((x & MASK_RECT_WIDTH) << 16) + (y & MASK_RECT_WIDTH)); \
258        do { \
259           *(ULONG *)(MMIOREG_RECT_XY) = rectxy; \
260        } while (*(volatile ULONG *)(MMIOREG_RECT_XY) != rectxy); \
261      }
262#define ASTSetupFG_MMIO(color) \
263      { \
264        do { \
265           *(ULONG *)(MMIOREG_FG) = (ULONG)(color); \
266        } while (*(volatile ULONG *)(MMIOREG_FG) != (ULONG)(color)); \
267      }
268#define ASTSetupBG_MMIO(color) \
269      { \
270        do { \
271           *(ULONG *)(MMIOREG_BG) = (ULONG)(color); \
272        } while (*(volatile ULONG *)(MMIOREG_BG) != (ULONG)(color)); \
273      }
274#define ASTSetupMONO1_MMIO(pat) \
275      { \
276        do { \
277          *(ULONG *)(MMIOREG_MONO1) = (ULONG)(pat); \
278        } while (*(volatile ULONG *)(MMIOREG_MONO1) != (ULONG)(pat)); \
279      }
280#define ASTSetupMONO2_MMIO(pat) \
281      { \
282        do { \
283          *(ULONG *)(MMIOREG_MONO2) = (ULONG)(pat); \
284        } while (*(volatile ULONG *)(MMIOREG_MONO2) != (ULONG)(pat)); \
285      }
286#define ASTSetupCLIP1_MMIO(left, top) \
287      { \
288       ULONG clip1; \
289       clip1 = (ULONG)(((left & MASK_CLIP) << 16) + (top & MASK_CLIP)); \
290       do { \
291          *(ULONG *)(MMIOREG_CLIP1) = clip1; \
292       } while (*(volatile ULONG *)(MMIOREG_CLIP1) != clip1); \
293      }
294#define ASTSetupCLIP2_MMIO(right, bottom) \
295      { \
296       ULONG clip2; \
297       clip2 = (ULONG)(((right & MASK_CLIP) << 16) + (bottom & MASK_CLIP)); \
298       do { \
299          *(ULONG *)(MMIOREG_CLIP2) = clip2; \
300       } while (*(volatile ULONG *)(MMIOREG_CLIP2) != clip2); \
301      }
302#define ASTSetupCMDReg_MMIO(reg) \
303      { \
304        *(ULONG *)(MMIOREG_CMD) = (ULONG)(reg);	\
305      }
306#define ASTSetupPatReg_MMIO(patreg, pat) \
307      { \
308       do { \
309          *(ULONG *)(MMIOREG_PAT + patreg*4) = (ULONG)(pat); \
310       } while (*(volatile ULONG *)(MMIOREG_PAT + patreg*4) != (ULONG)(pat)); \
311      }
312
313/* Line CMD */
314#define ASTSetupLineXY_MMIO(x, y) \
315      { \
316        ULONG linexy; \
317        linexy = (ULONG)(((x & MASK_LINE_X) << 16) + (y & MASK_LINE_Y)); \
318        do { \
319           *(ULONG *)(MMIOREG_LINE_XY) = linexy; \
320        } while (*(volatile ULONG *)(MMIOREG_LINE_XY) != linexy); \
321      }
322#define ASTSetupLineXMErrTerm_MMIO(xm, err) \
323      { \
324        ULONG lineerr; \
325        lineerr = (ULONG)((xm << 24) + (err & MASK_LINE_ERR)); \
326        do { \
327           *(ULONG *)(MMIOREG_LINE_Err) = lineerr; \
328        } while (*(volatile ULONG *)(MMIOREG_LINE_Err) != lineerr); \
329      }
330#define ASTSetupLineWidth_MMIO(width) \
331      { \
332        ULONG linewidth; \
333        linewidth = (ULONG)((width & MASK_LINE_WIDTH) << 16); \
334        do { \
335          *(ULONG *)(MMIOREG_LINE_WIDTH) = linewidth; \
336        } while (*(volatile ULONG *)(MMIOREG_LINE_WIDTH) != linewidth); \
337      }
338#define ASTSetupLineK1Term_MMIO(err) \
339      { \
340        do { \
341          *(ULONG *)(MMIOREG_LINE_K1) = (ULONG)(err & MASK_LINE_K1); \
342        } while (*(volatile ULONG *)(MMIOREG_LINE_K1) != (ULONG)(err & MASK_LINE_K1)); \
343      }
344#define ASTSetupLineK2Term_MMIO(err) \
345      { \
346        do { \
347           *(ULONG *)(MMIOREG_LINE_K2) = (ULONG)(err & MASK_LINE_K2); \
348        } while (*(volatile ULONG *)(MMIOREG_LINE_K2) != (ULONG)(err & MASK_LINE_K2)); \
349      }
350#define ASTSetupLineStyle1_MMIO(pat) \
351      { \
352        do { \
353           *(ULONG *)(MMIOREG_LINE_STYLE1) = (ULONG)(pat); \
354        } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE1) != (ULONG)(pat)); \
355      }
356#define ASTSetupLineStyle2_MMIO(pat) \
357      { \
358        do { \
359          *(ULONG *)(MMIOREG_LINE_STYLE2) = (ULONG)(pat); \
360        } while (*(volatile ULONG *)(MMIOREG_LINE_STYLE2) != (ULONG)(pat)); \
361      }
362
363/* CMDQ Mode Macro */
364#define mUpdateWritePointer *(ULONG *) (pAST->CMDQInfo.pjWritePort) = (pAST->CMDQInfo.ulWritePointer >>3)
365
366/* General CMD */
367#define ASTSetupSRCBase(addr, base) \
368      { \
369        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_BASE); 	\
370        addr->PKT_SC_dwData[0] = (ULONG)(base);					\
371      }
372#define ASTSetupSRCPitch(addr, pitch) \
373      { \
374        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_PITCH); 	\
375        addr->PKT_SC_dwData[0] = (ULONG)(pitch << 16);					\
376      }
377#define ASTSetupDSTBase(addr, base) \
378      { \
379        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_BASE); 	\
380        addr->PKT_SC_dwData[0] = (ULONG)(base);					\
381      }
382#define ASTSetupDSTPitchHeight(addr, pitch, height) \
383      { \
384        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_PITCH); 	\
385        addr->PKT_SC_dwData[0] = (ULONG)((pitch << 16) + ((height) & MASK_DST_HEIGHT));					\
386      }
387#define ASTSetupDSTXY(addr, x, y) \
388      { \
389        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_DST_XY); 	\
390        addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_DST_X) << 16) + (y & MASK_DST_Y));					\
391      }
392#define ASTSetupSRCXY(addr, x, y) \
393      { \
394        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_SRC_XY); 	\
395        addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_SRC_X) << 16) + (y & MASK_SRC_Y));					\
396      }
397#define ASTSetupRECTXY(addr, x, y) \
398      { \
399        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_RECT_XY); 	\
400        addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_RECT_WIDTH) << 16) + (y & MASK_RECT_WIDTH));					\
401      }
402#define ASTSetupFG(addr, color) \
403      { \
404        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_FG); 	\
405        addr->PKT_SC_dwData[0] = (ULONG)(color);					\
406      }
407#define ASTSetupBG(addr, color) \
408      { \
409        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_BG); 	\
410        addr->PKT_SC_dwData[0] = (ULONG)(color);					\
411      }
412#define ASTSetupMONO1(addr, pat) \
413      { \
414        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO1); 	\
415        addr->PKT_SC_dwData[0] = (ULONG)(pat);				\
416      }
417#define ASTSetupMONO2(addr, pat) \
418      { \
419        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_MONO2); 	\
420        addr->PKT_SC_dwData[0] = (ULONG)(pat);				\
421      }
422#define ASTSetupCLIP1(addr, left, top) \
423      { \
424        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP1); 	\
425        addr->PKT_SC_dwData[0] = (ULONG)(((left & MASK_CLIP) << 16) + (top & MASK_CLIP));	\
426      }
427#define ASTSetupCLIP2(addr, right, bottom) \
428      { \
429        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CLIP2); 	\
430        addr->PKT_SC_dwData[0] = (ULONG)(((right & MASK_CLIP) << 16) + (bottom & MASK_CLIP));	\
431      }
432#define ASTSetupCMDReg(addr, reg) \
433      { \
434        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_CMD); 	\
435        addr->PKT_SC_dwData[0] = (ULONG)(reg);					\
436      }
437#define ASTSetupPatReg(addr, patreg, pat) \
438      { \
439        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + (CMDQREG_PAT + (patreg << 24))); 	\
440        addr->PKT_SC_dwData[0] = (ULONG)(pat);				\
441      }
442
443/* Line CMD */
444#define ASTSetupLineXY(addr, x, y) \
445      { \
446        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_XY); 	\
447        addr->PKT_SC_dwData[0] = (ULONG)(((x & MASK_LINE_X) << 16) + (y & MASK_LINE_Y));					\
448      }
449#define ASTSetupLineXMErrTerm(addr, xm, err) \
450      { \
451        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_Err); 	\
452        addr->PKT_SC_dwData[0] = (ULONG)((xm << 24) + (err & MASK_LINE_ERR));					\
453      }
454#define ASTSetupLineWidth(addr, width) \
455      { \
456        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_WIDTH); 	\
457        addr->PKT_SC_dwData[0] = (ULONG)((width & MASK_LINE_WIDTH) << 16);				\
458      }
459#define ASTSetupLineK1Term(addr, err) \
460      { \
461        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K1); 	\
462        addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K1);				\
463      }
464#define ASTSetupLineK2Term(addr, err) \
465      { \
466        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_K2); 	\
467        addr->PKT_SC_dwData[0] = (ULONG)(err & MASK_LINE_K2);				\
468      }
469#define ASTSetupLineStyle1(addr, pat) \
470      { \
471        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE1); 	\
472        addr->PKT_SC_dwData[0] = (ULONG)(pat);				\
473      }
474#define ASTSetupLineStyle2(addr, pat) \
475      { \
476        addr->PKT_SC_dwHeader  = (ULONG)(PKT_SINGLE_CMD_HEADER + CMDQREG_LINE_STYLE2); 	\
477        addr->PKT_SC_dwData[0] = (ULONG)(pat);				\
478      }
479
480#define ASTSetupNULLCMD(addr) \
481      { \
482        addr->PKT_SC_dwHeader  = (ULONG) (PKT_NULL_CMD); 			\
483        addr->PKT_SC_dwData[0] = (ULONG) 0;					\
484      }
485