[U-Boot-Users] [PATCH] fix little endian 16 bit cfb_console support

Andrew Dyer amdyer at gmail.com
Mon Mar 5 05:33:31 CET 2007


if VIDEO_FB_LITTLE_ENDIAN is defined and a 16-bit video mode is used
(GDF_16BIT_565RGB or GDF_15BIT_555RGB), then the macro SHORTSWAP32(x)
in drivers/cfg_console.c is not swapping shorts but instead swaps
bytes.  This leads to bad displays of font characters.  Attached patch
fixes this.

Signed-off-by: Andrew Dyer <amdyer at gmail.com>

-- 
Hardware, n.:
        The parts of a computer system that can be kicked.
-------------- next part --------------
Index: drivers/cfb_console.c
===================================================================
RCS file: /home/cvsroot/Projects/u-boot/drivers/cfb_console.c,v
retrieving revision 1.1.1.3
diff -p -u -r1.1.1.3 cfb_console.c
--- drivers/cfb_console.c	22 Oct 2005 20:51:29 -0000	1.1.1.3
+++ drivers/cfb_console.c	5 Mar 2007 04:22:57 -0000
@@ -299,8 +299,8 @@ void	console_cursor (int state);
 #define SWAP16(x)	 ((((x) & 0x00ff) << 8) | ( (x) >> 8))
 #define SWAP32(x)	 ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
 			  (((x) & 0x00ff0000) >>  8) | (((x) & 0xff000000) >> 24) )
-#define SHORTSWAP32(x)	 ((((x) & 0x000000ff) <<  8) | (((x) & 0x0000ff00) >> 8)|\
-			  (((x) & 0x00ff0000) <<  8) | (((x) & 0xff000000) >> 8) )
+#define SHORTSWAP32(x)	 ((((x) & 0x0000ffff) <<  16) | (((x) & 0xffff0000) >> 16))
+
 #else
 #define SWAP16(x)	 (x)
 #define SWAP32(x)	 (x)


More information about the U-Boot mailing list