From d7ea23293dfd81bbfb4a3e3d1cc7e6b89afaabc5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 21 Jul 2011 02:21:03 -0700 Subject: Conditionally implement vbexport functions There are a few functions in display.c in the vbexport library which depend on being able to call functions provided by the LCD driver. If that support isn't turned on then compilation will fail. It can't always be turned on because it's not always the right driver to use. This change conditionally compiles in the existing implementation if the right support is available and compiles in a warning message and a failing return code if it isn't. BUG=chrome-os-partner:4552 TEST=Built on x86. Signed-off-by: Gabe Black Change-Id: I70695f06bb1b55063d035307e0420f8fc58b1efa Reviewed-on: http://gerrit.chromium.org/gerrit/4768 Reviewed-by: Vadim Bendebury Tested-by: Gabe Black --- lib/vbexport/display.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/vbexport') diff --git a/lib/vbexport/display.c b/lib/vbexport/display.c index b1f50133a5b..4f72cedf821 100644 --- a/lib/vbexport/display.c +++ b/lib/vbexport/display.c @@ -54,6 +54,7 @@ VbError_t VbExDisplayBacklight(uint8_t enable) return VBERROR_SUCCESS; } +#ifdef CONFIG_LCD /* Print the message on the center of LCD. */ static void print_on_center(const char *message) { @@ -84,9 +85,11 @@ static void print_on_center(const char *message) VbExDisplayDebugInfo(result); } +#endif VbError_t VbExDisplayScreen(uint32_t screen_type) { +#ifdef CONFIG_LCD /* * Show the debug messages for development. It is a backup method * when GBB does not contain a full set of bitmaps. @@ -117,8 +120,13 @@ VbError_t VbExDisplayScreen(uint32_t screen_type) return 1; } return VBERROR_SUCCESS; +#else + printf("VbExDisplayScreen needs lcd support which isn't configured.\n"); + return 1; +#endif } +#ifdef CONFIG_LCD static uint8_t *uncompress_lzma(uint8_t *in_addr, SizeT in_size, SizeT out_size) { @@ -133,10 +141,12 @@ static uint8_t *uncompress_lzma(uint8_t *in_addr, SizeT in_size, } return out_addr; } +#endif VbError_t VbExDisplayImage(uint32_t x, uint32_t y, const ImageInfo *info, const void *buffer) { +#ifdef CONFIG_LCD int ret; uint8_t *raw_data; @@ -172,14 +182,24 @@ VbError_t VbExDisplayImage(uint32_t x, uint32_t y, const ImageInfo *info, } return VBERROR_SUCCESS; +#else + printf("VbExDisplayImage needs lcd support which isn't configured.\n"); + return 1; +#endif } VbError_t VbExDisplayDebugInfo(const char *info_str) { +#ifdef CONFIG_LCD /* Show the debug message on the upper left corner */ console_col = 0; console_row = 0; lcd_puts(info_str); return VBERROR_SUCCESS; +#else + printf("VbExDisplayDebugInfo needs lcd support which isn't " + "configured.\n"); + return 1; +#endif } -- cgit v1.2.3