Advertisement
Guest User

Untitled

a guest
Apr 4th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.55 KB | None | 0 0
  1. diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
  2. index d98ed5a..0eeec82 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,78 @@ bool lcd_active()
  14.      return display_on;
  15.  }
  16.  
  17.  
  18.  void lcd_update_rect(int x, int y, int width, int height)
  19.  {
  20. -    int px = x, py = y;
  21. +    int px = x, py = y,offs=0;
  22.      int pxmax = x + width, pymax = y + height;
  23. -
  24. -    lcd_write_reg(0x03, y);
  25. -    lcd_write_reg(0x05, pymax-1);
  26. -    lcd_write_reg(0x07, x);
  27. -    lcd_write_reg(0x09, pxmax-1);
  28. +    lcdctrl_bypass(1);
  29. +    lcd_write_reg(0x02, 0x00);
  30. +    lcd_write_reg(0x03, 0x00);
  31. +    lcd_write_reg(0x04, 0x00);
  32. +    lcd_write_reg(0x05, LCD_HEIGHT - 1);
  33. +    lcd_write_reg(0x06, 0x00);
  34. +    lcd_write_reg(0x07, 0x00);
  35. +    lcd_write_reg(0x08, 0x00);
  36. +    lcd_write_reg(0x09, LCD_WIDTH - 1);
  37.  
  38.      lcd_cmd(0x22);
  39.  
  40. -    for (px=x; px<pxmax; px++)
  41. +    lcdctrl_bypass(0);
  42. +    while (!(LCDC_STA & LCDC_MCU_IDLE));
  43. +    for (px = 0; px < LCD_WIDTH; px++) {
  44. +        for (py=0; py < LCD_HEIGHT; py+=2) {
  45. +            *(&LCD_BUFF + offs) = (unsigned long)*FBADDR(px, py)|(((unsigned long)*FBADDR(px, py+1))<<16);
  46. +            offs = (offs+1)%(1022/2);
  47. +            if (offs == 0) {
  48. +                MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  49. +                while (!(LCDC_STA & LCDC_MCU_IDLE));
  50. +            }
  51. +        }
  52. +    }
  53. +    if (offs != 0) {
  54. +        for (px = 0; px < LCD_WIDTH; px++) {
  55. +            for (py=0; py < LCD_HEIGHT; py+=2) {
  56. +                *(&LCD_BUFF + offs) = (unsigned long)*FBADDR(px, py)|(((unsigned long)*FBADDR(px, py+1))<<16);
  57. +                offs = (offs+1)%(1022/2);
  58. +                if (offs == 0) {
  59. +                    MCU_CTRL=(1<<1)|(1<<2)|(1<<5);
  60. +                    return;
  61. +                }
  62. +            }
  63. +        }
  64. +    }
  65.  }
  66.  
  67.  /* Blit a YUV bitmap directly to the LCD */
  68. diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  69. index affc49b..3bfe342 100644
  70. --- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  71. +++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
  72. @@ -30,6 +30,7 @@
  73.  unsigned int lcd_data_transform(unsigned int data)
  74.  {
  75.      unsigned int r, g, b;
  76. +    return data;
  77.  
  78.  #if defined(RK27_GENERIC)
  79.      /* 18 bit interface */
  80. @@ -65,7 +66,7 @@ void lcd_write_reg(unsigned int reg, unsigned int val)
  81.      lcd_data(val);
  82.  }
  83.  
  84. -static void lcdctrl_bypass(unsigned int on_off)
  85. +void lcdctrl_bypass(unsigned int on_off)
  86.  {
  87.      while (!(LCDC_STA & LCDC_MCU_IDLE));
  88.  
  89. @@ -86,23 +87,36 @@ static void lcdctrl_init(void)
  90.       * MCU mode
  91.       * 24b RGB
  92.       */
  93. -    LCDC_CTRL = ALPHA(7) | LCDC_STOP | LCDC_MCU | RGB24B;
  94. +    LCDC_CTRL = ALPHA(7) | LCDC_STOP | LCDC_MCU;// | RGB24B;
  95.      MCU_CTRL = ALPHA_BASE(0x3f) | MCU_CTRL_BYPASS;
  96.  
  97. -    HOR_ACT = LCD_WIDTH + 3;    /* define horizonatal active region */
  98. -    VERT_ACT = LCD_HEIGHT;       /* define vertical active region */
  99. -    VERT_PERIOD = 0xfff;  /* CSn/WEn/RDn signal timings */
  100. +    HOR_BP = 1;
  101. +    VERT_BP = 1;
  102. +    HOR_ACT = LCD_HEIGHT;    /* define horizonatal active region */
  103. +    VERT_ACT = LCD_WIDTH;       /* define vertical active region */
  104. +    VERT_PERIOD = (7<<7)|(7<<3)|7;//0xfff;  /* CSn/WEn/RDn signal timings */
  105.  
  106. -    LINE0_YADDR = LINE_ALPHA_EN | 0x7fe;
  107. -    LINE1_YADDR = LINE_ALPHA_EN | ((1 * LCD_WIDTH) - 2);
  108. -    LINE2_YADDR = LINE_ALPHA_EN | ((2 * LCD_WIDTH) - 2);
  109. -    LINE3_YADDR = LINE_ALPHA_EN | ((3 * LCD_WIDTH) - 2);
  110. +    LINE0_YADDR = 0;
  111. +    LINE1_YADDR = (1 * LCD_HEIGHT);
  112. +    LINE2_YADDR = (2 * LCD_HEIGHT);
  113. +    LINE3_YADDR = (3 * LCD_HEIGHT);
  114.  
  115. -    LINE0_UVADDR = 0x7fe + 1;
  116. -    LINE1_UVADDR = ((1 * LCD_WIDTH) - 2 + 1);
  117. -    LINE2_UVADDR = ((2 * LCD_WIDTH) - 2 + 1);
  118. -    LINE3_UVADDR = ((3 * LCD_WIDTH) - 2 + 1);
  119. +    LINE0_UVADDR = 1;
  120. +    LINE1_UVADDR = (1 * LCD_HEIGHT) + 1;
  121. +    LINE2_UVADDR = (2 * LCD_HEIGHT) + 1;
  122. +    LINE3_UVADDR = (3 * LCD_HEIGHT) + 1;
  123.  
  124. +    /**/
  125. +    /*    LINE0_YADDR = 0x7fe;
  126. +    LINE1_YADDR = ((1 * LCD_HEIGHT) -2);
  127. +    LINE2_YADDR = ((2 * LCD_HEIGHT) -2);
  128. +    LINE3_YADDR = ((3 * LCD_HEIGHT) -2);
  129. +
  130. +    LINE0_UVADDR = 0x7fe + 1;
  131. +    LINE1_UVADDR = ((1 * LCD_HEIGHT) -2+ 1);
  132. +    LINE2_UVADDR = ((2 * LCD_HEIGHT) -2+ 1);
  133. +    LINE3_UVADDR = ((3 * LCD_HEIGHT) -2+ 1);
  134. +    */
  135.  #if 0
  136.      LINE0_YADDR = 0;
  137.      LINE1_YADDR = (1 * LCD_WIDTH);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement