The Best / FT800_beyondtek

Dependents:   datalogger_ft810

Fork of FT800_3 by The Best

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FT_Gpu-old.h Source File

FT_Gpu-old.h

00001 /* mbed Library for FTDI FT800  Enbedded Video Engine "EVE"
00002  * based on Original Code Sample from FTDI 
00003  * ported to mbed by Peter Drescher, DC2PD 2014
00004  * Released under the MIT License: http://mbed.org/license/mit */
00005 
00006 #ifndef _FT_GPU_H_
00007 #define _FT_GPU_H_
00008 
00009 /* Definitions used for FT800 co processor command buffer */
00010 #define FT_DL_SIZE           (8*1024)  //8KB Display List buffer size
00011 #define FT_CMD_FIFO_SIZE     (4*1024)  //4KB coprocessor Fifo size
00012 #define FT_CMD_SIZE          (4)       //4 byte per coprocessor command of EVE
00013 
00014 #define FT800_VERSION "1.9.0"
00015 #define ADC_DIFFERENTIAL     1UL
00016 #define ADC_SINGLE_ENDED     0UL
00017 #define ADPCM_SAMPLES        2UL
00018 #define ALWAYS               7UL
00019 #define ARGB1555             0UL
00020 #define ARGB2                5UL
00021 #define ARGB4                6UL
00022 #define BARGRAPH             11UL
00023 #define BILINEAR             1UL
00024 #define BITMAPS              1UL
00025 #define BORDER               0UL
00026 
00027 #define CMDBUF_SIZE          4096UL
00028 #define CMD_APPEND           4294967070UL
00029 #define CMD_BGCOLOR          4294967049UL
00030 #define CMD_BITMAP_TRANSFORM 4294967073UL
00031 #define CMD_BUTTON           4294967053UL
00032 #define CMD_CALIBRATE        4294967061UL
00033 #define CMD_CLOCK            4294967060UL
00034 #define CMD_COLDSTART        4294967090UL
00035 #define CMD_CRC              4294967043UL
00036 #define CMD_DIAL             4294967085UL
00037 #define CMD_DLSTART          4294967040UL
00038 #define CMD_EXECUTE          4294967047UL
00039 #define CMD_FGCOLOR          4294967050UL
00040 #define CMD_GAUGE            4294967059UL
00041 #define CMD_GETMATRIX        4294967091UL
00042 #define CMD_GETPOINT         4294967048UL
00043 #define CMD_GETPROPS         4294967077UL
00044 #define CMD_GETPTR           4294967075UL
00045 #define CMD_GRADCOLOR        4294967092UL
00046 #define CMD_GRADIENT         4294967051UL
00047 #define CMD_HAMMERAUX        4294967044UL
00048 #define CMD_IDCT             4294967046UL
00049 #define CMD_INFLATE          4294967074UL
00050 #define CMD_INTERRUPT        4294967042UL
00051 #define CMD_KEYS             4294967054UL
00052 #define CMD_LOADIDENTITY     4294967078UL
00053 #define CMD_LOADIMAGE        4294967076UL
00054 #define CMD_LOGO             4294967089UL
00055 #define CMD_MARCH            4294967045UL
00056 #define CMD_MEMCPY           4294967069UL
00057 #define CMD_MEMCRC           4294967064UL
00058 #define CMD_MEMSET           4294967067UL
00059 #define CMD_MEMWRITE         4294967066UL
00060 #define CMD_MEMZERO          4294967068UL
00061 #define CMD_NUMBER           4294967086UL
00062 #define CMD_PROGRESS         4294967055UL
00063 #define CMD_REGREAD          4294967065UL
00064 #define CMD_ROTATE           4294967081UL
00065 #define CMD_SCALE            4294967080UL
00066 #define CMD_SCREENSAVER      4294967087UL
00067 #define CMD_SCROLLBAR        4294967057UL
00068 #define CMD_SETFONT          4294967083UL
00069 #define CMD_SETMATRIX        4294967082UL
00070 #define CMD_SKETCH           4294967088UL
00071 #define CMD_SLIDER           4294967056UL
00072 #define CMD_SNAPSHOT         4294967071UL
00073 #define CMD_SPINNER          4294967062UL
00074 #define CMD_STOP             4294967063UL
00075 #define CMD_SWAP             4294967041UL
00076 #define CMD_TEXT             4294967052UL
00077 #define CMD_TOGGLE           4294967058UL
00078 #define CMD_TOUCH_TRANSFORM  4294967072UL
00079 #define CMD_TRACK            4294967084UL
00080 #define CMD_TRANSLATE        4294967079UL
00081 
00082 #define DECR                 4UL
00083 #define DECR_WRAP            7UL
00084 #define DLSWAP_DONE          0UL
00085 #define DLSWAP_FRAME         2UL
00086 #define DLSWAP_LINE          1UL
00087 #define DST_ALPHA            3UL
00088 #define EDGE_STRIP_A         7UL
00089 #define EDGE_STRIP_B         8UL
00090 #define EDGE_STRIP_L         6UL
00091 #define EDGE_STRIP_R         5UL
00092 #define EQUAL                5UL
00093 #define GEQUAL               4UL
00094 #define GREATER              3UL
00095 #define INCR                 3UL
00096 #define INCR_WRAP            6UL
00097 #define INT_CMDEMPTY         32UL
00098 #define INT_CMDFLAG          64UL
00099 #define INT_CONVCOMPLETE     128UL
00100 #define INT_PLAYBACK         16UL
00101 #define INT_SOUND            8UL
00102 #define INT_SWAP             1UL
00103 #define INT_TAG              4UL
00104 #define INT_TOUCH            2UL
00105 #define INVERT               5UL
00106 
00107 #define KEEP                 1UL
00108 #define L1                   1UL
00109 #define L4                   2UL
00110 #define L8                   3UL
00111 #define LEQUAL               2UL
00112 #define LESS                 1UL
00113 #define LINEAR_SAMPLES       0UL
00114 #define LINES                3UL
00115 #define LINE_STRIP           4UL
00116 #define NEAREST              0UL
00117 #define NEVER                0UL
00118 #define NOTEQUAL             6UL
00119 #define ONE                  1UL
00120 #define ONE_MINUS_DST_ALPHA  5UL
00121 #define ONE_MINUS_SRC_ALPHA  4UL
00122 #define OPT_CENTER           1536UL
00123 #define OPT_CENTERX          512UL
00124 #define OPT_CENTERY          1024UL
00125 #define OPT_FLAT             256UL
00126 #define OPT_MONO             1UL
00127 #define OPT_NOBACK           4096UL
00128 #define OPT_NODL             2UL
00129 #define OPT_NOHANDS          49152UL
00130 #define OPT_NOHM             16384UL
00131 #define OPT_NOPOINTER        16384UL
00132 #define OPT_NOSECS           32768UL
00133 #define OPT_NOTICKS          8192UL
00134 #define OPT_RIGHTX           2048UL
00135 #define OPT_SIGNED           256UL
00136 #define PALETTED             8UL
00137 
00138 #define FTPOINTS             2UL
00139 #define RECTS                9UL
00140 
00141 #define RAM_G           0x000000    // Main graphics RAM.
00142 #define ROM_CHIPID      0x0C0000    // Chip ID and revision.    
00143 #define ROM_FONT        0x1E0000    
00144 #define ROM_FONT_ADDR   0x2FFFFC    // Font table pointer address,
00145 #define RAM_DL          0x300000    // Display list RAM. 
00146 #define RAM_REG         0x302000    // Registers.
00147 #define RAM_CMD         0x308000    // Coprocessor command buffer.  
00148 #define REG_ID          0x302000    // start of the registers - the ID reg
00149 
00150 /* OLD FT800 adresses
00151 #define RAM_PAL              1056768UL
00152 #define REG_ANALOG           1058104UL
00153 #define REG_ANA_COMP         1058160UL
00154 #define REG_CMD_DL           1058028UL
00155 #define REG_CMD_READ         1058020UL
00156 #define REG_CMD_WRITE        1058024UL
00157 #define REG_CPURESET         1057820UL
00158 #define REG_CRC              1058152UL
00159 #define REG_CSPREAD          1057892UL
00160 #define REG_CYA0             1058000UL
00161 #define REG_CYA1             1058004UL
00162 #define REG_CYA_TOUCH        1058100UL
00163 #define REG_DATESTAMP        1058108UL
00164 #define REG_DITHER           1057884UL
00165 #define REG_DLSWAP           1057872UL
00166 #define REG_GPIO             1057936UL
00167 #define REG_GPIO_DIR         1057932UL
00168 #define REG_HCYCLE           1057832UL
00169 #define REG_HOFFSET          1057836UL
00170 #define REG_HSIZE            1057840UL
00171 #define REG_HSYNC0           1057844UL
00172 #define REG_HSYNC1           1057848UL
00173 #define REG_INT_FLAGS        1057944UL
00174 #define REG_INT_MASK         1057952UL
00175 #define REG_MACRO_0          1057992UL
00176 #define REG_MACRO_1          1057996UL
00177 #define REG_OUTBITS          1057880UL
00178 #define REG_PCLK             1057900UL
00179 #define REG_PCLK_POL         1057896UL
00180 #define REG_PLAY             1057928UL
00181 #define REG_SOUND            1057924UL
00182 #define REG_SWIZZLE          1057888UL
00183 #define REG_TAG              1057912UL
00184 #define REG_TAG_X            1057904UL
00185 #define REG_TAG_Y            1057908UL
00186 #define REG_TAP_CRC          1057824UL
00187 #define REG_TAP_MASK         1057828UL
00188 #define REG_TOUCH_DIRECT_XY  1058164UL
00189 #define REG_TOUCH_DIRECT_Z1Z2 1058168UL
00190 #define REG_TRACKER          1085440UL
00191 #define REG_TRIM             1058156UL
00192 #define REG_VCYCLE           1057852UL
00193 #define REG_VOFFSET          1057856UL
00194 #define REG_VOL_PB           1057916UL
00195 #define REG_VOL_SOUND        1057920UL
00196 #define REG_VSIZE            1057860UL
00197 #define REG_VSYNC0           1057864UL
00198 #define REG_VSYNC1           1057868UL
00199 #define REG_ROMSUB_SEL       1058016UL
00200 #define REG_ROTATE           1057876UL
00201 */
00202     #define REG_CLOCK               0x302008
00203     #define REG_FREQUENCY           0x30200C
00204     #define REG_RENDERMODE          0x302010
00205     #define REG_FRAMES              0x302004
00206 
00207 #define REG_PLAYBACK_START      0x3020B4   
00208 #define REG_PLAYBACK_LENGTH     0x3020B8 
00209 #define REG_PLAYBACK_READPTR    0x3020BC
00210 #define REG_PLAYBACK_FREQ       0x3020C0
00211 #define REG_PLAYBACK_FORMAT     0x3020C4
00212 #define REG_PLAYBACK_LOOP       0x3020C8
00213 #define REG_PLAYBACK_PLAY       0x3020CC
00214 
00215     #define REG_PWM_HZ              0x3020D0
00216     #define REG_PWM_DUTY            0x3020D4
00217     #define REG_SNAPY               0x302014
00218     #define REG_SNAPSHOT            0x302018
00219 #define REG_TOUCH_MODE          0x302104  
00220 #define REG_TOUCH_ADC_MODE      0x302108
00221 #define REG_TOUCH_CHARGE        0x30210C
00222 #define REG_TOUCH_SETTLE        0x302110 
00223 #define REG_TOUCH_OVERSAMPLE    0x302114
00224 #define REG_TOUCH_RZTHRESH      0x302118  
00225 #define REG_TOUCH_RAW_XY        0x30211C
00226 #define REG_TOUCH_RZ            0x302120
00227 #define REG_TOUCH_SCREEN_XY     0x302124  
00228 #define REG_TOUCH_TAG_XY        0x302128  
00229 #define REG_TOUCH_TAG           0x30212C
00230     #define REG_TOUCH_TAG1_XY       0x302130
00231     #define REG_TOUCH_TAG1          0x302134 
00232     #define REG_TOUCH_TAG2_XY       0x302138 
00233     #define REG_TOUCH_TAG2          0x30213C
00234     #define REG_TOUCH_TAG3_XY       0x302140
00235     #define REG_TOUCH_TAG3          0x302144
00236     #define REG_TOUCH_TAG4_XY       0x302148
00237     #define REG_TOUCH_TAG4          0x30214C    
00238 #define REG_TOUCH_TRANSFORM_A   0x302150
00239 #define REG_TOUCH_TRANSFORM_B   0x302154
00240 #define REG_TOUCH_TRANSFORM_C   0x302158
00241 #define REG_TOUCH_TRANSFORM_D   0x30215C
00242 #define REG_TOUCH_TRANSFORM_E   0x302160  
00243 #define REG_TOUCH_TRANSFORM_F   0x302164
00244     #define REG_TOUCH_CONFIG        0x302168
00245     #define REG_SNAPFORMAT          0x30201C
00246     #define REG_CPURESET            0x302020 
00247     #define REG_TAP_CRC             0x302024
00248     #define REG_TAP_MASK            0x302028
00249     #define REG_HCYCLE              0x30202C
00250     #define REG_HOFFSET             0x302030
00251     #define REG_HSIZE               0x302034
00252     #define REG_HSYNC0              0x302038
00253     #define REG_HSYNC1              0x30203C
00254     #define REG_VCYCLE              0x302040 
00255     #define REG_VOFFSET             0x302044   
00256     #define REG_VSIZE               0x302048
00257     #define REG_VSYNC0              0x30204C
00258     #define REG_VSYNC1              0x302050    
00259     #define REG_DLSWAP              0x302054   
00260     #define REG_ROTATE              0x302058 
00261     #define REG_OUTBITS             0x30205C  
00262     #define REG_DITHER              0x302060
00263     #define REG_SWIZZLE             0x302064  
00264     #define REG_CSPREAD             0x302068
00265     #define REG_PCLK_POL            0x30206C
00266     #define REG_PCLK                0x302070
00267     #define REG_TAG_X               0x302074  
00268     #define REG_TAG_Y               0x302078
00269     #define REG_TAG                 0x30207C
00270     #define REG_VOL_PB              0x302080 
00271     #define REG_VOL_SOUND           0x302084  
00272     #define REG_SOUND               0x302088  
00273     #define REG_PLAY                0x30208C  
00274     #define REG_GPIO_DIR            0x302090
00275     #define REG_GPIO                0x302094
00276     #define REG_GPIOX_DIR           0x302098
00277     #define REG_GPIOX               0x30209C
00278     #define REG_INT_FLAGS           0x3020A8
00279     #define REG_INT_EN              0x3020AC
00280     #define REG_INT_MASK            0x3020B0
00281     #define REG_MACRO_0             0x3020D8   
00282     #define REG_MACRO_1             0x3020DC
00283     #define REG_CMD_READ            0x3020F8
00284     #define REG_CMD_WRITE           0x3020FC
00285     #define REG_CMD_DL              0x302100   
00286     #define REG_CTOUCH_TOUCH4_X     0x30216C
00287     #define REG_BIST_EN             0x302174
00288     #define REG_TRIM                0x302180
00289     #define REG_ANA_COMP            0x302184
00290     #define REG_SPI_WIDTH           0x302188  
00291     #define REG_TOUCH_DIRECT_XY     0x30218C
00292     #define REG_TOUCH_DIRECT_Z1Z2   0x302190
00293     #define REG_DATESTAMP           0x302564
00294     #define REG_CMDB_SPACE          0x302574
00295     #define REG_CMDB_WRITE          0x302578 
00296     #define REG_TRACKER             0x309000
00297     #define REG_TRACKER_1           0x309004
00298     #define REG_TRACKER_2           0x309008
00299     #define REG_TRACKER_3           0x30900C
00300     #define REG_TRACKER_4           0x309010
00301 
00302 #define REPEAT               1UL
00303 #define REPLACE              2UL
00304 #define RGB332               4UL
00305 #define RGB565               7UL
00306 #define SRC_ALPHA            2UL
00307 #define TEXT8X8              9UL
00308 #define TEXTVGA              10UL
00309 #define TOUCHMODE_CONTINUOUS 3UL
00310 #define TOUCHMODE_FRAME      2UL
00311 #define TOUCHMODE_OFF        0UL
00312 #define TOUCHMODE_ONESHOT    1UL
00313 #define ULAW_SAMPLES         1UL
00314 #define ZERO                 0UL
00315 
00316 
00317 #define VERTEX2F(x,y) ((1UL<<30)|(((x)&32767UL)<<15)|(((y)&32767UL)<<0))
00318 #define VERTEX2II(x,y,handle,cell) ((2UL<<30)|(((x)&511UL)<<21)|(((y)&511UL)<<12)|(((handle)&31UL)<<7)|(((cell)&127UL)<<0))
00319 #define BITMAP_SOURCE(addr) ((1UL<<24)|(((addr)&1048575UL)<<0))
00320 #define CLEAR_COLOR_RGB(red,green,blue) ((2UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0))
00321 #define TAG(s) ((3UL<<24)|(((s)&255UL)<<0))
00322 #define COLOR_RGB(red,green,blue) ((4UL<<24)|(((red)&255UL)<<16)|(((green)&255UL)<<8)|(((blue)&255UL)<<0))
00323 #define BITMAP_HANDLE(handle) ((5UL<<24)|(((handle)&31UL)<<0))
00324 #define CELL(cell) ((6UL<<24)|(((cell)&127UL)<<0))
00325 #define BITMAP_LAYOUT(format,linestride,height) ((7UL<<24)|(((format)&31UL)<<19)|(((linestride)&1023UL)<<9)|(((height)&511UL)<<0))
00326 #define BITMAP_SIZE(filter,wrapx,wrapy,width,height) ((8UL<<24)|(((filter)&1UL)<<20)|(((wrapx)&1UL)<<19)|(((wrapy)&1UL)<<18)|(((width)&511UL)<<9)|(((height)&511UL)<<0))
00327 #define ALPHA_FUNC(func,ref) ((9UL<<24)|(((func)&7UL)<<8)|(((ref)&255UL)<<0))
00328 #define STENCIL_FUNC(func,ref,mask) ((10UL<<24)|(((func)&7UL)<<16)|(((ref)&255UL)<<8)|(((mask)&255UL)<<0))
00329 #define BLEND_FUNC(src,dst) ((11UL<<24)|(((src)&7UL)<<3)|(((dst)&7UL)<<0))
00330 #define STENCIL_OP(sfail,spass) ((12UL<<24)|(((sfail)&7UL)<<3)|(((spass)&7UL)<<0))
00331 #define POINT_SIZE(size) ((13UL<<24)|(((size)&8191UL)<<0))
00332 #define LINE_WIDTH(width) ((14UL<<24)|(((width)&4095UL)<<0))
00333 #define CLEAR_COLOR_A(alpha) ((15UL<<24)|(((alpha)&255UL)<<0))
00334 #define COLOR_A(alpha) ((16UL<<24)|(((alpha)&255UL)<<0))
00335 #define CLEAR_STENCIL(s) ((17UL<<24)|(((s)&255UL)<<0))
00336 #define CLEAR_TAG(s) ((18UL<<24)|(((s)&255UL)<<0))
00337 #define STENCIL_MASK(mask) ((19UL<<24)|(((mask)&255UL)<<0))
00338 #define TAG_MASK(mask) ((20UL<<24)|(((mask)&1UL)<<0))
00339 #define BITMAP_TRANSFORM_A(a) ((21UL<<24)|(((a)&131071UL)<<0))
00340 #define BITMAP_TRANSFORM_B(b) ((22UL<<24)|(((b)&131071UL)<<0))
00341 #define BITMAP_TRANSFORM_C(c) ((23UL<<24)|(((c)&16777215UL)<<0))
00342 #define BITMAP_TRANSFORM_D(d) ((24UL<<24)|(((d)&131071UL)<<0))
00343 #define BITMAP_TRANSFORM_E(e) ((25UL<<24)|(((e)&131071UL)<<0))
00344 #define BITMAP_TRANSFORM_F(f) ((26UL<<24)|(((f)&16777215UL)<<0))
00345 #define SCISSOR_XY(x,y) ((27UL<<24)|(((x)&511UL)<<9)|(((y)&511UL)<<0))
00346 #define SCISSOR_SIZE(width,height) ((28UL<<24)|(((width)&1023UL)<<10)|(((height)&1023UL)<<0))
00347 #define CALL(dest) ((29UL<<24)|(((dest)&65535UL)<<0))
00348 #define JUMP(dest) ((30UL<<24)|(((dest)&65535UL)<<0))
00349 #define BEGIN(prim) ((31UL<<24)|(((prim)&15UL)<<0))
00350 #define COLOR_MASK(r,g,b,a) ((32UL<<24)|(((r)&1UL)<<3)|(((g)&1UL)<<2)|(((b)&1UL)<<1)|(((a)&1UL)<<0))
00351 #define CLEAR(c,s,t) ((38UL<<24)|(((c)&1UL)<<2)|(((s)&1UL)<<1)|(((t)&1UL)<<0))
00352 #define END() ((33UL<<24))
00353 #define SAVE_CONTEXT() ((34UL<<24))
00354 #define RESTORE_CONTEXT() ((35UL<<24))
00355 #define RETURN() ((36UL<<24))
00356 #define MACRO(m) ((37UL<<24)|(((m)&1UL)<<0))
00357 #define DISPLAY() ((0UL<<24))
00358 
00359 #define FT_GPU_NUMCHAR_PERFONT (128)
00360 #define FT_GPU_FONT_TABLE_SIZE (148)
00361 
00362 
00363 
00364 /* FT800 font table structure */
00365 /* Font table address in ROM can be found by reading the address from 0xFFFFC location. */
00366 /* 16 font tables are present at the address read from location 0xFFFFC */
00367 typedef struct FT_Gpu_Fonts
00368 {
00369     /* All the values are in bytes */
00370     /* Width of each character font from 0 to 127 */
00371     ft_uint8_t  FontWidth[FT_GPU_NUMCHAR_PERFONT];
00372     /* Bitmap format of font wrt bitmap formats supported by FT800 - L1, L4, L8 */
00373     ft_uint32_t FontBitmapFormat;
00374     /* Font line stride in FT800 ROM */
00375     ft_uint32_t FontLineStride;
00376     /* Font width in pixels */
00377     ft_uint32_t FontWidthInPixels;
00378     /* Font height in pixels */
00379     ft_uint32_t FontHeightInPixels;
00380     /* Pointer to font graphics raw data */
00381     ft_uint32_t PointerToFontGraphicsData;
00382 }FT_Gpu_Fonts_t;
00383 
00384 #endif /* #ifndef _FT_GPU_H_ */
00385 
00386 
00387 /* Nothing beyond this */
00388 
00389 
00390 
00391 
00392