Advertisement
z3ntu

test.c

Oct 26th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.49 KB | None | 0 0
  1. // Documentation on what this is:
  2. // Copied relevant bits from the lk/bootloader from the FP2 to get "knowledge" about C and how to print the cmd hex values.
  3. // Now the code is integrated in my testing lk, but it's here for reference.
  4.  
  5. #include <stdio.h>
  6.  
  7. struct mipi_dsi_cmd {
  8.     int size;
  9.     char *payload;
  10.     int wait;
  11. };
  12.  
  13. /*---------------------------------------------------------------------------*/
  14. /* Panel Command information                                                 */
  15. /*---------------------------------------------------------------------------*/
  16. static char otm1902b_1080p_cmd_on_cmd0[] = {
  17. 0x02, 0x00, 0x29, 0xC0,
  18. 0x00, 0x00, 0xFF, 0xFF,  };
  19.  
  20.  
  21. static char otm1902b_1080p_cmd_on_cmd1[] = {
  22. 0x05, 0x00, 0x29, 0xC0,
  23. 0xFF, 0x19, 0x02, 0x01,
  24. 0X00, 0xFF, 0xFF, 0xFF,  };
  25.  
  26.  
  27. static char otm1902b_1080p_cmd_on_cmd2[] = {
  28. 0x02, 0x00, 0x29, 0xC0,
  29. 0x00, 0x80, 0xFF, 0xFF,  };
  30.  
  31.  
  32. static char otm1902b_1080p_cmd_on_cmd3[] = {
  33. 0x03, 0x00, 0x29, 0xC0,
  34. 0xFF, 0x19, 0x02, 0xFF,  };
  35.  
  36.  
  37. static char otm1902b_1080p_cmd_on_cmd4[] = {
  38. 0x02, 0x00, 0x29, 0xC0,
  39. 0x00, 0xB0, 0xFF, 0xFF,  };
  40.  
  41.  
  42. static char otm1902b_1080p_cmd_on_cmd5[] = {
  43. 0x05, 0x00, 0x29, 0xC0,
  44. 0xCA, 0xFF, 0x02, 0x5F,
  45. 0x40, 0xFF, 0xFF, 0xFF,  };
  46.  
  47.  
  48. static char otm1902b_1080p_cmd_on_cmd6[] = {
  49. 0x02, 0x00, 0x29, 0xC0,
  50. 0x53, 0x2C, 0xFF, 0xFF,  };
  51.  
  52.  
  53. static char otm1902b_1080p_cmd_on_cmd7[] = {
  54. 0x02, 0x00, 0x29, 0xC0,
  55. 0x51, 0xFF, 0xFF, 0xFF,  };
  56.  
  57. static char otm1902b_1080p_cmd_on_cmd8[] = {
  58. 0x11, 0x00, 0x05, 0x80,  };
  59.  
  60. static char otm1902b_1080p_cmd_on_cmd9[] = {
  61. 0x29, 0x00, 0x05, 0x80,   };
  62.  
  63. static struct mipi_dsi_cmd otm1902b_1080p_cmd_on_command[] = {
  64. { 0x8 , otm1902b_1080p_cmd_on_cmd0 ,0x010},
  65. { 0xc , otm1902b_1080p_cmd_on_cmd1 ,0x010},
  66. { 0x8 , otm1902b_1080p_cmd_on_cmd2 ,0x010},
  67. { 0x8 , otm1902b_1080p_cmd_on_cmd3 ,0x010},
  68. { 0x8 , otm1902b_1080p_cmd_on_cmd4 ,0x010},
  69. { 0xc , otm1902b_1080p_cmd_on_cmd5 ,0x010},
  70. { 0x8 , otm1902b_1080p_cmd_on_cmd6 ,0x010},
  71. { 0x4 , otm1902b_1080p_cmd_on_cmd8 , 0x32},
  72. { 0x4 , otm1902b_1080p_cmd_on_cmd9 , 0x60},
  73. };
  74.  
  75. int main() {
  76.     printf("hello\n");
  77.     struct mipi_dsi_cmd *cmds = otm1902b_1080p_cmd_on_command;
  78.     int count = 9;
  79.     int i = 0;
  80.  
  81.  
  82.     struct mipi_dsi_cmd *cm;
  83.  
  84.     cm = cmds;
  85.  
  86.     for (i = 0; i < count; i++) {
  87.         printf("One cmd with hex values of:\n");
  88.  
  89.         for(int j = 0; j < cm->size; j++) {
  90.             printf("%02x ", (unsigned int)(unsigned char)cm->payload[j]);
  91.         }
  92.        
  93.         printf("\n");
  94.         cm++;
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement