Advertisement
Guest User

FT81x.h - Library for FT810, FT811, FT812, FT813

a guest
Jul 12th, 2018
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.17 KB | None | 0 0
  1. /****************************************************************************************
  2. *
  3. * FTDIChip FT811 with Chipkit uC32 - Version 1.0
  4. *
  5. ****************************************************************************************
  6. * File Name: FT81x.h
  7. * Purpose: This header file contains the display list and graphics processor
  8. * commands for the FTDI FT81x series graphics controllers.
  9. * MCU: Chipkit uC32 (or Arduino)
  10. *
  11. * Software License Agreement
  12. *
  13. * This code is provided as an example only and is not guaranteed.
  14. * The developer of the final application incorporating any parts of this
  15. * sample project is responsible for ensuring its safe and correct operation
  16. * and for any consequences resulting from its use.
  17. *
  18. ****************************************************************************************/
  19.  
  20. #define FT_DL_SIZE (8*1024) //8KB Display List buffer size
  21. #define FT_CMD_FIFO_SIZE (4*1024) //4KB coprocessor Fifo size
  22. #define FT_CMD_SIZE (4) //4 byte per coprocessor command of EVE
  23.  
  24. // FT811 Chip Commands - use with cmdWrite
  25. #define FT800_ACTIVE 0x00 // Initializes FT800
  26. #define FT800_STANDBY 0x41 // Place FT800 in Standby (clk running)
  27. #define FT800_SLEEP 0x42 // Place FT800 in Sleep (clk off)
  28. #define FT800_PWRDOWN 0x50 // Place FT800 in Power Down (core off)
  29. #define FT800_CLKEXT 0x44 // Select external clock source
  30. #define FT800_CLK48M 0x62 // Select 48MHz PLL
  31. #define FT800_CLK36M 0x61 // Select 36MHz PLL
  32. #define FT800_CORERST 0x68 // Reset core - all registers default
  33.  
  34. // COLOURS defined here (optional)
  35. #define RED 0xFF0000UL // Red
  36. #define GREEN 0x00FF00UL // Green
  37. #define BLUE 0x0000FFUL // Blue
  38. #define WHITE 0xFFFFFFUL // White
  39. #define BLACK 0x000000UL // Black
  40. #define YELLOW 0xffff00UL // Yellow
  41. #define MAGENTA 0x00ffffUL // Magenta
  42. #define SILVER 0xC0C0C0UL // Silver
  43. #define DARK_RED 0x8B0000UL // Dark Red
  44.  
  45. // FT81x Registers
  46. // -- Register Name Address (hex) Reset value
  47. #define REG_ID 0x302000UL // 7Ch
  48. #define REG_FRAMES 0x302004UL // 0
  49. #define REG_CLOCK 0x302008UL // 0
  50. #define REG_FREQUENCY 0x30200CUL // 60000000
  51. #define REG_RENDERMODE 0x302010UL // 0
  52. #define REG_SNAPY 0x302014UL // 0
  53. #define REG_SNAPSHOT 0x302018UL
  54. #define REG_SNAPFORMAT 0x30201CUL // 20h
  55. #define REG_CPURESET 0x302020UL // 2
  56. #define REG_TAP_CRC 0x302024UL
  57. #define REG_TAP_MASK 0x302028UL // FFFFFFFFh
  58. #define REG_HCYCLE 0x30202CUL // 224h
  59. #define REG_HOFFSET 0x302030UL // 02Bh
  60. #define REG_HSIZE 0x302034UL // 1E0h
  61. #define REG_HSYNC0 0x302038UL // 000h
  62. #define REG_HSYNC1 0x30203CUL // 029h
  63. #define REG_VCYCLE 0x302040UL // 124h
  64. #define REG_VOFFSET 0x302044UL // 00Ch
  65. #define REG_VSIZE 0x302048UL // 110h
  66. #define REG_VSYNC0 0x30204CUL // 000h
  67. #define REG_VSYNC1 0x302050UL // 00Ah
  68. #define REG_DLSWAP 0x302054UL // 0
  69. #define REG_ROTATE 0x302058UL // 0
  70. #define REG_OUTBITS 0x30205CUL // 1B6h/000h
  71. #define REG_DITHER 0x302060UL // 1
  72. #define REG_SWIZZLE 0x302064UL // 0
  73. #define REG_CSPREAD 0x302068UL / / 1
  74. #define REG_PCLK_POL 0x30206CUL // 0
  75. #define REG_PCLK 0x302070UL // 0
  76. #define REG_TAG_X 0x302074UL // 0
  77. #define REG_TAG_Y 0x302078UL // 0
  78. #define REG_TAG 0x30207CUL // 0
  79. #define REG_VOL_PB 0x302080UL // FFh
  80. #define REG_VOL_SOUND 0x302084UL // FFh
  81. #define REG_SOUND 0x302088UL // 0
  82. #define REG_PLAY 0x30208CUL // 0h
  83. #define REG_GPIO_DIR 0x302090UL // 80h
  84. #define REG_GPIO 0x302094UL // 00h
  85. #define REG_GPIOX_DIR 0x302098UL // 8000h
  86. #define REG_GPIOX 0x30209CUL // 0080h
  87. #define REG_INT_FLAGS 0x3020A8UL // 00h
  88. #define REG_INT_EN 0x3020AcUL // 0
  89. #define REG_INT_MASK 0x3020B0UL // FFh
  90. #define REG_PLAYBACK_START 0x3020B4UL // 0
  91. #define REG_PLAYBACK_LENGTH 0x3020B8UL // 0
  92. #define REG_PLAYBACK_READPTR 0x3020BCUL
  93. #define REG_PLAYBACK_FREQ 0x3020C0UL // 8000
  94. #define REG_PLAYBACK_FORMAT 0x3020C4UL // 0
  95. #define REG_PLAYBACK_LOOP 0x3020C8UL // 0
  96. #define REG_PLAYBACK_PLAY 0x3020CCUL // 0
  97. #define REG_PWM_HZ 0x3020D0UL // 250
  98. #define REG_PWM_DUTY 0x3020D4UL // 128
  99. #define REG_MACRO_0 0x3020D8UL // 0
  100. #define REG_MACRO_1 0x3020DCUL // 0
  101. #define REG_CMD_READ 0x3020F8UL // 0
  102. #define REG_CMD_WRITE 0x3020FCUL // 0
  103. #define REG_CMD_DL 0x302100UL // 0
  104. #define REG_TOUCH_MODE 0x302104UL // 3
  105. #define REG_TOUCH_ADC_MODE 0x302108UL // 1
  106. #define REG_CTOUCH_EXTENDED 0x302108UL // 1
  107. #define REG_TOUCH_CHARGE 0x30210CUL // 9000
  108. #define REG_TOUCH_SETTLE 0x302110UL // 3
  109. #define REG_TOUCH_OVERSAMPLE 0x302114UL // 7
  110. #define REG_TOUCH_RZTHRESH 0x302118UL // FFFFh
  111. #define REG_TOUCH_RAW_XY 0x30211CUL
  112. #define REG_CTOUCH_TOUCH1_XY 0x30211CUL
  113. #define REG_TOUCH_RZ 0x302120UL
  114. #define REG_CTOUCH_TOUCH4_Y 0x302124UL
  115. #define REG_TOUCH_SCREEN_XY 0x302128UL
  116. #define REG_CTOUCH_TOUCH0_XY 0x302128UL
  117. #define REG_TOUCH_TAG_XY 0x302128UL
  118. #define REG_TOUCH_TAG 0x30212CUL
  119. #define REG_TOUCH_TAG1_XY 0x302130UL
  120. #define REG_TOUCH_TAG1 0x302134UL
  121. #define REG_TOUCH_TAG2_XY 0x302138UL
  122. #define REG_TOUCH_TAG2 0x30213CUL
  123. #define REG_TOUCH_TAG3_XY 0x302140UL
  124. #define REG_TOUCH_TAG3 0x302144UL
  125. #define REG _TOUCH_TAG4_XY 0x302148UL
  126. #define REG_TOUCH_TAG4 0x30214CUL
  127. #define REG_TOUCH_TRANSFORM_A 0x302150UL // 00010000h
  128. #define REG_TOUCH_TRANSFORM_B 0x302154UL // 00000000h
  129. #define REG_TOUCH_TRANSFORM_C 0x302158UL // 00000000h
  130. #define REG_TOUCH_TRANSFORM_D 0x30215CUL // 00000000h
  131. #define REG_TOUCH_TRANSFORM_E 0x302160UL // 00010000h
  132. #define REG_TOUCH_TRANSFORM_F 0x302164UL // 00000000h
  133. #define REG_TOUCH_CONFIG 0x302168UL
  134. #define REG_CTOUCH_TOUCH4_X 0x30216CUL
  135. #define REG_BIST_EN 0x302174UL // 0
  136. #define REG_TRIM 0x302180UL
  137. #define REG_ANA_COMP 0x302184UL
  138. #define REG_SPI_WIDTH 0x302188UL
  139. #define REG_TOUCH_DIRECT_XY 0x30218CUL
  140. #define REG_CTOUCH_TOUCH2_XY 0x30218CUL
  141. #define REG_TOUCH_DIRECT_Z1Z2 0x302190UL
  142. #define REG_CTOUCH_TOUCH3_XY 0x302190UL
  143. #define REG_DATESTAMP 0x302564UL
  144. #define REG_CMDB_SPACE 0x302574UL // FFCh
  145. #define REG_CMDB_WRITE 0x302578UL
  146.  
  147. // FT81x Memory Map Addresses
  148. // -- Register Name Start Addr. End Address Description
  149. #define RAM_G 0x000000UL // 0x0FFFFF 1024 kB Graphics RAM
  150. #define RAM_DL 0x300000UL // 0x301FFF 8 kB Display List RAM
  151. #define RAM_REG 0x302000UL // 0x302FFF 4 kB Registers
  152. #define RAM_CMD 0x308000UL // 0x308FFF 4 kb Command Buffer
  153. #define RAM_PAL 0x102000UL //
  154. #define ROM_FONT 0x1E0000UL // 0x2FFFFB 1152 kB Font table and bitmap
  155. #define ROM_FONT_ADDR 0x2FFFFCUL // 0x2FFFFF 4 B Font table pointer address
  156.  
  157. // Display list commands to be embedded in Graphics Processor
  158. #define DL_ALPHA_FUNC 0x09000000UL // requires OR'd arguments
  159. #define DL_BITMAP_HANDLE 0x05000000UL // requires OR'd arguments
  160. #define DL_BITMAP_LAYOUT 0x07000000UL // requires OR'd arguments
  161. #define DL_BITMAP_SIZE 0x08000000UL // requires OR'd arguments
  162. #define DL_BITMAP_SOURCE 0x01000000UL // requires OR'd arguments
  163. #define DL_BITMAP_TFORM_A 0x15000000UL // requires OR'd arguments
  164. #define DL_BITMAP_TFORM_B 0x16000000UL // requires OR'd arguments
  165. #define DL_BITMAP_TFORM_C 0x17000000UL // requires OR'd arguments
  166. #define DL_BITMAP_TFORM_D 0x18000000UL // requires OR'd arguments
  167. #define DL_BITMAP_TFORM_E 0x19000000UL // requires OR'd arguments
  168. #define DL_BITMAP_TFORM_F 0x1A000000UL // requires OR'd arguments
  169. #define DL_BLEND_FUNC 0x0B000000UL // requires OR'd arguments
  170. #define DL_BEGIN 0x1F000000UL // requires OR'd arguments
  171. #define DL_CALL 0x1D000000UL // requires OR'd arguments
  172. #define DL_CLEAR 0x26000000UL // requires OR'd arguments
  173. #define DL_CELL 0x06000000UL // requires OR'd arguments
  174. #define DL_CLEAR_RGB 0x02000000UL // requires OR'd arguments
  175. #define DL_CLEAR_STENCIL 0x11000000UL // requires OR'd arguments
  176. #define DL_CLEAR_TAG 0x12000000UL // requires OR'd arguments
  177. #define DL_COLOR_A 0x0F000000UL // requires OR'd arguments
  178. #define DL_COLOR_MASK 0x20000000UL // requires OR'd arguments
  179. #define DL_COLOR_RGB 0x04000000UL // requires OR'd arguments
  180. #define DL_DISPLAY 0x00000000UL
  181. #define DL_END 0x21000000UL
  182. #define DL_JUMP 0x1E000000UL // requires OR'd arguments
  183. #define DL_LINE_WIDTH 0x0E000000UL // requires OR'd arguments
  184. #define DL_MACRO 0x25000000UL // requires OR'd arguments
  185. #define DL_POINT_SIZE 0x0D000000UL // requires OR'd arguments
  186. #define DL_RESTORE_CONTEXT 0x23000000UL
  187. #define DL_RETURN 0x24000000UL
  188. #define DL_SAVE_CONTEXT 0x22000000UL
  189. #define DL_SCISSOR_SIZE 0x1C000000UL // requires OR'd arguments
  190. #define DL_SCISSOR_XY 0x1B000000UL // requires OR'd arguments
  191. #define DL_STENCIL_FUNC 0x0A000000UL // requires OR'd arguments
  192. #define DL_STENCIL_MASK 0x13000000UL // requires OR'd arguments
  193. #define DL_STENCIL_OP 0x0C000000UL // requires OR'd arguments
  194. #define DL_TAG 0x03000000UL // requires OR'd arguments
  195. #define DL_TAG_MASK 0x14000000UL // requires OR'd arguments
  196. #define DL_VERTEX2F 0x40000000UL // requires OR'd arguments
  197. #define DL_VERTEX2II 0x02000000UL // requires OR'd arguments
  198.  
  199. // Command and register value options
  200. #define CLR_COL 0x4
  201. #define CLR_STN 0x2
  202. #define CLR_TAG 0x1
  203. #define DECR 4UL
  204. #define DECR_WRAP 7UL
  205. #define DLSWAP_DONE 0UL
  206. #define DLSWAP_FRAME 2UL
  207. #define DLSWAP_LINE 1UL
  208. #define DST_ALPHA 3UL
  209. #define EDGE_STRIP_A 7UL
  210. #define EDGE_STRIP_B 8UL
  211. #define EDGE_STRIP_L 6UL
  212. #define EDGE_STRIP_R 5UL
  213. #define EQUAL 5UL
  214. #define GEQUAL 4UL
  215. #define GREATER 3UL
  216. #define INCR 3UL
  217. #define INCR_WRAP 6UL
  218. #define INT_CMDEMPTY 32UL
  219. #define INT_CMDFLAG 64UL
  220. #define INT_CONVCOMPLETE 128UL
  221. #define INT_PLAYBACK 16UL
  222. #define INT_SOUND 8UL
  223. #define INT_SWAP 1UL
  224. #define INT_TAG 4UL
  225. #define INT_TOUCH 2UL
  226. #define INVERT 5UL
  227. #define KEEP 1UL
  228. #define L1 1UL
  229. #define L4 2UL
  230. #define L8 3UL
  231. #define LEQUAL 2UL
  232. #define LESS 1UL
  233. #define LINEAR_SAMPLES 0UL
  234. #define LINES 3UL
  235. #define LINE_STRIP 4UL
  236. #define NEAREST 0UL
  237. #define NEVER 0UL
  238. #define NOTEQUAL 6UL
  239. #define ONE 1UL
  240. #define ONE_MINUS_DST_ALPHA 5UL
  241. #define ONE_MINUS_SRC_ALPHA 4UL
  242. #define OPT_CENTER 1536UL // 0x6000
  243. #define OPT_CENTERX 512UL // 0x0200
  244. #define OPT_CENTERY 1024UL // 0x0400
  245. #define OPT_FLAT 256UL // 0x0100
  246. #define OPT_MONO 1UL
  247. #define OPT_NOBACK 4096UL // 0x1000
  248. #define OPT_NODL 2UL
  249. #define OPT_NOHANDS 49152UL // 0xC168
  250. #define OPT_NOHM 16384UL // 0x4000
  251. #define OPT_NOPOINTER 16384UL // 0x4000
  252. #define OPT_NOSECS 32768UL // 0x8000
  253. #define OPT_NOTICKS 8192UL // 0x2000
  254. #define OPT_RIGHTX 2048UL // 0x0800
  255. #define OPT_SIGNED 256UL // 0x0100
  256. #define PALETTED 8UL
  257. #define PLAYCOLOR 0x00a0a080
  258. #define FTPOINTS 2UL // "POINTS" is a reserved word
  259. #define RECTS 9UL
  260. #define REPEAT 1UL
  261. #define REPLACE 2UL
  262. #define RGB332 4UL
  263. #define RGB565 7UL
  264. #define SRC_ALPHA 2UL
  265. #define TEXT8X8 9UL
  266. #define TEXTVGA 10UL
  267. #define TOUCHMODE_CONTINUOUS 3UL
  268. #define TOUCHMODE_FRAME 2UL
  269. #define TOUCHMODE_OFF 0UL
  270. #define TOUCHMODE_ONESHOT 1UL
  271. #define ULAW_SAMPLES 1UL
  272. #define ZERO 0UL
  273.  
  274. #define ADC_DIFFERENTIAL 1UL
  275. #define ADC_SINGLE_ENDED 0UL
  276. #define ADPCM_SAMPLES 2UL
  277. #define ALWAYS 7UL
  278. #define ARGB1555 0UL
  279. #define ARGB2 5UL
  280. #define ARGB4 6UL
  281. #define BARGRAPH 11UL
  282. #define BILINEAR 1UL
  283. #define BITMAPS 1UL
  284. #define BORDER 0UL
  285. #define CMDBUF_SIZE 4096UL
  286. #define CMD_APPEND 4294967070UL
  287. #define CMD_BGCOLOR 4294967049UL
  288. #define CMD_BITMAP_TRANSFORM 4294967073UL
  289. #define CMD_BUTTON 4294967053UL
  290. #define CMD_CALIBRATE 4294967061UL
  291. #define CMD_CLOCK 4294967060UL
  292. #define CMD_COLDSTART 4294967090UL
  293. #define CMD_CRC 4294967043UL
  294. #define CMD_CSKETCH 4294967093UL
  295. #define CMD_DIAL 4294967085UL
  296. #define CMD_DLSTART 4294967040UL
  297. #define CMD_EXECUTE 4294967047UL
  298. #define CMD_FGCOLOR 4294967050UL
  299. #define CMD_GAUGE 4294967059UL
  300. #define CMD_GETMATRIX 4294967091UL
  301. #define CMD_GETPOINT 4294967048UL
  302. #define CMD_GETPROPS 4294967077UL
  303. #define CMD_GETPTR 4294967075UL
  304. #define CMD_GRADCOLOR 4294967092UL
  305. #define CMD_GRADIENT 4294967051UL
  306. #define CMD_HAMMERAUX 4294967044UL
  307. #define CMD_IDCT_DELETED 4294967046UL
  308. #define CMD_INFLATE 4294967074UL
  309. #define CMD_INTERRUPT 4294967042UL
  310. #define CMD_INT_RAMSHARED 4294967101UL
  311. #define CMD_INT_SWLOADIMAGE 4294967102UL
  312. #define CMD_KEYS 4294967054UL
  313. #define CMD_LOADIDENTITY 4294967078UL
  314. #define CMD_LOADIMAGE 4294967076UL
  315. #define CMD_LOGO 4294967089UL
  316. #define CMD_MARCH 4294967045UL
  317. #define CMD_MEDIAFIFO 4294967097UL
  318. #define CMD_MEMCPY 4294967069UL
  319. #define CMD_MEMCRC 4294967064UL
  320. #define CMD_MEMSET 4294967067UL
  321. #define CMD_MEMWRITE 4294967066UL
  322. #define CMD_MEMZERO 4294967068UL
  323. #define CMD_NUMBER 4294967086UL
  324. #define CMD_PLAYVIDEO 4294967098UL
  325. #define CMD_PROGRESS 4294967055UL
  326. #define CMD_REGREAD 4294967065UL
  327. #define CMD_ROMFONT 4294967103UL
  328. #define CMD_ROTATE 4294967081UL
  329. #define CMD_SCALE 4294967080UL
  330. #define CMD_SCREENSAVER 4294967087UL
  331. #define CMD_SCROLLBAR 4294967057UL
  332. #define CMD_SETBASE 4294967096UL
  333. #define CMD_SETBITMAP 4294967107UL
  334. #define CMD_SETFONT 4294967083UL
  335. #define CMD_SETFONT2 4294967099UL
  336. #define CMD_SETMATRIX 4294967082UL
  337. #define CMD_SETROTATE 4294967094UL
  338. #define CMD_SETSCRATCH 4294967100UL
  339. #define CMD_SKETCH 4294967088UL
  340. #define CMD_SLIDER 4294967056UL
  341. #define CMD_SNAPSHOT 4294967071UL
  342. #define CMD_SNAPSHOT2 4294967095UL
  343. #define CMD_SPINNER 4294967062UL
  344. #define CMD_STOP 4294967063UL
  345. #define CMD_SWAP 4294967041UL
  346. #define CMD_SYNC 4294967106UL
  347. #define CMD_TEXT 4294967052UL
  348. #define CMD_TOGGLE 4294967058UL
  349. #define CMD_TOUCH_TRANSFORM 4294967072UL
  350. #define CMD_TRACK 4294967084UL
  351. #define CMD_TRANSLATE 4294967079UL
  352. #define CMD_VIDEOFRAME 4294967105UL
  353. #define CMD_VIDEOSTART 4294967104UL
  354. #define DECR 4UL
  355. #define DLSWAP_DONE 0UL
  356. #define DLSWAP_FRAME 2UL
  357. #define DLSWAP_LINE 1UL
  358. #define DST_ALPHA 3UL
  359. #define EDGE_STRIP_A 7UL
  360. #define EDGE_STRIP_B 8UL
  361. #define EDGE_STRIP_L 6UL
  362. #define EDGE_STRIP_R 5UL
  363. #define EQUAL 5UL
  364. #define GEQUAL 4UL
  365. #define GREATER 3UL
  366. #define INCR 3UL
  367. #define INT_CMDEMPTY 32UL
  368. #define INT_CMDFLAG 64UL
  369. #define INT_CONVCOMPLETE 128UL
  370. #define INT_G8 18UL
  371. #define INT_L8C 12UL
  372. #define INT_PLAYBACK 16UL
  373. #define INT_SOUND 8UL
  374. #define INT_SWAP 1UL
  375. #define INT_TAG 4UL
  376. #define INT_TOUCH 2UL
  377. #define INT_VGA 13UL
  378. #define INVERT 5UL
  379. #define KEEP 1UL
  380. #define L1 1UL
  381. #define L2 17UL
  382. #define L4 2UL
  383. #define L8 3UL
  384. #define LEQUAL 2UL
  385. #define LESS 1UL
  386. #define LINEAR_SAMPLES 0UL
  387. #define LINES 3UL
  388. #define LINE_STRIP 4UL
  389. #define NEAREST 0UL
  390. #define NEVER 0UL
  391. #define NOTEQUAL 6UL
  392. #define ONE 1UL
  393. #define ONE_MINUS_DST_ALPHA 5UL
  394. #define ONE_MINUS_SRC_ALPHA 4UL
  395. #define OPT_CENTER 1536UL
  396. #define OPT_CENTERX 512UL
  397. #define OPT_CENTERY 1024UL
  398. #define OPT_FLAT 256UL
  399. #define OPT_FULLSCREEN 8UL
  400. #define OPT_MEDIAFIFO 16UL
  401. #define OPT_MONO 1UL
  402. #define OPT_NOBACK 4096UL
  403. #define OPT_NODL 2UL
  404. #define OPT_NOHANDS 49152UL
  405. #define OPT_NOHM 16384UL
  406. #define OPT_NOPOINTER 16384UL
  407. #define OPT_NOSECS 32768UL
  408. #define OPT_NOTEAR 4UL
  409. #define OPT_NOTICKS 8192UL
  410. #define OPT_RIGHTX 2048UL
  411. #define OPT_SIGNED 256UL
  412. #define OPT_SOUND 32UL
  413. #define PALETTED 8UL
  414. #define PALETTED4444 15UL
  415. #define PALETTED565 14UL
  416. #define PALETTED8 16UL
  417. #define FTPOINTS 2UL
  418. #define RAM_CMD 3178496UL
  419. #define RAM_DL 3145728UL
  420. #define RAM_G 0UL
  421. #define RAM_REG 3153920UL
  422. #define RAM_ROMSUB 3186688UL
  423. #define RECTS 9UL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement