summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-28 08:12:05 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-28 08:12:05 +0000
commit58fc279d2674b5d56fed6772f82cdf1e431088f1 (patch)
tree07a174bba7430b0ebc3c0f84d39ecb209eec1fc5 /firmware/export
parent885cdfdeb98d54b2597e65f1b9ae9ab98da8286f (diff)
downloadrockbox-58fc279d2674b5d56fed6772f82cdf1e431088f1.tar.gz
rockbox-58fc279d2674b5d56fed6772f82cdf1e431088f1.zip
Scroll on main and remote with a single thread. Change the way system messages are defined before running out is an issue (which requires a full update of rockbox on the player).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14035 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/kernel.h49
-rw-r--r--firmware/export/lcd-remote.h5
-rw-r--r--firmware/export/lcd.h26
-rw-r--r--firmware/export/scroll_engine.h92
4 files changed, 128 insertions, 44 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index d5898a97f1..cb850d7af2 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -34,21 +34,40 @@
34#define QUEUE_LENGTH 16 /* MUST be a power of 2 */ 34#define QUEUE_LENGTH 16 /* MUST be a power of 2 */
35#define QUEUE_LENGTH_MASK (QUEUE_LENGTH - 1) 35#define QUEUE_LENGTH_MASK (QUEUE_LENGTH - 1)
36 36
37/* System defined message ID's, occupying the top 5 bits of the event ID */ 37/* System defined message ID's - |sign bit = 1|class|id| */
38#define SYS_EVENT (long)0x80000000 /* SYS events are negative */ 38/* Event class list */
39#define SYS_USB_CONNECTED ((SYS_EVENT | ((long)1 << 27))) 39#define SYS_EVENT_CLS_QUEUE 0
40#define SYS_USB_CONNECTED_ACK ((SYS_EVENT | ((long)2 << 27))) 40#define SYS_EVENT_CLS_USB 1
41#define SYS_USB_DISCONNECTED ((SYS_EVENT | ((long)3 << 27))) 41#define SYS_EVENT_CLS_POWER 2
42#define SYS_USB_DISCONNECTED_ACK ((SYS_EVENT | ((long)4 << 27))) 42#define SYS_EVENT_CLS_FILESYS 3
43#define SYS_TIMEOUT ((SYS_EVENT | ((long)5 << 27))) 43#define SYS_EVENT_CLS_PLUG 4
44#define SYS_HOTSWAP_INSERTED ((SYS_EVENT | ((long)6 << 27))) 44/* make sure SYS_EVENT_CLS_BITS has enough range */
45#define SYS_HOTSWAP_EXTRACTED ((SYS_EVENT | ((long)7 << 27))) 45
46#define SYS_POWEROFF ((SYS_EVENT | ((long)8 << 27))) 46/* MSb->|S|c...c|i...i| */
47#define SYS_FS_CHANGED ((SYS_EVENT | ((long)9 << 27))) 47#define SYS_EVENT ((long)(~0ul ^ (~0ul >> 1)))
48#define SYS_CHARGER_CONNECTED ((SYS_EVENT | ((long)10 << 27))) 48#define SYS_EVENT_CLS_BITS (3)
49#define SYS_CHARGER_DISCONNECTED ((SYS_EVENT | ((long)11 << 27))) 49#define SYS_EVENT_CLS_SHIFT (sizeof (long)*8-SYS_EVENT_CLS_BITS-1)
50#define SYS_PHONE_PLUGGED ((SYS_EVENT | ((long)12 << 27))) 50#define SYS_EVENT_CLS_MASK (((1l << SYS_EVENT_CLS_BITS)-1) << SYS_EVENT_SHIFT)
51#define SYS_PHONE_UNPLUGGED ((SYS_EVENT | ((long)13 << 27))) 51#define MAKE_SYS_EVENT(cls, id) (SYS_EVENT | ((long)(cls) << SYS_EVENT_CLS_SHIFT) | (long)(id))
52/* Macros for extracting codes */
53#define SYS_EVENT_CLS(e) (((e) & SYS_EVENT_CLS_MASK) >> SYS_EVENT_SHIFT)
54#define SYS_EVENT_ID(e) ((e) & ~(SYS_EVENT|SYS_EVENT_CLS_MASK))
55
56#define SYS_TIMEOUT MAKE_SYS_EVENT(SYS_EVENT_CLS_QUEUE, 0)
57#define SYS_USB_CONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 0)
58#define SYS_USB_CONNECTED_ACK MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 1)
59#define SYS_USB_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 2)
60#define SYS_USB_DISCONNECTED_ACK MAKE_SYS_EVENT(SYS_EVENT_CLS_USB, 3)
61#define SYS_POWEROFF MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 0)
62#define SYS_CHARGER_CONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 1)
63#define SYS_CHARGER_DISCONNECTED MAKE_SYS_EVENT(SYS_EVENT_CLS_POWER, 2)
64#define SYS_FS_CHANGED MAKE_SYS_EVENT(SYS_EVENT_CLS_FILESYS, 0)
65#define SYS_HOTSWAP_INSERTED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 0)
66#define SYS_HOTSWAP_EXTRACTED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 1)
67#define SYS_PHONE_PLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 2)
68#define SYS_PHONE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 3)
69#define SYS_REMOTE_PLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 4)
70#define SYS_REMOTE_UNPLUGGED MAKE_SYS_EVENT(SYS_EVENT_CLS_PLUG, 5)
52 71
53struct event 72struct event
54{ 73{
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index cfb643ff96..329edd5f27 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -39,10 +39,6 @@
39int remote_type(void); 39int remote_type(void);
40#endif 40#endif
41 41
42#ifndef SIMULATOR
43extern struct event_queue remote_scroll_queue;
44#endif
45
46#define STYLE_DEFAULT 0x00000000 42#define STYLE_DEFAULT 0x00000000
47#define STYLE_INVERT 0x20000000 43#define STYLE_INVERT 0x20000000
48 44
@@ -146,6 +142,7 @@ extern void lcd_remote_setmargins(int xmargin, int ymargin);
146extern int lcd_remote_getxmargin(void); 142extern int lcd_remote_getxmargin(void);
147extern int lcd_remote_getymargin(void); 143extern int lcd_remote_getymargin(void);
148extern void lcd_remote_setfont(int font); 144extern void lcd_remote_setfont(int font);
145extern int lcd_remote_getfont(void);
149extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); 146extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
150 147
151/* low level drawing function pointer arrays */ 148/* low level drawing function pointer arrays */
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 8f01ef5cab..608f9ffa0f 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -312,6 +312,7 @@ extern void lcd_set_flip(bool yesno);
312extern void lcd_set_drawmode(int mode); 312extern void lcd_set_drawmode(int mode);
313extern int lcd_get_drawmode(void); 313extern int lcd_get_drawmode(void);
314extern void lcd_setfont(int font); 314extern void lcd_setfont(int font);
315extern int lcd_getfont(void);
315 316
316extern void lcd_puts_style_offset(int x, int y, const unsigned char *str, 317extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
317 int style, int offset); 318 int style, int offset);
@@ -376,29 +377,4 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
376 377
377#endif /* HAVE_LCD_BITMAP */ 378#endif /* HAVE_LCD_BITMAP */
378 379
379/* internal usage, but in multiple drivers */
380#define SCROLL_SPACING 3
381#ifdef HAVE_LCD_BITMAP
382#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
383#else
384#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
385#endif
386
387struct scrollinfo {
388 char line[SCROLL_LINE_SIZE];
389 int len; /* length of line in chars */
390 int offset;
391 int startx;
392#ifdef HAVE_LCD_BITMAP
393 int width; /* length of line in pixels */
394 bool invert; /* invert the scrolled text */
395#endif
396 bool backward; /* scroll presently forward or backward? */
397 bool bidir;
398 long start_tick;
399#ifdef HAVE_LCD_COLOR
400 int line_colour;
401#endif
402};
403
404#endif /* __LCD_H__ */ 380#endif /* __LCD_H__ */
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
new file mode 100644
index 0000000000..aa11a9ba1f
--- /dev/null
+++ b/firmware/export/scroll_engine.h
@@ -0,0 +1,92 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 Michael Sevakis
11 *
12 * LCD scrolling driver and scheduler
13 *
14 * Much collected and combined from the various Rockbox LCD drivers.
15 *
16 * All files in this archive are subject to the GNU General Public License.
17 * See the file COPYING in the source tree root for full license agreement.
18 *
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
21 *
22 ****************************************************************************/
23#ifndef __SCROLL_ENGINE_H__
24#define __SCROLL_ENGINE_H__
25
26void scroll_init(void);
27void lcd_scroll_fn(void);
28void lcd_remote_scroll_fn(void);
29
30/* internal usage, but in multiple drivers */
31#define SCROLL_SPACING 3
32#ifdef HAVE_LCD_BITMAP
33#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
34#else
35#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH + 2)
36#endif
37
38struct scrollinfo
39{
40 char line[SCROLL_LINE_SIZE];
41 int len; /* length of line in chars */
42 int offset;
43 int startx;
44#ifdef HAVE_LCD_BITMAP
45 int width; /* length of line in pixels */
46 bool invert; /* invert the scrolled text */
47#endif
48 bool backward; /* scroll presently forward or backward? */
49 bool bidir;
50 long start_tick;
51#ifdef HAVE_LCD_COLOR
52 int line_color;
53#endif
54};
55
56struct scroll_screen_info
57{
58 struct scrollinfo * const scroll;
59 const int num_scroll; /* number of scrollable lines (also number of scroll structs) */
60 int lines; /* Bitpattern of which lines are scrolling */
61 long ticks; /* # of ticks between updates*/
62 long delay; /* ticks delay before start */
63 int bidir_limit; /* percent */
64#ifdef HAVE_LCD_CHARCELLS
65 long jump_scroll_delay; /* delay between jump scroll jumps */
66 int jump_scroll; /* 0=off, 1=once, ..., JUMP_SCROLL_ALWAYS */
67#endif
68#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
69 int step; /* pixels per scroll step */
70#endif
71#if defined(HAVE_REMOTE_LCD)
72 long last_scroll;
73#endif
74};
75
76/** main lcd **/
77#ifdef HAVE_LCD_BITMAP
78#define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32)
79#else
80#define LCD_SCROLLABLE_LINES LCD_HEIGHT
81#endif
82
83extern struct scroll_screen_info lcd_scroll_info;
84
85/** remote lcd **/
86#ifdef HAVE_REMOTE_LCD
87#define LCD_REMOTE_SCROLLABLE_LINES \
88 (((LCD_REMOTE_HEIGHT+4)/5 < 32) ? (LCD_REMOTE_HEIGHT+4)/5 : 32)
89extern struct scroll_screen_info lcd_remote_scroll_info;
90#endif
91
92#endif /* __SCROLL_ENGINE_H__ */