Index: firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c
===================================================================
--- firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c	(Revision 20060)
+++ firmware/target/arm/as3525/sansa-e200v2/lcd-e200v2.c	(Arbeitskopie)
@@ -179,6 +179,15 @@
         flip_lcd(yesno);
 }

+static void lcd_window(int xmin, int ymin, int xmax, int ymax)
+{
+    ymin += y_offset;
+    ymax += y_offset;
+    lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin);
+    lcd_write_reg(R_VERT_RAM_ADDR_POS,  (ymax << 8) | ymin);
+    lcd_write_reg(R_RAM_ADDR_SET,       (ymin << 8) | xmin);
+}
+
 static void _display_on(void)
 {
     /* Initialisation the display the same way as the original firmware */
@@ -269,17 +278,13 @@
     lcd_write_reg(R_GAMMA_AMP_AVG_ADJ_RES_NEG, 0x0f08);


-    lcd_write_reg(R_RAM_ADDR_SET, 0);
     lcd_write_reg(R_GATE_SCAN_POS, 0);
     lcd_write_reg(R_VERT_SCROLL_CONTROL, 0);
-    
-    lcd_write_reg(R_1ST_SCR_DRV_POS, 219 << 8);
-    lcd_write_reg(R_2ND_SCR_DRV_POS, 219 << 8);

-    lcd_write_reg(R_HORIZ_RAM_ADDR_POS, 175 << 8);
-    lcd_write_reg(R_VERT_RAM_ADDR_POS, 219 << 8);
+    lcd_window(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);    
+    lcd_write_reg(R_1ST_SCR_DRV_POS, (LCD_HEIGHT-1) << 8);
+    lcd_write_reg(R_2ND_SCR_DRV_POS, (LCD_HEIGHT-1) << 8);

-
     lcd_write_reg(R_DISP_CONTROL1, 0x0037);

     display_on=true;  /* must be done before calling lcd_update() */
@@ -363,18 +368,6 @@
     (void)height;
 }

-static void lcd_window_x(int xmin, int xmax)
-{
-    lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin);
-}
-
-static void lcd_window_y(int ymin, int ymax)
-{
-    ymin += y_offset;
-    ymax += y_offset;
-    lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin);
-    lcd_write_reg(R_RAM_ADDR_SET, ymin << 8);
-}
 /* Update the display.
    This must be called after all other LCD functions that change the display. */
 void lcd_update(void)
@@ -386,8 +379,7 @@

     lcd_busy = true;
     /* Set start position and window */
-    lcd_window_x(0, LCD_WIDTH-1);
-    lcd_window_x(0, LCD_HEIGHT-1);
+    lcd_window(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1);

     lcd_write_cmd(R_WRITE_DATA_2_GRAM);

@@ -425,10 +417,9 @@
     lcd_busy = true;

     lcd_write_cmd(R_WRITE_DATA_2_GRAM);
-    lcd_window_x(x, x + width);
-    lcd_window_y(y, ymax);
+    lcd_window(x, y, x+width, ymax);

-    ptr = &lcd_framebuffer[y][x];
+    ptr = (fb_data*)&lcd_framebuffer[y][x];

     do
     {
@@ -450,8 +441,7 @@

     lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ);
     /* Set start position and window */
-    lcd_window_x(LCD_WIDTH+1, 1);
-    lcd_window_y(LCD_HEIGHT+1, 1);
+    lcd_window(LCD_WIDTH+1, LCD_HEIGHT+1, 1, 1);

     lcd_write_cmd(R_WRITE_DATA_2_GRAM);