2005-04-15 09:42:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2005 by Richard S. La Charité
|
2005-04-15 09:42:12 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-04-15 09:42:12 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __LCD_REMOTE_H__
|
|
|
|
#define __LCD_REMOTE_H__
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "cpu.h"
|
|
|
|
#include "config.h"
|
2008-01-07 20:34:11 +00:00
|
|
|
#include "lcd.h"
|
2005-04-15 09:42:12 +00:00
|
|
|
|
2005-04-15 12:37:54 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2008-03-26 23:35:34 +00:00
|
|
|
#if defined(TARGET_TREE) && !defined(__PCTOOL__)
|
2007-02-25 22:09:14 +00:00
|
|
|
#include "lcd-remote-target.h"
|
|
|
|
#endif
|
|
|
|
|
2006-02-17 22:38:38 +00:00
|
|
|
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
2006-07-28 13:35:36 +00:00
|
|
|
#define REMOTETYPE_UNPLUGGED 0
|
2006-02-17 22:38:38 +00:00
|
|
|
#define REMOTETYPE_H100_LCD 1
|
|
|
|
#define REMOTETYPE_H300_LCD 2
|
|
|
|
#define REMOTETYPE_H300_NONLCD 3
|
2007-02-25 22:09:14 +00:00
|
|
|
int remote_type(void);
|
|
|
|
#endif
|
|
|
|
|
2007-06-17 21:16:34 +00:00
|
|
|
#define STYLE_DEFAULT 0x00000000
|
|
|
|
#define STYLE_INVERT 0x20000000
|
2006-07-28 07:17:00 +00:00
|
|
|
|
|
|
|
#if LCD_REMOTE_DEPTH <= 8
|
|
|
|
#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
|
|
|
|
|| (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
|
|
|
|
typedef unsigned short fb_remote_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_RDATA_SZ 2
|
2006-07-28 07:17:00 +00:00
|
|
|
#else
|
|
|
|
typedef unsigned char fb_remote_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_RDATA_SZ 1
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif
|
|
|
|
#elif LCD_DEPTH <= 16
|
|
|
|
typedef unsigned short fb_remote_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_RDATA_SZ 2
|
2006-07-28 07:17:00 +00:00
|
|
|
#else
|
|
|
|
typedef unsigned long fb_remote_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_RDATA_SZ 4
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif
|
|
|
|
|
2008-03-12 23:08:33 +00:00
|
|
|
/* common functions */
|
|
|
|
void lcd_remote_init(void);
|
|
|
|
void lcd_remote_write_command(int cmd);
|
|
|
|
void lcd_remote_write_command_ex(int cmd, int data);
|
|
|
|
void lcd_remote_write_data(const fb_remote_data *data, int count);
|
2006-07-28 07:17:00 +00:00
|
|
|
|
|
|
|
/* Low-level drawing function types */
|
|
|
|
typedef void lcd_remote_pixelfunc_type(int x, int y);
|
|
|
|
typedef void lcd_remote_blockfunc_type(fb_remote_data *address, unsigned mask,
|
|
|
|
unsigned bits);
|
|
|
|
|
2006-10-14 01:32:58 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1 /* greyscale - 8 bit max */
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
extern unsigned lcd_remote_color_to_native(unsigned color);
|
|
|
|
#endif
|
|
|
|
|
2006-07-28 07:17:00 +00:00
|
|
|
#define LCD_REMOTE_MAX_LEVEL ((1 << LCD_REMOTE_DEPTH) - 1)
|
2006-10-14 01:32:58 +00:00
|
|
|
/**
|
|
|
|
* On 2 bit for example (y >> (8-DEPTH)) = (y >> 6) = y/64 gives:
|
|
|
|
* |000-063|064-127|128-191|192-255|
|
|
|
|
* | 0 | 1 | 2 | 3 |
|
|
|
|
*/
|
|
|
|
#define LCD_REMOTE_BRIGHTNESS(y) ((y) >> (8-LCD_REMOTE_DEPTH))
|
2006-07-28 07:17:00 +00:00
|
|
|
|
|
|
|
#define LCD_REMOTE_BLACK LCD_REMOTE_BRIGHTNESS(0)
|
|
|
|
#define LCD_REMOTE_DARKGRAY LCD_REMOTE_BRIGHTNESS(85)
|
|
|
|
#define LCD_REMOTE_LIGHTGRAY LCD_REMOTE_BRIGHTNESS(170)
|
|
|
|
#define LCD_REMOTE_WHITE LCD_REMOTE_BRIGHTNESS(255)
|
|
|
|
#define LCD_REMOTE_DEFAULT_FG LCD_REMOTE_BLACK
|
|
|
|
#define LCD_REMOTE_DEFAULT_BG LCD_REMOTE_WHITE
|
|
|
|
#endif
|
|
|
|
|
2007-02-20 19:31:34 +00:00
|
|
|
/* Frame buffer dimensions (format checks only cover existing targets!) */
|
2006-07-28 07:17:00 +00:00
|
|
|
#if LCD_REMOTE_DEPTH == 1
|
2007-02-20 19:31:34 +00:00
|
|
|
#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
|
2006-07-28 07:17:00 +00:00
|
|
|
#elif LCD_REMOTE_DEPTH == 2
|
|
|
|
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
|
2007-02-20 19:31:34 +00:00
|
|
|
#define LCD_REMOTE_FBHEIGHT ((LCD_REMOTE_HEIGHT+7)/8)
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif
|
2007-02-20 19:31:34 +00:00
|
|
|
#endif /* LCD_REMOTE_DEPTH */
|
|
|
|
/* Set defaults if not defined different yet. The defaults apply to both
|
|
|
|
* dimensions for LCD_REMOTE_DEPTH >= 8 */
|
|
|
|
#ifndef LCD_REMOTE_FBWIDTH
|
|
|
|
#define LCD_REMOTE_FBWIDTH LCD_REMOTE_WIDTH
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif
|
2007-02-20 19:31:34 +00:00
|
|
|
#ifndef LCD_REMOTE_FBHEIGHT
|
|
|
|
#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_HEIGHT
|
|
|
|
#endif
|
|
|
|
/* The actual framebuffer */
|
|
|
|
extern fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH];
|
|
|
|
|
2006-07-28 07:17:00 +00:00
|
|
|
|
2005-04-15 09:42:12 +00:00
|
|
|
extern void lcd_remote_init(void);
|
2005-04-15 12:36:03 +00:00
|
|
|
extern int lcd_remote_default_contrast(void);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_set_contrast(int val);
|
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
extern void lcd_remote_set_viewport(struct viewport* vp);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_clear_display(void);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern void lcd_remote_clear_viewport(void);
|
2006-07-28 07:17:00 +00:00
|
|
|
extern void lcd_remote_puts(int x, int y, const unsigned char *str);
|
|
|
|
extern void lcd_remote_puts_style(int x, int y, const unsigned char *str,
|
2006-01-22 04:24:26 +00:00
|
|
|
int style);
|
2006-10-14 01:32:58 +00:00
|
|
|
extern void lcd_remote_puts_offset(int x, int y, const unsigned char *str,
|
2006-07-28 07:17:00 +00:00
|
|
|
int offset);
|
|
|
|
extern void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str,
|
|
|
|
int style, int offset);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_putc(int x, int y, unsigned short ch);
|
|
|
|
extern void lcd_remote_stop_scroll(void);
|
|
|
|
extern void lcd_remote_scroll_speed(int speed);
|
|
|
|
extern void lcd_remote_scroll_delay(int ms);
|
2006-07-28 07:17:00 +00:00
|
|
|
extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
|
|
|
|
extern void lcd_remote_puts_scroll_style(int x, int y, const unsigned char *str,
|
|
|
|
int style);
|
|
|
|
extern void lcd_remote_puts_scroll_offset(int x, int y,
|
|
|
|
const unsigned char *str, int offset);
|
|
|
|
extern void lcd_remote_puts_scroll_style_offset(int x, int y,
|
|
|
|
const unsigned char *string,
|
2006-01-22 01:42:05 +00:00
|
|
|
int style, int offset);
|
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_update(void);
|
2005-06-29 01:39:50 +00:00
|
|
|
extern void lcd_remote_update_rect(int x, int y, int width, int height);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern void lcd_remote_update_viewport(void);
|
|
|
|
extern void lcd_remote_update_viewport_rect(int x, int y, int width, int height);
|
2005-04-25 23:47:51 +00:00
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_set_invert_display(bool yesno);
|
|
|
|
extern void lcd_remote_set_flip(bool yesno);
|
2005-06-29 01:39:50 +00:00
|
|
|
|
|
|
|
extern void lcd_remote_set_drawmode(int mode);
|
|
|
|
extern int lcd_remote_get_drawmode(void);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern int lcd_remote_getwidth(void);
|
|
|
|
extern int lcd_remote_getheight(void);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_setfont(int font);
|
2008-01-08 01:22:14 +00:00
|
|
|
extern int lcd_remote_getfont(void);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h);
|
2005-06-29 01:39:50 +00:00
|
|
|
|
2006-07-28 07:17:00 +00:00
|
|
|
/* low level drawing function pointer arrays */
|
2006-11-26 14:26:08 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
|
|
|
extern lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs;
|
|
|
|
extern lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs;
|
|
|
|
#else
|
2006-07-28 07:17:00 +00:00
|
|
|
extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8];
|
|
|
|
extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8];
|
2006-11-26 14:26:08 +00:00
|
|
|
#endif
|
2006-07-28 07:17:00 +00:00
|
|
|
|
2005-04-25 23:47:51 +00:00
|
|
|
extern void lcd_remote_drawpixel(int x, int y);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_remote_drawline(int x1, int y1, int x2, int y2);
|
2005-06-29 01:39:50 +00:00
|
|
|
extern void lcd_remote_hline(int x1, int x2, int y);
|
|
|
|
extern void lcd_remote_vline(int x, int y1, int y2);
|
|
|
|
extern void lcd_remote_drawrect(int x, int y, int width, int height);
|
|
|
|
extern void lcd_remote_fillrect(int x, int y, int width, int height);
|
2006-07-28 07:17:00 +00:00
|
|
|
extern void lcd_remote_bitmap_part(const fb_remote_data *src, int src_x,
|
2005-06-29 01:39:50 +00:00
|
|
|
int src_y, int stride, int x, int y,
|
|
|
|
int width, int height);
|
2006-07-28 07:17:00 +00:00
|
|
|
extern void lcd_remote_bitmap(const fb_remote_data *src, int x, int y,
|
2005-06-29 01:39:50 +00:00
|
|
|
int width, int height);
|
2006-07-28 07:17:00 +00:00
|
|
|
extern void lcd_remote_putsxy(int x, int y, const unsigned char *str);
|
2005-06-29 01:39:50 +00:00
|
|
|
|
2005-04-25 23:47:51 +00:00
|
|
|
extern void lcd_remote_bidir_scroll(int threshold);
|
|
|
|
extern void lcd_remote_scroll_step(int pixels);
|
2005-04-15 09:42:12 +00:00
|
|
|
|
2006-07-28 07:17:00 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
|
|
|
extern void lcd_remote_set_foreground(unsigned foreground);
|
|
|
|
extern unsigned lcd_remote_get_foreground(void);
|
|
|
|
extern void lcd_remote_set_background(unsigned background);
|
|
|
|
extern unsigned lcd_remote_get_background(void);
|
|
|
|
extern void lcd_remote_set_drawinfo(int mode, unsigned foreground,
|
|
|
|
unsigned background);
|
2007-04-25 21:44:56 +00:00
|
|
|
void lcd_remote_set_backdrop(fb_remote_data* backdrop);
|
|
|
|
fb_remote_data* lcd_remote_get_backdrop(void);
|
2006-07-28 07:17:00 +00:00
|
|
|
|
|
|
|
extern void lcd_remote_mono_bitmap_part(const unsigned char *src, int src_x,
|
|
|
|
int src_y, int stride, int x, int y,
|
|
|
|
int width, int height);
|
|
|
|
extern void lcd_remote_mono_bitmap(const unsigned char *src, int x, int y,
|
|
|
|
int width, int height);
|
|
|
|
extern void lcd_remote_bitmap_transparent_part(const fb_remote_data *src,
|
|
|
|
int src_x, int src_y,
|
|
|
|
int stride, int x, int y,
|
|
|
|
int width, int height);
|
|
|
|
extern void lcd_bitmap_remote_transparent(const fb_remote_data *src, int x,
|
|
|
|
int y, int width, int height);
|
|
|
|
#else /* LCD_REMOTE_DEPTH == 1 */
|
2005-07-07 00:05:29 +00:00
|
|
|
#define lcd_remote_mono_bitmap lcd_remote_bitmap
|
|
|
|
#define lcd_remote_mono_bitmap_part lcd_remote_bitmap_part
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif /* LCD_REMOTE_DEPTH */
|
2005-07-07 00:05:29 +00:00
|
|
|
|
2005-04-15 09:42:12 +00:00
|
|
|
#endif
|
2006-07-28 07:17:00 +00:00
|
|
|
#endif /* __LCD_REMOTE_H__ */
|