Guest User

457_x1000_LCD_8Bit_Data_Tables.diff

a guest
Sep 1st, 2024
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.28 KB | Source Code | 0 0
  1. x1000_LCD_8Bit_Data_Tables  'revisited' for cd91c238de + g5877
  2.  
  3. These is not intened to make the variables smaller.
  4. This is intended that the LCD Init Tables entrys are stored as 8Bit entitys vs. 32Bit
  5.  
  6. Without this Patch - g5877 lcd-erosqnative.c Dual Model Tables Size:
  7. (erosqnative_lcd_cmd_enable_v3[] + erosqnative_lcd_cmd_enable_v1[])
  8. ~1152 Byte allocated as unsigned 32Bit entrys (only 8Bit have meaning)
  9.  
  10. With this Patch - g5877 lcd-erosqnative.c Dual Model Tables Size
  11. ~288 Byte allocated as unsigned 8 Bit entrys.
  12.  
  13. (mipsel-elf-objdump -D disassemble and comparison of the File)
  14.  
  15. Mips/GCC uses then 'lbu' (Load Byte unsigned 'zero-extended' Mips32 command)
  16. to access the Entrys
  17.  
  18. Saves ~1K in Bootloader and RB Binary (for Tables that are only used 2x in a Power cycle)
  19.  
  20. Credit ZappBranigan2972 on forums / F. Jacobsen on the Theme Site
  21.  
  22. ---
  23.  
  24. --- a/firmware/target/mips/ingenic_x1000/lcd-x1000.h.orig   2024-06-18 11:38:08.040816436 +0200
  25. +++ b/firmware/target/mips/ingenic_x1000/lcd-x1000.h    2024-06-18 11:38:35.124191578 +0200
  26. @@ -33,7 +33,7 @@
  27.  
  28.  #define LCD_INSTR_CMD       0
  29.  #define LCD_INSTR_DAT       1
  30. -#define LCD_INSTR_UDELAY    2
  31. +#define LCD_INSTR_MDELAY    2
  32.  #define LCD_INSTR_END       3
  33.  
  34.  struct lcd_tgt_config {
  35. @@ -93,7 +93,7 @@
  36.   * - LCD_INSTR_DAT, dat: issue data write of 'dat'
  37.   * - LCD_INSTR_UDELAY, us: call udelay(us)
  38.   */
  39. -extern void lcd_exec_commands(const uint32_t* cmdseq);
  40. +extern void lcd_exec_commands(const uint8_t* cmdseq);
  41.  
  42.  /* Enable/disable the LCD controller.
  43.   *
  44. --- a/firmware/target/mips/ingenic_x1000/lcd-x1000.c.orig   2024-06-18 11:38:19.486546953 +0200
  45. +++ b/firmware/target/mips/ingenic_x1000/lcd-x1000.c    2024-06-18 12:05:12.082071560 +0200
  46. @@ -374,10 +374,10 @@
  47.  #endif
  48.  }
  49.  
  50. -void lcd_exec_commands(const uint32_t* cmdseq)
  51. +void lcd_exec_commands(const uint8_t* cmdseq)
  52.  {
  53.      while(*cmdseq != LCD_INSTR_END) {
  54. -        uint32_t instr = *cmdseq++;
  55. +        uint8_t instr = *cmdseq++;
  56.          uint32_t d = 0;
  57.          switch(instr) {
  58.          case LCD_INSTR_CMD:
  59. @@ -389,8 +389,8 @@
  60.              lcd_send(d);
  61.              break;
  62.  
  63. -        case LCD_INSTR_UDELAY:
  64. -            udelay(*cmdseq++);
  65. +        case LCD_INSTR_MDELAY:
  66. +            udelay((*cmdseq++)*1000);
  67.              break;
  68.  
  69.          default:
  70.  
  71. --- a/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c.orig 2024-06-18 12:26:58.623490679 +0200
  72. +++ b/firmware/target/mips/ingenic_x1000/erosqnative/lcd-erosqnative.c  2024-06-18 12:31:15.322573051 +0200
  73. @@ -39,7 +39,7 @@
  74.   * Init sequence From 'EROS Q (c口)_V2.1_20231209固件.zip'                  *
  75.   * update.upt/.iso -> In 'uboot.bin' at 0x52da0-0x5305f                       *
  76.   *  http://www.eroshifi.com/download/firmware/122.html                        */
  77. -static const uint32_t erosqnative_lcd_cmd_enable_v3[] = {
  78. +static const uint8_t erosqnative_lcd_cmd_enable_v3[] = {
  79.  
  80.      /* Unlock EXTC? */
  81.      LCD_INSTR_CMD,      0xfe, // Inter Register Enable1
  82. @@ -148,15 +148,15 @@
  83.  
  84.      /* Exit Sleep */
  85.      LCD_INSTR_CMD,      0x11,
  86. -    LCD_INSTR_UDELAY,   120000,
  87. +    LCD_INSTR_MDELAY,   120, // uint8_t max. 255 (ms)
  88.      /* Display On */
  89.      LCD_INSTR_CMD,      0x29,
  90. -    LCD_INSTR_UDELAY,   20000,
  91. +    LCD_INSTR_MDELAY,   20,
  92.      LCD_INSTR_END,
  93.  };
  94.  
  95.  /* Original Display / Hifiwalker -1.5 / Surfans -2.7 */
  96. -static const uint32_t erosqnative_lcd_cmd_enable_v1[] = {
  97. +static const uint8_t erosqnative_lcd_cmd_enable_v1[] = {
  98.      /* Set EXTC? */
  99.      LCD_INSTR_CMD,      0xc8,
  100.      LCD_INSTR_DAT,      0xff,
  101. @@ -222,40 +222,40 @@
  102.      LCD_INSTR_DAT,      0x0f,
  103.      /* Exit Sleep */
  104.      LCD_INSTR_CMD,      0x11,
  105. -    LCD_INSTR_UDELAY,   120000,
  106. +    LCD_INSTR_MDELAY,   120,
  107.      /* Display On */
  108.      LCD_INSTR_CMD,      0x29,
  109. -    LCD_INSTR_UDELAY,   20000,
  110. +    LCD_INSTR_MDELAY,   20,
  111.      LCD_INSTR_END,
  112.  };
  113.  
  114. -static const uint32_t erosqnative_lcd_of_compat_cmd[] = {
  115. +static const uint8_t erosqnative_lcd_of_compat_cmd[] = {
  116.      /* Pixel Format Set */
  117.      LCD_INSTR_CMD,      0x3a,
  118.      LCD_INSTR_DAT,      0x66, /* 18 bpp */
  119.      /* Exit Sleep */
  120.      LCD_INSTR_CMD,      0x11,
  121. -    LCD_INSTR_UDELAY,   120000,
  122. +    LCD_INSTR_MDELAY,   120,
  123.      /* Display On */
  124.      LCD_INSTR_CMD,      0x29,
  125. -    LCD_INSTR_UDELAY,   20000,
  126. +    LCD_INSTR_MDELAY,   20,
  127.      LCD_INSTR_END,
  128.  };
  129.  
  130.  /* sleep and wake copied directly from m3k */
  131. -static const uint32_t erosqnative_lcd_cmd_sleep[] = {
  132. +static const uint8_t erosqnative_lcd_cmd_sleep[] = {
  133.      /* Display OFF */
  134.      LCD_INSTR_CMD,      0x28,
  135.      /* Sleep IN */
  136.      LCD_INSTR_CMD,      0x10,
  137. -    LCD_INSTR_UDELAY,   5000,
  138. +    LCD_INSTR_MDELAY,   5,
  139.      LCD_INSTR_END,
  140.  };
  141.  
  142. -static const uint32_t erosqnative_lcd_cmd_wake[] = {
  143. +static const uint8_t erosqnative_lcd_cmd_wake[] = {
  144.      /* Sleep OUT */
  145.      LCD_INSTR_CMD,      0x11,
  146. -    LCD_INSTR_UDELAY,   5000,
  147. +    LCD_INSTR_MDELAY,   5,
  148.      /* Display ON */
  149.      LCD_INSTR_CMD,      0x29,
  150.      LCD_INSTR_END,
  151. --- a/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c.orig 2024-06-25 08:04:30.966090598 +0200
  152. +++ b/firmware/target/mips/ingenic_x1000/fiiom3k/lcd-fiiom3k.c  2024-06-25 08:07:03.633814997 +0200
  153. @@ -25,13 +25,13 @@
  154.  #include "gpio-x1000.h"
  155.  #include "system.h"
  156.  
  157. -static const uint32_t fiio_lcd_cmd_enable[] = {
  158. +static const uint8_t fiio_lcd_cmd_enable[] = {
  159.      /* Software reset */
  160.      LCD_INSTR_CMD,      0x01,
  161. -    LCD_INSTR_UDELAY,   120000,
  162. +    LCD_INSTR_MDELAY,   120,
  163.      /* Sleep out */
  164.      LCD_INSTR_CMD,      0x11,
  165. -    LCD_INSTR_UDELAY,   5000,
  166. +    LCD_INSTR_MDELAY,   5,
  167.      /* Memory access order */
  168.      LCD_INSTR_CMD,      0x36,
  169.      LCD_INSTR_DAT,      0x00,
  170. @@ -127,19 +127,19 @@
  171.      LCD_INSTR_END,
  172.  };
  173.  
  174. -static const uint32_t fiio_lcd_cmd_sleep[] = {
  175. +static const uint8_t fiio_lcd_cmd_sleep[] = {
  176.      /* Display OFF */
  177.      LCD_INSTR_CMD,      0x28,
  178.      /* Sleep IN */
  179.      LCD_INSTR_CMD,      0x10,
  180. -    LCD_INSTR_UDELAY,   5000,
  181. +    LCD_INSTR_MDELAY,   5,
  182.      LCD_INSTR_END,
  183.  };
  184.  
  185. -static const uint32_t fiio_lcd_cmd_wake[] = {
  186. +static const uint8_t fiio_lcd_cmd_wake[] = {
  187.      /* Sleep OUT */
  188.      LCD_INSTR_CMD,      0x11,
  189. -    LCD_INSTR_UDELAY,   5000,
  190. +    LCD_INSTR_MDELAY,   5,
  191.      /* Display ON */
  192.      LCD_INSTR_CMD,      0x29,
  193.      LCD_INSTR_END,
  194.  
  195. --- a/firmware/target/mips/ingenic_x1000//shanlingq1/lcd-shanlingq1.c.orig  2024-06-25 08:25:23.439453701 +0200
  196. +++ b/firmware/target/mips/ingenic_x1000//shanlingq1/lcd-shanlingq1.c   2024-06-25 08:26:30.902062549 +0200
  197. @@ -27,7 +27,7 @@
  198.  /* LCD controller is probably an RM68090.
  199.   */
  200.  
  201. -static const uint32_t q1_lcd_cmd_enable[] = {
  202. +static const uint8_t q1_lcd_cmd_enable[] = {
  203.      LCD_INSTR_CMD, 0x00,
  204.      LCD_INSTR_CMD, 0xbe,
  205.      LCD_INSTR_DAT, 0xc3,
  206. @@ -321,7 +321,7 @@
  207.  
  208.  /* NOTE this sleep mode may not be saving power, but it gets rid of the
  209.   * ghost image that would otherwise remain on the display */
  210. -static const uint32_t q1_lcd_cmd_sleep[] = {
  211. +static const uint8_t q1_lcd_cmd_sleep[] = {
  212.      LCD_INSTR_CMD, 0x00,
  213.      LCD_INSTR_CMD, 0x10,
  214.      LCD_INSTR_DAT, 0x00,
  215. @@ -335,7 +335,7 @@
  216.      LCD_INSTR_END,
  217.  };
  218.  
  219. -static const uint32_t q1_lcd_cmd_wake[] = {
  220. +static const uint8_t q1_lcd_cmd_wake[] = {
  221.      LCD_INSTR_CMD, 0x00,
  222.      LCD_INSTR_CMD, 0x07,
  223.      LCD_INSTR_DAT, 0x01,
  224.  
Advertisement
Add Comment
Please, Sign In to add comment