Linux Audio

Check our new training course

Loading...
  1#ifndef ACCEL_H__
  2#define ACCEL_H__
  3
  4#define HW_ROP2_COPY 0xc
  5#define HW_ROP2_XOR 0x6
  6
  7/* notes: below address are the offset value from de_base_address (0x100000)*/
  8
  9/* for sm718/750/502 de_base is at mmreg_1mb*/
 10#define DE_BASE_ADDR_TYPE1 0x100000
 11/* for sm712,de_base is at mmreg_32kb */
 12#define DE_BASE_ADDR_TYPE2  0x8000
 13/* for sm722,de_base is at mmreg_0 */
 14#define DE_BASE_ADDR_TYPE3 0
 15
 16/* type1 data port address is at mmreg_0x110000*/
 17#define DE_PORT_ADDR_TYPE1 0x110000
 18/* for sm712,data port address is at mmreg_0 */
 19#define DE_PORT_ADDR_TYPE2 0x100000
 20/* for sm722,data port address is at mmreg_1mb */
 21#define DE_PORT_ADDR_TYPE3 0x100000
 22
 23#define DE_SOURCE                                       0x0
 24#define DE_SOURCE_WRAP                                  BIT(31)
 25#define DE_SOURCE_X_K1_SHIFT                            16
 26#define DE_SOURCE_X_K1_MASK                             (0x3fff << 16)
 27#define DE_SOURCE_X_K1_MONO_MASK			(0x1f << 16)
 28#define DE_SOURCE_Y_K2_MASK                             0xffff
 29
 30#define DE_DESTINATION                                  0x4
 31#define DE_DESTINATION_WRAP                             BIT(31)
 32#define DE_DESTINATION_X_SHIFT                          16
 33#define DE_DESTINATION_X_MASK                           (0x1fff << 16)
 34#define DE_DESTINATION_Y_MASK                           0xffff
 35
 36#define DE_DIMENSION                                    0x8
 37#define DE_DIMENSION_X_SHIFT                            16
 38#define DE_DIMENSION_X_MASK                             (0x1fff << 16)
 39#define DE_DIMENSION_Y_ET_MASK                          0x1fff
 40
 41#define DE_CONTROL                                      0xC
 42#define DE_CONTROL_STATUS                               BIT(31)
 43#define DE_CONTROL_PATTERN                              BIT(30)
 44#define DE_CONTROL_UPDATE_DESTINATION_X                 BIT(29)
 45#define DE_CONTROL_QUICK_START                          BIT(28)
 46#define DE_CONTROL_DIRECTION                            BIT(27)
 47#define DE_CONTROL_MAJOR                                BIT(26)
 48#define DE_CONTROL_STEP_X                               BIT(25)
 49#define DE_CONTROL_STEP_Y                               BIT(24)
 50#define DE_CONTROL_STRETCH                              BIT(23)
 51#define DE_CONTROL_HOST                                 BIT(22)
 52#define DE_CONTROL_LAST_PIXEL                           BIT(21)
 53#define DE_CONTROL_COMMAND_SHIFT                        16
 54#define DE_CONTROL_COMMAND_MASK                         (0x1f << 16)
 55#define DE_CONTROL_COMMAND_BITBLT                       (0x0 << 16)
 56#define DE_CONTROL_COMMAND_RECTANGLE_FILL               (0x1 << 16)
 57#define DE_CONTROL_COMMAND_DE_TILE                      (0x2 << 16)
 58#define DE_CONTROL_COMMAND_TRAPEZOID_FILL               (0x3 << 16)
 59#define DE_CONTROL_COMMAND_ALPHA_BLEND                  (0x4 << 16)
 60#define DE_CONTROL_COMMAND_RLE_STRIP                    (0x5 << 16)
 61#define DE_CONTROL_COMMAND_SHORT_STROKE                 (0x6 << 16)
 62#define DE_CONTROL_COMMAND_LINE_DRAW                    (0x7 << 16)
 63#define DE_CONTROL_COMMAND_HOST_WRITE                   (0x8 << 16)
 64#define DE_CONTROL_COMMAND_HOST_READ                    (0x9 << 16)
 65#define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP         (0xa << 16)
 66#define DE_CONTROL_COMMAND_ROTATE                       (0xb << 16)
 67#define DE_CONTROL_COMMAND_FONT                         (0xc << 16)
 68#define DE_CONTROL_COMMAND_TEXTURE_LOAD                 (0xe << 16)
 69#define DE_CONTROL_ROP_SELECT                           BIT(15)
 70#define DE_CONTROL_ROP2_SOURCE                          BIT(14)
 71#define DE_CONTROL_MONO_DATA_SHIFT                      12
 72#define DE_CONTROL_MONO_DATA_MASK                       (0x3 << 12)
 73#define DE_CONTROL_MONO_DATA_NOT_PACKED                 (0x0 << 12)
 74#define DE_CONTROL_MONO_DATA_8_PACKED                   (0x1 << 12)
 75#define DE_CONTROL_MONO_DATA_16_PACKED                  (0x2 << 12)
 76#define DE_CONTROL_MONO_DATA_32_PACKED                  (0x3 << 12)
 77#define DE_CONTROL_REPEAT_ROTATE                        BIT(11)
 78#define DE_CONTROL_TRANSPARENCY_MATCH                   BIT(10)
 79#define DE_CONTROL_TRANSPARENCY_SELECT                  BIT(9)
 80#define DE_CONTROL_TRANSPARENCY                         BIT(8)
 81#define DE_CONTROL_ROP_MASK                             0xff
 82
 83/* Pseudo fields. */
 84
 85#define DE_CONTROL_SHORT_STROKE_DIR_MASK                (0xf << 24)
 86#define DE_CONTROL_SHORT_STROKE_DIR_225                 (0x0 << 24)
 87#define DE_CONTROL_SHORT_STROKE_DIR_135                 (0x1 << 24)
 88#define DE_CONTROL_SHORT_STROKE_DIR_315                 (0x2 << 24)
 89#define DE_CONTROL_SHORT_STROKE_DIR_45                  (0x3 << 24)
 90#define DE_CONTROL_SHORT_STROKE_DIR_270                 (0x4 << 24)
 91#define DE_CONTROL_SHORT_STROKE_DIR_90                  (0x5 << 24)
 92#define DE_CONTROL_SHORT_STROKE_DIR_180                 (0x8 << 24)
 93#define DE_CONTROL_SHORT_STROKE_DIR_0                   (0xa << 24)
 94#define DE_CONTROL_ROTATION_MASK                        (0x3 << 24)
 95#define DE_CONTROL_ROTATION_0                           (0x0 << 24)
 96#define DE_CONTROL_ROTATION_270                         (0x1 << 24)
 97#define DE_CONTROL_ROTATION_90                          (0x2 << 24)
 98#define DE_CONTROL_ROTATION_180                         (0x3 << 24)
 99
100#define DE_PITCH                                        0x000010
101#define DE_PITCH_DESTINATION_SHIFT                      16
102#define DE_PITCH_DESTINATION_MASK                       (0x1fff << 16)
103#define DE_PITCH_SOURCE_MASK                            0x1fff
104
105#define DE_FOREGROUND                                   0x000014
106#define DE_FOREGROUND_COLOR_MASK                        0xffffffff
107
108#define DE_BACKGROUND                                   0x000018
109#define DE_BACKGROUND_COLOR_MASK                        0xffffffff
110
111#define DE_STRETCH_FORMAT                               0x00001C
112#define DE_STRETCH_FORMAT_PATTERN_XY                    BIT(30)
113#define DE_STRETCH_FORMAT_PATTERN_Y_SHIFT               27
114#define DE_STRETCH_FORMAT_PATTERN_Y_MASK                (0x7 << 27)
115#define DE_STRETCH_FORMAT_PATTERN_X_SHIFT               23
116#define DE_STRETCH_FORMAT_PATTERN_X_MASK                (0x7 << 23)
117#define DE_STRETCH_FORMAT_PIXEL_FORMAT_SHIFT            20
118#define DE_STRETCH_FORMAT_PIXEL_FORMAT_MASK             (0x3 << 20)
119#define DE_STRETCH_FORMAT_PIXEL_FORMAT_8                (0x0 << 20)
120#define DE_STRETCH_FORMAT_PIXEL_FORMAT_16               (0x1 << 20)
121#define DE_STRETCH_FORMAT_PIXEL_FORMAT_32               (0x2 << 20)
122#define DE_STRETCH_FORMAT_PIXEL_FORMAT_24               (0x3 << 20)
123#define DE_STRETCH_FORMAT_ADDRESSING_SHIFT              16
124#define DE_STRETCH_FORMAT_ADDRESSING_MASK               (0xf << 16)
125#define DE_STRETCH_FORMAT_ADDRESSING_XY                 (0x0 << 16)
126#define DE_STRETCH_FORMAT_ADDRESSING_LINEAR             (0xf << 16)
127#define DE_STRETCH_FORMAT_SOURCE_HEIGHT_MASK            0xfff
128
129#define DE_COLOR_COMPARE                                0x000020
130#define DE_COLOR_COMPARE_COLOR_MASK                     0xffffff
131
132#define DE_COLOR_COMPARE_MASK                           0x000024
133#define DE_COLOR_COMPARE_MASK_MASK                      0xffffff
134
135#define DE_MASKS                                        0x000028
136#define DE_MASKS_BYTE_MASK                              (0xffff << 16)
137#define DE_MASKS_BIT_MASK                               0xffff
138
139#define DE_CLIP_TL                                      0x00002C
140#define DE_CLIP_TL_TOP_MASK                             (0xffff << 16)
141#define DE_CLIP_TL_STATUS                               BIT(13)
142#define DE_CLIP_TL_INHIBIT                              BIT(12)
143#define DE_CLIP_TL_LEFT_MASK                            0xfff
144
145#define DE_CLIP_BR                                      0x000030
146#define DE_CLIP_BR_BOTTOM_MASK                          (0xffff << 16)
147#define DE_CLIP_BR_RIGHT_MASK                           0x1fff
148
149#define DE_MONO_PATTERN_LOW                             0x000034
150#define DE_MONO_PATTERN_LOW_PATTERN_MASK                0xffffffff
151
152#define DE_MONO_PATTERN_HIGH                            0x000038
153#define DE_MONO_PATTERN_HIGH_PATTERN_MASK               0xffffffff
154
155#define DE_WINDOW_WIDTH                                 0x00003C
156#define DE_WINDOW_WIDTH_DST_SHIFT                       16
157#define DE_WINDOW_WIDTH_DST_MASK                        (0x1fff << 16)
158#define DE_WINDOW_WIDTH_SRC_MASK                        0x1fff
159
160#define DE_WINDOW_SOURCE_BASE                           0x000040
161#define DE_WINDOW_SOURCE_BASE_EXT                       BIT(27)
162#define DE_WINDOW_SOURCE_BASE_CS                        BIT(26)
163#define DE_WINDOW_SOURCE_BASE_ADDRESS_MASK              0x3ffffff
164
165#define DE_WINDOW_DESTINATION_BASE                      0x000044
166#define DE_WINDOW_DESTINATION_BASE_EXT                  BIT(27)
167#define DE_WINDOW_DESTINATION_BASE_CS                   BIT(26)
168#define DE_WINDOW_DESTINATION_BASE_ADDRESS_MASK         0x3ffffff
169
170#define DE_ALPHA                                        0x000048
171#define DE_ALPHA_VALUE_MASK                             0xff
172
173#define DE_WRAP                                         0x00004C
174#define DE_WRAP_X_MASK                                  (0xffff << 16)
175#define DE_WRAP_Y_MASK                                  0xffff
176
177#define DE_STATUS                                       0x000050
178#define DE_STATUS_CSC                                   BIT(1)
179#define DE_STATUS_2D                                    BIT(0)
180
181/* blt direction */
182#define TOP_TO_BOTTOM 0
183#define LEFT_TO_RIGHT 0
184#define BOTTOM_TO_TOP 1
185#define RIGHT_TO_LEFT 1
186
187void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt);
188
189void sm750_hw_de_init(struct lynx_accel *accel);
190
191int sm750_hw_fillrect(struct lynx_accel *accel,
192				u32 base, u32 pitch, u32 Bpp,
193				u32 x, u32 y, u32 width, u32 height,
194				u32 color, u32 rop);
195
196int sm750_hw_copyarea(
197struct lynx_accel *accel,
198unsigned int sBase,  /* Address of source: offset in frame buffer */
199unsigned int sPitch, /* Pitch value of source surface in BYTE */
200unsigned int sx,
201unsigned int sy,     /* Starting coordinate of source surface */
202unsigned int dBase,  /* Address of destination: offset in frame buffer */
203unsigned int dPitch, /* Pitch value of destination surface in BYTE */
204unsigned int bpp,    /* Color depth of destination surface */
205unsigned int dx,
206unsigned int dy,     /* Starting coordinate of destination surface */
207unsigned int width,
208unsigned int height, /* width and height of rectangle in pixel value */
209unsigned int rop2);
210
211int sm750_hw_imageblit(struct lynx_accel *accel,
212		 const char *pSrcbuf, /* pointer to start of source buffer in system memory */
213		 u32 srcDelta,          /* Pitch value (in bytes) of the source buffer, +ive means top down and -ive mean button up */
214		 u32 startBit, /* Mono data can start at any bit in a byte, this value should be 0 to 7 */
215		 u32 dBase,    /* Address of destination: offset in frame buffer */
216		 u32 dPitch,   /* Pitch value of destination surface in BYTE */
217		 u32 bytePerPixel,      /* Color depth of destination surface */
218		 u32 dx,
219		 u32 dy,       /* Starting coordinate of destination surface */
220		 u32 width,
221		 u32 height,   /* width and height of rectangle in pixel value */
222		 u32 fColor,   /* Foreground color (corresponding to a 1 in the monochrome data */
223		 u32 bColor,   /* Background color (corresponding to a 0 in the monochrome data */
224		 u32 rop2);
225#endif