summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2013-05-11 12:30:04 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2013-05-11 12:30:38 +0200
commitca8154741fd01e4b11461ce522da7d5e30a12d6e (patch)
treec60f09d1f91b2c7c3e520b220a60b90545ddf86d /firmware/target
parent3f4824b94fdfcb99cd8bfe8d7b60ba6106f3accd (diff)
rk27xx: Slightly refactor lcd_set_gram_area()
Change-Id: I1040164220dd87b19b58be560eb5b628857bc284
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/rk27xx/lcd-hifiman.c43
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.c2
-rw-r--r--firmware/target/arm/rk27xx/lcdif-rk27xx.h2
-rw-r--r--firmware/target/arm/rk27xx/ma/lcd-ma.c21
-rw-r--r--firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c17
5 files changed, 46 insertions, 39 deletions
diff --git a/firmware/target/arm/rk27xx/lcd-hifiman.c b/firmware/target/arm/rk27xx/lcd-hifiman.c
index 03b488548e..1adc6e36ed 100644
--- a/firmware/target/arm/rk27xx/lcd-hifiman.c
+++ b/firmware/target/arm/rk27xx/lcd-hifiman.c
@@ -159,15 +159,17 @@ static void lcd_v1_enable (bool on)
LCDC_CTRL &= ~RGB24B;
}
-static void lcd_v1_set_gram_area(int x, int y, int width, int height)
+
+static void lcd_v1_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
lcdctrl_bypass(1);
LCDC_CTRL |= RGB24B;
- lcd_write_reg(0x03, x);
- lcd_write_reg(0x05, width-1);
- lcd_write_reg(0x07, y);
- lcd_write_reg(0x09, height-1);
+ lcd_write_reg(0x03, x_start);
+ lcd_write_reg(0x05, x_end);
+ lcd_write_reg(0x07, y_start);
+ lcd_write_reg(0x09, y_end);
lcd_cmd(0x22);
LCDC_CTRL &= ~RGB24B;
@@ -178,7 +180,7 @@ static void lcd_v1_update_rect(int x, int y, int width, int height)
int px = x, py = y;
int pxmax = x + width, pymax = y + height;
- lcd_v1_set_gram_area(x, y, pxmax, pymax);
+ lcd_v1_set_gram_area(x, y, pxmax-1, pymax-1);
for (py=y; py<pymax; py++)
for (px=x; px<pxmax; px++)
@@ -291,19 +293,20 @@ static void lcd_v2_enable (bool on)
}
-static void lcd_v2_set_gram_area(int x, int y, int width, int height)
+static void lcd_v2_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
lcdctrl_bypass(1);
LCDC_CTRL |= RGB24B;
- lcd_write_reg(0x36, height-1);
- lcd_write_reg(0x37, y);
- lcd_write_reg(0x38, width-1);
- lcd_write_reg(0x39, x);
+ lcd_write_reg(0x36, y_end);
+ lcd_write_reg(0x37, y_start);
+ lcd_write_reg(0x38, x_end);
+ lcd_write_reg(0x39, x_start);
/* set GRAM address */
- lcd_write_reg(0x20, y);
- lcd_write_reg(0x21, x);
+ lcd_write_reg(0x20, y_start);
+ lcd_write_reg(0x21, x_start);
lcd_cmd(0x22);
LCDC_CTRL &= ~RGB24B;
@@ -314,7 +317,7 @@ static void lcd_v2_update_rect(int x, int y, int width, int height)
int px = x, py = y;
int pxmax = x + width, pymax = y + height;
- lcd_v2_set_gram_area(x, y, pxmax, pymax);
+ lcd_v2_set_gram_area(x, y, pxmax-1, pymax-1);
for (py=y; py<pymax; py++)
for (px=x; px<pxmax; px++)
@@ -340,12 +343,13 @@ void lcd_enable (bool on)
lcd_v2_enable(on);
}
-void lcd_set_gram_area(int x, int y, int width, int height)
+void lcd_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
if (lcd_type == LCD_V1)
- lcd_v1_set_gram_area(x, y, width, height);
+ lcd_v1_set_gram_area(x_start, y_start, x_end, y_end);
else
- lcd_v2_set_gram_area(x, y, width, height);
+ lcd_v2_set_gram_area(x_start, y_start, x_end, y_end);
}
void lcd_update_rect(int x, int y, int width, int height)
@@ -371,9 +375,10 @@ void lcd_enable (bool on)
lcd_v1_enable(on);
}
-void lcd_set_gram_area(int x, int y, int width, int height)
+void lcd_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
- lcd_v1_set_gram_area(x, y, width, height);
+ lcd_v1_set_gram_area(x_start, y_start, x_end, y_end);
}
void lcd_update_rect(int x, int y, int width, int height)
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.c b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
index 314838f2c1..560ab4708e 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.c
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.c
@@ -246,7 +246,7 @@ void lcd_init_device(void)
void lcd_update()
{
- lcd_set_gram_area(0, 0, LCD_WIDTH, LCD_HEIGHT);
+ lcd_set_gram_area(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);
lcdctrl_bypass(0);
commit_discard_dcache_range(FBADDR(0,0), 2*LCD_WIDTH*LCD_HEIGHT);
diff --git a/firmware/target/arm/rk27xx/lcdif-rk27xx.h b/firmware/target/arm/rk27xx/lcdif-rk27xx.h
index 7af27bbe8a..4961863504 100644
--- a/firmware/target/arm/rk27xx/lcdif-rk27xx.h
+++ b/firmware/target/arm/rk27xx/lcdif-rk27xx.h
@@ -10,6 +10,6 @@ void lcd_write_reg(unsigned int reg, unsigned int val);
void lcdctrl_bypass(unsigned int on_off);
void lcd_display_init(void);
-void lcd_set_gram_area(int x, int y, int width, int height);
+void lcd_set_gram_area(int x_start, int y_start, int x_end, int y_end);
#endif /* _LCDIF_RK27XX_H */
diff --git a/firmware/target/arm/rk27xx/ma/lcd-ma.c b/firmware/target/arm/rk27xx/ma/lcd-ma.c
index ad67352eb7..3c3d9fb097 100644
--- a/firmware/target/arm/rk27xx/ma/lcd-ma.c
+++ b/firmware/target/arm/rk27xx/ma/lcd-ma.c
@@ -151,21 +151,22 @@ void lcd_enable (bool on)
LCDC_CTRL &= ~RGB24B;
}
-void lcd_set_gram_area(int x, int y, int width, int height)
+void lcd_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
lcdctrl_bypass(1);
LCDC_CTRL |= RGB24B;
lcd_cmd(0x002A);
- lcd_data((x&0xff00)>>8);
- lcd_data(x&0x00ff);
- lcd_data(((width-1)&0xff00)>>8);
- lcd_data((width-1)&0x00ff);
+ lcd_data((x_start&0xff00)>>8);
+ lcd_data(x_start&0x00ff);
+ lcd_data((x_end&0xff00)>>8);
+ lcd_data(x_end&0x00ff);
lcd_cmd(0x002B);
- lcd_data((y&0xff00)>>8);
- lcd_data(y&0x00ff);
- lcd_data(((height-1)&0xff00)>>8);
- lcd_data((height-1)&0x00ff);
+ lcd_data((y_start&0xff00)>>8);
+ lcd_data(y_start&0x00ff);
+ lcd_data((y_end&0xff00)>>8);
+ lcd_data(y_end&0x00ff);
lcd_cmd(0x2c);
LCDC_CTRL &= ~RGB24B;
@@ -176,7 +177,7 @@ void lcd_update_rect(int x, int y, int width, int height)
int px = x, py = y;
int pxmax = x + width, pymax = y + height;
- lcd_set_gram_area(x, y, pxmax, pymax);
+ lcd_set_gram_area(x, y, pxmax-1, pymax-1);
for (py = y; py < pymax; py++)
for (px = x; px < pxmax; px++)
diff --git a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
index 988f710660..75911614ab 100644
--- a/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
+++ b/firmware/target/arm/rk27xx/rk27generic/lcd-rk27generic.c
@@ -161,18 +161,19 @@ void lcd_display_init(void)
lcd_sleep(false);
}
-void lcd_set_gram_area(int x, int y, int width, int height)
+void lcd_set_gram_area(int x_start, int y_start,
+ int x_end, int y_end)
{
lcdctrl_bypass(1);
LCDC_CTRL |= RGB24B;
/* addresses setup */
- lcd_write_reg(WINDOW_H_START, y);
- lcd_write_reg(WINDOW_H_END, height-1);
- lcd_write_reg(WINDOW_V_START, x);
- lcd_write_reg(WINDOW_V_END, width-1);
- lcd_write_reg(GRAM_H_ADDR, y);
- lcd_write_reg(GRAM_V_ADDR, x);
+ lcd_write_reg(WINDOW_H_START, y_start);
+ lcd_write_reg(WINDOW_H_END, y_end);
+ lcd_write_reg(WINDOW_V_START, x_start);
+ lcd_write_reg(WINDOW_V_END, x_end);
+ lcd_write_reg(GRAM_H_ADDR, y_start);
+ lcd_write_reg(GRAM_V_ADDR, x_start);
lcd_cmd(GRAM_WRITE);
LCDC_CTRL &= ~RGB24B;
@@ -183,7 +184,7 @@ void lcd_update_rect(int x, int y, int width, int height)
int px = x, py = y;
int pxmax = x + width, pymax = y + height;
- lcd_set_gram_area(x, y, pxmax, pymax);
+ lcd_set_gram_area(x, y, pxmax-1, pymax-1);
for (py=y; py<pymax; py++)
{