/************************************************************************/
/* ** CONFIG STUFF -- should be moved to board config file */
/************************************************************************/
+#ifndef CONFIG_EDT32F10
#define CONFIG_LCD_LOGO
#define LCD_INFO /* Display Logo, (C) and system info */
+#endif
/* #define LCD_TEST_PATTERN */ /* color backgnd for frame/color adjust */
/* #define CFG_INVERT_COLORS */ /* Not needed - adjust vl_dp instead */
/************************************************************************/
/* ** CONSOLE CONSTANTS */
/************************************************************************/
+#if LCD_BPP == LCD_MONOCHROME
+
+/*
+ * Simple color definitions
+ */
+#define CONSOLE_COLOR_BLACK 0
+#define CONSOLE_COLOR_WHITE 1 /* Must remain last / highest */
+
+#else
+
/*
* Simple color definitions
*/
#define CONSOLE_COLOR_GREY 14
#define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
+#endif
+
#if defined(CONFIG_LCD_LOGO) && (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET)
#error Default Color Map overlaps with Logo Color Map
#endif
static void *lcd_logo (bd_t *bd);
static void lcd_setcolreg (ushort regno,
ushort red, ushort green, ushort blue);
+static void lcd_initcolregs (void);
static int lcd_getbgcolor (void);
static void lcd_setfgcolor (int color);
static void lcd_setbgcolor (int color);
u_char vl_wbf; /* Wait between frames */
} vidinfo_t;
+#define LCD_MONOCHROME 0
+#define LCD_COLOR2 1
+#define LCD_COLOR4 2
+#define LCD_COLOR8 3
+
/*----------------------------------------------------------------------*/
#ifdef CONFIG_NEC_NL6648AC33
/*
OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4
};
#endif /* CONFIG_OPTREX_BW */
+
+/*-----------------------------------------------------------------*/
+#ifdef CONFIG_EDT32F10
+/*
+ * Emerging Display Technologies 320x240. Passive, monochrome, single scan.
+ */
+#define LCD_BPP LCD_MONOCHROME
+#define LCD_DF 20
+
+static vidinfo_t panel_info = {
+ 320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
+ LCD_BPP, 0, 0, 0, 0, 0, 15, 0, 0
+};
+#endif
/*----------------------------------------------------------------------*/
+#ifndef LCD_BPP
+#define LCD_BPP LCD_COLOR8
+#endif
+#ifndef LCD_DF
+#define LCD_DF 1
+#endif
+
#define NBITS(bit_code) (1 << (bit_code))
#define NCOLORS(bit_code) (1 << NBITS(bit_code))
#define CONSOLE_SIZE (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
#define CONSOLE_SCROLL_SIZE (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
+#if LCD_BPP == LCD_MONOCHROME
+#define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
+ (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
+#elif LCD_BPP == LCD_COLOR8
+#define COLOR_MASK(c) (c)
+#else
+#error Unsupported LCD BPP.
+#endif
+
static short console_col;
static short console_row;
memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
/* Clear the last one */
- /*
- * WARNING: the following code assumes 8 Bits per pixel
- */
- memset (CONSOLE_ROW_LAST, lcd_color_bg, CONSOLE_ROW_SIZE);
+ memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
#else
/*
* Poor attempt to optimize speed by moving "long"s.
static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
{
uchar *dest;
- ushort row;
+ ushort off, row;
- dest = (uchar *)(lcd_base + y * lcd_line_length + x);
+ dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
+ off = x * (1 << LCD_BPP) % 8;
- /*
- * WARNING: the following code assumes 8 Bits per pixel
- */
for (row=0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str;
uchar *d = dest;
int i;
+#if LCD_BPP == LCD_MONOCHROME
+ uchar rest = *d & -(1 << (8-off));
+ uchar sym;
+#endif
for (i=0; i<count; ++i) {
uchar c, bits;
c = *s++;
bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
+#if LCD_BPP == LCD_MONOCHROME
+ sym = (COLOR_MASK(lcd_color_fg) & bits) |
+ (COLOR_MASK(lcd_color_bg) & ~bits);
+
+ *d++ = rest | (sym >> off);
+ rest = sym << (8-off);
+#elif LCD_BPP == LCD_COLOR8
for (c=0; c<8; ++c) {
*d++ = (bits & 0x80) ?
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
+#endif
}
+
+#if LCD_BPP == LCD_MONOCHROME
+ *d = rest | (*d & ((1 << (8-off)) - 1));
+#endif
}
}
lcd_ctrl_init (lcdbase);
+#if LCD_BPP == LCD_MONOCHROME
+ /* Setting the palette */
+ lcd_initcolregs();
+
+#elif LCD_BPP == LCD_COLOR8
/* Setting the palette */
lcd_setcolreg (CONSOLE_COLOR_BLACK, 0, 0, 0);
lcd_setcolreg (CONSOLE_COLOR_RED, 0xFF, 0, 0);
lcd_setcolreg (CONSOLE_COLOR_CYAN, 0, 0xFF, 0xFF);
lcd_setcolreg (CONSOLE_COLOR_GREY, 0xAA, 0xAA, 0xAA);
lcd_setcolreg (CONSOLE_COLOR_WHITE, 0xFF, 0xFF, 0xFF);
+#endif
#ifndef CFG_WHITE_ON_BLACK
lcd_setfgcolor (CONSOLE_COLOR_BLACK);
test_pattern();
#else
/* set framebuffer to background color */
- /*
- * WARNING: the following code assumes 8 Bits per pixel
- */
memset ((char *)lcd_base,
- lcd_getbgcolor(),
+ COLOR_MASK(lcd_getbgcolor()),
lcd_line_length*panel_info.vl_row);
#endif
*/
lccrtmp = LCDBIT (LCCR_BNUM_BIT,
- (((panel_info.vl_row * panel_info.vl_col) * 8) / 128));
+ (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp) |
LCDBIT (LCCR_OEP_BIT, panel_info.vl_oep) |
* 64 MHz would be bad).
*/
immr->im_clkrst.car_sccr &= ~0x1F;
- immr->im_clkrst.car_sccr |= 1; /* was 8 */
+ immr->im_clkrst.car_sccr |= LCD_DF; /* was 8 */
+#ifndef CONFIG_EDT32F10
/* Enable LCD on port D.
*/
immr->im_ioport.iop_pdpar |= 0x1FFF;
*/
immr->im_cpm.cp_pbpar |= 0x00005001;
immr->im_cpm.cp_pbdir |= 0x00005001;
+#else
+ /* Enable LCD on port D.
+ */
+ immr->im_ioport.iop_pdpar |= 0x1DFF;
+ immr->im_ioport.iop_pdpar &= ~0x0200;
+ immr->im_ioport.iop_pddir |= 0x1FFF;
+ immr->im_ioport.iop_pddat |= 0x0200;
+#endif
/* Load the physical address of the linear frame buffer
* into the LCD controller.
/* MORE HACKS...This must be updated according to 823 manual
* for different panels.
*/
+#ifndef CONFIG_EDT32F10
lcdp->lcd_lchcr = LCHCR_BO |
LCDBIT (LCHCR_AT_BIT, 4) |
LCDBIT (LCHCR_HPC_BIT, panel_info.vl_col) |
panel_info.vl_wbl;
+#else
+ lcdp->lcd_lchcr = LCHCR_BO |
+ LCDBIT (LCHCR_AT_BIT, 4) |
+ LCDBIT (LCHCR_HPC_BIT, panel_info.vl_col/4) |
+ panel_info.vl_wbl;
+#endif
+
lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
/*----------------------------------------------------------------------*/
+static
+void lcd_initcolregs (void)
+{
+ volatile immap_t *immr = (immap_t *) CFG_IMMR;
+ volatile cpm8xx_t *cp = &(immr->im_cpm);
+ ushort regno;
+
+ for (regno = 0; regno < 16; regno++) {
+ cp->lcd_cmap[regno * 2] = 0;
+ cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
static void lcd_setfgcolor (int color)
{
lcd_color_fg = color & 0x0F;
/* Enable the LCD panel */
immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25)); /* LAM = 1 */
lcdp->lcd_lccr |= LCCR_PON;
-#ifdef CONFIG_LWMON
+#if defined(CONFIG_LWMON)
{ uchar c = pic_read (0x60);
c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
pic_write (0x60, c);
}
+#elif defined(CONFIG_R360MPI)
+ {
+ extern void r360_pwm_write (uchar reg, uchar val);
+
+ r360_pwm_write(8, 1);
+ r360_pwm_write(0, 4);
+ r360_pwm_write(1, 6);
+ }
#endif /* CONFIG_LWMON */
}
volatile immap_t *immr = (immap_t *) CFG_IMMR;
volatile lcd823_t *lcdp = &immr->im_lcd;
-#ifdef CONFIG_LWMON
+#if defined(CONFIG_LWMON)
{ uchar c = pic_read (0x60);
c &= ~0x07; /* Power off CCFL, Disable CCFL, Chip Disable LCD */
pic_write (0x60, c);
}
+#elif defined(CONFIG_R360MPI)
+ {
+ extern void r360_pwm_write (uchar reg, uchar val);
+
+ r360_pwm_write(0, 0);
+ r360_pwm_write(1, 0);
+ }
#endif /* CONFIG_LWMON */
/* Disable the LCD panel */
lcdp->lcd_lccr &= ~LCCR_PON;