Sansa AMS: refactor DBOP button reading (e200v2/Fuze/c200v2)

This gets rid of LCD glitches on Sansa Fuze, and now LCD transfers can
get interrupted by button reading

Flyspray: FS #10603
Author: Bertrik Sikken

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24192 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-01-06 23:41:36 +00:00
parent 8e8e2627b2
commit 57667c51cf
9 changed files with 162 additions and 320 deletions

View file

@ -26,6 +26,7 @@
#include "debug.h"
#include "system.h"
#include "clock-target.h"
#include "dbop-as3525.h"
/* The controller is unknown, but some registers appear to be the same as the
HD66789R */
@ -89,8 +90,6 @@ static unsigned short r_entry_mode = R_ENTRY_MODE_HORZ_NORMAL;
#define R_DISP_CONTROL_REV 0x0000
static unsigned short r_disp_control_rev = R_DISP_CONTROL_NORMAL;
static volatile bool lcd_busy = false;
static inline void lcd_delay(int x)
{
do {
@ -435,8 +434,6 @@ void lcd_blit_yuv(unsigned char * const src[3],
yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
lcd_busy = true;
lcd_write_reg(R_ENTRY_MODE,
display_flipped ? R_ENTRY_MODE_VIDEO_FLIPPED : R_ENTRY_MODE_VIDEO_NORMAL
);
@ -473,8 +470,6 @@ void lcd_blit_yuv(unsigned char * const src[3],
}
while (--height > 0);
}
lcd_busy = false;
}
/* Update the display.
@ -484,8 +479,6 @@ void lcd_update(void)
if (!display_on)
return;
lcd_busy = true;
lcd_write_reg(R_ENTRY_MODE, r_entry_mode);
/* Set start position and window */
@ -494,8 +487,6 @@ void lcd_update(void)
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
lcd_write_data((fb_data*)lcd_framebuffer, LCD_WIDTH*LCD_HEIGHT);
lcd_busy = false;
}
/* Update a fraction of the display. */
@ -525,8 +516,6 @@ void lcd_update_rect(int x, int y, int width, int height)
if (y >= ymax)
return; /* nothing left to do */
lcd_busy = true;
lcd_write_reg(R_ENTRY_MODE, r_entry_mode);
lcd_window(x, y, xmax, ymax);
@ -541,25 +530,4 @@ void lcd_update_rect(int x, int y, int width, int height)
ptr += LCD_WIDTH;
}
while (--height >= 0);
lcd_busy = false;
}
/* writes one red pixel outside the visible area, needed for correct
* dbop reads */
bool lcd_button_support(void)
{
if (lcd_busy)
return false;
lcd_write_reg(R_ENTRY_MODE, r_entry_mode);
/* Set start position and window */
lcd_window(LCD_WIDTH+1, LCD_HEIGHT+1, LCD_WIDTH+2, LCD_HEIGHT+2);
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
lcd_write_value16(0xf<<12);
return true;
}