Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 3rd, 2012  |  syntax: None  |  size: 4.72 KB  |  views: 37  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
  2. index d98ed5a..2b41030 100644
  3. --- a/firmware/target/arm/rk27xx/lcd-hifiman.c
  4. +++ b/firmware/target/arm/rk27xx/lcd-hifiman.c
  5. @@ -112,6 +112,7 @@ void lcd_init_device(void)
  6.  {
  7.      lcdif_init(LCDIF_16BIT);
  8.      lcd_display_init();
  9. +    memset(&LCD_BUFF, 0x00, 2048*4);
  10.  }
  11.  
  12.  void lcd_enable (bool on)
  13. @@ -153,22 +154,72 @@ bool lcd_active()
  14.      return display_on;
  15.  }
  16.  
  17. -
  18. +int k = 0;
  19.  void lcd_update_rect(int x, int y, int width, int height)
  20.  {
  21. -    int px = x, py = y;
  22. +    int px = x, py = y,offs=0;
  23.      int pxmax = x + width, pymax = y + height;
  24. -
  25. -    lcd_write_reg(0x03, y);
  26. -    lcd_write_reg(0x05, pymax-1);
  27. -    lcd_write_reg(0x07, x);
  28. -    lcd_write_reg(0x09, pxmax-1);
  29. +    lcdctrl_bypass(1);
  30. +    lcd_write_reg(0x02, 0x00);
  31. +    lcd_write_reg(0x03, 0x00);
  32. +    lcd_write_reg(0x04, 0x00);
  33. +    lcd_write_reg(0x05, LCD_HEIGHT - 1);
  34. +    lcd_write_reg(0x06, 0x00);
  35. +    lcd_write_reg(0x07, 0x00);
  36. +    lcd_write_reg(0x08, 0x00);
  37. +    lcd_write_reg(0x09, LCD_WIDTH - 1);
  38.  
  39.      lcd_cmd(0x22);
  40.  
  41. -    for (px=x; px<pxmax; px++)
  42. +    lcdctrl_bypass(0);
  43. +    while (!(LCDC_STA & LCDC_MCU_IDLE));
  44. +    for (px = 0; px < LCD_WIDTH; px++) {
  45. +        for (py=0; py < LCD_HEIGHT; py++) {
  46. +            *(&LCD_BUFF + offs) = lcd_data_transform(*FBADDR(px, py));
  47. +            offs = (offs+1)%(1022);
  48. +            if (offs == 0) {
  49. +                MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  50. +                while (!(LCDC_STA & LCDC_MCU_IDLE));
  51. +            }
  52. +        }
  53. +    }
  54. +    if (offs != 0) {
  55. +        for (px = 0; px < LCD_WIDTH; px++) {
  56. +            for (py=0; py < LCD_HEIGHT; py++) {
  57. +                *(&LCD_BUFF + offs) = lcd_data_transform(*FBADDR(px, py));
  58. +                offs = (offs+1)%(1022);
  59. +                if (offs == 0) {
  60. +                    MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  61. +                    return;
  62. +                }
  63. +            }
  64. +        }
  65. +    }
  66. +    /*   px = 0;
  67. +        py = 0;
  68. +        while (offs != 1022) {
  69. +            *(&LCD_BUFF + offs) = lcd_data_transform(*(FBADDR(px, py)));
  70. +            offs++;
  71. +            py++;
  72. +            if (py == LCD_HEIGHT) {
  73. +                py = 0;
  74. +                px++;
  75. +            }
  76. +        }
  77. +        MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  78. +        }*/
  79. +    //MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  80. +    
  81. +            /*    for (px = 0; px < 2048; px++) {
  82. +        *(&LCD_BUFF + px) = 0xFF;
  83. +    }
  84. +    MCU_CTRL=(1<<1)|(1<<2)|(1<<5);*/
  85. +
  86. +    /*   for (px=x; px<pxmax; px++)
  87.         for (py=y; py<pymax; py++)
  88. -            lcd_data(*FBADDR(px, py));
  89. +    lcd_data(*FBADDR(px, py));*/
  90.  }
  91.  
  92.  /* Blit a YUV bitmap directly to the LCD */
  93. diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  94. index affc49b..6887200 100644
  95. --- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  96. +++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  97. @@ -65,7 +65,7 @@ void lcd_write_reg(unsigned int reg, unsigned int val)
  98.      lcd_data(val);
  99.  }
  100.  
  101. -static void lcdctrl_bypass(unsigned int on_off)
  102. +void lcdctrl_bypass(unsigned int on_off)
  103.  {
  104.      while (!(LCDC_STA & LCDC_MCU_IDLE));
  105.  
  106. @@ -89,19 +89,32 @@ static void lcdctrl_init(void)
  107.      LCDC_CTRL = ALPHA(7) | LCDC_STOP | LCDC_MCU | RGB24B;
  108.      MCU_CTRL = ALPHA_BASE(0x3f) | MCU_CTRL_BYPASS;
  109.  
  110. -    HOR_ACT = LCD_WIDTH + 3;    /* define horizonatal active region */
  111. -    VERT_ACT = LCD_HEIGHT;       /* define vertical active region */
  112. +    HOR_BP = 1;
  113. +    VERT_BP = 1;
  114. +    HOR_ACT = LCD_HEIGHT+3;    /* define horizonatal active region */
  115. +    VERT_ACT = LCD_WIDTH;       /* define vertical active region */
  116.      VERT_PERIOD = 0xfff;  /* CSn/WEn/RDn signal timings */
  117.  
  118. -    LINE0_YADDR = LINE_ALPHA_EN | 0x7fe;
  119. -    LINE1_YADDR = LINE_ALPHA_EN | ((1 * LCD_WIDTH) - 2);
  120. -    LINE2_YADDR = LINE_ALPHA_EN | ((2 * LCD_WIDTH) - 2);
  121. -    LINE3_YADDR = LINE_ALPHA_EN | ((3 * LCD_WIDTH) - 2);
  122. +    /*    LINE0_YADDR = 0;
  123. +    LINE1_YADDR = (1 * LCD_HEIGHT);
  124. +    LINE2_YADDR = (2 * LCD_HEIGHT);
  125. +    LINE3_YADDR = (3 * LCD_HEIGHT);
  126. +
  127. +    LINE0_UVADDR = 1;
  128. +    LINE1_UVADDR = (1 * LCD_HEIGHT) + 1;
  129. +    LINE2_UVADDR = (2 * LCD_HEIGHT) + 1;
  130. +    LINE3_UVADDR = (3 * LCD_HEIGHT) + 1;
  131. +
  132. +    /**/
  133. +    LINE0_YADDR = 0x7fe;
  134. +    LINE1_YADDR = ((1 * LCD_HEIGHT) -2);
  135. +    LINE2_YADDR = ((2 * LCD_HEIGHT) -2);
  136. +    LINE3_YADDR = ((3 * LCD_HEIGHT) -2);
  137.  
  138.      LINE0_UVADDR = 0x7fe + 1;
  139. -    LINE1_UVADDR = ((1 * LCD_WIDTH) - 2 + 1);
  140. -    LINE2_UVADDR = ((2 * LCD_WIDTH) - 2 + 1);
  141. -    LINE3_UVADDR = ((3 * LCD_WIDTH) - 2 + 1);
  142. +    LINE1_UVADDR = ((1 * LCD_HEIGHT) -2+ 1);
  143. +    LINE2_UVADDR = ((2 * LCD_HEIGHT) -2+ 1);
  144. +    LINE3_UVADDR = ((3 * LCD_HEIGHT) -2+ 1);
  145.  
  146.  #if 0
  147.      LINE0_YADDR = 0;