My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

display_list.h 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /******************
  2. * display_list.h *
  3. *****************/
  4. /**********************************************************************************
  5. * Adapted from: *
  6. * https://github.com/RudolphRiedel/FT800-FT813 *
  7. * By Rudolph Riedel *
  8. * *
  9. * MIT License *
  10. * *
  11. * Copyright (c) 2017 *
  12. * *
  13. * Permission is hereby granted, free of charge, to any person obtaining a copy *
  14. * of this software and associated documentation files (the "Software"), to deal *
  15. * in the Software without restriction, including without limitation the rights *
  16. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell *
  17. * copies of the Software, and to permit persons to whom the Software is *
  18. * furnished to do so, subject to the following conditions: *
  19. * *
  20. * The above copyright notice and this permission notice shall be included in all *
  21. * copies or substantial portions of the Software. *
  22. * *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  24. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  25. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
  26. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
  27. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *
  28. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *
  29. * SOFTWARE. *
  30. * *
  31. **********************************************************************************/
  32. #pragma once
  33. namespace FTDI {
  34. /* FT8xx graphics engine specific macros useful for static display list generation */
  35. inline uint32_t ALPHA_FUNC(uint8_t func, uint8_t ref) {return DL::ALPHA_FUNC|((func&7UL)<<8)|(ref&255UL);}
  36. inline uint32_t BEGIN(begin_t prim) {return DL::BEGIN|(prim&15UL);}
  37. inline uint32_t BITMAP_SOURCE(uint32_t ram_g_addr) {return DL::BITMAP_SOURCE|(ram_g_addr);}
  38. inline uint32_t BITMAP_HANDLE(uint8_t handle) {return DL::BITMAP_HANDLE|(handle&31UL);}
  39. inline uint32_t BITMAP_LAYOUT(uint8_t format, uint16_t linestride, uint16_t height)
  40. {return DL::BITMAP_LAYOUT|((format&31UL)<<19)|((linestride&1023UL)<<9)|(height&511UL);}
  41. inline uint32_t BITMAP_SIZE(uint8_t filter, uint8_t wrapx, uint8_t wrapy, uint16_t width, uint16_t height)
  42. {return DL::BITMAP_SIZE|((filter&1UL)<<20)|((wrapx&1UL)<<19)|((wrapy&1UL)<<18)|((width&511UL)<<9)|(height&511UL);}
  43. #if FTDI_API_LEVEL >= 810
  44. inline uint32_t BITMAP_LAYOUT_H(uint8_t linestride, uint8_t height)
  45. {return DL::BITMAP_LAYOUT_H|((linestride&3UL)<<2)|(height&3UL);}
  46. inline uint32_t BITMAP_SIZE_H(uint8_t width, uint8_t height)
  47. {return DL::BITMAP_SIZE_H|((width&3UL)<<2)|(height&3UL);}
  48. #endif
  49. inline uint32_t BITMAP_TRANSFORM_A(uint16_t a) {return DL::BITMAP_TRANSFORM_A|(a&131071UL);}
  50. inline uint32_t BITMAP_TRANSFORM_B(uint16_t b) {return DL::BITMAP_TRANSFORM_B|(b&131071UL);}
  51. inline uint32_t BITMAP_TRANSFORM_C(uint32_t c) {return DL::BITMAP_TRANSFORM_C|(c&16777215UL);}
  52. inline uint32_t BITMAP_TRANSFORM_D(uint16_t d) {return DL::BITMAP_TRANSFORM_D|(d&131071UL);}
  53. inline uint32_t BITMAP_TRANSFORM_E(uint16_t e) {return DL::BITMAP_TRANSFORM_E|(e&131071UL);}
  54. inline uint32_t BITMAP_TRANSFORM_F(uint32_t f) {return DL::BITMAP_TRANSFORM_F|(f&16777215UL);}
  55. inline uint32_t BLEND_FUNC(uint8_t src,uint8_t dst) {return DL::BLEND_FUNC|((src&7UL)<<3)|(dst&7UL);}
  56. inline uint32_t CALL(uint16_t dest) {return DL::CALL|(dest&65535UL);}
  57. inline uint32_t CELL(uint8_t cell) {return DL::CELL|(cell&127UL);}
  58. inline uint32_t CLEAR(bool c,bool s,bool t) {return DL::CLEAR|((c?1UL:0UL)<<2)|((s?1UL:0UL)<<1)|(t?1UL:0UL);}
  59. inline uint32_t CLEAR_COLOR_A(uint8_t alpha) {return DL::CLEAR_COLOR_A|(alpha&255UL);}
  60. inline uint32_t CLEAR_COLOR_RGB(uint8_t red, uint8_t green, uint8_t blue)
  61. {return DL::CLEAR_COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
  62. inline uint32_t CLEAR_COLOR_RGB(uint32_t rgb) {return DL::CLEAR_COLOR_RGB|rgb;}
  63. inline uint32_t CLEAR_STENCIL(uint8_t s) {return DL::CLEAR_STENCIL|(s&255UL);}
  64. inline uint32_t CLEAR_TAG(uint8_t s) {return DL::CLEAR_TAG|(s&255UL);}
  65. inline uint32_t COLOR_A(uint8_t alpha) {return DL::COLOR_A|(alpha&255UL);}
  66. inline uint32_t COLOR_MASK(bool r, bool g, bool b, bool a) {return DL::COLOR_MASK|((r?1UL:0UL)<<3)|((g?1UL:0UL)<<2)|((b?1UL:0UL)<<1)|(a?1UL:0UL);}
  67. inline uint32_t COLOR_RGB(uint8_t red,uint8_t green,uint8_t blue)
  68. {return DL::COLOR_RGB|((red&255UL)<<16)|((green&255UL)<<8)|(blue&255UL);}
  69. inline uint32_t COLOR_RGB(uint32_t rgb) {return DL::COLOR_RGB|rgb;}
  70. /* inline uint32_t DISPLAY() {return (0UL<<24)) */
  71. inline uint32_t END() {return DL::END;}
  72. inline uint32_t JUMP(uint16_t dest) {return DL::JUMP|(dest&65535UL);}
  73. inline uint32_t LINE_WIDTH(uint16_t width) {return DL::LINE_WIDTH|(width&4095UL);}
  74. inline uint32_t MACRO(uint8_t m) {return DL::MACRO|(m&1UL);}
  75. inline uint32_t POINT_SIZE(uint16_t size) {return DL::POINT_SIZE|(size&8191UL);}
  76. inline uint32_t RESTORE_CONTEXT() {return DL::RESTORE_CONTEXT;}
  77. inline uint32_t RETURN () {return DL::RETURN;}
  78. inline uint32_t SAVE_CONTEXT() {return DL::SAVE_CONTEXT;}
  79. inline uint32_t SCISSOR_XY(uint16_t x,uint16_t y) {
  80. return DL::SCISSOR_XY |
  81. (FTDI::ftdi_chip >= 810
  82. ? ((x&2047UL)<<11)|(y&2047UL)
  83. : ((x& 511UL)<<10)|(y&511UL));
  84. }
  85. inline uint32_t SCISSOR_SIZE(uint16_t w,uint16_t h) {
  86. return DL::SCISSOR_SIZE |
  87. (FTDI::ftdi_chip >= 810
  88. ? ((w&4095UL)<<12)|(h&4095UL)
  89. : ((w&1023UL)<<10)|(h&1023UL));
  90. }
  91. inline uint32_t SCISSOR_XY() {return DL::SCISSOR_XY;}
  92. inline uint32_t SCISSOR_SIZE() {
  93. return DL::SCISSOR_SIZE |
  94. (FTDI::ftdi_chip >= 810
  95. ? (2048UL<<12)|(2048UL)
  96. : ( 512UL<<10)|( 512UL));
  97. }
  98. inline uint32_t STENCIL_FUNC(uint16_t func, uint8_t ref, uint8_t mask)
  99. {return DL::STENCIL_FUNC|((func&7UL)<<16)|((ref&255UL)<<8)|(mask&255UL);}
  100. inline uint32_t STENCIL_MASK(uint8_t mask) {return DL::STENCIL_MASK|(mask&255UL);}
  101. inline uint32_t STENCIL_OP(uint8_t sfail, uint8_t spass) {return DL::STENCIL_OP|(((sfail)&7UL)<<3)|(spass&7UL);}
  102. inline uint32_t TAG(uint8_t s) {return DL::TAG|(s&255UL);}
  103. inline uint32_t TAG_MASK(bool mask) {return DL::TAG_MASK|(mask?1:0);}
  104. inline uint32_t VERTEX2F(uint16_t x, uint16_t y) {return DL::VERTEX2F|((x&32767UL)<<15)|(y&32767UL);}
  105. inline uint32_t VERTEX2II(uint16_t x,uint16_t y, uint8_t handle = 0, uint8_t cell = 0)
  106. {return DL::VERTEX2II|((x&511UL)<<21)|((y&511UL)<<12)|((handle&31UL)<<7)|(cell&127UL);}
  107. #if FTDI_API_LEVEL >= 810
  108. inline uint32_t VERTEX_FORMAT(uint8_t frac) {return DL::VERTEX_FORMAT|(frac&7UL);}
  109. inline uint32_t VERTEX_TRANSLATE_X(int32_t x) {return DL::VERTEX_TRANSLATE_X|(x&131071UL);}
  110. inline uint32_t VERTEX_TRANSLATE_Y(int32_t y) {return DL::VERTEX_TRANSLATE_Y|(y&131071UL);}
  111. #endif
  112. }