From: Nikita Kiryanov Date: Tue, 3 Feb 2015 11:32:23 +0000 (+0200) Subject: lcd: mpc8xx: move mpc823-specific fb_put_byte to mpc8xx_lcd.c X-Git-Tag: v2015.04-rc2~34^2~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=27fad01b7fca1ed9ae946ced37c3d4bde828ba14;p=oweals%2Fu-boot.git lcd: mpc8xx: move mpc823-specific fb_put_byte to mpc8xx_lcd.c Reduce the amount of platform-specific code in common/lcd.c by moving MPC823 implementation of fb_put_byte() to mpc8xx_lcd.c. Since we must also have a default implementation for everybody else, make the remainder of the code into a weak function. Signed-off-by: Nikita Kiryanov Reviewed-by: Simon Glass Tested-by: Bo Shen Tested-by: Josh Wu Cc: Simon Glass Cc: Anatolij Gustschin --- diff --git a/common/lcd.c b/common/lcd.c index f17b35b7fe..efd9a87545 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -635,11 +635,10 @@ static void lcd_display_rle8_bitmap(bmp_image_t *bmp, ushort *cmap, uchar *fb, } #endif -#if defined(CONFIG_MPC823) -#define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++) -#else -#define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++ -#endif +__weak void fb_put_byte(uchar **fb, uchar **from) +{ + *(*fb)++ = *(*from)++; +} #if defined(CONFIG_BMP_16BPP) __weak void fb_put_word(uchar **fb, uchar **from) @@ -764,7 +763,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) WATCHDOG_RESET(); for (j = 0; j < width; j++) { if (bpix != 16) { - FB_PUT_BYTE(fb, bmap); + fb_put_byte(&fb, &bmap); } else { *(uint16_t *)fb = cmap_base[*(bmap++)]; fb += sizeof(uint16_t) / sizeof(*fb); diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c index 9d2e5edc72..190c05a598 100644 --- a/drivers/video/mpc8xx_lcd.c +++ b/drivers/video/mpc8xx_lcd.c @@ -364,6 +364,13 @@ ushort *configuration_get_cmap(void) return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); } +#if defined(CONFIG_MPC823) +void fb_put_byte(uchar **fb, uchar **from) +{ + *(*fb)++ = (255 - *(*from)++); +} +#endif + void lcd_enable (void) { volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;