1 #ifndef __SH7723_BLT_H__
2 #define __SH7723_BLT_H__
3 
4 #include <sys/ioctl.h>
5 
6 #include "sh7722_types.h"
7 
8 
9 
10 #define SH7723_SUPPORTED_DRAWINGFLAGS      (DSDRAW_NOFX | DSDRAW_BLEND)
11 
12 #define SH7723_SUPPORTED_DRAWINGFUNCTIONS  (DFXL_FILLRECTANGLE | \
13                                             DFXL_FILLTRIANGLE  | \
14                                             DFXL_DRAWLINE      | \
15                                             DFXL_DRAWRECTANGLE)
16 
17 #define SH7723_SUPPORTED_BLITTINGFLAGS     (DSBLIT_BLEND_COLORALPHA | \
18                                             DSBLIT_SRC_COLORKEY)
19 
20 #define SH7723_SUPPORTED_BLITTINGFUNCTIONS (DFXL_BLIT)
21 
22 
23 DFBResult sh7723EngineSync  ( void *drv, void *dev );
24 
25 void sh7723EngineReset      ( void *drv, void *dev );
26 void sh7723FlushTextureCache( void *drv, void *dev );
27 
28 void sh7723EmitCommands     ( void *drv, void *dev );
29 
30 void sh7723CheckState       ( void *drv, void *dev,
31                               CardState *state, DFBAccelerationMask accel );
32 
33 void sh7723SetState         ( void *drv, void *dev,
34                               GraphicsDeviceFuncs *funcs,
35                               CardState *state, DFBAccelerationMask accel );
36 
37 bool sh7723FillRectangle    ( void *drv, void *dev, DFBRectangle *rect );
38 bool sh7723FillTriangle     ( void *drv, void *dev, DFBTriangle *triangle );
39 bool sh7723DrawRectangle    ( void *drv, void *dev, DFBRectangle *rect );
40 bool sh7723DrawLine         ( void *drv, void *dev, DFBRegion *line );
41 bool sh7723Blit             ( void *drv, void *dev, DFBRectangle *rect, int dx, int dy );
42 
43 #define SH7723_S16S16(h,l)         ((u32)((((u16)(h)) << 16) | ((u16)(l))))
44 
45 #define SH7723_XY(x,y)             SH7723_S16S16(x,y)
46 
47 #define	SH7723_TDG_BASE            0xA4680000
48 
49 //#define	BEM_HC_DMA_START		   (SH7723_TDG_BASE + 0x00044)
50 #define	M2DG_SCLR		   (SH7723_TDG_BASE + 0x000)
51 //#define	BEM_HC_DMA_ADR			   (SH7723_TDG_BASE + 0x00040)
52 #define	M2DG_DLSAR		   (SH7723_TDG_BASE + 0x048)
53 
54 
55 
56 
57 #define M2DG_OPCODE_TRAP        0x00000000
58 #define M2DG_OPCODE_WPR         0x18000000
59 #define M2DG_OPCODE_SYNC        0x12000000
60 #define M2DG_OPCODE_LCOFS       0x40000000
61 #define M2DG_OPCODE_MOVE        0x48000000
62 #define M2DG_OPCODE_NOP         0x08000000
63 #define M2DG_OPCODE_INTERRUPT   0x08008000
64 #define M2DG_SYNC_TCLR          0x00000010
65 
66 #define M2DG_OPCODE_POLYGON_4C  0x80000000
67 #define M2DG_OPCODE_LINE_C      0xB0000000
68 #define M2DG_OPCODE_BITBLTA     0xA2000100
69 #define M2DG_OPCODE_BITBLTC     0xA0000000
70 
71 #define M2DG_DRAWMODE_STRANS    0x00000800
72 #define M2DG_DRAWMODE_CLIP      0x00002000
73 #define M2DG_DRAWMODE_ANTIALIAS 0x00000002
74 #define M2DG_DRAWMODE_ALPHA     0x00000002
75 
76 #define M2DG_DRAWMODE_SRCDIR_X  0x00000040
77 #define M2DG_DRAWMODE_SRCDIR_Y  0x00000020
78 #define M2DG_DRAWMODE_DSTDIR_X  0x00000010
79 #define M2DG_DRAWMODE_DSTDIR_Y  0x00000008
80 
81 
82 
83 //ignore and replace
84 #define	BEM_WR_CTRL                (0x00400)
85 #define	BEM_WR_V1                  (0x00410)
86 #define	BEM_WR_V2                  (0x00414)
87 #define	BEM_WR_FGC                 (0x00420)
88 
89 #define	BEM_BE_CTRL                (0x00800)
90 #define	BEM_BE_V1                  (0x00810)
91 #define	BEM_BE_V2                  (0x00814)
92 #define	BEM_BE_V3                  (0x00818)
93 #define	BEM_BE_V4                  (0x0081C)
94 #define	BEM_BE_COLOR1              (0x00820)
95 #define	BEM_BE_SRC_LOC             (0x00830)
96 #define	BEM_BE_SRC_SIZE            (0x00834)
97 #define	BEM_BE_MATRIX_A            (0x00850)
98 #define	BEM_BE_MATRIX_B            (0x00854)
99 #define	BEM_BE_MATRIX_C            (0x00858)
100 #define	BEM_BE_MATRIX_D            (0x0085C)
101 #define	BEM_BE_MATRIX_E            (0x00860)
102 #define	BEM_BE_MATRIX_F            (0x00864)
103 #define	BEM_BE_ORIGIN              (0x00870)
104 #define	BEM_BE_SC_MIN              (0x00880)
105 #define	BEM_BE_SC_MAX              (0x00884)
106 
107 #define	BEM_TE_SRC                 (0x00C00)
108 #define	BEM_TE_SRC_BASE            (0x00C04)
109 #define	BEM_TE_SRC_SIZE            (0x00C08)
110 #define	BEM_TE_SRC_CNV             (0x00C0C)
111 #define	BEM_TE_MASK                (0x00C10)
112 #define	BEM_TE_MASK_BASE           (0x00C14)
113 #define	BEM_TE_MASK_SIZE           (0x00C18)
114 #define	BEM_TE_MASK_CNV            (0x00C1C)
115 #define	BEM_TE_ALPHA               (0x00C28)
116 #define	BEM_TE_FILTER              (0x00C30)
117 #define	BEM_TE_INVALID             (0x00C40)
118 
119 #define	BEM_PE_DST                 (0x01000)
120 #define	BEM_PE_DST_BASE            (0x01004)
121 #define	BEM_PE_DST_SIZE            (0x01008)
122 #define	BEM_PE_SC                  (0x0100C)
123 #define	BEM_PE_SC0_MIN             (0x01010)
124 #define	BEM_PE_SC0_MAX             (0x01014)
125 #define	BEM_PE_CKEY                (0x01040)
126 #define	BEM_PE_CKEY_B              (0x01044)
127 #define	BEM_PE_CKEY_A              (0x01048)
128 #define	BEM_PE_COLORCHANGE         (0x01050)
129 #define	BEM_PE_ALPHA               (0x01058)
130 #define	BEM_PE_COLORCHANGE_0       (0x01060)
131 #define	BEM_PE_COLORCHANGE_1       (0x01064)
132 #define	BEM_PE_OPERATION           (0x01080)
133 #define	BEM_PE_FIXEDALPHA          (0x01084)
134 #define	BEM_PE_OFFSET              (0x01088)
135 #define	BEM_PE_MASK                (0x01094)
136 #define	BEM_PE_CACHE               (0x010B0)
137 
138 /*
139  * BEM_BE_CTRL
140  */
141 #define BE_FLIP_NONE               0x00000000
142 #define BE_FLIP_HORIZONTAL         0x01000000
143 #define BE_FLIP_VERTICAL           0x02000000
144 #define BE_FLIP_BOTH               0x03000000
145 
146 #define BE_CTRL_FIXMODE_20_12      0x00000000
147 #define BE_CTRL_FIXMODE_16_16      0x00100000
148 #define BE_CTRL_CLIP               0x00080000
149 #define BE_CTRL_ORIGIN             0x00040000
150 #define BE_CTRL_ZOOM               0x00020000
151 #define BE_CTRL_MATRIX             0x00010000
152 
153 #define BE_CTRL_SCANMODE_LINE      0x00000000
154 #define BE_CTRL_SCANMODE_4x4       0x00001000
155 #define BE_CTRL_SCANMODE_8x4       0x00002000
156 
157 #define BE_CTRL_BLTDIR_FORWARD     0x00000000
158 #define BE_CTRL_BLTDIR_BACKWARD    0x00000100
159 #define BE_CTRL_BLTDIR_AUTOMATIC   0x00000200
160 
161 #define BE_CTRL_TEXTURE            0x00000020
162 #define BE_CTRL_QUADRANGLE         0x00000002
163 #define BE_CTRL_RECTANGLE          0x00000001
164 
165 /*
166  * BEM_PE_OPERATION
167  */
168 #define BLE_FUNC_NONE              0x00000000
169 #define BLE_FUNC_AxB_plus_CxD      0x10000000
170 #define BLE_FUNC_CxD_minus_AxB     0x20000000
171 #define BLE_FUNC_AxB_minus_CxD     0x30000000
172 
173 #define BLE_ROP_XOR                0x01660000
174 
175 #define BLE_SRCA_FIXED             0x00000000
176 #define BLE_SRCA_SOURCE_ALPHA      0x00001000
177 #define BLE_SRCA_ALPHA_CHANNEL     0x00002000
178 
179 #define BLE_DSTA_FIXED             0x00000000
180 #define BLE_DSTA_DEST_ALPHA        0x00000100
181 
182 #define BLE_SRCF_ZERO              0x00000000
183 #define BLE_SRCF_ONE               0x00000010
184 #define BLE_SRCF_DST               0x00000020
185 #define BLE_SRCF_1_DST             0x00000030
186 #define BLE_SRCF_SRC_A             0x00000040
187 #define BLE_SRCF_1_SRC_A           0x00000050
188 #define BLE_SRCF_DST_A             0x00000060
189 #define BLE_SRCF_1_DST_A           0x00000070
190 
191 #define BLE_DSTO_DST               0x00000000
192 #define BLE_DSTO_OFFSET            0x00000008
193 
194 #define BLE_DSTF_ZERO              0x00000000
195 #define BLE_DSTF_ONE               0x00000001
196 #define BLE_DSTF_SRC               0x00000002
197 #define BLE_DSTF_1_SRC             0x00000003
198 #define BLE_DSTF_SRC_A             0x00000004
199 #define BLE_DSTF_1_SRC_A           0x00000005
200 #define BLE_DSTF_DST_A             0x00000006
201 #define BLE_DSTF_1_DST_A           0x00000007
202 
203 /*
204  * BEM_PE_CKEY
205  */
206 #define CKEY_EXCLUDE_UNUSED        0x00100000
207 #define CKEY_EXCLUDE_ALPHA         0x00010000
208 #define CKEY_A_ENABLE              0x00000100
209 #define CKEY_B_ENABLE              0x00000001
210 
211 /*
212  * BEM_PE_COLORCHANGE
213  */
214 #define COLORCHANGE_DISABLE        0x00000000
215 #define COLORCHANGE_COMPARE_FIRST  0x0000000b
216 #define COLORCHANGE_EXCLUDE_UNUSED 0x00010000
217 
218 /*
219  * BEM_PE_MASK
220  */
221 #define PE_MASK_DISABLE            0x00000000
222 #define PE_MASK_COLOR              0x00000001
223 #define PE_MASK_ALPHA              0x00000080
224 
225 /*
226  * BEM_TE_MASK
227  */
228 #define TE_MASK_DISABLE            0x00000000
229 #define TE_MASK_ENABLE             0x00010000
230 
231 /*
232  * BEM_WR_CTRL
233  */
234 #define WR_CTRL_LINE               0x00000002
235 #define WR_CTRL_POLYLINE           0x00000003
236 #define WR_CTRL_ANTIALIAS          0x00020100
237 #define WR_CTRL_ENDPOINT           0x00001000
238 
239 #endif
240