All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 1/4] PXA27x LCD and boot logo support
@ 2007-02-15 18:59 Rodolfo Giometti
  2007-02-15 19:01 ` [U-Boot-Users] [PATCH 2/4] " Rodolfo Giometti
  0 siblings, 1 reply; 4+ messages in thread
From: Rodolfo Giometti @ 2007-02-15 18:59 UTC (permalink / raw)
  To: u-boot

Boot logo compilation fixup.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>

-------------- next part --------------
diff --git a/Makefile b/Makefile
index 15fd656..2ac8dd5 100644
--- a/Makefile
+++ b/Makefile
@@ -115,7 +115,7 @@ ifeq ($(OBJTREE)/include/config.mk,$(wildcard $(OBJTREE)/include/config.mk))
 
 # load ARCH, BOARD, and CPU configuration
 include $(OBJTREE)/include/config.mk
-export	ARCH CPU BOARD VENDOR SOC
+export	ARCH CPU BOARD VENDOR SOC LOGO_BMP
 
 ifndef CROSS_COMPILE
 ifeq ($(HOSTARCH),ppc)
diff --git a/tools/Makefile b/tools/Makefile
index 606f024..4a38f94 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -40,7 +40,7 @@ endif
 LOGO_H	= $(OBJTREE)/include/bmp_logo.h
 
 ifeq ($(LOGO_BMP),)
-LOGO_BMP= logos/denx.bmp
+LOGO_BMP= denx.bmp
 endif
 
 #-------------------------------------------------------------------------
@@ -203,8 +203,8 @@ $(obj)crc32.c:
 		@rm -f $(obj)crc32.c
 		ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
 
-$(LOGO_H):	$(obj)bmp_logo $(LOGO_BMP)
-		$(obj)./bmp_logo $(LOGO_BMP) >$@
+$(LOGO_H):	$(obj)bmp_logo logos/$(LOGO_BMP)
+		$(obj)./bmp_logo logos/$(LOGO_BMP) >$@
 
 #########################################################################
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 2/4] PXA27x LCD and boot logo support
  2007-02-15 18:59 [U-Boot-Users] [PATCH 1/4] PXA27x LCD and boot logo support Rodolfo Giometti
@ 2007-02-15 19:01 ` Rodolfo Giometti
  2007-02-15 19:04   ` [U-Boot-Users] [PATCH 3/4] " Rodolfo Giometti
  0 siblings, 1 reply; 4+ messages in thread
From: Rodolfo Giometti @ 2007-02-15 19:01 UTC (permalink / raw)
  To: u-boot

Configuration variable CFG_LOGO_CMAP_MODE for different colormaps
support.
    
Signed-off-by: Rodolfo Giometti <giometti@linux.it>
-------------- next part --------------
diff --git a/README b/README
index a0949f0..2dfb04d 100644
--- a/README
+++ b/README
@@ -2186,6 +2186,10 @@ Low Level (hardware related) configuration options:
   CFG_POCMR2_MASK_ATTRIB: (MPC826x only)
 		Overrides the default PCI memory map in cpu/mpc8260/pci.c if set.
 
+- CFG_LOGO_CMAP_MODE
+		Define the current LCD color map mode. Default value is 444 but
+		565 can also be used.
+
 - CONFIG_ETHER_ON_FEC[12]
 		Define to enable FEC[12] on a 8xx series processor.
 
diff --git a/common/lcd.c b/common/lcd.c
index d79350f..b82fbec 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -52,6 +52,10 @@
 
 #ifdef CONFIG_LCD
 
+#ifndef CFG_LOGO_CMAP_MODE
+#define CFG_LOGO_CMAP_MODE	444	/* the default */
+#endif
+
 /************************************************************************/
 /* ** FONT DATA								*/
 /************************************************************************/
@@ -62,7 +66,7 @@
 /************************************************************************/
 #ifdef CONFIG_LCD_LOGO
 # include <bmp_logo.h>		/* Get logo data, width and height	*/
-# if (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET)
+# if (LCD_BPP < LCD_COLOR16) && (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET)
 #  error Default Color Map overlaps with Logo Color Map
 # endif
 #endif
@@ -317,7 +321,11 @@ static void test_pattern (void)
 	ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
 	ushort h_step = (h_max + N_BLK_HOR  - 1) / N_BLK_HOR;
 	ushort v, h;
+#if LCD_BPP == LCD_COLOR16
+	ushort *pix = (ushort *)lcd_base;
+#else
 	uchar *pix = (uchar *)lcd_base;
+#endif
 
 	printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
 		h_max, v_max, h_step, v_step);
@@ -519,10 +527,11 @@ void bitmap_plot (int x, int y)
 	volatile immap_t *immr = (immap_t *) CFG_IMMR;
 	volatile cpm8xx_t *cp = &(immr->im_cpm);
 #endif
+	uint palette;
 
 	debug ("Logo: width %d  height %d  colors %d  cmap %d\n",
 		BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
-		sizeof(bmp_logo_palette)/(sizeof(ushort)));
+		sizeof(bmp_logo_palette)/(sizeof(uint)));
 
 	bmap = &bmp_logo_bitmap[0];
 	fb   = (uchar *)(lcd_base + y * lcd_line_length + x);
@@ -538,8 +547,20 @@ void bitmap_plot (int x, int y)
 		WATCHDOG_RESET();
 
 		/* Set color map */
-		for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
-			ushort colreg = bmp_logo_palette[i];
+		for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(uint))); ++i) {
+			palette = bmp_logo_palette[i];
+#if CFG_LOGO_CMAP_MODE == 444
+			ushort colreg = ((palette & 0xf00000)>>12) | \
+					((palette & 0x00f000)>>8)  | \
+					((palette & 0x0000f0)>>4);
+#elif CFG_LOGO_CMAP_MODE == 565
+			ushort colreg = ((palette & 0xf80000)>>8) | \
+					((palette & 0x00fc00)>>5) | \
+					((palette & 0x0000f8)>>3);
+#else
+# error "Unsupported CMAP mode"
+#endif
+
 #ifdef  CFG_INVERT_COLORS
 			*cmap++ = 0xffff - colreg;
 #else
@@ -559,8 +580,18 @@ void bitmap_plot (int x, int y)
 		fb16 = (ushort *)(lcd_base + y * lcd_line_length + x);
 		for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
 			for (j=0; j<BMP_LOGO_WIDTH; j++) {
-				fb16[j] = bmp_logo_palette[(bmap[j])];
+				palette = bmp_logo_palette[bmap[j]-BMP_LOGO_OFFSET];
+#if CFG_LOGO_CMAP_MODE == 444
+				fb16[j] = ((palette & 0xf00000)>>12) | \
+					  ((palette & 0x00f000)>>8)  | \
+					  ((palette & 0x0000f0)>>4);
+#elif CFG_LOGO_CMAP_MODE == 565
+				fb16[j] = ((palette & 0xf80000)>>8) | \
+					  ((palette & 0x00fc00)>>5) | \
+					  ((palette & 0x0000f8)>>3);
+#endif
 				}
+
 			bmap += BMP_LOGO_WIDTH;
 			fb16 += panel_info.vl_col;
 		}
diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c
index 98be617..f54d259 100644
--- a/tools/bmp_logo.c
+++ b/tools/bmp_logo.c
@@ -14,7 +14,6 @@
 typedef struct bitmap_s {		/* bitmap description */
 	uint16_t width;
 	uint16_t height;
-	uint8_t	palette[256*3];
 	uint8_t	*data;
 } bitmap_t;
 
@@ -42,11 +41,12 @@ void skip_bytes (FILE *fp, int n)
 
 int main (int argc, char *argv[])
 {
-	int	i, x;
+	int	i, x, d;
 	FILE	*fp;
 	bitmap_t bmp;
 	bitmap_t *b = &bmp;
-	uint16_t data_offset, n_colors;
+	uint16_t data_offset, bit_count, n_colors;
+	uint32_t red, green, blue;
 
 	if (argc < 2) {
 		fprintf (stderr, "Usage: %s file\n", argv[0]);
@@ -73,7 +73,9 @@ int main (int argc, char *argv[])
 	fread (&b->width,   sizeof (uint16_t), 1, fp);
 	skip_bytes (fp, 2);
 	fread (&b->height,  sizeof (uint16_t), 1, fp);
-	skip_bytes (fp, 22);
+	skip_bytes (fp, 4);
+	fread (&bit_count,  sizeof (uint16_t), 1, fp);
+	skip_bytes (fp, 16);
 	fread (&n_colors, sizeof (uint16_t), 1, fp);
 	skip_bytes (fp, 6);
 
@@ -83,10 +85,20 @@ int main (int argc, char *argv[])
 	data_offset = le_short(data_offset);
 	b->width = le_short(b->width);
 	b->height = le_short(b->height);
+	bit_count = le_short(bit_count);
 	n_colors = le_short(n_colors);
 
-	/* assume we are working with an 8-bit file */
-	if ((n_colors == 0) || (n_colors > 256 - DEFAULT_CMAP_SIZE)) {
+	/*
+	 * Sanity checks.
+	 */
+	if (bit_count != 8) {
+		fprintf (stderr, "%s is not a 8bpp image.\n", argv[1]);
+		exit (EXIT_FAILURE);
+	}
+
+	if (n_colors == 0)
+		n_colors = 1 << bit_count;
+	if (n_colors > 256 - DEFAULT_CMAP_SIZE) {
 		/* reserve DEFAULT_CMAP_SIZE color map entries for default map */
 		n_colors = 256 - DEFAULT_CMAP_SIZE;
 	}
@@ -115,25 +127,26 @@ int main (int argc, char *argv[])
 	}
 
 	/* read and print the palette information */
-	printf ("unsigned short bmp_logo_palette[] = {\n");
+	printf ("unsigned int bmp_logo_palette[] = {\n");
 
 	for (i=0; i<n_colors; ++i) {
-		b->palette[(int)(i*3+2)] = fgetc(fp);
-		b->palette[(int)(i*3+1)] = fgetc(fp);
-		b->palette[(int)(i*3+0)] = fgetc(fp);
-		x=fgetc(fp);
+		blue  = fgetc(fp);
+		green = fgetc(fp);
+		red   = fgetc(fp);
+		x     = fgetc(fp);
 
-		printf ("%s0x0%X%X%X,%s",
+		printf ("%s0x%06X,%s",
 			((i%8) == 0) ? "\t" : "  ",
-			(b->palette[(int)(i*3+0)] >> 4) & 0x0F,
-			(b->palette[(int)(i*3+1)] >> 4) & 0x0F,
-			(b->palette[(int)(i*3+2)] >> 4) & 0x0F,
+			(red<<16) | (green<<8) | blue,
 			((i%8) == 7) ? "\n" : ""
 		);
 	}
 
 	/* seek to offset indicated by file header */
-	fseek(fp, (long)data_offset, SEEK_SET);
+	if (fseek(fp, (long)data_offset, SEEK_SET) < 0) {
+		printf ("cannot fseek!\n");
+		exit (EXIT_FAILURE);
+	}
 
 	/* read the bitmap; leave room for default color map */
 	printf ("\n");
@@ -142,8 +155,13 @@ int main (int argc, char *argv[])
 	printf ("unsigned char bmp_logo_bitmap[] = {\n");
 	for (i=(b->height-1)*b->width; i>=0; i-=b->width) {
 		for (x = 0; x < b->width; x++) {
-			b->data[(uint16_t) i + x] = (uint8_t) fgetc (fp) \
-						+ DEFAULT_CMAP_SIZE;
+			d = fgetc (fp);
+			if (feof(fp)) {
+				printf ("unaspected end-of-file!\n");
+				exit (EXIT_FAILURE);
+			}
+
+			*(b->data + i + x) = d + DEFAULT_CMAP_SIZE;
 		}
 	}
 	fclose (fp);
@@ -152,7 +170,7 @@ int main (int argc, char *argv[])
 		if ((i%8) == 0)
 			putchar ('\t');
 		printf ("0x%02X,%c",
-			b->data[i],
+			*(b->data + i),
 			((i%8) == 7) ? '\n' : ' '
 		);
 	}

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 3/4] PXA27x LCD and boot logo support
  2007-02-15 19:01 ` [U-Boot-Users] [PATCH 2/4] " Rodolfo Giometti
@ 2007-02-15 19:04   ` Rodolfo Giometti
  2007-02-15 19:06     ` [U-Boot-Users] [PATCH 4/4] " Rodolfo Giometti
  0 siblings, 1 reply; 4+ messages in thread
From: Rodolfo Giometti @ 2007-02-15 19:04 UTC (permalink / raw)
  To: u-boot

Support for PXA27x LCD.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>

-------------- next part --------------
diff --git a/common/lcd.c b/common/lcd.c
index b82fbec..62dc354 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -42,7 +42,7 @@
 #include <lcd.h>
 #include <watchdog.h>
 
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 #include <asm/byteorder.h>
 #endif
 
@@ -521,7 +521,7 @@ void bitmap_plot (int x, int y)
 	uchar *bmap;
 	uchar *fb;
 	ushort *fb16;
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 	struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
 	volatile immap_t *immr = (immap_t *) CFG_IMMR;
@@ -538,7 +538,7 @@ void bitmap_plot (int x, int y)
 
 	if (NBITS(panel_info.vl_bpix) < 12) {
 		/* Leave room for default color map */
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
@@ -619,7 +619,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	unsigned long pwidth = panel_info.vl_col;
 	unsigned colors,bpix;
 	unsigned long compression;
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 	struct pxafb_info *fbi = &panel_info.pxa;
 #elif defined(CONFIG_MPC823)
 	volatile immap_t *immr = (immap_t *) CFG_IMMR;
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		(int)width, (int)height, (int)colors);
 
 	if (bpix==8) {
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
@@ -678,7 +678,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #else
 			*cmap = colreg;
 #endif
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 			cmap++;
 #elif defined(CONFIG_MPC823)
 			cmap--;
@@ -717,7 +717,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	for (i = 0; i < height; ++i) {
 		WATCHDOG_RESET();
 		for (j = 0; j < width ; j++)
-#if defined(CONFIG_PXA250)
+#if defined(CONFIG_PXA250) || defined(CONFIG_PXA27X)
 			*(fb++)=*(bmap++);
 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
 			*(fb++)=255-*(bmap++);
diff --git a/include/lcd.h b/include/lcd.h
index b688583..e0dd19e 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -77,7 +77,7 @@ typedef struct vidinfo {
 
 extern vidinfo_t panel_info;
 
-#elif defined CONFIG_PXA250
+#elif defined CONFIG_PXA250 || defined CONFIG_PXA27X
 /*
  * PXA LCD DMA descriptor
  */

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH 4/4] PXA27x LCD and boot logo support
  2007-02-15 19:04   ` [U-Boot-Users] [PATCH 3/4] " Rodolfo Giometti
@ 2007-02-15 19:06     ` Rodolfo Giometti
  0 siblings, 0 replies; 4+ messages in thread
From: Rodolfo Giometti @ 2007-02-15 19:06 UTC (permalink / raw)
  To: u-boot

Support for 16bpp LCDs.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>
-------------- next part --------------
diff --git a/cpu/pxa/pxafb.c b/cpu/pxa/pxafb.c
index b2caa73..cd529e3 100644
--- a/cpu/pxa/pxafb.c
+++ b/cpu/pxa/pxafb.c
@@ -148,7 +148,7 @@ vidinfo_t panel_info = {
 
 /*----------------------------------------------------------------------*/
 
-#if LCD_BPP == LCD_COLOR8
+#if LCD_BPP == LCD_COLOR8 || LCD_BPP == LCD_COLOR16
 void lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue);
 #endif
 #if LCD_BPP == LCD_MONOCHROME
@@ -200,7 +200,7 @@ lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
 #endif /* NOT_USED_SO_FAR */
 
 /*----------------------------------------------------------------------*/
-#if LCD_BPP == LCD_COLOR8
+#if LCD_BPP == LCD_COLOR8 || LCD_BPP == LCD_COLOR16
 void
 lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
 {
@@ -225,7 +225,7 @@ lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
 		red, green, blue,
 		palette[regno]);
 }
-#endif /* LCD_COLOR8 */
+#endif /* LCD_COLOR8 || LCD_BPP == LCD_COLOR16 */
 
 /*----------------------------------------------------------------------*/
 #if LCD_BPP == LCD_MONOCHROME

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-15 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15 18:59 [U-Boot-Users] [PATCH 1/4] PXA27x LCD and boot logo support Rodolfo Giometti
2007-02-15 19:01 ` [U-Boot-Users] [PATCH 2/4] " Rodolfo Giometti
2007-02-15 19:04   ` [U-Boot-Users] [PATCH 3/4] " Rodolfo Giometti
2007-02-15 19:06     ` [U-Boot-Users] [PATCH 4/4] " Rodolfo Giometti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.