summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/sandisk')
-rw-r--r--firmware/target/arm/sandisk/sansa-c200/lcd-c200.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
index 6626ea4e6d..511456bf47 100644
--- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
+++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c
@@ -28,28 +28,17 @@
28 28
29#define LCD_BUSY 0x8000 29#define LCD_BUSY 0x8000
30 30
31/* check if number of useconds has past */ 31/* wait for LCD */
32static inline bool timer_check(int clock_start, int usecs)
33{
34 return ((int)(USEC_TIMER - clock_start)) >= usecs;
35}
36
37/* wait for LCD with timeout */
38static inline void lcd_wait_write(void) 32static inline void lcd_wait_write(void)
39{ 33{
40 int start = USEC_TIMER; 34 while (LCD_BASE & LCD_BUSY);
41
42 do {
43 if ((LCD_BASE & LCD_BUSY) == 0)
44 break;
45 } while (timer_check(start, 1000) == 0);
46} 35}
47 36
48/* send LCD data */ 37/* send LCD data */
49static void lcd_send_data(unsigned data) 38static void lcd_send_data(unsigned data)
50{ 39{
51 lcd_wait_write(); 40 lcd_wait_write();
52 LCD_DATA = (data >> 8) & 0xff; 41 LCD_DATA = data >> 8;
53 42
54 lcd_wait_write(); 43 lcd_wait_write();
55 LCD_DATA = data & 0xff; 44 LCD_DATA = data & 0xff;