summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-02-25 22:36:04 +0000
committerJens Arnold <amiconn@rockbox.org>2007-02-25 22:36:04 +0000
commit7d718a8064177a879423de7a78999a64126c79dc (patch)
treece4e6aab4c39eb6884463007899be2431094879b
parentd528e54b619007ec30bfbbe9dca6c0886c822b74 (diff)
downloadrockbox-7d718a8064177a879423de7a78999a64126c79dc.tar.gz
rockbox-7d718a8064177a879423de7a78999a64126c79dc.zip
X5: Move the remote tick to target tree.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12486 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/lcd-remote-2bit-vi.c62
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-remote-target.h3
-rw-r--r--firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c48
3 files changed, 54 insertions, 59 deletions
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c
index 74e098010e..281cbc2189 100644
--- a/firmware/drivers/lcd-remote-2bit-vi.c
+++ b/firmware/drivers/lcd-remote-2bit-vi.c
@@ -73,9 +73,7 @@ static const char scroll_tick_table[16] = {
73 73
74/* remote hotplug */ 74/* remote hotplug */
75#ifndef SIMULATOR 75#ifndef SIMULATOR
76static struct event_queue remote_scroll_queue; 76struct event_queue remote_scroll_queue;
77#define REMOTE_INIT_LCD 1
78#define REMOTE_DEINIT_LCD 2
79#endif 77#endif
80 78
81/*** parameter handling ***/ 79/*** parameter handling ***/
@@ -1131,51 +1129,6 @@ void lcd_remote_puts_scroll_style_offset(int x, int y, const unsigned char *stri
1131 scrolling_lines &= ~(1<<y); 1129 scrolling_lines &= ~(1<<y);
1132} 1130}
1133 1131
1134#ifndef SIMULATOR
1135/* Monitor remote hotswap */
1136static void remote_tick(void)
1137{
1138 static bool last_status = false;
1139 static int countdown = 0;
1140 static int init_delay = 0;
1141 bool current_status;
1142
1143 current_status = remote_detect();
1144
1145 /* Only report when the status has changed */
1146 if (current_status != last_status)
1147 {
1148 last_status = current_status;
1149 countdown = current_status ? 20*HZ : 1;
1150 }
1151 else
1152 {
1153 /* Count down until it gets negative */
1154 if (countdown >= 0)
1155 countdown--;
1156
1157 if (current_status)
1158 {
1159 if (!(countdown % 8))
1160 {
1161 if (--init_delay <= 0)
1162 {
1163 queue_post(&remote_scroll_queue, REMOTE_INIT_LCD, 0);
1164 init_delay = 6;
1165 }
1166 }
1167 }
1168 else
1169 {
1170 if (countdown == 0)
1171 {
1172 queue_post(&remote_scroll_queue, REMOTE_DEINIT_LCD, 0);
1173 }
1174 }
1175 }
1176}
1177#endif
1178
1179static void scroll_thread(void) 1132static void scroll_thread(void)
1180{ 1133{
1181 struct font* pf; 1134 struct font* pf;
@@ -1279,23 +1232,14 @@ static void scroll_thread(void)
1279} 1232}
1280 1233
1281/* LCD init */ 1234/* LCD init */
1282#ifdef SIMULATOR
1283void lcd_remote_init(void)
1284{
1285 create_thread(scroll_thread, scroll_stack,
1286 sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE));
1287}
1288#else
1289void lcd_remote_init(void) 1235void lcd_remote_init(void)
1290{ 1236{
1237#ifndef SIMULATOR
1291 /* Call device specific init */ 1238 /* Call device specific init */
1292 lcd_remote_init_device(); 1239 lcd_remote_init_device();
1293
1294 lcd_remote_clear_display();
1295 /* private queue */ 1240 /* private queue */
1296 queue_init(&remote_scroll_queue, false); 1241 queue_init(&remote_scroll_queue, false);
1297 tick_add_task(remote_tick); 1242#endif
1298 create_thread(scroll_thread, scroll_stack, 1243 create_thread(scroll_thread, scroll_stack,
1299 sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE)); 1244 sizeof(scroll_stack), scroll_name IF_PRIO(, PRIORITY_USER_INTERFACE));
1300} 1245}
1301#endif
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h b/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h
index 783363bef3..86c361097b 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h
+++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h
@@ -19,6 +19,9 @@
19#ifndef LCD_REMOTE_TARGET_H 19#ifndef LCD_REMOTE_TARGET_H
20#define LCD_REMOTE_TARGET_H 20#define LCD_REMOTE_TARGET_H
21 21
22#define REMOTE_INIT_LCD 1
23#define REMOTE_DEINIT_LCD 2
24
22void lcd_remote_init_device(void); 25void lcd_remote_init_device(void);
23void lcd_remote_write_command(int cmd); 26void lcd_remote_write_command(int cmd);
24void lcd_remote_write_command_ex(int cmd, int data); 27void lcd_remote_write_command_ex(int cmd, int data);
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
index bd1fb19727..139ebbc2a3 100644
--- a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c
@@ -58,6 +58,8 @@ static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING;
58 58
59bool remote_initialized = false; 59bool remote_initialized = false;
60 60
61static void remote_tick(void);
62
61/* Standard low-level byte writer. Requires CLK high on entry */ 63/* Standard low-level byte writer. Requires CLK high on entry */
62static inline void _write_byte(unsigned data) 64static inline void _write_byte(unsigned data)
63{ 65{
@@ -335,6 +337,9 @@ void lcd_remote_init_device(void)
335 and_l(~0x01000000, &GPIO_OUT); 337 and_l(~0x01000000, &GPIO_OUT);
336 and_l(~0x01000000, &GPIO_ENABLE); 338 and_l(~0x01000000, &GPIO_ENABLE);
337 or_l(0x01000000, &GPIO_FUNCTION); 339 or_l(0x01000000, &GPIO_FUNCTION);
340
341 lcd_remote_clear_display();
342 tick_add_task(remote_tick);
338} 343}
339 344
340void lcd_remote_on(void) 345void lcd_remote_on(void)
@@ -392,6 +397,49 @@ void lcd_remote_poweroff(void)
392 lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); 397 lcd_remote_write_command(LCD_SET_POWER_SAVE | 1);
393} 398}
394 399
400/* Monitor remote hotswap */
401static void remote_tick(void)
402{
403 static bool last_status = false;
404 static int countdown = 0;
405 static int init_delay = 0;
406 bool current_status;
407
408 current_status = remote_detect();
409
410 /* Only report when the status has changed */
411 if (current_status != last_status)
412 {
413 last_status = current_status;
414 countdown = current_status ? 20*HZ : 1;
415 }
416 else
417 {
418 /* Count down until it gets negative */
419 if (countdown >= 0)
420 countdown--;
421
422 if (current_status)
423 {
424 if (!(countdown % 8))
425 {
426 if (--init_delay <= 0)
427 {
428 queue_post(&remote_scroll_queue, REMOTE_INIT_LCD, 0);
429 init_delay = 6;
430 }
431 }
432 }
433 else
434 {
435 if (countdown == 0)
436 {
437 queue_post(&remote_scroll_queue, REMOTE_DEINIT_LCD, 0);
438 }
439 }
440 }
441}
442
395/* Update the display. 443/* Update the display.
396 This must be called after all other LCD functions that change the display. */ 444 This must be called after all other LCD functions that change the display. */
397void lcd_remote_update(void) ICODE_ATTR; 445void lcd_remote_update(void) ICODE_ATTR;